Commit 3d6332cceda2f400046bb9c35ae57b2842214827
1 parent
2637e962
Minor fix to all2all resolver.
Showing
1 changed file
with
4 additions
and
1 deletions
corneferencer/resolvers/resolve.py
... | ... | @@ -135,7 +135,8 @@ def all2all(text, threshold): |
135 | 135 | best_prediction = 0.0 |
136 | 136 | best_link = None |
137 | 137 | for pos2, mnt2 in enumerate(text.mentions): |
138 | - if ((mnt1.set != mnt2.set or not mnt1.set) and pos1 != pos2 and not features.pair_intersect(mnt1, mnt2)): | |
138 | + if ((mnt1.set != mnt2.set or not mnt1.set or not mnt2.set) | |
139 | + and pos1 != pos2 and not features.pair_intersect(mnt1, mnt2)): | |
139 | 140 | ante = mnt1 |
140 | 141 | ana = mnt2 |
141 | 142 | if pos2 < pos1: |
... | ... | @@ -150,6 +151,8 @@ def all2all(text, threshold): |
150 | 151 | if best_link is not None: |
151 | 152 | if best_link.set and not mnt1.set: |
152 | 153 | mnt1.set = best_link.set |
154 | + elif not best_link.set and mnt1.set: | |
155 | + best_link.set = mnt1.set | |
153 | 156 | elif best_link.set and mnt1.set: |
154 | 157 | text.merge_sets(best_link.set, mnt1.set) |
155 | 158 | elif not best_link.set and not mnt1.set: |
... | ... |