dobbersc commited on
Commit
5349887
β€’
1 Parent(s): 236615d

Update README.md

Browse files

As reported in #1 the current example in the model description does not yield the expected output. This PR fixes #1, as outlined in this [comment](https://huggingface.co/flair/upos-multi/discussions/1#63ff30be6bb959b94e6d8b76).

Files changed (1) hide show
  1. README.md +13 -14
README.md CHANGED
@@ -70,29 +70,28 @@ tagger = SequenceTagger.load("flair/upos-multi")
70
  # make example sentence
71
  sentence = Sentence("Ich liebe Berlin, as they say. ")
72
 
73
- # predict NER tags
74
  tagger.predict(sentence)
75
 
76
  # print sentence
77
  print(sentence)
78
 
79
- # print predicted NER spans
80
- print('The following NER tags are found:')
81
- # iterate over entities and print
82
- for entity in sentence.get_spans('pos'):
83
- print(entity)
84
  ```
85
 
86
  This yields the following output:
87
  ```
88
- Span [1]: "Ich" [βˆ’ Labels: PRON (0.9999)]
89
- Span [2]: "liebe" [βˆ’ Labels: VERB (0.9999)]
90
- Span [3]: "Berlin" [βˆ’ Labels: PROPN (0.9997)]
91
- Span [4]: "," [βˆ’ Labels: PUNCT (1.0)]
92
- Span [5]: "as" [βˆ’ Labels: SCONJ (0.9991)]
93
- Span [6]: "they" [βˆ’ Labels: PRON (0.9998)]
94
- Span [7]: "say" [βˆ’ Labels: VERB (0.9998)]
95
- Span [8]: "." [βˆ’ Labels: PUNCT (1.0)]
96
  ```
97
 
98
  So, the words "*Ich*" and "*they*" are labeled as **pronouns** (PRON), while "*liebe*" and "*say*" are labeled as **verbs** (VERB) in the multilingual sentence "*Ich liebe Berlin, as they say*".
 
70
  # make example sentence
71
  sentence = Sentence("Ich liebe Berlin, as they say. ")
72
 
73
+ # predict POS tags
74
  tagger.predict(sentence)
75
 
76
  # print sentence
77
  print(sentence)
78
 
79
+ # iterate over tokens and print the predicted POS label
80
+ print("The following POS tags are found:")
81
+ for token in sentence:
82
+ print(token.get_label("upos"))
 
83
  ```
84
 
85
  This yields the following output:
86
  ```
87
+ Token[0]: "Ich" β†’ PRON (0.9999)
88
+ Token[1]: "liebe" β†’ VERB (0.9999)
89
+ Token[2]: "Berlin" β†’ PROPN (0.9997)
90
+ Token[3]: "," β†’ PUNCT (1.0)
91
+ Token[4]: "as" β†’ SCONJ (0.9991)
92
+ Token[5]: "they" β†’ PRON (0.9998)
93
+ Token[6]: "say" β†’ VERB (0.9998)
94
+ Token[7]: "." β†’ PUNCT (1.0)
95
  ```
96
 
97
  So, the words "*Ich*" and "*they*" are labeled as **pronouns** (PRON), while "*liebe*" and "*say*" are labeled as **verbs** (VERB) in the multilingual sentence "*Ich liebe Berlin, as they say*".