Perf: limit embedding in KG. (#8917)

### What problem does this PR solve?


### Type of change

- [x] Performance Improvement
This commit is contained in:
Kevin Hu
2025-07-18 19:51:14 +08:00
committed by GitHub
parent 77deaf390b
commit ab53a73768
3 changed files with 39 additions and 24 deletions

View File

@ -237,7 +237,10 @@ class EntityResolution(Extractor):
return True
return False
if len(set(a) & set(b)) > 1:
return True
a, b = set(a), set(b)
max_l = max(len(a), len(b))
if max_l < 4:
return len(a & b) > 1
return len(a & b)*1./max_l >= 0.8
return False