pyannotators-entityfishing 1.6.138__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.
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/PKG-INFO +1 -1
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/src/pyannotators_entityfishing/__init__.py +1 -1
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/src/pyannotators_entityfishing/candidates.py +16 -1
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/build_poi.py +45 -6
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/.claude/skills/ef-mapping/SKILL.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/.gitignore +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/.gitmodules +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/.python-version +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/LICENSE +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/README.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/Taskfile.yml +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/pyproject.toml +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/src/pyannotators_entityfishing/ef_client.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/src/pyannotators_entityfishing/entityfishing.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/.claude-plugin/marketplace.json +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/.claude-plugin/plugin.json +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/HOWTO.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/README.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/Stages.yml +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/Taskfile.yml +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/help/help_examples.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/help/plugin-help.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/help/template.en.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/resources/help/template.fr.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/SKILL.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/annotator.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/converter.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/formatter.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/importer.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/processor.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/segmenter.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/new-plugin/references/types.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/skills/plugin-help/SKILL.md +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/tools/check-marketplace.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/submodules/python-archetype/vars/pythonPipeline.groovy +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/build_poi_lexicons.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/build_rerank_data.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/check_rerank_endpoint.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/el_jev.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/eval_linking.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/eval_mappings.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/eval_rerank.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/finetune_rerank.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/merge_rerank.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/poi_common_words.json +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/recalibrate_linking.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/review_linking.html +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/review_linking.py +0 -0
- {pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/sherpa_plan_project.py +0 -0
- {pyannotators_entityfishing-1.6.138 → 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.
|
|
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>
|
|
@@ -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
|
|
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]:
|
{pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/build_poi.py
RENAMED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
A POI is a building, monument, venue, transport hub, museum, park, square or cemetery.
|
|
8
8
|
The mapping is a list of Wikidata classes, gathered from the subclass trees of hub classes,
|
|
9
9
|
minus the natural places (continents, bodies of water, landforms: the AFP does not want them)
|
|
10
|
+
but the mountains, lakes, forests, waterfalls, canyons and caves, which it wants
|
|
10
11
|
and two kinds of concepts:
|
|
11
12
|
|
|
12
13
|
- a settlement: a population (P1082) marks a city, a town or an island, which stay Location;
|
|
@@ -84,9 +85,24 @@ PRECISE_HUBS = {
|
|
|
84
85
|
"Q39614": ("cemetery", 2),
|
|
85
86
|
"Q200141": ("necropolis", 2),
|
|
86
87
|
}
|
|
87
|
-
# Natural places, which
|
|
88
|
-
#
|
|
88
|
+
# Natural places, which stay Location: every subclass of a continent, a body of water or a landform
|
|
89
|
+
# (the Mediterranean, the Alps, the Strait of Hormuz), whatever hub brings it in...
|
|
89
90
|
NATURAL_ROOTS = {"Q5107": "continent", "Q15324": "body of water", "Q271669": "landform"}
|
|
91
|
+
# ...but those of these hubs, which the AFP wants as POI (answer of 2026-10-14): a place a country
|
|
92
|
+
# or a city holds, the Mont Ventoux, the Lake Geneva, Sherwood Forest. Walked like the broad hubs.
|
|
93
|
+
NATURAL_HUBS = {
|
|
94
|
+
"Q8502": "mountain",
|
|
95
|
+
"Q8072": "volcano",
|
|
96
|
+
"Q207326": "summit",
|
|
97
|
+
"Q54050": "hill",
|
|
98
|
+
"Q23397": "lake",
|
|
99
|
+
"Q131681": "reservoir",
|
|
100
|
+
"Q4421": "forest",
|
|
101
|
+
"Q34038": "waterfall",
|
|
102
|
+
"Q150784": "canyon",
|
|
103
|
+
"Q35509": "cave",
|
|
104
|
+
"Q11269813": "cave with prehistoric art", # not under cave: Lascaux, Chauvet
|
|
105
|
+
}
|
|
90
106
|
# Subclasses the hubs bring in that are not points of interest, found by
|
|
91
107
|
# `python tools/wdfilter.py audit tests/data_v2/POI.json`.
|
|
92
108
|
EXCLUDE = {
|
|
@@ -115,6 +131,25 @@ EXCLUDE = {
|
|
|
115
131
|
"Q666294": "list of Natural Reserves in Russia",
|
|
116
132
|
"Q2501058": "Off-Off-Broadway",
|
|
117
133
|
"Q7307215": "ship refit",
|
|
134
|
+
"Q6617796": "list of ecoregions in Nigeria",
|
|
135
|
+
"Q30889174": "Chongar bridges",
|
|
136
|
+
"Q12363245": "no English label",
|
|
137
|
+
# brought in by the natural hubs: man-made or managed, not places one names
|
|
138
|
+
"Q131596": "farm",
|
|
139
|
+
"Q819511": "spoil tip",
|
|
140
|
+
"Q1413117": "retention basin",
|
|
141
|
+
"Q1434085": "underground hangar",
|
|
142
|
+
"Q1911141": "molehill",
|
|
143
|
+
"Q2039061": "windbreak",
|
|
144
|
+
"Q2137499": "infiltration basin",
|
|
145
|
+
"Q2527200": "compost heap",
|
|
146
|
+
"Q2586008": "commercial forest",
|
|
147
|
+
"Q2710737": "stockpile",
|
|
148
|
+
"Q2843044": "tree farm",
|
|
149
|
+
"Q3632569": "settling basin",
|
|
150
|
+
"Q4086881": "bioswale",
|
|
151
|
+
"Q4410701": "cultivated forest",
|
|
152
|
+
"Q4994812": "fire-fighting pond",
|
|
118
153
|
}
|
|
119
154
|
|
|
120
155
|
# Gold sets, sampled on structural properties rather than on the P31 classes the
|
|
@@ -129,9 +164,9 @@ GOLD = {
|
|
|
129
164
|
"POI_stations": ("?x wdt:P296 ?code . ?x wdt:P625 ?c .", "a station code (P296)"),
|
|
130
165
|
"POI_museums": ("?x wdt:P31/wdt:P279* wd:Q33506 .", "instance of museum or a subclass"),
|
|
131
166
|
"POI_parks": ("?x wdt:P31/wdt:P279* wd:Q22698 . ?x wdt:P625 ?c .", "instance of park or a subclass"),
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
167
|
+
"POI_mountains": ("?x wdt:P2660 ?prominence .", "a topographic prominence (P2660)"),
|
|
168
|
+
"POI_lakes": ("?x wdt:P4511 ?depth . ?x wdt:P625 ?c .", "a vertical depth (P4511) and coordinates"),
|
|
169
|
+
"POI_waterfalls": ("?x wdt:P31/wdt:P279* wd:Q34038 .", "instance of waterfall or a subclass"),
|
|
135
170
|
"POI_squares": ("?x wdt:P31/wdt:P279* wd:Q174782 .", "instance of square or a subclass"),
|
|
136
171
|
"LOC_rivers": ("?x wdt:P403 ?mouth . ?x wdt:P2043 ?length .", "a watercourse with a mouth (P403): stays Location"),
|
|
137
172
|
}
|
|
@@ -142,10 +177,14 @@ def poi_classes() -> list[str]:
|
|
|
142
177
|
kept: set[str] = set()
|
|
143
178
|
for hub in BROAD_HUBS:
|
|
144
179
|
kept.update(n.qid for n in taxonomy(hub, max_depth=2, counts=False) if n.sites >= MIN_SITES or n.depth == 0)
|
|
180
|
+
wanted: set[str] = set()
|
|
181
|
+
for hub in NATURAL_HUBS:
|
|
182
|
+
wanted.update(n.qid for n in taxonomy(hub, max_depth=2, counts=False) if n.sites >= MIN_SITES or n.depth == 0)
|
|
183
|
+
kept |= wanted
|
|
145
184
|
for hub, (_, depth) in PRECISE_HUBS.items():
|
|
146
185
|
kept.update(n.qid for n in taxonomy(hub, max_depth=depth, counts=False) if n.depth <= 1 or n.sites >= MIN_SITES)
|
|
147
186
|
natural = {r["c"].rsplit("/", 1)[1] for root in NATURAL_ROOTS for r in _sparql(f"SELECT ?c WHERE {{ ?c wdt:P279* wd:{root} }}", timeout=300)}
|
|
148
|
-
return sorted(kept - EXCLUDE.keys() - natural, key=lambda q: int(q[1:]))
|
|
187
|
+
return sorted(kept - EXCLUDE.keys() - (natural - wanted), key=lambda q: int(q[1:]))
|
|
149
188
|
|
|
150
189
|
|
|
151
190
|
def build_mapping(qids: list[str]) -> dict:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/build_rerank_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/eval_linking.py
RENAMED
|
File without changes
|
{pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/eval_mappings.py
RENAMED
|
File without changes
|
{pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/eval_rerank.py
RENAMED
|
File without changes
|
{pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/finetune_rerank.py
RENAMED
|
File without changes
|
{pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/merge_rerank.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/review_linking.html
RENAMED
|
File without changes
|
{pyannotators_entityfishing-1.6.138 → pyannotators_entityfishing-1.6.142}/tools/review_linking.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|