pyprocessors-coreference 1.6.34__tar.gz → 1.6.36__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 (37) hide show
  1. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/PKG-INFO +11 -11
  2. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/README.md +10 -10
  3. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/docs/adr/0001-linking-candidats-entityfishing-decision-jev.md +2 -2
  4. pyprocessors_coreference-1.6.36/docs/adr/0003-traduction-des-descriptions-par-la-spec-openapi.md +54 -0
  5. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/docs/sherpa/coreference.en.md +31 -31
  6. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/docs/sherpa/coreference.fr.md +31 -31
  7. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/src/pyprocessors_coreference/__init__.py +1 -1
  8. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/src/pyprocessors_coreference/coreference.py +23 -35
  9. pyprocessors_coreference-1.6.36/src/pyprocessors_coreference/i18n.py +35 -0
  10. pyprocessors_coreference-1.6.36/src/pyprocessors_coreference/locales/fr.json +22 -0
  11. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/.claude/settings.json +0 -0
  12. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/.gitignore +0 -0
  13. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/.gitmodules +0 -0
  14. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/.python-version +0 -0
  15. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/LICENSE +0 -0
  16. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/docs/adr/0002-acronymes-mentions-de-l-entite.md +0 -0
  17. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/pyproject.toml +0 -0
  18. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/.claude-plugin/marketplace.json +0 -0
  19. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/.claude-plugin/plugin.json +0 -0
  20. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/HOWTO.md +0 -0
  21. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/README.md +0 -0
  22. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/resources/Stages.yml +0 -0
  23. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/resources/help/help_examples.py +0 -0
  24. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/resources/help/plugin-help.py +0 -0
  25. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/resources/help/template.en.md +0 -0
  26. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/resources/help/template.fr.md +0 -0
  27. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/skills/new-plugin/SKILL.md +0 -0
  28. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/skills/new-plugin/references/annotator.md +0 -0
  29. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/skills/new-plugin/references/converter.md +0 -0
  30. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/skills/new-plugin/references/formatter.md +0 -0
  31. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/skills/new-plugin/references/importer.md +0 -0
  32. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/skills/new-plugin/references/processor.md +0 -0
  33. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/skills/new-plugin/references/segmenter.md +0 -0
  34. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/skills/new-plugin/references/types.md +0 -0
  35. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/skills/plugin-help/SKILL.md +0 -0
  36. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/tools/check-marketplace.py +0 -0
  37. {pyprocessors_coreference-1.6.34 → pyprocessors_coreference-1.6.36}/submodules/python-archetype/vars/pythonPipeline.groovy +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pyprocessors-coreference
3
- Version: 1.6.34
3
+ Version: 1.6.36
4
4
  Summary: Processor grouping the mentions of the same entity
5
5
  Project-URL: Homepage, https://bitbucket.org/kairntech/pyprocessors_coreference
6
6
  Author-email: Olivier Terrier <olivier.terrier@kairntech.com>
@@ -61,13 +61,13 @@ Pour chaque document, entre mentions de même famille de labels :
61
61
  - **tous les labels de personne forment une seule famille** : ceux de la famille
62
62
  `person_family` (`person`, `afpperson`, ou `PER` déclaré dans `label_families`) ;
63
63
  - **un nom partiel de personne rejoint le nom complet dont il est la fin**, que le
64
- nom complet soit avant ou après lui dans le document : « Macron » et « M. Macron »
65
- rejoignent « Emmanuel Macron » ;
66
- - **un prénom seul rejoint le seul nom complet qu'il commence** : « Emmanuel » rejoint
67
- « Emmanuel Macron », sauf si une de ses mentions est incluse dans une mention plus longue
64
+ nom complet soit avant ou après lui dans le document : « Curie » et « M. Curie »
65
+ rejoignent « Pierre Curie » ;
66
+ - **un prénom seul rejoint le seul nom complet qu'il commence** : « Pierre » rejoint
67
+ « Pierre Curie », sauf si une de ses mentions est incluse dans une mention plus longue
68
68
  (un lexique qui reconnaît « Charles » dans « Charles White ») ;
69
- - **un nom partiel ambigu n'est pas fusionné** : avec « Emmanuel Macron » et
70
- « Brigitte Macron » dans le texte, « Macron » garde son propre groupe, et liste les
69
+ - **un nom partiel ambigu n'est pas fusionné** : avec « Pierre Curie » et
70
+ « Marie Curie » dans le texte, « Curie » garde son propre groupe, et liste les
71
71
  groupes possibles pour que l'étape de linking tranche ;
72
72
  - **la règle du nom partiel ne vaut que pour les personnes** : « Airbus » ne rejoint pas
73
73
  « Airbus Defence and Space ».
@@ -110,16 +110,16 @@ from pymultirole_plugins.v1.schema import Annotation, Document
110
110
 
111
111
  from pyprocessors_coreference.coreference import CoreferenceParameters, CoreferenceProcessor
112
112
 
113
- text = "Emmanuel Macron est arrivé. M. Macron a parlé."
113
+ text = "Pierre Curie est arrivé. M. Curie a parlé."
114
114
  document = Document(
115
115
  text=text,
116
116
  annotations=[
117
- Annotation(start=0, end=15, labelName="person", text="Emmanuel Macron"),
118
- Annotation(start=28, end=37, labelName="person", text="M. Macron"),
117
+ Annotation(start=0, end=12, labelName="person", text="Pierre Curie"),
118
+ Annotation(start=25, end=33, labelName="person", text="M. Curie"),
119
119
  ],
120
120
  )
121
121
  [document] = CoreferenceProcessor().process([document], CoreferenceParameters())
122
- # Both annotations: entity_group "g1", canonical_form "Emmanuel Macron".
122
+ # Both annotations: entity_group "g1", canonical_form "Pierre Curie".
123
123
  ```
124
124
 
125
125
  ### Parameters
@@ -31,13 +31,13 @@ Pour chaque document, entre mentions de même famille de labels :
31
31
  - **tous les labels de personne forment une seule famille** : ceux de la famille
32
32
  `person_family` (`person`, `afpperson`, ou `PER` déclaré dans `label_families`) ;
33
33
  - **un nom partiel de personne rejoint le nom complet dont il est la fin**, que le
34
- nom complet soit avant ou après lui dans le document : « Macron » et « M. Macron »
35
- rejoignent « Emmanuel Macron » ;
36
- - **un prénom seul rejoint le seul nom complet qu'il commence** : « Emmanuel » rejoint
37
- « Emmanuel Macron », sauf si une de ses mentions est incluse dans une mention plus longue
34
+ nom complet soit avant ou après lui dans le document : « Curie » et « M. Curie »
35
+ rejoignent « Pierre Curie » ;
36
+ - **un prénom seul rejoint le seul nom complet qu'il commence** : « Pierre » rejoint
37
+ « Pierre Curie », sauf si une de ses mentions est incluse dans une mention plus longue
38
38
  (un lexique qui reconnaît « Charles » dans « Charles White ») ;
39
- - **un nom partiel ambigu n'est pas fusionné** : avec « Emmanuel Macron » et
40
- « Brigitte Macron » dans le texte, « Macron » garde son propre groupe, et liste les
39
+ - **un nom partiel ambigu n'est pas fusionné** : avec « Pierre Curie » et
40
+ « Marie Curie » dans le texte, « Curie » garde son propre groupe, et liste les
41
41
  groupes possibles pour que l'étape de linking tranche ;
42
42
  - **la règle du nom partiel ne vaut que pour les personnes** : « Airbus » ne rejoint pas
43
43
  « Airbus Defence and Space ».
@@ -80,16 +80,16 @@ from pymultirole_plugins.v1.schema import Annotation, Document
80
80
 
81
81
  from pyprocessors_coreference.coreference import CoreferenceParameters, CoreferenceProcessor
82
82
 
83
- text = "Emmanuel Macron est arrivé. M. Macron a parlé."
83
+ text = "Pierre Curie est arrivé. M. Curie a parlé."
84
84
  document = Document(
85
85
  text=text,
86
86
  annotations=[
87
- Annotation(start=0, end=15, labelName="person", text="Emmanuel Macron"),
88
- Annotation(start=28, end=37, labelName="person", text="M. Macron"),
87
+ Annotation(start=0, end=12, labelName="person", text="Pierre Curie"),
88
+ Annotation(start=25, end=33, labelName="person", text="M. Curie"),
89
89
  ],
90
90
  )
91
91
  [document] = CoreferenceProcessor().process([document], CoreferenceParameters())
92
- # Both annotations: entity_group "g1", canonical_form "Emmanuel Macron".
92
+ # Both annotations: entity_group "g1", canonical_form "Pierre Curie".
93
93
  ```
94
94
 
95
95
  ### Parameters
@@ -31,8 +31,8 @@ date: 2026-09-24
31
31
 
32
32
  Les règles s'appliquent toujours entre mentions de même famille de labels (voir plus bas) :
33
33
  - **même surface normalisée → même groupe** ;
34
- - **PERSON seulement : un nom partiel rejoint un nom complet vu dans le document** (« Macron » rejoint « Emmanuel Macron ») ;
35
- - **un nom partiel ambigu n'est pas fusionné de force** : avec Emmanuel et Brigitte Macron dans le même texte, « Macron » garde ses deux groupes possibles.
34
+ - **PERSON seulement : un nom partiel rejoint un nom complet vu dans le document** (« Curie » rejoint « Pierre Curie ») ;
35
+ - **un nom partiel ambigu n'est pas fusionné de force** : avec Pierre et Marie Curie dans le même texte, « Curie » garde ses deux groupes possibles.
36
36
 
37
37
  **Le code part de `person_varnames`**, aujourd'hui en double dans `pyprocessors_afp_entities` et `pyprocessors_escrim_reconciliation`, qui a trois défauts :
38
38
  - la portée ne va que vers l'avant ;
@@ -0,0 +1,54 @@
1
+ ---
2
+ status: proposed
3
+ date: 2026-10-21
4
+ ---
5
+
6
+ # ADR-0003 — Le nom, la description et les paramètres d'un plugin sont traduits dans la spec OpenAPI, depuis un `locales/<langue>.json` du plugin
7
+
8
+ - **Décision** — L'anglais reste dans le code : le titre et la `description` des `Field`, et la docstring de la classe, dont la première ligne donne le nom affiché du plugin. Chaque autre langue est un fichier `src/<paquet>/locales/<langue>.json` livré dans le wheel. La spec OpenAPI porte toutes les langues à la fois dans une extension `x-i18n` : `{"fr": {"title", "description"}}` sur chaque paramètre, et `{"fr": {"summary", "description"}}` sur l'opération du plugin.
9
+ - **Pourquoi** — Chaque nouveau plugin doit aujourd'hui être ajouté à la main dans `sherpa-ui` (`src/locales/{en,fr}.yaml`, clés `permissions.use<Type>:<nom>`), et seul son **nom** y est traduit. La description du plugin, le titre et la description des paramètres arrivent de la spec sans traduction ([SHERPA-3124](https://kairntech.atlassian.net/browse/SHERPA-3124)). Une seule spec plutôt qu'une par langue : `pymultirole_server` la génère une fois et la met en cache (`app.openapi_schema`), et une spec par langue imposerait un cache par langue et une négociation `Accept-Language`, pour un seul client.
10
+ - **Statut** — `proposed`. Ce dépôt sert de prototype : le mécanisme doit migrer dans `pymultirole_plugins` et `pymultirole_server` (voir *La suite*).
11
+
12
+ ## Le format des traductions
13
+
14
+ ```json
15
+ {
16
+ "name": "Gestion des coréférences",
17
+ "description": "Regroupe les mentions d'une même entité…",
18
+ "parameters": {"labels": {"title": "Labels", "description": "Labels des mentions à regrouper…"}}
19
+ }
20
+ ```
21
+
22
+ - **JSON plutôt que YAML** : il se lit avec la bibliothèque standard, sans dépendance. Weblate, Crowdin et i18next le lisent tels quels.
23
+ - **Pas de gettext (`.po`)** : c'est le standard Python, mais il prend le texte anglais comme clé. Corriger une virgule en anglais orphelinerait alors la traduction, et il faudrait en plus une étape de compilation (`.mo`). Ici, la clé est le nom du champ, qui est stable et que le test vérifie.
24
+ - **Pas de fichier `en.json`** : l'anglais est le texte du code et sert de secours quand une traduction manque.
25
+ - **Nom du fichier `<langue>.json`** : même convention que les pages d'aide `docs/sherpa/<plugin>.<langue>.md`.
26
+
27
+ ## Le mécanisme
28
+
29
+ Pydantic v2 accepte un `json_schema_extra` **appelable** dans le `model_config`. Les sous-classes en héritent, et l'appel reçoit `(schema, cls)`. `TranslatedParameters` (`i18n.py`) l'utilise pour charger les `locales/*.json` du paquet de `cls`, puis ajoute `x-i18n` aux propriétés. FastAPI recopie ce `x-i18n` dans `components.schemas` sans le modifier : c'est vérifié avec FastAPI.
30
+
31
+ ```json
32
+ "labels": {"title": "Labels", "description": "Labels of the mentions to group…", "extra": "label",
33
+ "x-i18n": {"fr": {"title": "Labels", "description": "Labels des mentions à regrouper…"}}}
34
+ ```
35
+
36
+ Le test `test_translations_are_complete_and_in_the_schema` échoue si un paramètre n'est pas traduit (titre et description), si une clé ne correspond plus à aucun paramètre, ou s'il manque le nom ou la description du plugin.
37
+
38
+ Le suffixe `#extra:…` que `pymultirole_server` ajoute à `description` ne concerne pas les traductions : le backend `sherpa` l'extrait de `description` (`OpenAPIDiscovery.kt`) et il ne dépend pas de la langue.
39
+
40
+ ## La suite (hors de ce dépôt)
41
+
42
+ 1. **`pymultirole_plugins`** : `ProcessorParameters`, et ses équivalents pour les autres familles de plugins, reprennent le `model_config` de `TranslatedParameters`. Ce dépôt supprime alors `i18n.py` et garde son `locales/`. Cela demande une version 1.7, donc d'élargir **ensemble** la borne `<1.7.0` dans tous les dépôts frères.
43
+ 2. **Les plugins** : la première ligne de la docstring de chaque classe devient son nom affiché en anglais (ligne de résumé PEP 257), reprise de `sherpa-ui/src/locales/en.yaml`. Ce dépôt ne l'a pas encore fait.
44
+ 3. **`pymultirole_server`** (`server.py`, à l'enregistrement des routes) : `summary` reçoit la première ligne de la docstring et `description` le reste. Il passe aussi `openapi_extra={"x-i18n": {langue: {"summary": t["name"], "description": t["description"]}}}` à `app.post(...)`.
45
+ 4. **`sherpa`** (`OpenAPIDiscovery.kt`) : `visitOpenApiSchema` ne garde que `title`, `required`, `default`, `enum` et `description`. Il doit aussi propager `x-i18n` par propriété, ainsi que le `summary` et le `x-i18n` de l'opération.
46
+ 5. **`sherpa-ui`** : afficher `x-i18n[langue]` s'il existe, sinon le texte de la spec, sinon le nom technique, comme `maybeLocalize` aujourd'hui. Les clés `permissions.use*` des plugins et la table codée en dur de `localediff.py` disparaissent.
47
+ 6. **`python-archetype`** : un `py:i18n-check` commun pour remplacer le test de complétude propre à chaque dépôt, sur le modèle de `py:help-check`.
48
+
49
+ Ce que cette décision ne règle pas : la permission `use<Type>:<nom>` du rôle `__DefaultAnnotationComponents` (`sherpa/src/main/conf/config.yaml`). C'est une autorisation, pas une traduction, et elle reste à ajouter pour chaque plugin, à moins de décider d'un joker `use<Type>:*` (décision produit).
50
+
51
+ ## Ce qu'on écarte
52
+
53
+ - **Une spec par langue** (`/openapi.json?lang=fr`) : seulement si un client autre que l'interface Sherpa a besoin d'une spec entièrement traduite.
54
+ - **Des descriptions multilingues dans le code** (`description={"en": …, "fr": …}`) : `description` doit rester une chaîne pour Swagger et les clients génériques.
@@ -1,6 +1,6 @@
1
1
  # Coreference Processor (`coreference`)
2
2
 
3
- Groups the mentions of the same entity in a document: "Emmanuel Macron", "M. Macron" and "MACRON" get the same group identifier and the same canonical form, "Emmanuel Macron".
3
+ Groups the mentions of the same entity in a document: "Pierre Curie", "M. Curie" and "CURIE" get the same group identifier and the same canonical form, "Pierre Curie".
4
4
 
5
5
  ## When to use it
6
6
 
@@ -35,7 +35,7 @@ The processor creates no annotation, and only removes acronym annotations (see *
35
35
  | Property | Content | Example |
36
36
  |---|---|---|
37
37
  | `entity_group` | the group identifier, the same for all the mentions of an entity in the document, numbered in order of appearance | `g1` |
38
- | `canonical_form` | the longest form of the group, without title: the most words, then the most characters | `Emmanuel Macron` |
38
+ | `canonical_form` | the longest form of the group, without title: the most words, then the most characters | `Pierre Curie` |
39
39
  | `mention_type` | the type of mention, always `name` | `name` |
40
40
  | `family` | the family of the label, by the name of a label: the one the linking step may map for the whole family | `location` for `afplocation` |
41
41
  | `entity_group_candidates` | only for an ambiguous partial name: the groups it could belong to | `["g1", "g2"]` |
@@ -50,7 +50,7 @@ Properties the annotation already carried are kept. Processing the same document
50
50
  |---|---|---|
51
51
  | **Labels** (`labels`) | — (all labels) | Labels of the mentions to group. Annotations of other labels get no property. Empty, all annotations are grouped. |
52
52
  | **Label Families** (`label_families`) | — | Families of labels grouped as one, each label mapped to its family, the labels mapped to the same family grouped together: another label (`loc_org` → `organization`), whose name is written in the `family` property of the mentions.<br/> A label not declared here belongs to the family of the shortest label that ends its name (afplocation with location). |
53
- | **Person Family** (`person_family`) *(advanced)* | `person` | Family of person names: its labels form a single group (`person` and `afpperson`), and only these names benefit from the partial-name rule ("Macron" joins "Emmanuel Macron"). A label of another name joins it through **Label Families** (`PER` → `person`). |
53
+ | **Person Family** (`person_family`) *(advanced)* | `person` | Family of person names: its labels form a single group (`person` and `afpperson`), and only these names benefit from the partial-name rule ("Curie" joins "Pierre Curie"). A label of another name joins it through **Label Families** (`PER` → `person`). |
54
54
  | **Honorifics** (`honorifics`) *(advanced)* | `["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles", "Me", "Dr", "Dr.", "Pr", "Pr.", "Mr", "Mr.", "Mrs", …` | Titles ignored in front of a person name, regardless of case. They are not part of the canonical form either. |
55
55
 
56
56
  <!-- /generated:parameters -->
@@ -61,7 +61,7 @@ Two mentions go in the same group in the following cases:
61
61
 
62
62
  1. **Same form and same label family.** The comparison ignores case and apostrophe variants: "Airbus" and "AIRBUS" are grouped. A label whose name ends with another grouped label is of its family: a "Washington" annotated `location` by a model and `afplocation` by a lexicon forms a single group, as do `organization` and `afporganization`.
63
63
  2. **Same family of persons.** All person labels count as one, whatever their name: a "George Lucas" annotated `person` by a model and `afpperson` by a lexicon forms a single group.
64
- 3. **Partial name, for persons only.** A name that ends a longer name joins this name, whether it appears before or after it in the document: "Macron" and "M. Macron" join "Emmanuel Macron". The **Honorifics** titles are ignored for the comparison. A first name alone likewise joins the only full name it starts: "Emmanuel" joins "Emmanuel Macron".
64
+ 3. **Partial name, for persons only.** A name that ends a longer name joins this name, whether it appears before or after it in the document: "Curie" and "M. Curie" join "Pierre Curie". The **Honorifics** titles are ignored for the comparison. A first name alone likewise joins the only full name it starts: "Pierre" joins "Pierre Curie".
65
65
  4. **Forms of one acronym.** When the Acronyms annotator ran before, the short form ("SEP") and the expanded form ("sclérose en plaques") of an acronym join the entity found exactly on one of them, everywhere in the document:
66
66
  - they take its label, the most frequent one if the entities of their forms have several;
67
67
  - a form already annotated by an entity is not duplicated: the acronym annotation is removed;
@@ -70,7 +70,7 @@ Two mentions go in the same group in the following cases:
70
70
  Are **never** grouped:
71
71
 
72
72
  - **a first name inside a longer mention**: a lexicon matching "Charles" within "Charles White" leaves "Charles" apart;
73
- - **an ambiguous partial name**: with "Emmanuel Macron" and "Brigitte Macron" in the same document, "Macron" forms its own group, as does "Pierre" with "Pierre Curie" and "Pierre Dupont". Its `entity_group_candidates` property lists the two possible groups, and the linking step decides;
73
+ - **an ambiguous partial name**: with "Pierre Curie" and "Marie Curie" in the same document, "Curie" forms its own group, as does "Pierre" with "Pierre Curie" and "Pierre Dupont". Its `entity_group_candidates` property lists the two possible groups, and the linking step decides;
74
74
  - **different label families**, persons aside: the person "George Washington" and the place "Washington" stay separate;
75
75
  - **a partial name of an organization or a place**: "Airbus" does not join "Airbus Defence and Space".
76
76
 
@@ -80,21 +80,21 @@ In each example, the output table shows the properties added to each annotation.
80
80
 
81
81
  ### 1. A partial name joins the full name
82
82
 
83
- "M. Macron" and the first name alone, "Emmanuel", join "Emmanuel Macron": same group `g1`, same canonical form:
83
+ "M. Curie" and the first name alone, "Pierre", join "Pierre Curie": same group `g1`, same canonical form:
84
84
 
85
85
  <!-- generated:example:partial-name -->
86
86
 
87
87
  Text (French):
88
88
 
89
- > Emmanuel Macron parle. M. Macron sourit. Emmanuel repart.
89
+ > Pierre Curie parle. M. Curie sourit. Pierre repart.
90
90
 
91
91
  Input annotations:
92
92
 
93
93
  | Annotated text | Label | Score |
94
94
  |---|---|---|
95
- | Emmanuel Macron | `person` | 1.00 |
96
- | M. Macron | `person` | 1.00 |
97
- | Emmanuel | `person` | 1.00 |
95
+ | Pierre Curie | `person` | 1.00 |
96
+ | M. Curie | `person` | 1.00 |
97
+ | Pierre | `person` | 1.00 |
98
98
 
99
99
  Default parameters.
100
100
 
@@ -102,29 +102,29 @@ Output annotations:
102
102
 
103
103
  | Annotated text | Label | Score | Properties |
104
104
  |---|---|---|---|
105
- | Emmanuel Macron | `person` | 1.00 | `canonical_form`: Emmanuel Macron<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
106
- | M. Macron | `person` | 1.00 | `canonical_form`: Emmanuel Macron<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
107
- | Emmanuel | `person` | 1.00 | `canonical_form`: Emmanuel Macron<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
105
+ | Pierre Curie | `person` | 1.00 | `canonical_form`: Pierre Curie<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
106
+ | M. Curie | `person` | 1.00 | `canonical_form`: Pierre Curie<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
107
+ | Pierre | `person` | 1.00 | `canonical_form`: Pierre Curie<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
108
108
 
109
109
  <!-- /generated:example:partial-name -->
110
110
 
111
111
  ### 2. An ambiguous partial name
112
112
 
113
- Two people bear the name "Macron": the mention "Macron" forms its own group, and `entity_group_candidates` lists the two possible groups:
113
+ Two people bear the name "Curie": the mention "Curie" forms its own group, and `entity_group_candidates` lists the two possible groups:
114
114
 
115
115
  <!-- generated:example:ambiguous -->
116
116
 
117
117
  Text (French):
118
118
 
119
- > Emmanuel Macron et Brigitte Macron voyagent. Macron sourit.
119
+ > Pierre Curie et Marie Curie voyagent. Curie sourit.
120
120
 
121
121
  Input annotations:
122
122
 
123
123
  | Annotated text | Label | Score |
124
124
  |---|---|---|
125
- | Emmanuel Macron | `person` | 1.00 |
126
- | Brigitte Macron | `person` | 1.00 |
127
- | Macron | `person` | 1.00 |
125
+ | Pierre Curie | `person` | 1.00 |
126
+ | Marie Curie | `person` | 1.00 |
127
+ | Curie | `person` | 1.00 |
128
128
 
129
129
  Default parameters.
130
130
 
@@ -132,9 +132,9 @@ Output annotations:
132
132
 
133
133
  | Annotated text | Label | Score | Properties |
134
134
  |---|---|---|---|
135
- | Emmanuel Macron | `person` | 1.00 | `canonical_form`: Emmanuel Macron<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
136
- | Brigitte Macron | `person` | 1.00 | `canonical_form`: Brigitte Macron<br>`entity_group`: g2<br>`family`: person<br>`mention_type`: name |
137
- | Macron | `person` | 1.00 | `canonical_form`: Macron<br>`entity_group`: g3<br>`entity_group_candidates`: ["g1", "g2"]<br>`family`: person<br>`mention_type`: name |
135
+ | Pierre Curie | `person` | 1.00 | `canonical_form`: Pierre Curie<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
136
+ | Marie Curie | `person` | 1.00 | `canonical_form`: Marie Curie<br>`entity_group`: g2<br>`family`: person<br>`mention_type`: name |
137
+ | Curie | `person` | 1.00 | `canonical_form`: Curie<br>`entity_group`: g3<br>`entity_group_candidates`: ["g1", "g2"]<br>`family`: person<br>`mention_type`: name |
138
138
 
139
139
  <!-- /generated:example:ambiguous -->
140
140
 
@@ -208,13 +208,13 @@ With **Labels** = `person`, the place "Washington" gets no property:
208
208
 
209
209
  Text (French):
210
210
 
211
- > Emmanuel Macron à Washington.
211
+ > Pierre Curie à Washington.
212
212
 
213
213
  Input annotations:
214
214
 
215
215
  | Annotated text | Label | Score |
216
216
  |---|---|---|
217
- | Emmanuel Macron | `person` | 1.00 |
217
+ | Pierre Curie | `person` | 1.00 |
218
218
  | Washington | `lieu` | 1.00 |
219
219
 
220
220
  Parameters: **Labels** = `["person"]`.
@@ -223,7 +223,7 @@ Output annotations:
223
223
 
224
224
  | Annotated text | Label | Score | Properties |
225
225
  |---|---|---|---|
226
- | Emmanuel Macron | `person` | 1.00 | `canonical_form`: Emmanuel Macron<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
226
+ | Pierre Curie | `person` | 1.00 | `canonical_form`: Pierre Curie<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
227
227
  | Washington | `lieu` | 1.00 | — |
228
228
 
229
229
  <!-- /generated:example:labels -->
@@ -263,20 +263,20 @@ Output annotations:
263
263
 
264
264
  ## Known limitations
265
265
 
266
- - **A `PER` label is not recognized as a person by default.** Only the labels whose name ends with "person" are. With `PER` annotations, "Macron" does not join "Emmanuel Macron" as long as **Label Families** does not map `PER` to `person`. Once declared, it groups them:
266
+ - **A `PER` label is not recognized as a person by default.** Only the labels whose name ends with "person" are. With `PER` annotations, "Curie" does not join "Pierre Curie" as long as **Label Families** does not map `PER` to `person`. Once declared, it groups them:
267
267
 
268
268
  <!-- generated:example:person-family -->
269
269
 
270
270
  Text (French):
271
271
 
272
- > Emmanuel Macron parle. Macron sourit.
272
+ > Pierre Curie parle. Curie sourit.
273
273
 
274
274
  Input annotations:
275
275
 
276
276
  | Annotated text | Label | Score |
277
277
  |---|---|---|
278
- | Emmanuel Macron | `PER` | 1.00 |
279
- | Macron | `PER` | 1.00 |
278
+ | Pierre Curie | `PER` | 1.00 |
279
+ | Curie | `PER` | 1.00 |
280
280
 
281
281
  Parameters: **Label Families** = `{"PER": "person"}`.
282
282
 
@@ -284,12 +284,12 @@ Output annotations:
284
284
 
285
285
  | Annotated text | Label | Score | Properties |
286
286
  |---|---|---|---|
287
- | Emmanuel Macron | `PER` | 1.00 | `canonical_form`: Emmanuel Macron<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
288
- | Macron | `PER` | 1.00 | `canonical_form`: Emmanuel Macron<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
287
+ | Pierre Curie | `PER` | 1.00 | `canonical_form`: Pierre Curie<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
288
+ | Curie | `PER` | 1.00 | `canonical_form`: Pierre Curie<br>`entity_group`: g1<br>`family`: person<br>`mention_type`: name |
289
289
 
290
290
  <!-- /generated:example:person-family -->
291
291
 
292
- - **The partial-name rule only looks at the end of the name.** Two different people sharing a last name are grouped if only one appears in full: in a document that only cites "Brigitte Macron", a "Macron" designating her husband joins her.
292
+ - **The partial-name rule only looks at the end of the name.** Two different people sharing a last name are grouped if only one appears in full: in a document that only cites "Marie Curie", a "Curie" designating her husband joins her.
293
293
  - **A title missing from the list is part of the name.** "Général Martin" is not reduced to "Martin"; it is grouped with "Martin" by the partial-name rule, but the canonical form of the group then becomes "Général Martin".
294
294
  - **A label belongs to one family only.** Declared with `organization`, a `loc_org` never joins a `location` of the same form.
295
295
  - **Mentions of labels excluded by Labels receive nothing**, not even a group of their own.
@@ -1,6 +1,6 @@
1
1
  # Processeur Coréférence (`coreference`)
2
2
 
3
- Regroupe les mentions d'une même entité dans un document : « Emmanuel Macron », « M. Macron » et « MACRON » reçoivent le même identifiant de groupe et la même forme canonique, « Emmanuel Macron ».
3
+ Regroupe les mentions d'une même entité dans un document : « Pierre Curie », « M. Curie » et « CURIE » reçoivent le même identifiant de groupe et la même forme canonique, « Pierre Curie ».
4
4
 
5
5
  ## Quand l'utiliser
6
6
 
@@ -35,7 +35,7 @@ Le processeur ne crée aucune annotation, et ne retire que des annotations d'acr
35
35
  | Propriété | Contenu | Exemple |
36
36
  |---|---|---|
37
37
  | `entity_group` | l'identifiant du groupe, le même pour toutes les mentions d'une entité dans le document, numéroté dans l'ordre d'apparition | `g1` |
38
- | `canonical_form` | la forme la plus longue du groupe, sans civilité : le plus de mots, puis le plus de caractères | `Emmanuel Macron` |
38
+ | `canonical_form` | la forme la plus longue du groupe, sans civilité : le plus de mots, puis le plus de caractères | `Pierre Curie` |
39
39
  | `mention_type` | le type de mention, toujours `name` | `name` |
40
40
  | `family` | la famille du label, par le nom d'un label : celui que l'étape de linking peut mapper pour toute la famille | `location` pour `afplocation` |
41
41
  | `entity_group_candidates` | seulement pour un nom partiel ambigu : les groupes auxquels il pourrait appartenir | `["g1", "g2"]` |
@@ -50,7 +50,7 @@ Les propriétés que l'annotation portait déjà sont conservées. Traiter deux
50
50
  |---|---|---|
51
51
  | **Labels** (`labels`) | — (tous les labels) | Labels des mentions à regrouper. Les annotations des autres labels ne reçoivent aucune propriété. Vide, toutes les annotations sont regroupées. |
52
52
  | **Label Families** (`label_families`) | — | Familles de labels regroupés comme un seul, chaque label associé à sa famille, les labels de même famille regroupés : un autre label (`loc_org` → `organization`), dont le nom est écrit dans la propriété `family` des mentions. Un label non déclaré ici rejoint la famille du label le plus court qui termine son nom (`afplocation` avec `location`). |
53
- | **Person Family** (`person_family`) *(avancé)* | `person` | Famille des noms de personne : ses labels forment un seul groupe (`person` et `afpperson`), et seuls ces noms bénéficient de la règle du nom partiel (« Macron » rejoint « Emmanuel Macron »). Un label d'un autre nom la rejoint par **Label Families** (`PER` → `person`). |
53
+ | **Person Family** (`person_family`) *(avancé)* | `person` | Famille des noms de personne : ses labels forment un seul groupe (`person` et `afpperson`), et seuls ces noms bénéficient de la règle du nom partiel (« Curie » rejoint « Pierre Curie »). Un label d'un autre nom la rejoint par **Label Families** (`PER` → `person`). |
54
54
  | **Honorifics** (`honorifics`) *(avancé)* | `["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles", "Me", "Dr", "Dr.", "Pr", "Pr.", "Mr", "Mr.", "Mrs", …` | Civilités ignorées devant un nom de personne, sans tenir compte des majuscules. Elles ne figurent pas non plus dans la forme canonique. |
55
55
 
56
56
  <!-- /generated:parameters -->
@@ -61,7 +61,7 @@ Deux mentions vont dans le même groupe dans les cas suivants :
61
61
 
62
62
  1. **Même forme et même famille de labels.** La comparaison ignore les majuscules et les variantes d'apostrophe : « Airbus » et « AIRBUS » sont regroupés. Un label dont le nom finit par un autre label regroupé est de sa famille : un « Washington » annoté `location` par un modèle et `afplocation` par un lexique forme un seul groupe, comme `organization` et `afporganization`.
63
63
  2. **Même famille de personnes.** Tous les labels de personnes comptent comme un seul, quel que soit leur nom : un « George Lucas » annoté `person` par un modèle et `afpperson` par un lexique forme un seul groupe.
64
- 3. **Nom partiel, pour les personnes seulement.** Un nom qui termine un nom plus long rejoint ce nom, qu'il apparaisse avant ou après lui dans le document : « Macron » et « M. Macron » rejoignent « Emmanuel Macron ». Les civilités de **Honorifics** sont ignorées pour comparer. Un prénom seul rejoint de même le seul nom complet qu'il commence : « Emmanuel » rejoint « Emmanuel Macron ».
64
+ 3. **Nom partiel, pour les personnes seulement.** Un nom qui termine un nom plus long rejoint ce nom, qu'il apparaisse avant ou après lui dans le document : « Curie » et « M. Curie » rejoignent « Pierre Curie ». Les civilités de **Honorifics** sont ignorées pour comparer. Un prénom seul rejoint de même le seul nom complet qu'il commence : « Pierre » rejoint « Pierre Curie ».
65
65
  4. **Formes d'un même acronyme.** Quand l'annotateur Acronymes est passé avant, la forme courte (« SEP ») et la forme développée (« sclérose en plaques ») d'un acronyme rejoignent l'entité trouvée exactement sur l'une d'elles, partout dans le document :
66
66
  - elles prennent son label, le plus fréquent si les entités de leurs formes en ont plusieurs ;
67
67
  - une forme déjà annotée par une entité n'est pas dupliquée : l'annotation de l'acronyme est retirée ;
@@ -70,7 +70,7 @@ Deux mentions vont dans le même groupe dans les cas suivants :
70
70
  Ne sont **jamais** regroupés :
71
71
 
72
72
  - **un prénom inclus dans une mention plus longue** : un lexique qui reconnaît « Charles » dans « Charles White » laisse « Charles » à part ;
73
- - **un nom partiel ambigu** : avec « Emmanuel Macron » et « Brigitte Macron » dans le même document, « Macron » forme son propre groupe, comme « Pierre » avec « Pierre Curie » et « Pierre Dupont ». Sa propriété `entity_group_candidates` liste les deux groupes possibles, et c'est l'étape de liaison qui tranche ;
73
+ - **un nom partiel ambigu** : avec « Pierre Curie » et « Marie Curie » dans le même document, « Curie » forme son propre groupe, comme « Pierre » avec « Pierre Curie » et « Pierre Dupont ». Sa propriété `entity_group_candidates` liste les deux groupes possibles, et c'est l'étape de liaison qui tranche ;
74
74
  - **des familles de labels différentes**, hors personnes : la personne « George Washington » et le lieu « Washington » restent séparés ;
75
75
  - **un nom partiel d'organisation ou de lieu** : « Airbus » ne rejoint pas « Airbus Defence and Space ».
76
76
 
@@ -80,21 +80,21 @@ Dans chaque exemple, le tableau de sortie montre les propriétés ajoutées à c
80
80
 
81
81
  ### 1. Un nom partiel rejoint le nom complet
82
82
 
83
- « M. Macron » et le prénom seul « Emmanuel » rejoignent « Emmanuel Macron » : même groupe `g1`, même forme canonique :
83
+ « M. Curie » et le prénom seul « Pierre » rejoignent « Pierre Curie » : même groupe `g1`, même forme canonique :
84
84
 
85
85
  <!-- generated:example:partial-name -->
86
86
 
87
87
  Texte (français) :
88
88
 
89
- > Emmanuel Macron parle. M. Macron sourit. Emmanuel repart.
89
+ > Pierre Curie parle. M. Curie sourit. Pierre repart.
90
90
 
91
91
  Annotations en entrée :
92
92
 
93
93
  | Texte annoté | Label | Score |
94
94
  |---|---|---|
95
- | Emmanuel Macron | `person` | 1,00 |
96
- | M. Macron | `person` | 1,00 |
97
- | Emmanuel | `person` | 1,00 |
95
+ | Pierre Curie | `person` | 1,00 |
96
+ | M. Curie | `person` | 1,00 |
97
+ | Pierre | `person` | 1,00 |
98
98
 
99
99
  Paramètres par défaut.
100
100
 
@@ -102,29 +102,29 @@ Annotations en sortie :
102
102
 
103
103
  | Texte annoté | Label | Score | Propriétés |
104
104
  |---|---|---|---|
105
- | Emmanuel Macron | `person` | 1,00 | `canonical_form` : Emmanuel Macron<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
106
- | M. Macron | `person` | 1,00 | `canonical_form` : Emmanuel Macron<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
107
- | Emmanuel | `person` | 1,00 | `canonical_form` : Emmanuel Macron<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
105
+ | Pierre Curie | `person` | 1,00 | `canonical_form` : Pierre Curie<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
106
+ | M. Curie | `person` | 1,00 | `canonical_form` : Pierre Curie<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
107
+ | Pierre | `person` | 1,00 | `canonical_form` : Pierre Curie<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
108
108
 
109
109
  <!-- /generated:example:partial-name -->
110
110
 
111
111
  ### 2. Un nom partiel ambigu
112
112
 
113
- Deux personnes portent le nom « Macron » : la mention « Macron » forme son propre groupe, et `entity_group_candidates` liste les deux groupes possibles :
113
+ Deux personnes portent le nom « Curie » : la mention « Curie » forme son propre groupe, et `entity_group_candidates` liste les deux groupes possibles :
114
114
 
115
115
  <!-- generated:example:ambiguous -->
116
116
 
117
117
  Texte (français) :
118
118
 
119
- > Emmanuel Macron et Brigitte Macron voyagent. Macron sourit.
119
+ > Pierre Curie et Marie Curie voyagent. Curie sourit.
120
120
 
121
121
  Annotations en entrée :
122
122
 
123
123
  | Texte annoté | Label | Score |
124
124
  |---|---|---|
125
- | Emmanuel Macron | `person` | 1,00 |
126
- | Brigitte Macron | `person` | 1,00 |
127
- | Macron | `person` | 1,00 |
125
+ | Pierre Curie | `person` | 1,00 |
126
+ | Marie Curie | `person` | 1,00 |
127
+ | Curie | `person` | 1,00 |
128
128
 
129
129
  Paramètres par défaut.
130
130
 
@@ -132,9 +132,9 @@ Annotations en sortie :
132
132
 
133
133
  | Texte annoté | Label | Score | Propriétés |
134
134
  |---|---|---|---|
135
- | Emmanuel Macron | `person` | 1,00 | `canonical_form` : Emmanuel Macron<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
136
- | Brigitte Macron | `person` | 1,00 | `canonical_form` : Brigitte Macron<br>`entity_group` : g2<br>`family` : person<br>`mention_type` : name |
137
- | Macron | `person` | 1,00 | `canonical_form` : Macron<br>`entity_group` : g3<br>`entity_group_candidates` : ["g1", "g2"]<br>`family` : person<br>`mention_type` : name |
135
+ | Pierre Curie | `person` | 1,00 | `canonical_form` : Pierre Curie<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
136
+ | Marie Curie | `person` | 1,00 | `canonical_form` : Marie Curie<br>`entity_group` : g2<br>`family` : person<br>`mention_type` : name |
137
+ | Curie | `person` | 1,00 | `canonical_form` : Curie<br>`entity_group` : g3<br>`entity_group_candidates` : ["g1", "g2"]<br>`family` : person<br>`mention_type` : name |
138
138
 
139
139
  <!-- /generated:example:ambiguous -->
140
140
 
@@ -208,13 +208,13 @@ Avec **Labels** = `person`, le lieu « Washington » ne reçoit aucune propriét
208
208
 
209
209
  Texte (français) :
210
210
 
211
- > Emmanuel Macron à Washington.
211
+ > Pierre Curie à Washington.
212
212
 
213
213
  Annotations en entrée :
214
214
 
215
215
  | Texte annoté | Label | Score |
216
216
  |---|---|---|
217
- | Emmanuel Macron | `person` | 1,00 |
217
+ | Pierre Curie | `person` | 1,00 |
218
218
  | Washington | `lieu` | 1,00 |
219
219
 
220
220
  Paramètres : **Labels** = `["person"]`.
@@ -223,7 +223,7 @@ Annotations en sortie :
223
223
 
224
224
  | Texte annoté | Label | Score | Propriétés |
225
225
  |---|---|---|---|
226
- | Emmanuel Macron | `person` | 1,00 | `canonical_form` : Emmanuel Macron<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
226
+ | Pierre Curie | `person` | 1,00 | `canonical_form` : Pierre Curie<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
227
227
  | Washington | `lieu` | 1,00 | — |
228
228
 
229
229
  <!-- /generated:example:labels -->
@@ -263,20 +263,20 @@ Annotations en sortie :
263
263
 
264
264
  ## Limites à connaître
265
265
 
266
- - **Un label `PER` n'est pas reconnu comme personne par défaut.** Seuls les labels dont le nom finit par « person » le sont. Avec des annotations `PER`, « Macron » ne rejoint pas « Emmanuel Macron » tant que **Label Families** n'associe pas `PER` à `person`. Déclaré, il les regroupe :
266
+ - **Un label `PER` n'est pas reconnu comme personne par défaut.** Seuls les labels dont le nom finit par « person » le sont. Avec des annotations `PER`, « Curie » ne rejoint pas « Pierre Curie » tant que **Label Families** n'associe pas `PER` à `person`. Déclaré, il les regroupe :
267
267
 
268
268
  <!-- generated:example:person-family -->
269
269
 
270
270
  Texte (français) :
271
271
 
272
- > Emmanuel Macron parle. Macron sourit.
272
+ > Pierre Curie parle. Curie sourit.
273
273
 
274
274
  Annotations en entrée :
275
275
 
276
276
  | Texte annoté | Label | Score |
277
277
  |---|---|---|
278
- | Emmanuel Macron | `PER` | 1,00 |
279
- | Macron | `PER` | 1,00 |
278
+ | Pierre Curie | `PER` | 1,00 |
279
+ | Curie | `PER` | 1,00 |
280
280
 
281
281
  Paramètres : **Label Families** = `{"PER": "person"}`.
282
282
 
@@ -284,12 +284,12 @@ Annotations en sortie :
284
284
 
285
285
  | Texte annoté | Label | Score | Propriétés |
286
286
  |---|---|---|---|
287
- | Emmanuel Macron | `PER` | 1,00 | `canonical_form` : Emmanuel Macron<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
288
- | Macron | `PER` | 1,00 | `canonical_form` : Emmanuel Macron<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
287
+ | Pierre Curie | `PER` | 1,00 | `canonical_form` : Pierre Curie<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
288
+ | Curie | `PER` | 1,00 | `canonical_form` : Pierre Curie<br>`entity_group` : g1<br>`family` : person<br>`mention_type` : name |
289
289
 
290
290
  <!-- /generated:example:person-family -->
291
291
 
292
- - **La règle du nom partiel ne regarde que la fin du nom.** Deux personnes différentes qui partagent un nom de famille sont regroupées si une seule apparaît en entier : dans un document qui ne cite que « Brigitte Macron », un « Macron » qui désigne son mari la rejoint.
292
+ - **La règle du nom partiel ne regarde que la fin du nom.** Deux personnes différentes qui partagent un nom de famille sont regroupées si une seule apparaît en entier : dans un document qui ne cite que « Marie Curie », un « Curie » qui désigne son mari la rejoint.
293
293
  - **Une civilité absente de la liste fait partie du nom.** « Général Martin » ne se réduit pas à « Martin » ; il est regroupé avec « Martin » par la règle du nom partiel, mais la forme canonique du groupe devient alors « Général Martin ».
294
294
  - **Un label n'appartient qu'à une famille.** Déclaré avec `organization`, un `loc_org` ne rejoint plus jamais un `location` de même forme.
295
295
  - **Les mentions des labels exclus par Labels ne reçoivent rien**, pas même un groupe à elles seules.
@@ -1,3 +1,3 @@
1
1
  """Processor grouping the mentions of the same entity"""
2
2
 
3
- __version__ = "1.6.34"
3
+ __version__ = "1.6.36"
@@ -7,8 +7,10 @@ from pydantic import BaseModel, Field
7
7
  from pymultirole_plugins.v1.processor import ProcessorBase, ProcessorParameters
8
8
  from pymultirole_plugins.v1.schema import Annotation, Document
9
9
 
10
+ from .i18n import TranslatedParameters
11
+
10
12
  # Honorifics in front of a person name, stripped before comparing names: in AFP
11
- # dispatches "M. Macron" follows "Emmanuel Macron". Compared case-insensitively.
13
+ # dispatches "M. Curie" follows "Pierre Curie". Compared case-insensitively.
12
14
  DEFAULT_HONORIFICS = ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles", "Me", "Dr", "Dr.", "Pr", "Pr.", "Mr", "Mr.", "Mrs", "Mrs.", "Ms", "Ms.", "Miss", "Sir", "Dame", "Lord", "Lady"]
13
15
 
14
16
  # Properties written on every grouped annotation (ADR-0001, §5).
@@ -33,59 +35,45 @@ PERSON_FAMILY = "\x00person"
33
35
  APOSTROPHES = str.maketrans({"’": "'", "‘": "'", "ʼ": "'"})
34
36
 
35
37
 
36
- class CoreferenceParameters(ProcessorParameters):
38
+ class CoreferenceParameters(TranslatedParameters):
37
39
  """Parameters of the coreference processor"""
38
40
 
39
41
  labels: list[str] | None = Field(
40
42
  None,
41
- description="""Labels of the mentions to group. If empty, the mentions of every label are grouped.<br/>
42
- Mentions are only grouped with mentions of the same family: a label whose name ends with another grouped label
43
- belongs to its family (afplocation with location, afporganization with organization), and all person labels form one family.""",
43
+ description="Labels of the mentions to group. If empty, all labels are grouped.",
44
44
  json_schema_extra={"extra": "label"},
45
45
  )
46
46
  label_families: dict[str, str] | None = Field(
47
47
  None,
48
- description="""Families of labels grouped as one: each label is mapped to its family, and the labels mapped to the same family
49
- are grouped together. The family is another label (loc_org → organization), whose name the linking step may map.<br/>
50
- A label not declared here belongs to the family of the shortest label that ends its name (afplocation with location).""",
48
+ description="""Label → family: labels of the same family are grouped together (loc_org → organization).<br/>
49
+ By default, a label belongs to the family of the shortest label that ends its name (geolocation with location).""",
51
50
  json_schema_extra={"extra": "key:label,val:label"},
52
51
  )
53
52
  person_family: str = Field(
54
53
  "person",
55
- description="""Family of person names: its labels are grouped together (person and afpperson mentions),
56
- and a partial name ("Macron") joins the full name it ends ("Emmanuel Macron").<br/>
57
- A label of another name joins it through Label Families (PER → person).""",
54
+ description="""Family of person names: a partial name ("Curie") joins the full name it ends ("Pierre Curie").""",
58
55
  json_schema_extra={"extra": "label,advanced"},
59
56
  )
60
57
  honorifics: list[str] = Field(
61
58
  DEFAULT_HONORIFICS,
62
- description="Honorifics ignored in front of a person name when comparing names (M., Mme, Dr...)",
59
+ description="Honorifics ignored in front of a person name (M., Mme, Dr...)",
63
60
  json_schema_extra={"extra": "advanced"},
64
61
  )
65
62
 
66
63
 
67
64
  class CoreferenceProcessor(ProcessorBase):
68
- """Group the mentions of the same entity, before entity linking.
69
-
70
- Tier 1 of the mention grouping of ADR-0001 (pyannotators_entityfishing): names
71
- only. Every annotation of a grouped label gets an `entity_group` (the same id for
72
- every mention of the entity in the document) and a `canonical_form` (the longest
73
- form of the group, which the candidate generation looks up):
74
-
75
- - same normalized surface and same label family → same group. A label whose name
76
- ends with another grouped label is of its family (the NER's "location" and the
77
- AFP lexicon's "afplocation" annotate the same span); all person labels count
78
- as one;
79
- - person labels only: a partial name joins the full name it ends, wherever the
80
- full name is in the document ("Macron" joins "Emmanuel Macron");
81
- - a first name alone joins the only full name it starts ("Emmanuel" joins
82
- "Emmanuel Macron"), unless one of its mentions lies inside a longer one;
83
- - an ambiguous partial name ("Macron" with both Emmanuel and Brigitte Macron)
84
- keeps a group of its own, and lists the possible groups in
85
- `entity_group_candidates` for the linking step to decide;
86
- - acronyms (pyannotators_acronyms, linked by their term in the lexicon "acronyms"):
87
- the short and expanded forms of an acronym join the entity found on any of them,
88
- and take its label. A form without entity is dropped.
65
+ """Group the mentions of the same entity in a document, before entity linking.
66
+
67
+ Each grouped mention gets an `entity_group` (one id per entity) and a `canonical_form`
68
+ (the longest form of the group):
69
+
70
+ - same normalized form and same label family → same group;
71
+ - a partial person name joins the full name it ends ("Curie" joins "Pierre Curie"),
72
+ a first name alone joins the only full name it starts ("Pierre" joins "Pierre Curie");
73
+ - an ambiguous partial name keeps its own group and lists the possible ones in
74
+ `entity_group_candidates`;
75
+ - the short and expanded forms of an acronym join the entity found on one of them;
76
+ an acronym without entity is dropped.
89
77
  """
90
78
 
91
79
  def process(self, documents: list[Document], parameters: ProcessorParameters) -> list[Document]:
@@ -119,8 +107,8 @@ def group_document(document: Document, params: CoreferenceParameters, honorifics
119
107
  surface_key[id(a)] = (family, tokens)
120
108
 
121
109
  # 2. Person labels: a surface that is a proper suffix of longer surfaces joins
122
- # them when they are all one entity. Longest first, so that "Emmanuel Macron" has
123
- # already joined "Président Emmanuel Macron" when "Macron" is considered.
110
+ # them when they are all one entity. Longest first, so that "Pierre Curie" has
111
+ # already joined "Physicien Pierre Curie" when "Curie" is considered.
124
112
  parent = {key: key for key in surfaces}
125
113
 
126
114
  def root(key):
@@ -0,0 +1,35 @@
1
+ """Translations of the parameter titles and descriptions, carried by the OpenAPI spec (ADR-0003).
2
+
3
+ Prototype of what belongs in `pymultirole_plugins.v1.processor.ProcessorParameters`:
4
+ English stays in the code, each other language is a `locales/<lang>.json` of the
5
+ plugin package, and every parameter gets an `x-i18n` {lang: {title, description}} in
6
+ its JSON schema.
7
+ """
8
+
9
+ import json
10
+ from functools import cache
11
+ from importlib.resources import files
12
+ from typing import Any
13
+
14
+ from pydantic import ConfigDict
15
+ from pymultirole_plugins.v1.processor import ProcessorParameters
16
+
17
+
18
+ @cache
19
+ def translations(package: str) -> dict[str, dict]:
20
+ """Language → {"name", "description", "parameters": {name: {"title", "description"}}}."""
21
+ locales = files(package) / "locales"
22
+ if not locales.is_dir():
23
+ return {}
24
+ return {f.name.removesuffix(".json"): json.loads(f.read_text(encoding="utf-8")) for f in locales.iterdir() if f.name.endswith(".json")}
25
+
26
+
27
+ def add_translations(schema: dict[str, Any], cls: type) -> None:
28
+ for lang, texts in translations(cls.__module__.split(".")[0]).items():
29
+ for name, text in texts.get("parameters", {}).items():
30
+ if name in schema.get("properties", {}):
31
+ schema["properties"][name].setdefault("x-i18n", {})[lang] = text
32
+
33
+
34
+ class TranslatedParameters(ProcessorParameters):
35
+ model_config = ConfigDict(json_schema_extra=add_translations)
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "Gestion des coréférences",
3
+ "description": "Regroupe les mentions d'une même entité dans un document, avant la liaison à une base de connaissances.\n\nChaque mention regroupée reçoit un `entity_group` (un identifiant par entité) et une `canonical_form` (la forme la plus longue du groupe) :\n\n- même forme normalisée et même famille de labels → même groupe ;\n- un nom de personne partiel rejoint le nom complet qu'il termine (« Curie » rejoint « Pierre Curie »), un prénom seul rejoint le seul nom complet qu'il commence (« Pierre » rejoint « Pierre Curie ») ;\n- un nom partiel ambigu garde son propre groupe et liste les groupes possibles dans `entity_group_candidates` ;\n- les formes courte et développée d'un acronyme rejoignent l'entité trouvée sur l'une d'elles ; un acronyme sans entité est supprimé.",
4
+ "parameters": {
5
+ "labels": {
6
+ "title": "Labels",
7
+ "description": "Labels des mentions à regrouper. Vide, tous les labels sont regroupés."
8
+ },
9
+ "label_families": {
10
+ "title": "Familles de labels",
11
+ "description": "Label → famille : les labels d'une même famille sont regroupés ensemble (loc_org → organization).<br/>Par défaut, un label appartient à la famille du label le plus court qui termine son nom (geolocation avec location)."
12
+ },
13
+ "person_family": {
14
+ "title": "Famille des personnes",
15
+ "description": "Famille des noms de personne : un nom partiel (« Curie ») rejoint le nom complet qu'il termine (« Pierre Curie »)."
16
+ },
17
+ "honorifics": {
18
+ "title": "Civilités",
19
+ "description": "Civilités ignorées devant un nom de personne (M., Mme, Dr...)"
20
+ }
21
+ }
22
+ }