lidp commited on
Commit
91ede52
·
1 Parent(s): 3d5f9ea

Refactoring entity_resolution (#2692)

Browse files

### What problem does this PR solve?

### Type of change

- [x] Refactoring

Files changed (1) hide show
  1. graphrag/entity_resolution.py +1 -5
graphrag/entity_resolution.py CHANGED
@@ -94,11 +94,7 @@ class EntityResolution:
94
 
95
  candidate_resolution = {entity_type: [] for entity_type in entity_types}
96
  for k, v in node_clusters.items():
97
- candidate_resolution_tmp = []
98
- for a, b in itertools.permutations(v, 2):
99
- if self.is_similarity(a, b) and (b, a) not in candidate_resolution_tmp:
100
- candidate_resolution_tmp.append((a, b))
101
- candidate_resolution[k] = candidate_resolution_tmp
102
 
103
  gen_conf = {"temperature": 0.5}
104
  resolution_result = set()
 
94
 
95
  candidate_resolution = {entity_type: [] for entity_type in entity_types}
96
  for k, v in node_clusters.items():
97
+ candidate_resolution[k] = [(a, b) for a, b in itertools.combinations(v, 2) if self.is_similarity(a, b)]
 
 
 
 
98
 
99
  gen_conf = {"temperature": 0.5}
100
  resolution_result = set()