+ 1

Removing anglicisms

Hey guys! I need help... I want create a browser plugin that automatically replaces anglicisms with German words. I use the dict data structure to developer a simple anglisisms German dictionary. After that I try to create a function removing_anglicisms (text) and replaces all known anglicisms contained there with suitable German word and return the improved text. But I can finish my function. Can someone help ? https://code.sololearn.com/cMCFaXTD2NI0/?ref=app

3rd Dec 2019, 10:01 PM
Sahra.P
Sahra.P - avatar
3 Respuestas
+ 5
I think, a simple way would be to use the replace method of string: for anglicism in anglicisms: text = text.replace( anglicism, anglicisms[anglicism] ) I renamed your dict to anglicisms because you shouldn't overwrite the names of builtin stuff like dict. (Also it's always good to make your code self-explanatory.)
3rd Dec 2019, 10:23 PM
HonFu
HonFu - avatar
0
I try it but it didnt work
4th Dec 2019, 9:10 PM
Sahra.P
Sahra.P - avatar