alanakbik commited on
Commit
90da09c
1 Parent(s): 6cdc8fa

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +14 -14
README.md CHANGED
@@ -9,11 +9,11 @@ datasets:
9
  inference: false
10
  ---
11
 
12
- ## English NER in Flair (default model)
13
 
14
- This is the standard 4-class NER model for English that ships with [Flair](https://github.com/flairNLP/flair/).
15
 
16
- F1-Score: **92,98** (CoNLL-03)
17
 
18
  Predicts 4 tags:
19
 
@@ -37,10 +37,10 @@ from flair.data import Sentence
37
  from flair.models import SequenceTagger
38
 
39
  # load tagger
40
- tagger = SequenceTagger.load("flair/ner-english")
41
 
42
  # make example sentence
43
- sentence = Sentence("George Washington went to Washington")
44
 
45
  # predict NER tags
46
  tagger.predict(sentence)
@@ -58,11 +58,11 @@ for entity in sentence.get_spans('ner'):
58
 
59
  This yields the following output:
60
  ```
61
- Span [1,2]: "George Washington" [− Labels: PER (0.9968)]
62
- Span [5]: "Washington" [− Labels: LOC (0.9994)]
63
  ```
64
 
65
- So, the entities "*George Washington*" (labeled as a **person**) and "*Washington*" (labeled as a **location**) are found in the sentence "*George Washington went to Washington*".
66
 
67
 
68
  ---
@@ -73,11 +73,11 @@ The following Flair script was used to train this model:
73
 
74
  ```python
75
  from flair.data import Corpus
76
- from flair.datasets import CONLL_03
77
  from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
78
 
79
  # 1. get the corpus
80
- corpus: Corpus = CONLL_03()
81
 
82
  # 2. what tag do we want to predict?
83
  tag_type = 'ner'
@@ -89,13 +89,13 @@ tag_dictionary = corpus.make_tag_dictionary(tag_type=tag_type)
89
  embedding_types = [
90
 
91
  # GloVe embeddings
92
- WordEmbeddings('glove'),
93
 
94
  # contextual string embeddings, forward
95
- FlairEmbeddings('news-forward'),
96
 
97
  # contextual string embeddings, backward
98
- FlairEmbeddings('news-backward'),
99
  ]
100
 
101
  # embedding stack consists of Flair and GloVe embeddings
@@ -115,7 +115,7 @@ from flair.trainers import ModelTrainer
115
  trainer = ModelTrainer(tagger, corpus)
116
 
117
  # 7. run training
118
- trainer.train('resources/taggers/ner-english',
119
  train_with_dev=True,
120
  max_epochs=150)
121
  ```
 
9
  inference: false
10
  ---
11
 
12
+ ## French NER in Flair (default model)
13
 
14
+ This is the standard 4-class NER model for French that ships with [Flair](https://github.com/flairNLP/flair/).
15
 
16
+ F1-Score: **90,61** (WikiNER)
17
 
18
  Predicts 4 tags:
19
 
 
37
  from flair.models import SequenceTagger
38
 
39
  # load tagger
40
+ tagger = SequenceTagger.load("flair/ner-french")
41
 
42
  # make example sentence
43
+ sentence = Sentence("George Washington est allé à Washington")
44
 
45
  # predict NER tags
46
  tagger.predict(sentence)
 
58
 
59
  This yields the following output:
60
  ```
61
+ Span [1,2]: "George Washington" [− Labels: PER (0.7394)]
62
+ Span [6]: "Washington" [− Labels: LOC (0.9161)]
63
  ```
64
 
65
+ So, the entities "*George Washington*" (labeled as a **person**) and "*Washington*" (labeled as a **location**) are found in the sentence "*George Washington est allé à Washington*".
66
 
67
 
68
  ---
 
73
 
74
  ```python
75
  from flair.data import Corpus
76
+ from flair.datasets import WIKINER_FRENCH
77
  from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
78
 
79
  # 1. get the corpus
80
+ corpus: Corpus = WIKINER_FRENCH()
81
 
82
  # 2. what tag do we want to predict?
83
  tag_type = 'ner'
 
89
  embedding_types = [
90
 
91
  # GloVe embeddings
92
+ WordEmbeddings('fr'),
93
 
94
  # contextual string embeddings, forward
95
+ FlairEmbeddings('fr-forward'),
96
 
97
  # contextual string embeddings, backward
98
+ FlairEmbeddings('fr-backward'),
99
  ]
100
 
101
  # embedding stack consists of Flair and GloVe embeddings
 
115
  trainer = ModelTrainer(tagger, corpus)
116
 
117
  # 7. run training
118
+ trainer.train('resources/taggers/ner-french',
119
  train_with_dev=True,
120
  max_epochs=150)
121
  ```