chartbeat-labs / textacy

NLP, before and after spaCy
https://textacy.readthedocs.io
Other
2.21k stars 249 forks source link

In named_entities i am specifying include_types="DATE",am getting error like (invalid `include_types` type: \"<class 'str'>\") how to reslove this issue #202

Closed SreejaRoyal closed 6 years ago

SreejaRoyal commented 6 years ago

Hi, this is my code..... in response I want only one entity type, for example ( Two weeks ago-> DATE, One month->DATE)

text='''Two weeks ago, I was in Kuwait participating in an I.M.F. seminar for Arab educators.For 30 minutes, we discussed the impact of technology trends on education in the Middle East.And then an Egyptian education official raised his hand and asked if he could ask me a personal question:"I heard Donald Trump say we need to close mosques in the United States," he said with great sorrow.Is that what we want our kids''' doc=textacy.Doc(text) ner=textacy.extract.named_entities(doc, include_types="DATE", exclude_types=None, drop_determiners=True, minfreq=1) for ne in ner: print(ne, ne.label) Iam getting error like, ->TypeError: invalid include_types type: "<class 'str'>"

How to resolve this issue.

bdewilde commented 6 years ago

Oh, wow. This is a bug, and I can't believe I missed it. For now, just putting "DATE" inside a list or tuple should make this code run. I'll push a fix to master when I have a chance.