Improve speaking grading.

This commit is contained in:
Cristiano Ferreira
2023-09-15 00:01:52 +01:00
parent 8f9b65281e
commit f77fafa864
3 changed files with 67 additions and 44 deletions

View File

@@ -21,4 +21,10 @@ def text_to_speech(text: str, file_name: str):
def has_words(text: str):
english_words = set(words.words())
words_in_input = text.split()
return any(word.lower() in english_words for word in words_in_input)
return any(word.lower() in english_words for word in words_in_input)
def has_10_words(text: str):
english_words = set(words.words())
words_in_input = text.split()
english_word_count = sum(1 for word in words_in_input if word.lower() in english_words)
return english_word_count >= 10