Преглед изворни кода

Let 'One' applicable for tables in docx (#3619)

### What problem does this PR solve?

#3598

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] Performance Improvement
tags/v0.14.0
Kevin Hu пре 11 месеци
родитељ
комит
609236f5c1
No account linked to committer's email address
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5
    2
      rag/app/one.py

+ 5
- 2
rag/app/one.py Прегледај датотеку

import re import re


from deepdoc.parser.utils import get_text from deepdoc.parser.utils import get_text
from rag.app import laws
from rag.app import naive
from rag.nlp import rag_tokenizer, tokenize from rag.nlp import rag_tokenizer, tokenize
from deepdoc.parser import PdfParser, ExcelParser, PlainParser, HtmlParser from deepdoc.parser import PdfParser, ExcelParser, PlainParser, HtmlParser




if re.search(r"\.docx$", filename, re.IGNORECASE): if re.search(r"\.docx$", filename, re.IGNORECASE):
callback(0.1, "Start to parse.") callback(0.1, "Start to parse.")
sections = [txt for txt in laws.Docx()(filename, binary) if txt]
sections, tbls = naive.Docx()(filename, binary)
sections = [s for s, _ in sections if s]
for (_, html), _ in tbls:
sections.append(html)
callback(0.8, "Finish parsing.") callback(0.8, "Finish parsing.")


elif re.search(r"\.pdf$", filename, re.IGNORECASE): elif re.search(r"\.pdf$", filename, re.IGNORECASE):

Loading…
Откажи
Сачувај