pyannotators-entityfishing 1.6.140__tar.gz → 1.6.142__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/PKG-INFO +1 -1
  2. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/src/pyannotators_entityfishing/__init__.py +1 -1
  3. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/src/pyannotators_entityfishing/candidates.py +16 -1
  4. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/.claude/skills/ef-mapping/SKILL.md +0 -0
  5. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/.gitignore +0 -0
  6. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/.gitmodules +0 -0
  7. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/.python-version +0 -0
  8. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/LICENSE +0 -0
  9. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/README.md +0 -0
  10. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/Taskfile.yml +0 -0
  11. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/pyproject.toml +0 -0
  12. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/src/pyannotators_entityfishing/ef_client.py +0 -0
  13. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/src/pyannotators_entityfishing/entityfishing.py +0 -0
  14. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/.claude-plugin/marketplace.json +0 -0
  15. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/.claude-plugin/plugin.json +0 -0
  16. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/HOWTO.md +0 -0
  17. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/README.md +0 -0
  18. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/Stages.yml +0 -0
  19. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/Taskfile.yml +0 -0
  20. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/help/help_examples.py +0 -0
  21. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/help/plugin-help.py +0 -0
  22. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/help/template.en.md +0 -0
  23. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/help/template.fr.md +0 -0
  24. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/SKILL.md +0 -0
  25. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/annotator.md +0 -0
  26. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/converter.md +0 -0
  27. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/formatter.md +0 -0
  28. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/importer.md +0 -0
  29. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/processor.md +0 -0
  30. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/segmenter.md +0 -0
  31. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/types.md +0 -0
  32. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/plugin-help/SKILL.md +0 -0
  33. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/tools/check-marketplace.py +0 -0
  34. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/vars/pythonPipeline.groovy +0 -0
  35. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/build_poi.py +0 -0
  36. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/build_poi_lexicons.py +0 -0
  37. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/build_rerank_data.py +0 -0
  38. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/check_rerank_endpoint.py +0 -0
  39. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/el_jev.py +0 -0
  40. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/eval_linking.py +0 -0
  41. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/eval_mappings.py +0 -0
  42. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/eval_rerank.py +0 -0
  43. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/finetune_rerank.py +0 -0
  44. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/merge_rerank.py +0 -0
  45. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/poi_common_words.json +0 -0
  46. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/recalibrate_linking.py +0 -0
  47. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/review_linking.html +0 -0
  48. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/review_linking.py +0 -0
  49. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/sherpa_plan_project.py +0 -0
  50. {pyannotators_entityfishing-1.6.140 → pyannotators_entityfishing-1.6.142}/tools/wdfilter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pyannotators-entityfishing
3
- Version: 1.6.140
3
+ Version: 1.6.142
4
4
  Summary: Annotator based on entity-fishing
5
5
  Project-URL: Homepage, https://github.com/oterrier/pyannotators_entityfishing/
6
6
  Author-email: Olivier Terrier <olivier.terrier@kairntech.com>
@@ -1,3 +1,3 @@
1
1
  """Annotator based on entity-fishing"""
2
2
 
3
- __version__ = "1.6.140"
3
+ __version__ = "1.6.142"
@@ -279,6 +279,17 @@ def add_candidates(
279
279
  found.update(filter_senses(missing, lookup({f for _, f in missing})))
280
280
  for key, vs in variants.items():
281
281
  terms_of[key] = next((found[(key[0], v)] for v in vs if found[(key[0], v)]), [])[:top_k]
282
+ # A mention whose surface is not the form of its group also gets the senses of its surface,
283
+ # after those of the group, when the best of them is not one of the group's: "le Brésilien
284
+ # Ronaldo", grouped with Cristiano Ronaldo, is offered Ronaldo Nazário too, and a decision by
285
+ # mention may tell them apart; "Macron", whose best sense is Emmanuel Macron, gets nothing more.
286
+ own_forms = {(key[0], a.text.strip()) for key, members in groups.items() if key in chosen for a in members if normalize(a.text) != normalize(chosen[key])}
287
+ own = {lf: FILTERED.get(cache_key(*lf)) for lf in own_forms}
288
+ missing = {lf for lf, terms in own.items() if terms is None}
289
+ if missing:
290
+ known = {f: senses[f] for _, f in missing if f in senses}
291
+ known.update(lookup({f for _, f in missing} - known.keys()))
292
+ own.update(filter_senses(missing, known))
282
293
  by_group_id = {key[2]: key for key in groups if key[1] == "group"}
283
294
  for key, members in groups.items():
284
295
  terms = terms_of[key]
@@ -288,9 +299,13 @@ def add_candidates(
288
299
  # every group it may belong to, the full names first, and its own.
289
300
  terms = round_robin([terms_of[k] for k in possible] + [terms], top_k)
290
301
  for a in members:
302
+ surface = own.get((key[0], a.text.strip())) or []
303
+ mine = terms
304
+ if surface and surface[0].identifier not in {t.identifier for t in terms}:
305
+ mine = round_robin([terms, surface[:top_k]], top_k)
291
306
  # Replace the Wikidata candidates, keep the terms of any other lexicon (AFP...).
292
307
  kept = [t for t in (a.terms or []) if t.lexicon != WIKIDATA]
293
- a.terms = kept + [t.model_copy(deep=True) for t in terms]
308
+ a.terms = kept + [t.model_copy(deep=True) for t in mine]
294
309
 
295
310
 
296
311
  def form_variants(form: str, restore_case: bool) -> list[str]: