oflakne26 commited on
Commit
680bdc2
1 Parent(s): cd3def5

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -8
main.py CHANGED
@@ -106,15 +106,21 @@ async def check_word(data: WordCheckData) -> Dict[str, Any]:
106
  for words in forms.values():
107
  all_forms.update(words)
108
 
109
- words_in_string = re.findall(r'\b\w+\b', input_string)
110
-
111
  found = False
112
-
113
- for form in all_forms:
114
- for word_in_string in words_in_string:
115
- if form.lower() in word_in_string.lower():
116
- found = True
117
- break
 
 
 
 
 
 
 
118
 
119
  result = {
120
  "found": found
 
106
  for words in forms.values():
107
  all_forms.update(words)
108
 
109
+ # Initialize found flag
 
110
  found = False
111
+
112
+ # Split the input string into words
113
+ input_words = input_string.split()
114
+
115
+ # Loop through each word in the input string
116
+ for input_word in input_words:
117
+ # Strip the word to contain only alphabetic characters
118
+ input_word = ''.join(filter(str.isalpha, input_word))
119
+
120
+ # Check if the stripped word is equal to any of the forms
121
+ if input_word in all_forms:
122
+ found = True
123
+ break # Exit loop if word is found
124
 
125
  result = {
126
  "found": found