snipsco / snips-nlu

Snips Python library to extract meaning from text
https://snips-nlu.readthedocs.io
Apache License 2.0
3.89k stars 514 forks source link

Not able to run ssnips-nlu generate-dataset #725

Closed yingyihuang closed 5 years ago

yingyihuang commented 5 years ago

Two issues when I install it on MAC 10.12.6 (Sierra)

$ snips-nlu generate-dataset en searchFlight.yaml Traceback (most recent call last): File "/Users/yhuang/anaconda2/bin/snips-nlu", line 11, in sys.exit(main()) File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/snips_nlu/main.py", line 39, in main plac.call(commands[command], sys.argv[1:]) File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/plac_core.py", line 328, in call cmd, result = parser.consume(arglist) File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/plac_core.py", line 207, in consume return cmd, self.func(*(args + varargs + extraopts), **kwargs) File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/snips_nlu/cli/generate_dataset.py", line 17, in generate_dataset dataset = Dataset.from_yaml_files(language, list(files)) File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/snips_nlu/dataset/dataset.py", line 105, in from_yaml_files return cls(language, intents, entities) File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/snips_nlu/dataset/dataset.py", line 39, in init self._ensure_entity_values() File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/snips_nlu/dataset/dataset.py", line 155, in _ensure_entity_values for entity in self.entities} File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/snips_nlu/dataset/dataset.py", line 155, in for entity in self.entities} File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/snips_nlu/dataset/dataset.py", line 172, in _get_entity_values entity.name, self.language)) File "/Users/yhuang/anaconda2/lib/python2.7/site-packages/snips_nlu_ontology/builtin_entities.py", line 183, in get_builtin_entity_examples % type(language)) TypeError: Expected language to be of type 'str' but found: <type 'str'>

yingyihuang commented 5 years ago

Update: I have to comment out the 3 lines to get it working.

adrienball commented 5 years ago

Hi @yingyihuang , Thanks for reporting, this is indeed a bug which is Python2 specific. We are enforcing unicode strings all over the python lib, however when using the CLI with Python2, we end up with bytes that we must convert to unicodes.

I have fixed this issue in #727

rskumar commented 5 years ago

Still getting same issue on Windows 7, Python 2.7 with latest snips-nlu package (0.18.0)