File size: 7,985 Bytes
9504e2c
 
fd86a34
 
f4d8362
fd86a34
 
 
 
29c5264
25988b2
 
 
 
 
 
 
 
 
 
 
9504e2c
fd86a34
 
25988b2
fd86a34
 
 
 
bd3007d
fd86a34
f6d9635
 
fd86a34
 
 
c2ca081
 
bd3007d
3d16638
 
c2ca081
1108839
3d16638
 
 
c2ca081
 
fd86a34
 
 
bd3007d
 
 
 
 
 
 
 
 
 
 
 
 
 
fd86a34
 
 
 
 
f6d9635
 
bd3007d
 
 
 
 
 
 
 
 
 
 
 
25988b2
bd3007d
 
 
 
 
 
 
 
0f647e0
bd3007d
 
 
 
0f647e0
 
 
bd3007d
 
0f647e0
bd3007d
 
 
 
0f647e0
bd3007d
 
 
 
0f647e0
bd3007d
 
 
 
0f647e0
bd3007d
 
 
 
0f647e0
bd3007d
 
 
 
0f647e0
bd3007d
 
 
 
0f647e0
bd3007d
 
 
 
0f647e0
bd3007d
 
 
 
0f647e0
bd3007d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25988b2
bd3007d
 
 
 
25988b2
bd3007d
 
 
25988b2
bd3007d
9dfcff2
 
 
 
 
 
 
 
 
 
 
25988b2
bd3007d
 
 
 
 
f6d9635
 
 
 
25988b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
---
license: cc-by-nc-4.0
language:
- fr
pipeline_tag: token-classification
widget:
- text: >-
    * ALBI, (Géog.) ville de France, capitale de l'Albigeois, dans le haut
    Languedoc : elle est sur le Tarn. Long. 19. 49. lat. 43. 55. 44.
- text: >-
    HILPERHAUSEN, (Géog.) ville d'Allemagne en Franconie, sur la Werra, au comté
    de Henneberg, entre Cobourg & Smalcalde ; elle appartient à une branche de
    la maison de Saxe-Gotha. Long. 28. 15. lat. 50. 35. (D. J.)
datasets:
- GEODE/GeoEDdA
metrics:
- f1
- precision
- recall
base_model:
- almanach/camembert-base
---


# camembert-base-edda-span-classification


<!-- Provide a quick summary of what the model is/does. -->

This model is designed to identify and classify named entities (such as Spatial, Person, and MISC), nominal entities, spatial relations, and other relevant information such as geographic coordinates within French encyclopedic entries.
It has been trained on the French *Encyclopédie ou dictionnaire raisonné des sciences des arts et des métiers par une société de gens de lettres (1751-1772)* edited by Diderot and d'Alembert (provided by the [ARTFL Encyclopédie Project](https://artfl-project.uchicago.edu)).
Dataset: [https://huggingface.co/datasets/GEODE/GeoEDdA](https://huggingface.co/datasets/GEODE/GeoEDdA)


## Class labels

<!-- Provide a list of tag detected by the model. -->

The tagset is as follows:
- **NC_Spatial**: a common noun that identifies a spatial entity (nominal spatial entity) including natural features, e.g. `ville`, `la rivière`, `royaume`.
- **NP_Spatial**: a proper noun identifying the name of a place (spatial named entities), e.g. `France`, `Paris`, `la Chine`.
- **Relation**: spatial relation, e.g. `dans`, `sur`, `à 10 lieues de`.
- **Latlong**: geographic coordinates, e.g. Long. 19. 49. lat. 43. 55. 44.
- **NC_Person**: a common noun that identifies a person (nominal spatial entity), e.g. `roi`, `l'empereur`, `les auteurs`.
- **NP_Person**: a proper noun identifying the name of a person (person named entities), e.g. `Louis XIV`, `Pline`, `les Romains`.
- **NP_Misc**: a proper noun identifying entities not classified as spatial or person, e.g. `l'Eglise`, `1702`, `Pélasgique`.
- **Head**: entry name
- **Domain-Mark**: words indicating the knowledge domain (usually after the head and between parenthesis), e.g. `Géographie`, `Geog.`, `en Anatomie`.



## Model Description

<!-- Provide a longer summary of what this model is. -->

- **Developed by:** [Ludovic Moncla](https://ludovicmoncla.github.io) and Hédi Zeghidi in the framework of the [GEODE](https://geode-project.github.io) project.
- **Model type:** CamemBERT token-classification
- **Repository:** [https://github.com/GEODE-project/ner-bert](https://github.com/GEODE-project/ner-bert)
- **Language(s) (NLP):** French
- **License:** cc-by-nc-4.0
- **Dataset:** https://zenodo.org/records/10530177




## Bias, Risks, and Limitations

<!-- This section is meant to convey both technical and sociotechnical limitations. -->

This model was trained entirely on French encyclopedic entries and will likely not perform well on text in other languages or other corpora. 



## How to Get Started with the Model

Use the code below to get started with the model.


```python
from transformers import pipeline
import torch
from datasets import load_dataset


pipe = pipeline("token-classification", model="GEODE/camembert-base-edda-span-classification", aggregation_strategy="simple", device=device)

content = "* ALBI, (Géog.) ville de France, capitale de l'Albigeois, dans le haut Languedoc : elle est sur le Tarn. Long. 19. 49. lat. 43. 55. 44."

print(pipe(content))


# Output
[{'entity_group': 'Head',
  'score': 0.9918331,
  'word': 'ALBI',
  'start': 2,
  'end': 6},
 {'entity_group': 'Domain_mark',
  'score': 0.9260238,
  'word': '(Géog.',
  'start': 8,
  'end': 14},
 {'entity_group': 'NC_Spatial',
  'score': 0.99029493,
  'word': 'ville',
  'start': 16,
  'end': 21},
 {'entity_group': 'NP_Spatial',
  'score': 0.9919335,
  'word': 'France',
  'start': 25,
  'end': 31},
 {'entity_group': 'NC_Spatial',
  'score': 0.9903319,
  'word': 'capitale',
  'start': 33,
  'end': 41},
 {'entity_group': 'NP_Spatial',
  'score': 0.9919644,
  'word': "l'Albigeois",
  'start': 45,
  'end': 56},
 {'entity_group': 'Relation',
  'score': 0.98715705,
  'word': 'dans',
  'start': 58,
  'end': 62},
 {'entity_group': 'NP_Spatial',
  'score': 0.9919502,
  'word': 'le haut Languedoc',
  'start': 63,
  'end': 80},
 {'entity_group': 'Relation',
  'score': 0.98698694,
  'word': 'sur',
  'start': 92,
  'end': 95},
 {'entity_group': 'NP_Spatial',
  'score': 0.9921453,
  'word': 'le Tarn',
  'start': 96,
  'end': 103},
 {'entity_group': 'Latlong',
  'score': 0.99200517,
  'word': 'Long. 19. 49. lat. 43. 55. 44',
  'start': 105,
  'end': 134}]
```


## Training Details

### Training Data

<!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->

The model was trained using a set of 2200 paragraphs randomly selected out of 2001 Encyclopédie's entries. 
All paragraphs were written in French and are distributed as follows among the Encyclopédie knowledge domains:

| Knowledge domain | Paragraphs | 
|---|:---:|
| Géographie | 1096 | 
| Histoire | 259 | 
| Droit Jurisprudence | 113 | 
| Physique | 92 | 
| Métiers | 92 | 
| Médecine | 88 | 
| Philosophie | 69 | 
| Histoire naturelle | 65 | 
| Belles-lettres | 65 | 
| Militaire | 62 | 
| Commerce | 48 | 
| Beaux-arts | 44 | 
| Agriculture | 36 | 
| Chasse | 31 | 
| Religion | 23 | 
| Musique | 17 | 


The spans/entities were labeled by the project team along with using pre-labelling with early models to speed up the labelling process. 
A train/val/test split was used.
Validation and test sets are composed of 200 paragraphs each: 100 classified as 'Géographie' and 100 from another knowledge domain.
The datasets have the following breakdown of tokens and spans/entities. 

|   | Train | Validation | Test|
|---|:---:|:---:|:---:|
|Paragraphs| 1,800 | 200 | 200|
| Tokens | 132,398 | 14,959 | 13,881 |
| NC-Spatial | 3,252 | 358 | 355 |
| NP-Spatial | 4,707 | 464 | 519 |
| Relation | 2,093 | 219 | 226 |
| Latlong | 553 | 66 | 72 |
| NC-Person | 1,378 | 132 | 133 |
| NP-Person | 1,599 | 170 | 150 |
| NP-Misc | 948 | 108 | 96 |
| Head | 1,261 | 142 | 153 |
| Domain-Mark | 1,069 | 122 | 133 |


### Training Procedure 

<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->

For full training details and results please see the GitHub repository: [https://github.com/GEODE-project/ner-bert](https://github.com/GEODE-project/ner-bert)


### Evaluation


* Overall micro-average model performances (token-based)


|   | Precision | Recall | F-score |
|---|:---:|:---:|:---:|
|    | 91.5   | 94.8   | 93.1 | 



* Token-based model performances (Test set)

|   | Precision | Recall | F-score | Support |
|---|:---:|:---:|:---:|:---:|
| NC-Spatial    |  96.7  |  95.1  |  95.9 | 592 |
| NP-Spatial    |  95.9  |  95.5  |  95.7 | 717 |
| Relation      |  89.8  |  95.6  |  92.6 | 452 |
| Latlong       |  97.0  |  98.5  |  97.7 | 789 |
| NC-Person     |  70.4  |  78.4  |  74.2 | 222 |
| NP-Person     |  88.6  |  90.4  |  89.5 | 198 |
| NP-Misc       |  69.0  |  82.9  |  75.3 | 175 |
| Head          |  97.3  |  98.0  |  97.6 | 254 |
| Domain-mark   |  99.0  |  100.0  |  99.5 | 392 |






## Acknowledgement


The authors are grateful to the [ASLAN project](https://aslan.universite-lyon.fr) (ANR-10-LABX-0081) of the Université de Lyon, for its financial support within the French program "Investments for the Future" operated by the National Research Agency (ANR).
Data courtesy the [ARTFL Encyclopédie Project](https://artfl-project.uchicago.edu), University of Chicago.