Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chatbot AI
#1
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)
Reply
#2
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Hi, I need some guidance with the dialogue for my chatbot aaron10500 0 1,367 Jun-22-2021, 02:38 PM
Last Post: aaron10500
  Chatbot metro17 1 1,681 Sep-27-2019, 01:02 PM
Last Post: Malt
  Chatbot with word2vec maik282 0 2,094 Apr-30-2019, 01:49 PM
Last Post: maik282

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020