Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example from README is not working #31

Closed
anapaulagomes opened this issue Feb 23, 2021 · 3 comments
Closed

Example from README is not working #31

anapaulagomes opened this issue Feb 23, 2021 · 3 comments

Comments

@anapaulagomes
Copy link

First of all, thanks for this awesome library.

Describe the bug
When running the example from the README with the version 1.0.0 I get the following error:

TypeError: __init__() missing 4 required positional arguments: 'name', 'neg_termset', 'extension_name', and 'chunk_prefix'

To Reproduce

Steps to reproduce the behavior:

  • Go to a Python terminal and run the following example:
import spacy
from negspacy.negation import Negex


nlp = spacy.load("en_core_web_sm")
negex = Negex(nlp, ent_types=["PERSON","ORG"])

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() missing 4 required positional arguments: 'name', 'neg_termset', 'extension_name', and 'chunk_prefix'

Expected behavior

Expecting it to work as in the README example with the latest version.

Desktop (please complete the following information):

  • OS: Linux PopOS
  • Spacy: 3.0.1
@jenojp
Copy link
Owner

jenojp commented Feb 23, 2021

whoops! That line was supposed to be removed from the README. Can you take a look and try again? Thank you for raising the issue!

nlp = spacy.load("en_core_web_sm")
nlp.add_pipe("negex", config={"ent_types":["PERSON","ORG"]})```

@anapaulagomes
Copy link
Author

Is it working on your side? Here is still failing for this example:

ValueError: [E002] Can't find factory for 'negex' for language English (en). This usually happens when spaCy calls `nlp.create_pipe` with a custom component name that's not registered on the current language class. If you're using a Transformer, make sure to install 'spacy-transformers'. If you're using a custom component, make sure you've added the decorator `@Language.component` (for function components) or `@Language.factory` (for class components).

And for the next one too:

from negspacy.negation import Negex
from negspacy.termsets import termset

ts = termset("en")

nlp = spacy.load("en_core_web_sm")
nlp.add_pipe(
    "negex",
    config={
        "neg_tersmset":ts.get_patterns()
    }
)

Error:

thinc.config.ConfigValidationError: 

Config validation error

negex -> neg_tersmset   extra fields not permitted

@jenojp
Copy link
Owner

jenojp commented Feb 25, 2021

Sorry another typo in the README. Change "neg_tersmet" to "neg_termset". Thank you for pointing these out!

    "negex",
    config={
        "neg_termset":ts.get_patterns()
    }
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants