Update README.md
#2
by
dobbersc
- opened
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
|
74 |
tagger.predict(sentence)
|
75 |
|
76 |
# print sentence
|
77 |
print(sentence)
|
78 |
|
79 |
-
# print predicted
|
80 |
-
print(
|
81 |
-
|
82 |
-
|
83 |
-
print(entity)
|
84 |
```
|
85 |
|
86 |
This yields the following output:
|
87 |
```
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
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*".
|