pyannotators-entityfishing 1.6.46__tar.gz → 1.6.47__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyannotators-entityfishing
3
- Version: 1.6.46
3
+ Version: 1.6.47
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>
@@ -30,7 +30,7 @@ Requires-Dist: bump2version; extra == 'dev'
30
30
  Requires-Dist: pre-commit; extra == 'dev'
31
31
  Provides-Extra: docs
32
32
  Requires-Dist: lxml-html-clean; extra == 'docs'
33
- Requires-Dist: m2r2; extra == 'docs'
33
+ Requires-Dist: myst-parser; extra == 'docs'
34
34
  Requires-Dist: sphinx; extra == 'docs'
35
35
  Requires-Dist: sphinx-rtd-theme; extra == 'docs'
36
36
  Requires-Dist: sphinxcontrib-apidoc; extra == 'docs'
@@ -57,7 +57,7 @@ test = [
57
57
  docs = [
58
58
  "sphinx",
59
59
  "sphinx-rtd-theme",
60
- "m2r2",
60
+ "myst-parser",
61
61
  "sphinxcontrib.apidoc",
62
62
  "lxml_html_clean",
63
63
  ]
@@ -1,3 +1,3 @@
1
1
  """Annotator based on entity-fishing"""
2
2
 
3
- __version__ = "1.6.46"
3
+ __version__ = "1.6.47"
@@ -148,12 +148,12 @@ def _enrich_concepts_with_properties(concepts: dict, wiki_props: list[str], mult
148
148
  """Enrich concept dicts with extracted wikidata_properties."""
149
149
  for concept in concepts.values():
150
150
  if concept is not None and "statements" in concept:
151
- fingerprint = defaultdict(list)
151
+ fingerprint = defaultdict(set)
152
152
  for wp in wiki_props:
153
- fingerprint[wp] = []
153
+ fingerprint[wp] = set()
154
154
  for st in concept["statements"]:
155
155
  if st["propertyId"] in wiki_props:
156
- fingerprint[st["propertyId"]].append(st["value"])
156
+ fingerprint[st["propertyId"]].add(st["value"])
157
157
  if sum(len(v) for v in fingerprint.values()) > 0:
158
158
  concept["wikidata_properties"] = dict(fingerprint)
159
159
 
@@ -184,7 +184,7 @@ def _build_annotation(entity: dict, label: str, concept: dict | None, lang: str,
184
184
  if fingerprints:
185
185
  fp_parts = []
186
186
  for f in fingerprints:
187
- fvals = concept["wikidata_properties"].get(f, [])
187
+ fvals = list(concept["wikidata_properties"].get(f, []))
188
188
  if fvals:
189
189
  fingers = [f"{f}:{v}" for v in sorted(fvals) if isinstance(v, str)]
190
190
  if multivalued_props:
@@ -194,7 +194,7 @@ def _build_annotation(entity: dict, label: str, concept: dict | None, lang: str,
194
194
  ann_term.properties["fingerprint"] = ",".join(fp_parts)
195
195
  if wikidata_properties:
196
196
  for wp in wikidata_properties:
197
- fvals = concept["wikidata_properties"].get(wp, [])
197
+ fvals = list(concept["wikidata_properties"].get(wp, []))
198
198
  if len(fvals) == 1:
199
199
  ann_term.properties[wp] = fvals[0]
200
200
  elif len(fvals) > 1: