Skip to content

Commit

Permalink
Fix csv for TAG. (#4454)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh authored Jan 13, 2025
1 parent ecdb2a8 commit e098fcf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rag/app/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e098fcf

Please sign in to comment.