mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 桌面端支持搜索图片中的文本 Fix https://github.com/siyuan-note/siyuan/issues/3470
This commit is contained in:
parent
b13eb03453
commit
5ae14c48f3
1 changed files with 2 additions and 3 deletions
|
|
@ -21,7 +21,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -97,8 +96,8 @@ func Tesseract(imgAbsPath string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret := string(output)
|
ret := string(output)
|
||||||
reg := regexp.MustCompile("\\s+")
|
ret = strings.ReplaceAll(ret, "\r", "")
|
||||||
ret = reg.ReplaceAllString(ret, "")
|
ret = strings.ReplaceAll(ret, "\n", "")
|
||||||
logging.LogInfof("tesseract [path=%s, size=%d]: %s", imgAbsPath, info.Size(), ret)
|
logging.LogInfof("tesseract [path=%s, size=%d]: %s", imgAbsPath, info.Size(), ret)
|
||||||
ocrResultCache.Set(imgAbsPath, ret, info.Size())
|
ocrResultCache.Set(imgAbsPath, ret, info.Size())
|
||||||
return ret
|
return ret
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue