pyner
pyner copied to clipboard
cannot use a string pattern on a bytes-like object
I tried to run this query: tagger.get_entities('University of California is located in California, United States')
and got this error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-76-0a5190e4b836> in <module>()
----> 1 tagger.get_entities('University of California is located in California, United States')
~\AppData\Local\Continuum\anaconda3\lib\site-packages\ner-0.1-py3.6.egg\ner\client.py in get_entities(self, text)
89 groupby(entities, key=itemgetter(0)))
90 else: #inlineXML
---> 91 entities = self.__inlineXML_parse_entities(tagged_text)
92 return self.__collapse_to_dict(entities)
93
~\AppData\Local\Continuum\anaconda3\lib\site-packages\ner-0.1-py3.6.egg\ner\client.py in __inlineXML_parse_entities(self, tagged_text)
62 """
63 return (match.groups() for match in
---> 64 INLINEXML_EPATTERN.finditer(tagged_text))
65
66 def __collapse_to_dict(self, pairs):
What causes this? I did not change anything of the code.
Having the same issue -- is it a python2 v 3 issue?
Same issue for me. I also tried to give a string as a byte but still does not work. Please let me know if you fixed it.
Same issue for me. I also tried to give a string as a byte but still does not work. Please let me know if you fixed it.
I made the modification in client.py, line 82 and it worked.
former:
tagged_text = self.tag_text(text)
latter:
tagged_text = str(self.tag_text(text), encoding = "utf-8")
I think your attempt didn't work just because you did not reload the lib or you can try to uninstall it and then install the newer one.
Here is my modified forked version