Skip to content

Project translates english language to hindi language in devanagari script. same script can be used for translating any one language to subsequent another language.

Notifications You must be signed in to change notification settings

ravis2114/Neural-Machine-Translation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Neural-Machine-Translation

Project translates english language to hindi language in devanagari script. same script can be used for translating any one language to subsequent another language.

english to hindi example


actual eng text :  ['the holy dip is on november']
actual hindi text :  ['मुख्य स्नान नवंबर को है']
translated hindi text :  ['नवंबर को अंतिम रूप से ये संशोधित श्रृंखला शुरू होती है।']

well it's not perfect since it is trained on just 69201 pairs of english-hindi parallel dataset. To train good encoder-decoder translation model it requires millions of parallel corpus of dataset and good amout of training time.

Main model architecture to be trained


Main Model to be trained

Encoder Model generated from saved Model


Encoder Model generated from saved Model

Decoder Model generated from saved Model


Decoder Model generated from saved Model

To translate using encoder-decoder model :

def translate(eng_sent):
  _, eh, ec = inf_enc_model.predict(eng_sent.reshape(1, len(eng_sent)))
  translated = []
  dec_inp_seq = np.array([2]).reshape(1,1) #2 for start token and 1 for end
  stop = False
  while not stop:
    d, [eh, ec] = dec_model_final.predict([dec_inp_seq, [eh, ec]])
    dec_inp_seq[:,] = np.argmax(d[0][0])
    translated.append(np.argmax(d[0][0]))

    if dec_inp_seq[0][0] == 1 or len(translated)>16:
      stop = True
  return translated

use this script for more info

or

open this colab notebook

License

MIT

About

Project translates english language to hindi language in devanagari script. same script can be used for translating any one language to subsequent another language.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published