aboSamoor / polyglot

Multilingual text (NLP) processing toolkit
http://polyglot-nlp.com
Other
2.3k stars 337 forks source link

TypeError: __import__() argument 1 must be string without null bytes, not str #151

Open gios91 opened 6 years ago

gios91 commented 6 years ago

I got an error from the following code snippet:

from polyglot.text import Text

blob = """Some text"."""
text = Text(blob)
text.entities

The following is the detailed stack-trace:

File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/decorators.py", line 20, in get value = obj.dict[self.func.name] = self.func(obj) File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/text.py", line 132, in entities for i, (w, tag) in enumerate(self.ne_chunker.annotate(self.words)): File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/decorators.py", line 20, in get value = obj.dict[self.func.name] = self.func(obj) File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/text.py", line 100, in ne_chunker return get_ner_tagger(lang=self.language.code) File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/decorators.py", line 30, in memoizer cache[key] = obj(*args, *kwargs) File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/tag/base.py", line 191, in get_ner_tagger return NEChunker(lang=lang) File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/tag/base.py", line 104, in init super(NEChunker, self).init(lang=lang) File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/tag/base.py", line 40, in init self.predictor = self._load_network() File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/tag/base.py", line 110, in _load_network self.model = load_ner_model(lang=self.lang, version=2) File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/decorators.py", line 30, in memoizer cache[key] = obj(args, **kwargs) File "/opt/continuum/anaconda/envs/sda_commdata/lib/python2.7/site-packages/polyglot/load.py", line 100, in load_ner_model return pickle.load(fh) TypeError: import() argument 1 must be string without null bytes, not str

I'm using polyglot 16.7.4 on a script running from Oozie (HUE 4.0).