Reputation: 51
I am trying to read from my intents.json file as below but I am getting a json decodeError as above (in the title) for the following code, can anyone please help me out: My main.py file:
import nltk
from nltk.stem.lancaster import LancasterStemmer
import random
import json
import tensorflow
import tflearn
import numpy
stemmer = LancasterStemmer()
with open("intents.json") as f:
data = json.load(f)
print(data["intents"])
My intents.json file:
{"intents": [
{"tag": "greeting",
"patterns": ["Hi", "How are you", "Is anyone there?", "Hello", "Good day", "Whats up"],
"responses": ["Hello!", "Good to see you again!", "Hi there, how can I help?"],
"context_set": ""
},
{"tag": "goodbye",
"patterns": ["cya", "See you later", "Goodbye", "I am Leaving", "Have a Good day"],
"responses": ["Sad to see you go :(", "Talk to you later", "Goodbye!"],
"context_set": ""
},
{"tag": "age",
"patterns": ["how old", "how old is tim", "what is your age", "how old are you", "age?"],
"responses": ["I am 18 years old!", "18 years young!"],
"context_set": ""
},
{"tag": "name",
"patterns": ["what is your name", "what should I call you", "whats your name?"],
"responses": ["You can call me Tim.", "I'm Tim!", "I'm Tim aka Tech With Tim."],
"context_set": ""
},
{"tag": "shop",
"patterns": ["Id like to buy something", "whats on the menu", "what do you reccommend?", "could i get something to eat"],
"responses": ["We sell chocolate chip cookies for $2!", "Cookies are on the menu!"],
"context_set": ""
},
{"tag": "hours",
"patterns": ["when are you guys open", "what are your hours", "hours of operation"],
"responses": ["We are open 7am-4pm Monday-Friday!"],
"context_set": ""
}
]
}
Upvotes: -1
Views: 855
Reputation: 131
hey are you sure that your code aren`t working? i copied your code and its work perfectly check this screenshot ->
Upvotes: 1