Update app.py
Browse files
app.py
CHANGED
@@ -17,13 +17,13 @@ def check_misspelled_words(user_input):
|
|
17 |
# Tokenize the input into words
|
18 |
words = user_input.split()
|
19 |
# Get a list of misspelled words
|
20 |
-
misspelled = spell.
|
21 |
return misspelled
|
22 |
|
23 |
# Define the function for mapping code
|
24 |
def mapping_code(user_input):
|
25 |
-
if len(user_input.split())
|
26 |
-
raise ValueError("Input sentence should be
|
27 |
emb1 = model.encode(user_input.lower())
|
28 |
similarities = util.pytorch_cos_sim(emb1, stored_embeddings)[0]
|
29 |
# Combine similarity scores with 'code' and 'description'
|
|
|
17 |
# Tokenize the input into words
|
18 |
words = user_input.split()
|
19 |
# Get a list of misspelled words
|
20 |
+
misspelled = [word for word in words if word.isalpha() and not word.isdigit() and not spell.correction(word.lower()) == word.lower()]
|
21 |
return misspelled
|
22 |
|
23 |
# Define the function for mapping code
|
24 |
def mapping_code(user_input):
|
25 |
+
if len(user_input.split()) <= 1: # Check if sentence has less than 5 words
|
26 |
+
raise ValueError("Input sentence should be more than 1 word long.Please provide the Full description")
|
27 |
emb1 = model.encode(user_input.lower())
|
28 |
similarities = util.pytorch_cos_sim(emb1, stored_embeddings)[0]
|
29 |
# Combine similarity scores with 'code' and 'description'
|