snipsco/snips-nlu

[Windows] Error when loading JSON dataset from the tutorial

ncsrikar opened this issue · 6 comments

datasetyaml.txt
datasetjson.txt
Error:
The yaml files and Json files uploaded as txt. I created the json just as told in tutorial. From the yaml in the example itself.
Traceback (most recent call last):
File "snips.py", line 12, in
json.load(f)
File "C:\Users\Srikar\AppData\Local\Programs\Python\Python37\lib\site-packages\simplejson_init_.py", line 471, in load
use_decimal=use_decimal, **kw)
File "C:\Users\Srikar\AppData\Local\Programs\Python\Python37\lib\site-packages\simplejson_init_.py", line 525, in loads
return _default_decoder.decode(s)
File "C:\Users\Srikar\AppData\Local\Programs\Python\Python37\lib\site-packages\simplejson\decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "C:\Users\Srikar\AppData\Local\Programs\Python\Python37\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Could you please provide the code you are using to load the JSON?
We can't help you without that.

Sorry, I forgot to add the code. Here it is.

`from snips_nlu import SnipsNLUEngine
import io
import simplejson as json

from snips_nlu import SnipsNLUEngine
from snips_nlu.default_configs import CONFIG_EN
engine = SnipsNLUEngine(config=CONFIG_EN)

default_engine = SnipsNLUEngine()
with io.open("dataset.json") as f:
dataset = json.load(f)

engine.fit(dataset)`

I can't reproduce but anyway it's not related to Snips NLU, if the json library can't load your json file it means that it's not a valid json.
I suggest you double check the file you are trying to load and make sure it's valid.
Best

The json was created by the command given in the Snips NLU tutorial. Anyway thanks for your help.

Hi, I have exactly the same issue. I followed the documentation on how Training Dataset Format. I copy paste the flight example but when I try to load the generated JSON, I get the error:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@ncsrikar did you find a solution for that ?

[EDIT]
I found the issue, it appears that on my Windows, the json generated by the command snips-nlu was somehow corrupted. By copy pasting the content of the file in a newly created json document, it solves the problem.

This issue seems to be windows specific. This stackoverflow issue may help: https://stackoverflow.com/questions/16573332/jsondecodeerror-expecting-value-line-1-column-1-char-0