Skip to content

Commit 5269876

Browse files
committed
Rename variable
1 parent ca02b2d commit 5269876

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/neo4j_graphrag/experimental/components/graph_pruning.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,21 +223,21 @@ def _validate_node(
223223

224224
def _enforce_nodes(
225225
self,
226-
extracted_nodes: list[Neo4jNode],
226+
nodes: list[Neo4jNode],
227227
schema: GraphSchema,
228228
lexical_graph_config: LexicalGraphConfig,
229229
pruning_stats: PruningStats,
230230
) -> list[Neo4jNode]:
231231
"""
232-
Filter extracted nodes to be conformant to the schema.
232+
Filter nodes to be conformant to the schema.
233233
234234
Keep only those whose label is in schema
235235
(unless schema has additional_node_types=True, default value)
236236
For each valid node, validate properties. If a node is left without
237237
properties, prune it.
238238
"""
239239
valid_nodes = []
240-
for node in extracted_nodes:
240+
for node in nodes:
241241
if node.label in lexical_graph_config.lexical_graph_node_labels:
242242
valid_nodes.append(node)
243243
continue
@@ -329,14 +329,14 @@ def _validate_relationship(
329329

330330
def _enforce_relationships(
331331
self,
332-
extracted_relationships: list[Neo4jRelationship],
332+
relationships: list[Neo4jRelationship],
333333
filtered_nodes: list[Neo4jNode],
334334
schema: GraphSchema,
335335
lexical_graph_config: LexicalGraphConfig,
336336
pruning_stats: PruningStats,
337337
) -> list[Neo4jRelationship]:
338338
"""
339-
Filter extracted nodes to be conformant to the schema.
339+
Filter relationships to be conformant to the schema.
340340
341341
Keep only those whose types are in schema, start/end node conform to schema,
342342
and start/end nodes are in filtered nodes (i.e., kept after node enforcement).
@@ -347,7 +347,7 @@ def _enforce_relationships(
347347

348348
valid_rels = []
349349
valid_nodes = {node.id: node.label for node in filtered_nodes}
350-
for rel in extracted_relationships:
350+
for rel in relationships:
351351
if rel.type in lexical_graph_config.lexical_graph_relationship_types:
352352
valid_rels.append(rel)
353353
continue

tests/unit/experimental/components/test_graph_pruning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def test_graph_pruning_enforce_nodes_lexical_graph(
172172
) -> None:
173173
pruner = GraphPruning()
174174
result = pruner._enforce_nodes(
175-
extracted_nodes=[
175+
nodes=[
176176
Neo4jNode(id="1", label="Paragraph"),
177177
],
178178
schema=GraphSchema(node_types=tuple(), additional_node_types=False),

0 commit comments

Comments
 (0)