-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a47fd1b
commit a073a35
Showing
3 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
Natural Language Processing/Spoken Language Translator/README.MD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# Spoken Language Translator 🔊🗣🤖 | ||
|
||
🔹I created a Language translator that automatically detects the language of the input text and translates it into the selected language. | ||
|
||
🔹It uses advanced machine learning algorithms to detect the language of the input text and translate it into the desired language. | ||
|
||
🔹This project utilizes the power of machine learning and natural language processing to provide accurate and efficient translations for various languages. | ||
|
||
## Goal 🎯 | ||
|
||
🔹The goal of this project is to develop a robust language translator that can accurately detect the language of the input text and translate it into the desired language. | ||
|
||
🔹This tool aims to facilitate communication across different languages and cultures, making it useful for individuals, businesses, and organizations worldwide. | ||
|
||
## Dataset 📊 | ||
|
||
🔹The Language Translator project does not require a specific dataset for training. Instead, it utilizes the Google Translate API for language detection and translation. | ||
|
||
🔹The API handles the language processing and translation tasks, making it unnecessary to use a separate dataset for this project. | ||
|
||
## Methodology 🔎 | ||
|
||
🔹The Language Translator project follows a structured approach to translate text from one language to another. Key steps include: | ||
|
||
1. **Language Detection**: Automatically detect the language of the input text using machine learning algorithms. | ||
2. **Translation**: Translate the input text into the desired language using pre-trained translation models. | ||
3. **User Interface**: Provide a user-friendly interface for users to enter text and select the desired language for translation. | ||
4. **Integration**: Integrate the language detection and translation functionalities into a seamless application for easy use. | ||
|
||
## Technologies Used 🚀 | ||
|
||
1. **Python**: For programming the language translator application. | ||
2. **Natural Language Toolkit (NLTK)**: For natural language processing tasks such as tokenization, tagging, and parsing. | ||
3. **Google Translate API**: For translating text from one language to another. | ||
4. **Flask**: For building the web application and providing a user interface. | ||
5. **HTML/CSS**: For designing the front-end of the web application. | ||
6. **JavaScript**: For enhancing the user interface and providing interactive features. | ||
|
||
## Features 💡 | ||
|
||
- **Language Detection**: Automatically detect the language of the input text. | ||
- **Translation**: Translate the input text into the selected language. | ||
- **User Interface**: Provide a simple and intuitive interface for users to interact with the translator. | ||
- **Multiple Languages**: Support translation for a wide range of languages to cater to diverse user needs. | ||
|
||
## Setup ⚙️ | ||
|
||
Before running the application, ensure you have the following libraries installed: | ||
|
||
- **Python**: Make sure you have Python installed on your system. You can download it from the official Python website: [https://www.python.org/downloads/](https://www.python.org/downloads/) | ||
|
||
- **NLTK**: Install the Natural Language Toolkit (NLTK) library using pip: | ||
|
||
`pip install nltk` | ||
|
||
- **Google Translate API**: Obtain the Google Translate API key and install the Google Translate library using pip: | ||
|
||
`pip install googletrans==4.0.0-rc1` | ||
|
||
- **Flask**: Install Flask for building the web application: | ||
|
||
`pip install Flask` | ||
|
||
- **Other Dependencies**: You may need to install other dependencies based on your system and requirements. Refer to the `requirements.txt` file for a complete list of dependencies. | ||
|
||
## Results 📢 | ||
|
||
🔹The Language Translator project has been successfully implemented and provides accurate translations for a wide range of languages. | ||
|
||
🔹The Google Translate API's advanced machine learning algorithms ensure that translations are accurate and reliable, making it a valuable tool for communication across different languages and cultures. | ||
|
||
## 📌 Conclusion | ||
|
||
🔹The Language Translator project demonstrates the power of machine learning and natural language processing in facilitating cross-language communication. | ||
|
||
🔹By automatically detecting the language of the input text and providing accurate translations, the tool helps bridge the language barrier and enables users to communicate effectively in different languages. | ||
|
||
🔹The project's use of the Google Translate API showcases the capabilities of modern machine learning algorithms in handling complex language processing tasks. | ||
|
||
|
||
## Usage 🧩✍ | ||
|
||
1. **Clone the Repository**: | ||
|
||
`git clone https://github.com/yourusername/language-translator.git` | ||
|
||
2. **Install Dependencies**: | ||
|
||
`pip install -r requirements.txt` | ||
|
||
3. **Run the Application**: | ||
|
||
`python app.py` | ||
|
||
4. **Access the Translator**: Open your web browser and navigate to `http://localhost:5000` to access the language translator application. | ||
|
||
|
||
## Future Work ⭐ | ||
|
||
- **Improved Language Detection**: Enhance the accuracy of language detection using advanced machine learning techniques. | ||
- **Additional Features**: Add features such as text-to-speech conversion and language identification for multilingual texts. | ||
- **Performance Optimization**: Optimize the translation process for faster and more efficient translations. |
4 changes: 4 additions & 0 deletions
4
Natural Language Processing/Spoken Language Translator/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
googletrans==4.0.0-rc1 | ||
pywin32==305 | ||
SpeechRecognition==3.8.1 | ||
tk |
94 changes: 94 additions & 0 deletions
94
Natural Language Processing/Spoken Language Translator/translator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
from tkinter import * | ||
from googletrans import Translator | ||
import win32com.client as wincl | ||
import speech_recognition as sr | ||
class translator: | ||
|
||
def translate(self): | ||
if str(self.fn.get())!="": | ||
self.translatedfinal = self.translator.translate(str(self.fn.get()), dest=self.variable.get()) | ||
else: | ||
self.translatedfinal = self.translator.translate(self.text, dest=self.variable.get()) | ||
|
||
self.name = Label(self.root, text="Translated Text:", bg='black',fg='cyan',font='1') | ||
self.name.place(x=100, y=400) | ||
self.final = Label(self.root, text=self.translatedfinal.text+" ", font=100,bg='black',fg='cyan') | ||
self.final.place(x=400, y=400) | ||
|
||
|
||
def __init__(self): | ||
self.root = Tk() | ||
self.root.geometry('900x700') | ||
self.root.title("Translator") | ||
self.root.config(bg='black') | ||
self.speak = wincl.Dispatch("SAPI.SpVoice") | ||
|
||
self.raw = "" | ||
self.fn = StringVar() | ||
self.ln = StringVar() | ||
self.translator = Translator() | ||
|
||
self.languages = [ | ||
"English", | ||
"Hindi", | ||
"Telugu", | ||
"Tamil", | ||
"Kannada", | ||
"Malayalam", | ||
"Marathi", | ||
"Gujarati", | ||
"Bengali", | ||
"Punjabi", | ||
"Odia", | ||
"Nepali", | ||
"Sindhi", | ||
"Sanskrit", | ||
"Russian", | ||
"French", | ||
"Arabic", | ||
"Bulgarian", | ||
"Danish", | ||
"German", | ||
"Greek", | ||
"Persian", | ||
"Italian", | ||
"Japanese", | ||
"Korean", | ||
"Polish", | ||
"Urdu", | ||
"Chinese", | ||
"Dutch", | ||
"Spanish", | ||
"Portuguese", | ||
"Romanian", | ||
"Swedish", | ||
"Turkish", | ||
"Vietnamese", | ||
"Afrikaans" | ||
] | ||
|
||
|
||
self.name = Label(self.root, text="Language Translator", bg='black',fg='cyan') | ||
self.name.config(font=("Old Stamper",30)) | ||
self.name.place(x=200, y=130) | ||
|
||
self.input = Label(self.root, text="Enter text here:", bg='black',fg='cyan',font=100) | ||
self.input.place(x=100, y=305) | ||
|
||
self.firste = Entry(self.root, textvariable=self.fn, bg='black', fg='cyan',font='10') | ||
self.firste.place(x=280, y=305) | ||
|
||
|
||
self.trans = Button(self.root, text="Translate", bd=7, bg='black', fg='cyan',command=self.translate) | ||
self.trans.place(x=600, y=500) | ||
|
||
self.variable = StringVar(self.root) | ||
self.variable.set(self.languages[0]) | ||
|
||
w=OptionMenu(self.root,self.variable,*self.languages) | ||
w.config(bg='black',fg='cyan',border=0) | ||
w.place(x=600,y=305) | ||
|
||
self.root.mainloop() | ||
|
||
s = translator() |