Impossibility of retrieving the pos of the tokens
#1
by
8raouf24
- opened
Hey @8raouf24 ,
Thanks for reporting this! The example in the model description is not up-to-date. We model POS tagging as a token classification problem, i.e. the model predicts a label for each token. In addition, the provided label type pos
is also incorrect and has to be changed to upos
. You can access the predictions as such:
# iterate over tokens and print the predicted POS label
print("The following POS tags are found:")
for token in sentence:
print(token.get_label("upos"))
# alternative: get all POS labels as list
print(sentence.get_labels("upos"))
The first variant would closely reproduce the output in the original example:
The following POS tags are found:
Token[0]: "Ich" β PRON (0.9999)
Token[1]: "liebe" β VERB (0.9999)
Token[2]: "Berlin" β PROPN (0.9997)
Token[3]: "," β PUNCT (1.0)
Token[4]: "as" β SCONJ (0.9991)
Token[5]: "they" β PRON (0.9998)
Token[6]: "say" β VERB (0.9998)
Token[7]: "." β PUNCT (1.0)
dobbersc
changed discussion status to
closed