refine token similarity (#2824)

### What problem does this PR solve?


### Type of change

- [x] Performance Improvement
This commit is contained in:
Kevin Hu
2024-10-14 13:33:18 +08:00
committed by GitHub
parent 8e5efcc47f
commit b164116277
2 changed files with 3 additions and 6 deletions

View File

@ -186,8 +186,5 @@ class EsQueryer:
s += v # * dtwt[k]
q = 1e-9
for k, v in qtwt.items():
q += v # * v
#d = 1e-9
# for k, v in dtwt.items():
# d += v * v
return s / q / max(1, math.sqrt(math.log10(max(len(qtwt.keys()), len(dtwt.keys())))))# math.sqrt(q) / math.sqrt(d)
q += v
return s / q