pelinker.linker_kb_lemma¶
Lemma-based KB training-entity index (same resolution as embedding-time matching).
build_kb_lemma_index(labels_map, nlp)
¶
Build {word_grouping: {lemma_string: kb_training_entity_label}} from labels_map values.
Mirrors the per-property lemma matching used at training time in
:func:pelinker.util.extract_and_embed_mentions (_wg_for_property for the bucket,
lemma strings for comparison), inverted to an O(1) lookup keyed by mention lemma.
Source code in pelinker/linker_kb_lemma.py
enrich_entity_predictions_kb_validation(rows, kb_lemma_by_wg, labels_map)
¶
Add validation-only fields to each prediction row (mutates rows in place).
Source code in pelinker/linker_kb_lemma.py
lookup_kb_training_entity_label(word_grouping, lemma, kb_lemma_by_wg)
¶
Resolve training entity label string from mention word_grouping + space-joined lemmas.