Hello! I'm a newbie to natural language processing and am trying to use spaCy for an information extraction project. So far everything has been great, except that in sentences like "One killed in Bucks County shooting", shooting gets tagged as a verb instead of a noun.
Here is my code (only slightly modified from the tutorial titled Customizing the Pipeline):
def arbitrary_fixup_rules(doc):
for token in doc:
if token.lower == u'shooting'
token.tag_ = u'NN'
def custom_pipeline(nlp):
return (nlp.tagger, arbitrary_fixup_rules, nlp.parser, nlp.entity)
nlp = spacy.load('en', create_pipeline=custom_pipeline)
However, running
doc = nlp(u'One dead in Bucks County shooting.')
resulted in
AttributeError: attribute 'tag_' of 'spacy.tokens.token.Token' objects is not writable
python 2.7, spacy version 1.1.2
Hello! I'm a newbie to natural language processing and am trying to use spaCy for an information extraction project. So far everything has been great, except that in sentences like "One killed in Bucks County shooting", shooting gets tagged as a verb instead of a noun.
Here is my code (only slightly modified from the tutorial titled Customizing the Pipeline):
However, running
resulted in
AttributeError: attribute 'tag_' of 'spacy.tokens.token.Token' objects is not writablepython 2.7, spacy version 1.1.2