mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +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
|
||||
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")
|
||||
return
|
||||
}
|
||||
|
||||
foundChi := false
|
||||
for _, lang := range langs {
|
||||
for _, lang := range TesseractLangs {
|
||||
if strings.Contains(lang, "chi") {
|
||||
foundChi = true
|
||||
break
|
||||
|
|
@ -126,13 +134,6 @@ func initTesseract() {
|
|||
logging.LogWarnf("no chi_* tesseract lang found")
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue