瀏覽代碼

refine text decode (#657)

### What problem does this PR solve?
#651 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.5.0
KevinHuSh 1 年之前
父節點
當前提交
7013d7f620
沒有連結到貢獻者的電子郵件帳戶。
共有 7 個檔案被更改,包括 7 行新增7 行删除
  1. 1
    1
      deepdoc/parser/excel_parser.py
  2. 1
    1
      rag/app/book.py
  3. 1
    1
      rag/app/laws.py
  4. 1
    1
      rag/app/naive.py
  5. 1
    1
      rag/app/one.py
  6. 1
    1
      rag/app/qa.py
  7. 1
    1
      rag/app/table.py

+ 1
- 1
deepdoc/parser/excel_parser.py 查看文件

@@ -69,7 +69,7 @@ class RAGFlowExcelParser:

if fnm.split(".")[-1].lower() in ["csv", "txt"]:
encoding = find_codec(binary)
txt = binary.decode(encoding)
txt = binary.decode(encoding, errors="ignore")
return len(txt.split("\n"))



+ 1
- 1
rag/app/book.py 查看文件

@@ -91,7 +91,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000,
txt = ""
if binary:
encoding = find_codec(binary)
txt = binary.decode(encoding)
txt = binary.decode(encoding, errors="ignore")
else:
with open(filename, "r") as f:
while True:

+ 1
- 1
rag/app/laws.py 查看文件

@@ -113,7 +113,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000,
txt = ""
if binary:
encoding = find_codec(binary)
txt = binary.decode(encoding)
txt = binary.decode(encoding, errors="ignore")
else:
with open(filename, "r") as f:
while True:

+ 1
- 1
rag/app/naive.py 查看文件

@@ -141,7 +141,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000,
txt = ""
if binary:
encoding = find_codec(binary)
txt = binary.decode(encoding)
txt = binary.decode(encoding, errors="ignore")
else:
with open(filename, "r") as f:
while True:

+ 1
- 1
rag/app/one.py 查看文件

@@ -85,7 +85,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000,
txt = ""
if binary:
encoding = find_codec(binary)
txt = binary.decode(encoding)
txt = binary.decode(encoding, errors="ignore")
else:
with open(filename, "r") as f:
while True:

+ 1
- 1
rag/app/qa.py 查看文件

@@ -107,7 +107,7 @@ def chunk(filename, binary=None, lang="Chinese", callback=None, **kwargs):
txt = ""
if binary:
encoding = find_codec(binary)
txt = binary.decode(encoding)
txt = binary.decode(encoding, errors="ignore")
else:
with open(filename, "r") as f:
while True:

+ 1
- 1
rag/app/table.py 查看文件

@@ -149,7 +149,7 @@ def chunk(filename, binary=None, from_page=0, to_page=10000000000,
txt = ""
if binary:
encoding = find_codec(binary)
txt = binary.decode(encoding)
txt = binary.decode(encoding, errors="ignore")
else:
with open(filename, "r") as f:
while True:

Loading…
取消
儲存