I have prepared a Model which can translate English Language to French Language with above 80% accuracy. I have used Tensorflow and Keras for this Project.
Objective and Problem Statement
Getting the Data
Exploratory Data Analysis
Data Preparation: Tokenization and Padding
def tokenize_padding(x, maxlen):
tokenizer = Tokenizer(char_level=False)
tokenizer.fit_on_texts(x)
sequences = tokenizer.texts_to_sequences(x)
padded = pad_sequences(sequences, maxlen=maxlen, padding="post")
return tokenizer, sequences, padded
Snapshot of the Model
model = Sequential()
model.add(Embedding(english_vocab, 256, input_length=maxlen_eng, mask_zero=True))
model.add(Bidirectional(GRU(256)))
model.add(RepeatVector(maxlen_fre))
model.add(Bidirectional(GRU(256, return_sequences=True)))
model.add(TimeDistributed(Dense(512, activation="relu")))
model.add(Dropout(0.5))
model.add(TimeDistributed(Dense(french_vocab, activation="softmax")))
model.compile(loss=sparse_categorical_crossentropy,
optimizer=Adam(learning_rate=0.001),
metrics=['accuracy'])
model.summary()
Model in Production