Translation examples¶
"Model C" is a fairly large attention model with dropout, trained on an extended vocabulary size of 16,000.
In [369]:
translate(model_C, "We can order dinner but I don't want pizza.")
Out[369]:
'no puedo hacer la cena pero no quiero pizza'
In [370]:
translate(model_C, "When I fell on the football field I broke my leg")
Out[370]:
'cuando me caí de el campo me me rompió la pierna'
In [371]:
beam_search(model_C, "When I fell on the football field I broke my leg", beam_width=10)
************** cuando me caí de el futbol me rompió la pierna
Out[371]:
('When I fell out of football I broke my leg', 'cuando me caí de el futbol me rompió la pierna')
In [372]:
beam_search(model_C, "I do not like green eggs and ham", beam_width=10)
************** no me gustan los huevos verdes y el jamón
Out[372]:
("I don't like green eggs and ham", 'no me gustan los huevos verdes y el jamón')
In [373]:
beam_search(model_C, "Tariffs are not a tax on Canada", beam_width=20)
************** [UNK] no son [UNK] en canadá
Out[373]:
('[Unk] are not [unk] in Canada', '[UNK] no son [UNK] en canadá')
In [374]:
beam_search(model_C, "An empty house is like a stray dog or a body from which life has departed.", beam_width=10)
************** una casa vacío es como un perro [UNK] o un perro [UNK] o la vida
Out[374]:
('An empty house is like a dog [unk] or a dog [unk] or life', 'una casa vacío es como un perro [UNK] o un perro [UNK] o la vida')
In [375]:
sentence = "Next to trying and winning, the best thing is trying and failing."
beam_search(model_C, sentence, beam_width=10)
************** la siguiente lo intentar ganar lo mejor está tratando
Out[375]:
('The next try to win the best is trying', 'la siguiente lo intentar ganar lo mejor está tratando')
In [376]:
sentence = "Next to trying and winning, the best thing is trying and failing."
beam_search(model_B, sentence, beam_width=10)
************** el primero está tratando de intentar todo lo que quiere decir y más vale
Out[376]:
('The first is trying to try everything that means and better', 'el primero está tratando de intentar todo lo que quiere decir y más vale')
In [377]:
sentence = "Next to trying and winning, the best thing is trying and failing."
beam_search(model_A, sentence, beam_width=10)
************** [UNK] por favor que te quedes en boston
Out[377]:
('[UNK] Please stay in Boston', '[UNK] por favor que te quedes en boston')
In [378]:
sentence = "The only thing we have to fear is fear itself"
beam_search(model_C, sentence, beam_width=30)
************** la única cosa que tenemos que temer es miedo
Out[378]:
('The only thing we have to fear is fear', 'la única cosa que tenemos que temer es miedo')
In [380]:
sentence = "That's one small step for man and one giant leap for mankind"
beam_search(model_C, sentence, beam_width=30)
************** ese es un pequeño paso para hombre y uno para la humanidad de la humanidad
Out[380]:
('That is a small step for men and one for humanity of humanity', 'ese es un pequeño paso para hombre y uno para la humanidad de la humanidad')
In [381]:
sentence = "Shut up, he explained"
beam_search(model_C, sentence, beam_width=30)
************** cállate
Out[381]:
('be quiet', 'cállate')
In [382]:
sentence = "Beauty is only skin deep, but ugly goes clean to the bone"
beam_search(model_C, sentence, beam_width=30)
************** la belleza es sólo el piel sino que [UNK] para la hueso
Out[382]:
('Beauty is only the skin but [one] for bone', 'la belleza es sólo el piel sino que [UNK] para la hueso')