This commit is contained in:
Daniel 2024-10-31 11:08:25 +08:00
parent cb16e5781e
commit 59bb202b13
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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", "")
}
}
}