From 59bb202b13275c797af70262378aceda2ec25ff7 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 31 Oct 2024 11:08:25 +0800 Subject: [PATCH] :art: Add logging https://github.com/siyuan-note/siyuan/issues/12960 --- kernel/util/ocr.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/util/ocr.go b/kernel/util/ocr.go index 24be30bb2..ab045c136 100644 --- a/kernel/util/ocr.go +++ b/kernel/util/ocr.go @@ -231,7 +231,7 @@ func Tesseract(imgAbsPath string) (ret []map[string]interface{}) { logging.LogInfof("tesseract [path=%s] success [%s]", imgAbsPath, tsv) // 按行分割 TSV 数据 - lines := strings.Split(tsv, "\r\n") + lines := strings.Split(tsv, "\n") // 解析 TSV 数据 跳过标题行,从第二行开始处理 for _, line := range lines[1:] { @@ -262,7 +262,7 @@ func GetOcrJsonText(jsonData []map[string]interface{}) (ret string) { if text, ok := dataMap["text"]; ok { // 确保 text 是字符串类型 if textStr, ok := text.(string); ok { - ret += " " + textStr + ret += " " + strings.ReplaceAll(textStr, "\r", "") } } }