GraphRAG - NER - spacy - fix spacy extraction (#14783)

Fix spacy extraction
This commit is contained in:
Wang Qi
2026-06-01 13:05:54 +08:00
committed by GitHub
parent 12579dbc3d
commit 10e8690890

View File

@@ -331,12 +331,13 @@ async def run_graphrag_for_kb(
callback(msg=f"[GraphRAG] chunk_list returned {len(raw_chunks)} raw chunks for doc:{doc_id}")
contents = [content for chunk in raw_chunks if (content := chunk.get("content_with_weight", ""))
]
# For NER-based extractionm, no need to batch extract entity and relation
if _select_extractor_type(graphrag_config) == "ner":
return raw_chunks
return contents
for d in raw_chunks:
content = d["content_with_weight"]
for content in contents:
if num_tokens_from_string(current_chunk + content) < batch_chunk_token_size:
current_chunk += content
else: