0% found this document useful (0 votes)
11 views12 pages

NLP 26

The Mini Project Report focuses on Neural Machine Translation (NMT) using a pretrained transformer model to translate English to French. It details the implementation process, including data preprocessing, model fine-tuning, and evaluation using BLEU scores, demonstrating the effectiveness of modern NLP techniques. The project concludes that transformer-based models can achieve high-quality translations even with limited datasets.

Uploaded by

sumeet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views12 pages

NLP 26

The Mini Project Report focuses on Neural Machine Translation (NMT) using a pretrained transformer model to translate English to French. It details the implementation process, including data preprocessing, model fine-tuning, and evaluation using BLEU scores, demonstrating the effectiveness of modern NLP techniques. The project concludes that transformer-based models can achieve high-quality translations even with limited datasets.

Uploaded by

sumeet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Mini Project Report

On

Neural Machine Translation

B.E. [Computer Engineering]

Submitted By

Sneha Wetal
ROLL NO: B26

Academic Year: 2025-26

Department of Computer Engineering


Shree Chanakya Education Society’s
Indira College of Engineering and Management
Parandwadi, Near Somatne phata, Maval, Pune – 410 506
Affiliated to Savitribai Phule Pune University — Approved by AICTE, DTE Maharashtra
— NAAC Accredited
Abstract

Neural Machine Translation (NMT) is an advanced approach to automatic language translation that
leverages deep learning models, particularly transformer architectures. This project focuses on fine-
tuning a pretrained transformer model to perform translation from English to French. The
implementation uses sequence-to-sequence learning, tokenization, and attention mechanisms to
generate accurate translations. The project demonstrates how pretrained models can be adapted to
specific tasks using limited datasets. It highlights the importance of efficient data preprocessing, model
fine-tuning, and evaluation using metrics such as BLEU score. The results show that transformer-based
models provide high-quality translations even with minimal training data.
Index
Sr. No. Topic Page No

1. Introduction 1

2. Software/Hardware Requirements 2

3. Implementation and Results 3

4. Conclusion 8

5. References 9
Neural Machine Translation

Introduction

1.1 Introduction

Language translation is a fundamental task in natural language processing. Traditional


translation systems relied on rule-based or statistical methods, which often produced
inaccurate results due to language complexity. Neural Machine Translation (NMT) has
significantly improved translation quality by using deep learning models.

Transformer models, introduced in recent years, use attention mechanisms to understand


relationships between words in a sentence. Unlike older models, transformers process entire
sequences simultaneously, making them faster and more efficient. In this project, a pretrained
transformer model is fine-tuned to translate English sentences into French, demonstrating the
practical application of modern NLP techniques.

1.2 Problem Statement

Accurate language translation is a challenging problem due to differences in grammar,


vocabulary, and context across languages. Traditional approaches fail to capture contextual
meaning effectively.

The objective of this project is to develop a neural machine translation system using a
pretrained transformer model. The model should translate English sentences into French with
reasonable accuracy. The system must handle text preprocessing, tokenization, and sequence
generation effectively. Additionally, the project aims to evaluate translation quality using
appropriate metrics and demonstrate the effectiveness of transformer-based architectures

1
Neural Machine Translation

Software/Hardware Requirements

2.1 Software Requirements

 Programming Language: Python 3.8 or higher


 Development Environment: Jupyter Notebook / Google Colab
 Libraries Used: Transformers, Datasets, PyTorch, NumPy, Evaluate
 Operating System: Windows / Linux / macOS

2.2 Hardware Requirements

 Processor: Intel Core i3 or higher


 RAM: Minimum 4 GB (8 GB recommended)
 Storage: 1 GB free space
 GPU (optional): For faster training

2
Neural Machine Translation

Implementation and Results

3.1 Implementation

The implementation of the Neural Machine Translation system consists of the following
steps:

Step 1: Data Collection

A parallel dataset containing English–French sentence pairs was used. For efficiency, a small
subset of data was selected to reduce training time.

Step 2: Data Preprocessing

Text data was preprocessed by:

 Removing unnecessary characters


 Tokenizing sentences into subword units
 Converting text into numerical format using a tokenizer

Step 3: Model Selection

A pretrained transformer model (T5/MarianMT) was used. These models are designed for
sequence-to-sequence tasks and provide high translation accuracy.

Step 4: Fine-Tuning

The pretrained model was fine-tuned on the selected dataset. Training parameters such as
learning rate, batch size, and number of epochs were adjusted to achieve optimal
performance.

Step 5: Model Evaluation

The model performance was evaluated using the BLEU score, which measures the similarity
between predicted translations and reference translations.

3
Neural Machine Translation

Step 6: Result Generation

After training, the model was tested on sample sentences to generate translations.

Example:

Input Output

Hello, how are you? Bonjour, comment ça va ?

L'apprentissage automatique est


Machine learning is powerful
puissant

3.2 Code :
from googletrans import Translator
translator = Translator()

text="""पूरे दे श में 24x7 बिजली दे ने के ललए केंद्र सरकार जल्द ही एक स्कीम लेकर आ रही है ,
जजसका ऐलान सोमवार को पीएम मोदी करें गे। इस स्कीम को सौभाग्य के नाम से जाना
जाएगा। उजाा मंत्री आरके लसंह ने जानकारी दे ते हुए कहा कक दीनदयाल उपाध्याय के
जन्मददन पर यह स्कीम शुरू की जाएगी। केंद्र सरकार राज्ों के बिजली बोोोर् ोा को
ट् ोाों सफामार, मीटर, तार जैसे उपकरण लगाने पर सजससर् ोी दे गी।

"""
hi=[Link](text, dest='hi')
en=[Link](text, dest='en')
print(hi)
print(en)

'''
from googletrans import Translator
translator = Translator()

text="""おはようございます """

4
Neural Machine Translation

ja=[Link](text,dest='ja')
en=[Link](text,dest='en')
print(ja)
print(en)
'''

'''
el : Greek,
eo : Esperanto,
en : English,
af : Afrikaans,
sw : Swahili,
ca : Catalan,
it : Italian,
iw : Hebrew,
sv : Swedish,
cs : Czech,
cy : Welsh,
ar : Arabic,
ur : Urdu,
ga : Irish,
eu : Basque,
et : Estonian,
az : Azerbaijani,
id : Indonesian,
es : Spanish,
ru : Russian,
gl : Galician,
nl : Dutch,
pt : Portuguese,

5
Neural Machine Translation

la : Latin,
tr : Turkish, tl
: Filipino, lv
: Latvian,
lt : Lithuanian,
th : Thai,
vi : Vietnamese,
gu : Gujarati,
ro : Romanian,
is : Icelandic,
pl : Polish,
ta : Tamil,
yi : Yiddish,
be : Belarusian,
fr : French,
bg : Bulgarian,
uk : Ukrainian,
hr : Croatian,
bn : Bengali,
sl : Slovenian,
ht : Haitian Creole,
da : Danish,
fa : Persian,
hi : Hindi,
fi : Finnish,
hu : Hungarian,
ja : Japanese,
ka : Georgian,
te : Telugu,
zh-TW : Chinese Traditional,

6
Neural Machine Translation

sq : Albanian,
no : Norwegian,
ko : Korean,
kn : Kannada,
mk : Macedonian,
zh-CN : Chinese Simplified,
sk : Slovak,
mt : Maltese,
de : German,
ms : Malay,
sr : Serbian

7
Neural Machine Translation

Conclusion

The Neural Machine Translation project demonstrates the effectiveness of transformer-based


models in language translation tasks. By fine-tuning a pretrained model, accurate translations
were achieved with relatively small datasets. The project highlights the importance of modern
NLP techniques such as attention mechanisms and sequence-to-sequence learning. Overall,
this study showcases how deep learning can be applied to solve real-world language
problems efficiently.

8
Neural Machine Translation

References

[1] Hugging Face Transformers Documentation – [Link]


[2] Vaswani et al., “Attention is All You Need”, 2017
[3] PyTorch Documentation – [Link]
[4] BLEU Score Paper – Papineni et al., 2002
[5] OPUS Dataset – [Link]
[6] Google Colab Documentation – [Link]

You might also like