Trouble in creating Chat Bot With PyTorch - NLP

ricphil: <p>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.</p>
<pre><code class="lang-auto"># nltk_utils.py
import numpy as np
import nltk
# nltk.download('punkt')
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
    examples:
    words = ["organize", "organizes", "organizing"]
    words = [stem(w) for w in words]
    -&gt; ["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
    example:
    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
</code></pre>
<p>I tried to modify <code>intents.json</code> with possible patterns and responses and re-run the training but it did not work. I am currently working for a <a href="https://thinkpalm.com/products/chat-bot/" rel="noopener nofollow ugc">chatbot development services</a> company and they have knowledge in SciPay and SpaCY. Would that be helpful here?</p>

ptrblck: <aside class="quote no-group" data-username="ricphil" data-post="1" data-topic="159790">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/r/87869e/48.png" class="avatar"> ricphil:</div>
<blockquote>
<p>It returns error and im having difficulty with the deep learning and ML algorithms.</p>
</blockquote>
</aside>
<p>Could you describe what kind of error you are seeing?</p>
<aside class="quote no-group" data-username="ricphil" data-post="1" data-topic="159790">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/r/87869e/48.png" class="avatar"> ricphil:</div>
<blockquote>
<p>I am currently working for a <a href="https://thinkpalm.com/products/chat-bot/">chatbot development services</a> company and they have knowledge in SciPay and SpaCY. Would that be helpful here?</p>
</blockquote>
</aside>
<p>Yes, I think it could be helpful to talk to your colleagues, who are already deploying “AI Chatbot Services”.</p>

mrtinstasikkk: <p>Thanks for recomendations. I will check it.</p>