Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 30, 2023. It is now read-only.

Commit c224fa9

Browse files
Update chatbot.py
1 parent b6c3dcb commit c224fa9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

‎chatbot.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def greeting(sentence):
5555
# Generating response
5656
def response(user_response):
5757
robo_response=''
58+
sent_tokens.append(user_response)
5859
TfidfVec = TfidfVectorizer(tokenizer=LemNormalize, stop_words='english')
5960
tfidf = TfidfVec.fit_transform(sent_tokens)
6061
vals = cosine_similarity(tfidf[-1], tfidf)
@@ -84,9 +85,6 @@ def response(user_response):
8485
if(greeting(user_response)!=None):
8586
print("ROBO: "+greeting(user_response))
8687
else:
87-
sent_tokens.append(user_response)
88-
word_tokens=word_tokens+nltk.word_tokenize(user_response)
89-
final_words=list(set(word_tokens))
9088
print("ROBO: ",end="")
9189
print(response(user_response))
9290
sent_tokens.remove(user_response)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /