avatar Bite 349. Writing better Spanish

Bob is a lazy typer and often forgets to accentuate his Spanish ๐Ÿ˜…

For example instead of Cuando era pequenฬƒo me gustaba jugar en la viฬ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_WORDS constant (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 ๐Ÿ’ช

 

Login and get coding
go back Intermediate level
Bitecoin 3X

17 out of 19 users completed this Bite.
Will you be the 18th person to crack this Bite?
Resolution time: ~77 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 5.0 on a 1-10 difficulty scale.
» Up for a challenge? ๐Ÿ’ช

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help