shakhovak
commited on
Commit
·
ebb1297
1
Parent(s):
6fb03a0
updates
Browse files- app.py +2 -0
- retrieve_bot.py +0 -2
- utils.py +0 -2
app.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
from flask import Flask, render_template, request
|
2 |
from retrieve_bot import ChatBot
|
|
|
3 |
|
4 |
app = Flask(__name__)
|
|
|
5 |
chatSheldon = ChatBot()
|
6 |
chatSheldon.load()
|
7 |
|
|
|
1 |
from flask import Flask, render_template, request
|
2 |
from retrieve_bot import ChatBot
|
3 |
+
import nltk
|
4 |
|
5 |
app = Flask(__name__)
|
6 |
+
nltk.download("punkt")
|
7 |
chatSheldon = ChatBot()
|
8 |
chatSheldon.load()
|
9 |
|
retrieve_bot.py
CHANGED
@@ -85,7 +85,6 @@ class ChatBot:
|
|
85 |
top_scores, top_indexes = top_candidates(
|
86 |
bot_cosine_scores, intent=intent, initial_data=self.scripts, top=10
|
87 |
)
|
88 |
-
print(top_scores)
|
89 |
if top_scores[0] < 0.9:
|
90 |
answer = random.choice(low_scoring_list)
|
91 |
self.conversation_history.clear()
|
@@ -109,7 +108,6 @@ class ChatBot:
|
|
109 |
answer = self.scripts.iloc[list(updated_top_candidates.keys())[0]][
|
110 |
"answer"
|
111 |
]
|
112 |
-
print(self.scripts.iloc[top_indexes[0]]["answer"])
|
113 |
else:
|
114 |
answer = self.scripts.iloc[top_indexes[0]]["answer"]
|
115 |
|
|
|
85 |
top_scores, top_indexes = top_candidates(
|
86 |
bot_cosine_scores, intent=intent, initial_data=self.scripts, top=10
|
87 |
)
|
|
|
88 |
if top_scores[0] < 0.9:
|
89 |
answer = random.choice(low_scoring_list)
|
90 |
self.conversation_history.clear()
|
|
|
108 |
answer = self.scripts.iloc[list(updated_top_candidates.keys())[0]][
|
109 |
"answer"
|
110 |
]
|
|
|
111 |
else:
|
112 |
answer = self.scripts.iloc[top_indexes[0]]["answer"]
|
113 |
|
utils.py
CHANGED
@@ -6,7 +6,6 @@ import pickle
|
|
6 |
import random
|
7 |
from nltk.tokenize import word_tokenize
|
8 |
import string
|
9 |
-
import nltk
|
10 |
|
11 |
|
12 |
def encode(texts, model, intent, contexts=None, do_norm=True):
|
@@ -219,7 +218,6 @@ def read_files_negative(path1, path2):
|
|
219 |
|
220 |
def intent_classification(question, answer, tag_model):
|
221 |
greetings = ["hi", "hello", "greeting", "greetings", "hii", "helo", "hellow"]
|
222 |
-
nltk.download("punkt")
|
223 |
tokens = word_tokenize(answer.lower())
|
224 |
for token in tokens:
|
225 |
if token in greetings:
|
|
|
6 |
import random
|
7 |
from nltk.tokenize import word_tokenize
|
8 |
import string
|
|
|
9 |
|
10 |
|
11 |
def encode(texts, model, intent, contexts=None, do_norm=True):
|
|
|
218 |
|
219 |
def intent_classification(question, answer, tag_model):
|
220 |
greetings = ["hi", "hello", "greeting", "greetings", "hii", "helo", "hellow"]
|
|
|
221 |
tokens = word_tokenize(answer.lower())
|
222 |
for token in tokens:
|
223 |
if token in greetings:
|