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

Update README.md (#2)

Browse files

- Update README.md (53498872645dd550fddf38253b670f4de78b2c31)


Co-authored-by: Conrad Dobberstein <dobbersc@users.noreply.huggingface.co>

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*".