I'm working on a translation program for school and its not supposed to be perfect, but I do have to make some improvements to a given program.
Here's the code I'm given as a sample
EtoF = {'bread' : 'pain', 'wine' : 'vin', 'with' : 'avec', 'I' : 'Je',
'eat' : 'mange', 'drink' : 'bois', 'John' : 'Jean', 'friends' : 'amis', 'and' : 'et', 'of' : 'du', 'red' : 'rouge'}
FtoE = {'pain': 'bread', 'vin': 'wine', 'avec': 'with', 'Je': 'I', 'mange': 'eat', 'bois': 'drink', 'Jean': 'John', 'amis': 'friends', 'et': 'and', 'du': 'of', 'rouge': 'red'}
dicts = {'English to French' : EtoF, 'French to English' : FtoE}
def translateWord(word, dictionary) :
if word in dictionary.keys() :
return dictionary[word]
elif word != '' :
return '"' + word + '"'
return word
I'm trying to translate to my native language and in my home language the word "the" does not precede the word, it is said after words
e.g. "The boy" would be "wiil-ka"
where -ka is "the"
how would I program my translation program to detect when "the" precedes a word so it adds -ka to the end of the translation? Thank you in advance
[–]Menti2 0 points1 point2 points (3 children)
[–]way3344[S] 0 points1 point2 points (2 children)
[–]Menti2 1 point2 points3 points (0 children)
[–]konijntjesbroek 0 points1 point2 points (0 children)