Split and extract the data (English and French word).Loop through each line of the text file.Open the dictionary.txt file in read mode,.Ask the user to enter a number in full English,. We will use a text file containing all the words we need: One, Two, Three… Ten, Eleven, Twelve, … Thirty, Forty, Fifty, … Hundred, Thousand.įinally we can write our algorithm which will: To do so we need an English/French dictionary. (Grammar and conjugation)įor our translation algorithm we will focus on a word for word translation. This is because the English grammar and the French grammar are different and though both languages have a lot of similarities they do not follow exactly the same rules. Note that even though this approach will be quite accurate to translate numbers written in full, it would be very inaccurate to translate full sentences. This means that we can write a simple algorithm here to translate word for word each of the words used from English to French. Twenty-five thousand six hundred and forty-twoįrom the examples given above we can see that the same rules are used in both English and French to write numbers in full. However we are only going to translate numbers as follows: Have you ever used Google Translate to translate some text or a full webpage?įor this challenge we are going to try to write a Python script to translate from English to French.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |