Login and get coding
Bob is a lazy typer and often forgets to accentuate his Spanish 😅
For example instead of Cuando era pequeño me gustaba jugar en la vía he would write: Cuando era pequeno me gustaba jugar en la via.
But Python to the rescue 🐍 ... help him out by finishing the
get_accentuated_sentence()function that receives a text as input argument and accentuates it using the provided (downloaded) Spanish dictionary stored in the
SPANISH_WORDSconstant (a list of Spanish word strings).
Take a look at the
unicodedata(Standard Library) module in order to make the link "accentuated -> not-accentuated" word (e.g. éxito -> exito), that should make it easier to complete this exercise 💡
By the way, note we kept the scope pretty simple here. Plural words nor verbs are expected to work. And there are some false positives, e.g. una (a) -> uña (nail). So the solution is not very real-world applicable. To meet that criteria we would have to implement stemming to recognize all forms of a word, even the conjugated ones.
However we think this is still a useful exercise to sharpen your coding skills, so good luck and keep calm and code in Python 💪
15 out of 17 users completed this Bite.
Will you be Pythonista #16 to crack this Bite?
Resolution time: ~79 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 5.0 on a 1-10 difficulty scale.
» Up for a challenge? 💪