pythonnlpnlgallennlpsimplenlg

TypeError: 'NLP' object is not callable


Here's the Site

From here i just try to ran the sample code provided on site, but am getting this error

enter image description here


TypeError Traceback (most recent call last) in ----> 1 text = nlp("The virginica species has the least average sepal_width.")

TypeError: 'NLP' object is not callable

I have installed all packages, but still what might have cause this issue?


Solution

  • Try that:

    >>> from nlg.utils import load_spacy_model
    >>> nlp = load_spacy_model()
    >>> text = nlp("The virginica species has the least average sepal_width.")
    

    I think the example author forgot to instantiate the nlp object, very common in spacy library. Consider reporting a issue in the nlg project.