Can I update token's POS tag? #5743
-
For some critical POS errors, I want to be able to correct by myself through a dictionary or rules. For dictionary, it could be as simple as:
Then I can do:
How hard to support such a feature? For serious uses of POS info, this would be very useful! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Beta Was this translation helpful? Give feedback.
-
That's good enough. I vaguely remember spacy token attributes are immutable. Not really, which is good. |
Beta Was this translation helpful? Give feedback.
-
Not immutable, just restricted to the UPOS tag set (plus a few custom whitespace-related tags). See the internal list here: https://github.com/explosion/spaCy/blob/27a1cd3c630055802513a20c1e75d0b37943cc39/spacy/parts_of_speech.pxd |
Beta Was this translation helpful? Give feedback.
token.pos_
is restricted to UPOS tags, so you could doNOUN
but notNN
. If you want to use any arbitrary tag likeNN
, use the attributetoken.tag_
instead.