mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 改进 Tesseract 识别
This commit is contained in:
parent
492aabcf22
commit
82145475a8
1 changed files with 10 additions and 9 deletions
|
|
@ -110,13 +110,21 @@ func initTesseract() {
|
||||||
TesseractEnabled = false
|
TesseractEnabled = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !gulu.Str.Contains("eng", langs) {
|
|
||||||
|
for _, lang := range langs {
|
||||||
|
if "eng" == lang || strings.HasPrefix(lang, "chi") {
|
||||||
|
TesseractLangs = append(TesseractLangs, lang)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logging.LogInfof("tesseract-ocr enabled [ver=%s, langs=%s]", ver, strings.Join(TesseractLangs, "+"))
|
||||||
|
|
||||||
|
if !gulu.Str.Contains("eng", TesseractLangs) {
|
||||||
logging.LogWarnf("no eng tesseract lang found")
|
logging.LogWarnf("no eng tesseract lang found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
foundChi := false
|
foundChi := false
|
||||||
for _, lang := range langs {
|
for _, lang := range TesseractLangs {
|
||||||
if strings.Contains(lang, "chi") {
|
if strings.Contains(lang, "chi") {
|
||||||
foundChi = true
|
foundChi = true
|
||||||
break
|
break
|
||||||
|
|
@ -126,13 +134,6 @@ func initTesseract() {
|
||||||
logging.LogWarnf("no chi_* tesseract lang found")
|
logging.LogWarnf("no chi_* tesseract lang found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, lang := range langs {
|
|
||||||
if "eng" == lang || strings.HasPrefix(lang, "chi") {
|
|
||||||
TesseractLangs = append(TesseractLangs, lang)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logging.LogInfof("tesseract-ocr enabled [ver=%s, langs=%s]", ver, strings.Join(TesseractLangs, "+"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTesseractVer() (ret string) {
|
func getTesseractVer() (ret string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue