The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Update grobid.py (#16298)
Alireza Kashanid1b4ead87c0a
diff --git a/libs/community/langchain_community/document_loaders/parsers/grobid.py b/libs/community/langchain_community/document_loaders/parsers/grobid.pyindex 8eb9974479..f73f91150c 100644--- a/libs/community/langchain_community/document_loaders/parsers/grobid.py+++ b/libs/community/langchain_community/document_loaders/parsers/grobid.py@@ -59,19 +59,20 @@ class GrobidParser(BaseBlobParser):for i, sentence in enumerate(paragraph.find_all("s")):paragraph_text.append(sentence.text)sbboxes = []- for bbox in sentence.get("coords").split(";"):- box = bbox.split(",")- sbboxes.append(- {- "page": box[0],- "x": box[1],- "y": box[2],- "h": box[3],- "w": box[4],- }- )- chunk_bboxes.append(sbboxes)- if segment_sentences is True:+ if sentence.get("coords") is not None:+ for bbox in sentence.get("coords").split(";"):+ box = bbox.split(",")+ sbboxes.append(+ {+ "page": box[0],+ "x": box[1],+ "y": box[2],+ "h": box[3],+ "w": box[4],+ }+ )+ chunk_bboxes.append(sbboxes)+ if (segment_sentences is True) and (len(sbboxes) > 0):fpage, lpage = sbboxes[0]["page"], sbboxes[-1]["page"]sentence_dict = {"text": sentence.text,