ソースを参照

Fix csv for TAG. (#4454)

### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.16.0
Kevin Hu 9ヶ月前
コミット
e098fcf6ad
コミッターのメールアドレスに関連付けられたアカウントが存在しません
1個のファイルの変更2行の追加2行の削除
  1. 2
    2
      rag/app/tag.py

+ 2
- 2
rag/app/tag.py ファイルの表示

@@ -91,14 +91,14 @@ def chunk(filename, binary=None, lang="Chinese", callback=None, **kwargs):
callback(0.1, "Start to parse.")
txt = get_text(filename, binary)
lines = txt.split("\n")
delimiter = "\t" if any("\t" in line for line in lines) else ","

fails = []
content = ""
res = []
reader = csv.reader(lines, delimiter=delimiter)
reader = csv.reader(lines)

for i, row in enumerate(reader):
row = [r.strip() for r in row if r.strip()]
if len(row) != 2:
content += "\n" + lines[i]
elif len(row) == 2:

読み込み中…
キャンセル
保存