I got a simple Language model code in python that needs to load an "intents.json" file.
I'm very new to coding so I appreciate any help. I've tried multiple different strategies to try and load the json file. None with success. This is the current code:
file_path = os.path.join('C:/Users/ed/Desktop/intents.json')
with open(file_path, encoding='cp1252') as f:
intents = json.load(f)
This is the intents.json file. I've ran it through a json validator and it has come back as valid. Here is the code:
{
"intents": [{
"tag": "greeting",
"patterns": ["Hi there", "Hello", "Hey", "Hi"],
"responses": ["Hello, how can I help you?", "Hi there! How can I assist you today?", "Hi! How may I assist you?", "Hello! How can I help you today?"]
},
{
"tag": "goodbye",
"patterns": ["Bye", "See you later", "Goodbye", "Have a nice day"],
"responses": ["Goodbye! Have a nice day", "See you later!", "Hope to see you soon!", "Take care!"]
},
{
"tag": "thanks",
"patterns": ["Thanks", "Thank you", "That's helpful", "Thank's a lot"],
"responses": ["You're welcome!", "Anytime!", "Glad I could help!", "No problem!"]
}
]
}
I have a multitude of errors coming back but the most prominent ones are these:
- raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- File "x:\LM\LMF\ANN2\main.py", line 14, in <module>
intents = json.load(f)
Again, thanks again for any help.