mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
solve task execution issues (#90)
This commit is contained in:
@ -15,7 +15,7 @@ import re
|
||||
from collections import Counter
|
||||
|
||||
from api.db import ParserType
|
||||
from rag.nlp import huqie, tokenize
|
||||
from rag.nlp import huqie, tokenize, tokenize_table
|
||||
from deepdoc.parser import PdfParser
|
||||
import numpy as np
|
||||
from rag.utils import num_tokens_from_string
|
||||
@ -158,18 +158,7 @@ def chunk(filename, binary=None, from_page=0, to_page=100000, lang="Chinese", ca
|
||||
eng = lang.lower() == "english"#pdf_parser.is_english
|
||||
print("It's English.....", eng)
|
||||
|
||||
res = []
|
||||
# add tables
|
||||
for img, rows in paper["tables"]:
|
||||
bs = 10
|
||||
de = ";" if eng else ";"
|
||||
for i in range(0, len(rows), bs):
|
||||
d = copy.deepcopy(doc)
|
||||
r = de.join(rows[i:i + bs])
|
||||
r = re.sub(r"\t——(来自| in ).*”%s" % de, "", r)
|
||||
tokenize(d, r)
|
||||
d["image"] = img
|
||||
res.append(d)
|
||||
res = tokenize_table(paper["tables"], doc, eng)
|
||||
|
||||
if paper["abstract"]:
|
||||
d = copy.deepcopy(doc)
|
||||
|
||||
Reference in New Issue
Block a user