MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / _handle_single_relationship_extraction

Function _handle_single_relationship_extraction

_cluster_utils.py:324–344  ·  view source on GitHub ↗
(
    record_attributes: list[str],
    chunk_key: str,
)

Source from the content-addressed store, hash-verified

322
323
324async def _handle_single_relationship_extraction(
325 record_attributes: list[str],
326 chunk_key: str,
327):
328 if len(record_attributes) < 5 or record_attributes[0] != '"relationship"':
329 return None
330 # add this record as edge
331 source = clean_str(record_attributes[1].upper())
332 target = clean_str(record_attributes[2].upper())
333 edge_description = clean_str(record_attributes[3])
334 edge_source_id = chunk_key
335 weight = (
336 float(record_attributes[-1]) if is_float_regex(record_attributes[-1]) else 1.0
337 )
338 return dict(
339 src_id=source,
340 tgt_id=target,
341 weight=weight,
342 description=edge_description,
343 source_id=edge_source_id,
344 )
345
346
347class ClusteringAlgorithm(ABC):

Callers

nothing calls this directly

Calls 2

clean_strFunction · 0.90
is_float_regexFunction · 0.90

Tested by

no test coverage detected