This repository contains a Python code script (Jupyter Notebook) that translates English sentences to Hinglish. It utilizes the Hugging Face Transformers library for machine translation. The code also processes nouns and verbs within the input sentences.
- Python 3.6+
- Jupyter Notebook
- Transformers library (
pip install transformers
) - NLTK library (
pip install nltk
) - SentencePiece library (
pip install sentencepiece
)
- Clone the repository to your local machine.
git clone https://github.com/sandip-2002/English_to_Hinglish.git
cd English_to_Hinglish
- Create a virtual environment and install the required packages:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
pip install -r requirements.txt
- Start a Jupyter Notebook server:
jupyter notebook
1.Running the Model
2.Open the Jupyter Notebook file English_to_Hinglish_Translator.ipynb.
3.Ensure you have Jupyter Notebook installed, and the required Python packages are installed in your virtual environment.
- Run the code cells in the Jupyter Notebook to translate English sentences to Hinglish.
4.The output translations will be displayed within the notebook, and the Hinglish translations will be generated and printed.
- Collect reference translations for the sentences to be evaluated.
- Generate candidate translations using your machine translation model.
- For each sentence: a. Tokenize the reference and candidate translations. b. Calculate the BLEU score for the candidate translation compared to the reference translations. c. Use a smoothing function to handle discrepancies in n-gram counts.
- Calculate the average BLEU score across all sentences.
- Interpret the BLEU scores: Higher scores indicate better translation quality.
- Use BLEU scores to assess and potentially improve your machine translation model.
The output translations for the provided example sentences are saved in the output.txt file.
Here are some example sentences that you can translate:
"Definitely share your feedback in the comment section." "So even if it's a big video, I will clearly mention all the products." "I was waiting for my bag."
This code uses the Hugging Face Transformers library for machine translation.