Python Forum

Full Version: Chatbot AI
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello. I am following a tutorial to create an AI chatbot yet I keep getting this error. Any help would be greatly appreciated.

json.decoder.JSONDecodeError: Expecting ',' delimiter: line 15 column 1 (char 303)

import random
import json
import pickle
import numpy as np

import nltk
from nltk.stem import WordNetLemmatizer

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation, Dropout
from tensorflow.keras.optimizers import SGD

lemmatizer = WordNetLemmatizer

intents = json.loads(open('intents.json').read())



words = []
classes = []
documents = []
ignore_letters = ['?', '!', '.', ',']

for intent in intents ['intents']:
    for pattern in intent ['patterns']:
        word_list = nltk.word_tokenize(pattern)
        words.append(word_list)
        documents.append((word_list, intent['tag']))
        if intent['tag'] not in classes:
            classes.append(intent['tag'])

print(documents)
(Jan-20-2022, 04:01 AM)mmagner2022 Wrote: [ -> ]json.decoder.JSONDecodeError: Expecting ',' delimiter: line 15 column 1 (char 303)
I guess you will have to look at your json file 'intents.json', at the beginning of line 15. There may be a comma missing.