Skip to content

Commit 3566228

Browse files
committed
Add new message for single-word responses
1 parent 132f1e3 commit 3566228

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/evaluation.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
import time
44

55
import gensim
6-
import matplotlib.pyplot as plt
76
import numpy as np
8-
import numpy.linalg
97
from nltk.corpus import stopwords
108
from nltk import word_tokenize
119
from nltk.data import find
@@ -114,6 +112,11 @@ def evaluation_function(response, answer, params):
114112
dif = ans_score[0] - resp_score[0]
115113
word = resp_score[1]
116114

115+
more_info_msg = f'Please provide more information about {word}' if word is not None else ''
116+
feedback_msg = (
117+
f"Cannot determine if the answer is correct ({'%.3f'%(w2v_similarity)}% similarity). {more_info_msg}" if len(response.split(' ')) > 1
118+
else "Incorrect" )
119+
117120
return {
118121
"is_correct": False,
119122
"result": {
@@ -124,7 +127,7 @@ def evaluation_function(response, answer, params):
124127
"BOW_similarity_value": similarity,
125128
"problematic_word": word
126129
},
127-
"feedback": f"Cannot determine if the answer is correct ({'%.3f'%(w2v_similarity)}% similarity). {f'Please provide more information about {word}' if word is not None else ''}"
130+
"feedback": feedback_msg,
128131
}
129132

130133

0 commit comments

Comments
 (0)