创建了.json但它变成空的

时间:2018-07-04 04:39:36

标签: python python-3.x

我正在跟踪在链接上找到的教程。

https://snips-nlu.readthedocs.io/en/latest/tutorial.html#snips-dataset-format

我正在尝试使用lib中包含的数据集创建CLI。我在终端中运行以下命令,并创建了.json,但为空。

是的,我在正确的目录中。有什么想法吗?

snips-nlu generate-dataset en intent_turnLightOn.txt intent_turnLightOff.txt intent_setTemperature.txt entity_room.txt > dataset.json


Traceback (most recent call last):
  File "/Users/jbennett8/anaconda3/bin/snips-nlu", line 11, in <module>
    sys.exit(main())
  File "/Users/jbennett8/anaconda3/lib/python3.6/site-packages/snips_nlu/__main__.py", line 29, in main
    plac.call(commands[command], sys.argv[1:])
  File "/Users/jbennett8/anaconda3/lib/python3.6/site-packages/plac_core.py", line 328, in call
    cmd, result = parser.consume(arglist)
  File "/Users/jbennett8/anaconda3/lib/python3.6/site-packages/plac_core.py", line 207, in consume
    return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "/Users/jbennett8/anaconda3/lib/python3.6/site-packages/snips_nlu/cli/generate_dataset.py", line 16, in generate_dataset
    dataset = AssistantDataset.from_files(language, list(files))
  File "/Users/jbennett8/anaconda3/lib/python3.6/site-packages/snips_nlu/cli/dataset/assistant_dataset.py", line 57, in from_files
    for f in intent_filepaths]
  File "/Users/jbennett8/anaconda3/lib/python3.6/site-packages/snips_nlu/cli/dataset/assistant_dataset.py", line 57, in <listcomp>
    for f in intent_filepaths]
  File "/Users/jbennett8/anaconda3/lib/python3.6/site-packages/snips_nlu/cli/dataset/intent_dataset.py", line 47, in from_file
    with filepath.open(encoding="utf-8") as f:
  File "/Users/jbennett8/anaconda3/lib/python3.6/pathlib.py", line 1161, in open
    opener=self._opener)
  File "/Users/jbennett8/anaconda3/lib/python3.6/pathlib.py", line 1015, in _opener
    return self._accessor.open(self, flags, mode)
  File "/Users/jbennett8/anaconda3/lib/python3.6/pathlib.py", line 387, in wrapped
    return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: 'intent_turnLightOff.txt'
MTVL163

1 个答案:

答案 0 :(得分:0)

将所有txt文件添加到正确的位置,即基本路径