Conversation
|
Task linked: CU-869c0g9f7 Fix embedding linker not disambiguating |
| le.append(entity) | ||
| continue | ||
| elif self.cnf_l.use_ner_link_candidates: | ||
| elif self.cnf_l.use_ner_link_candidates and not len(entity.link_candidates): |
There was a problem hiding this comment.
Minor but this is the actual line so not super trivial. For my non python brain benefit - do you have to not len here?
Can you do just a not?
| elif self.cnf_l.use_ner_link_candidates and not len(entity.link_candidates): | |
| elif self.cnf_l.use_ner_link_candidates and not entity.link_candidates: |
I think it's ultimately saying self.cnf_l.use_ner_link_candidates and len(entity.link_candidates) == 0, just the not len isnt a pattern I've seen before. I'm totally happy if it's super pythonic and standard, as a lot of things are.
There was a problem hiding this comment.
Yep, absolutely - having not entity.link_candidates would be better. I just started off with len(entity.link_candidates) == 0 and thought I'd simplify it. But you're right, relying on the truthy nature of a non-empty list is the best way here.
There was a problem hiding this comment.
Big change ! Thanks for clearing up
This PR will fix the issue with embedding linker that force it (in its default configuration with
use_ner_link_candidates = True) not to any disambiguation.Currently, whenever one runs the embedding linker it only links entities that had only one 1 link candidate. That's because of a condition in the
_pre_inferencemethod that ignored all other entities ifuse_ner_link_candidateswas set.This PR fixes that by:
NOTE: