Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

🌍 Language Detection using Machine Learning

A Natural Language Processing (NLP) project that automatically identifies the language of a given text using machine learning techniques. The project applies TF-IDF feature extraction and compares multiple classification algorithms to accurately detect text across multiple languages.


📌 Overview

Language detection is one of the fundamental tasks in Natural Language Processing. It is widely used in translation systems, multilingual search engines, chatbots, social media platforms, and content recommendation systems.

This project builds an end-to-end language detection pipeline using machine learning, from data preprocessing and feature engineering to model evaluation and prediction.


🚀 Features

  • Text preprocessing and cleaning
  • Exploratory Data Analysis (EDA)
  • TF-IDF feature extraction
  • Label Encoding
  • Naive Bayes Classifier
  • Logistic Regression Classifier
  • Model comparison
  • Confusion Matrix visualization
  • Classification Report
  • Cross-validation
  • Language prediction for custom text

🛠 Tech Stack

  • Python
  • Pandas
  • NumPy
  • Matplotlib
  • Seaborn
  • Scikit-learn
  • NLTK
  • WordCloud
  • Jupyter Notebook

📊 Dataset

Language Detection Dataset

The dataset contains multilingual text samples belonging to 17 different languages.

Features

  • Text
  • Language

Languages

  • English
  • Hindi
  • Tamil
  • Kannada
  • Malayalam
  • Arabic
  • German
  • French
  • Spanish
  • Portuguese
  • Italian
  • Russian
  • Swedish
  • Dutch
  • Turkish
  • Danish
  • Greek

🤖 Machine Learning Models

Feature Extraction

  • TF-IDF Vectorizer

Classification Models

  • Multinomial Naive Bayes
  • Complement Naive Bayes
  • Logistic Regression

📈 Evaluation Metrics

  • Accuracy
  • Precision
  • Recall
  • F1-Score
  • Confusion Matrix
  • Cross Validation Score

📊 Project Workflow

Dataset
   │
   ▼
Data Cleaning
   │
   ▼
Text Preprocessing
   │
   ▼
Exploratory Data Analysis
   │
   ▼
TF-IDF Vectorization
   │
   ▼
Train-Test Split
   │
   ▼
Model Training
   │
   ▼
Model Evaluation
   │
   ▼
Language Prediction

📁 Project Structure

language-detection/

│── language_detection.ipynb
│── README.md
│── requirements.txt
│── dataset/
│── images/
└── outputs/

📊 Key Highlights

  • Built an end-to-end multilingual text classification pipeline.
  • Compared multiple machine learning algorithms for language detection.
  • Used TF-IDF vectorization for feature extraction.
  • Evaluated models using standard classification metrics.
  • Visualized model performance with confusion matrices and data visualizations.

▶️ Installation

git clone https://github.com/YOUR_USERNAME/language-detection.git
cd language-detection
pip install -r requirements.txt
jupyter notebook

Open:

language_detection.ipynb

🔮 Future Improvements

  • Deep Learning (LSTM/BiLSTM)
  • Transformer Models (BERT/XLM-RoBERTa)
  • FastAPI Deployment
  • Streamlit Web App
  • Real-time Language Detection API
  • Support for Additional Languages

📜 License

This project is intended for educational and research purposes.


👨‍💻 Author

Rithvik Jaswal

Computer Science Engineering Student

Interested in Machine Learning, Natural Language Processing, Artificial Intelligence, and Data Science.


⭐ If you found this project useful, consider giving it a star.

About

Machine learning-based language detection using TF-IDF, Naive Bayes, and Logistic Regression for multilingual text classification.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages