in src/Backend/src/api/helpers/util.py [0:0]
def check_spelling_or_syllables(sentence: list[str]) -> int:
"""
Checks if the sentence is being spelled or if it is just syllables
"""
qty_spelling = 0
qty_syllables = 0
for word in sentence:
if len(word) == 1:
qty_spelling += 1
elif len(word) <= 4:
qty_syllables += 1
if len(sentence) == 0:
return 0
if qty_syllables / len(sentence) >= 0.7:
return 1 # Silabou
if qty_spelling / len(sentence) >= 0.7:
return -1 # Soletrou
return 0 # Normal