Trouble in creating Chat Bot With PyTorch - NLP

Hi I was recently building a sentiment analysis chatbot with the platform NLTK (Natural Language Toolkit). But i was having difficulties in the Feed Forward Neural net with 2 hidden layers. It returns error and im having difficulty with the deep learning and ML algorithms. I have specified the code below.

import numpy as np
import nltk
from nltk.stem.porter import PorterStemmer
stemmer = PorterStemmer()

def tokenize(sentence):
    split sentence into array of words/tokens
    a token can be a word or punctuation character, or number
    return nltk.word_tokenize(sentence)

def stem(word):
    stemming = find the root form of the word
    words = ["organize", "organizes", "organizing"]
    words = [stem(w) for w in words]
    -> ["organ", "organ", "organ"]
    return stemmer.stem(word.lower())

def bag_of_words(tokenized_sentence, words):
    return bag of words array:
    1 for each known word that exists in the sentence, 0 otherwise
    sentence = ["hello", "how", "are", "you"]
    words = ["hi", "hello", "I", "you", "bye", "thank", "cool"]
    bog   = [  0 ,    1 ,    0 ,   1 ,    0 ,    0 ,      0]
    # stem each word
    sentence_words = [stem(word) for word in tokenized_sentence]
    # initialize bag with 0 for each word
    bag = np.zeros(len(words), dtype=np.float32)
    for idx, w in enumerate(words):
        if w in sentence_words: 
            bag[idx] = 1

    return bag

I tried to modify intents.json with possible patterns and responses and re-run the training but it did not work. I am currently working for a chatbot development services company and they have knowledge in SciPay and SpaCY. Would that be helpful here?

Could you describe what kind of error you are seeing?

Yes, I think it could be helpful to talk to your colleagues, who are already deploying “AI Chatbot Services”.