Skip to content

Error from adding arbitrary fixup rules to pipeline #600

@cchu613

Description

@cchu613

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs and behaviour differing from documentationdocsDocumentation and website

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions