Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,12 +12,16 @@ with open("embeddings_1.pkl", "rb") as fIn:
|
|
| 12 |
stored_data = pickle.load(fIn)
|
| 13 |
stored_embeddings = stored_data["embeddings"]
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
def check_misspelled_words(user_input):
|
| 16 |
-
spell = SpellChecker()
|
| 17 |
# Tokenize the input into words
|
| 18 |
words = user_input.split()
|
| 19 |
-
|
|
|
|
| 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
|
|
@@ -51,7 +55,7 @@ def main():
|
|
| 51 |
misspelled_words = check_misspelled_words(user_input)
|
| 52 |
if misspelled_words:
|
| 53 |
st.write("Please enter a detailed correct full description")
|
| 54 |
-
st.write(misspelled_words)
|
| 55 |
else:
|
| 56 |
mapping_results = mapping_code(user_input)
|
| 57 |
# Display top 5 similar sentences
|
|
|
|
| 12 |
stored_data = pickle.load(fIn)
|
| 13 |
stored_embeddings = stored_data["embeddings"]
|
| 14 |
|
| 15 |
+
spell = SpellChecker()
|
| 16 |
+
|
| 17 |
+
# Define a function to check for misspelled words
|
| 18 |
def check_misspelled_words(user_input):
|
|
|
|
| 19 |
# Tokenize the input into words
|
| 20 |
words = user_input.split()
|
| 21 |
+
|
| 22 |
+
# Get a list of misspelled words excluding words containing only numbers
|
| 23 |
misspelled = [word for word in words if word.isalpha() and not word.isdigit() and not spell.correction(word.lower()) == word.lower()]
|
| 24 |
+
|
| 25 |
return misspelled
|
| 26 |
|
| 27 |
# Define the function for mapping code
|
|
|
|
| 55 |
misspelled_words = check_misspelled_words(user_input)
|
| 56 |
if misspelled_words:
|
| 57 |
st.write("Please enter a detailed correct full description")
|
| 58 |
+
#st.write(misspelled_words)
|
| 59 |
else:
|
| 60 |
mapping_results = mapping_code(user_input)
|
| 61 |
# Display top 5 similar sentences
|