help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
multi-language-chatbot
/
modules
RSK World
multi-language-chatbot
Multi-language Chatbot - Python + Flask + OpenAI API + NLP + Translation + Language Detection + Cultural Adaptation
modules
  • __pycache__
  • __init__.py194 B
  • analytics_engine.py28.6 KB
  • chatbot_core.py10.8 KB
  • collaboration_manager.py22.3 KB
  • conversation_memory.py25.2 KB
  • cultural_adapter.py12.3 KB
  • document_analyzer.py21.5 KB
  • language_detector.py5.8 KB
  • multimodal_processor.py32.7 KB
  • personality_engine.py33.6 KB
  • sentiment_analyzer.py16.9 KB
  • translator.py7.5 KB
  • voice_processor.py13.2 KB
README.md.env.example
README.md
Raw Download

README.md

# Multi-language Chatbot

**Advanced NLP Chatbot with Multi-language Support and Cultural Adaptation**

![Multi-language Chatbot](https://img.shields.io/badge/Python-3.8+-blue.svg)
![License](https://img.shields.io/badge/License-MIT-green.svg)
![Status](https://img.shields.io/badge/Status-Active-brightgreen.svg)

**Developed by RSK World (https://rskworld.in)**
*Founder: Molla Samser | Designer & Tester: Rima Khatun*
*Contact: help@rskworld.in | +91 93305 39277*
*Year: 2026*

---

## 🌟 Features

### Core Features
- **🌍 Multi-language Support**: Communicate in 12+ languages including English, Hindi, Bengali, Spanish, French, German, Chinese, Japanese, Arabic, Portuguese, Russian, and Italian
- **πŸ” Automatic Language Detection**: Automatically detects user's language with confidence scoring
- **πŸ”„ Real-time Translation**: Seamlessly translates messages between supported languages
- **🎭 Cultural Adaptation**: Adapts responses based on cultural context and regional preferences
- **πŸ’¬ Intelligent Conversation**: Powered by OpenAI GPT with fallback to rule-based responses
- **🎨 Modern Web Interface**: Responsive, Bootstrap-based UI with real-time chat
- **πŸ“Š Session Analytics**: Track conversation statistics and language usage
- **πŸ’Ύ Chat History**: Save and export conversation history
- **πŸ”’ Security Features**: Rate limiting, input validation, CORS configuration
- **πŸ§ͺ Comprehensive Testing**: Full test suite with pytest

### Advanced Features
- **🎀 Voice Input/Output**: Speech-to-text and text-to-speech capabilities with multiple language support
- **😊 Sentiment Analysis**: Advanced sentiment and emotion detection with multi-language support
- **🧠 Conversation Memory**: Persistent conversation context with learning capabilities
- **πŸ“„ Document Analysis**: Support for PDF, Word, Excel, images with OCR and content extraction
- **πŸ‘₯ Real-time Collaboration**: Multi-user chat rooms with WebSocket support
- **πŸ“ˆ Advanced Analytics**: Comprehensive analytics dashboard with visualizations and reports
- **🎭 Personality Customization**: Multiple personality profiles (Professional, Friendly, Casual, Academic, Creative)
- **πŸ–ΌοΈ Multi-modal Input**: Support for text, voice, images, video, and mixed input processing
- **πŸ€– AI-Powered Features**: OpenAI integration for advanced NLP capabilities
- **πŸ“± Mobile Responsive**: Fully responsive design for all devices

---

## πŸš€ Quick Start

### Prerequisites

- Python 3.8 or higher
- pip (Python package manager)
- OpenAI API key (optional, for AI responses)
- Google Translate API key (optional, for enhanced translations)

### Installation

1. **Clone or download the project**
```bash
cd multi-language-chatbot
```

2. **Create a virtual environment**
```bash
python -m venv venv

# Windows
venv\Scripts\activate

# macOS/Linux
source venv/bin/activate
```

3. **Install dependencies**
```bash
pip install -r requirements.txt
```

4. **Set up environment variables**
```bash
# Copy the example environment file
cp .env.example .env

# Edit .env file with your API keys
# OPENAI_API_KEY=your_openai_api_key_here
# GOOGLE_TRANSLATE_API_KEY=your_google_translate_api_key_here
```

5. **Run the application**
```bash
python run.py
```

6. **Open your browser**
Navigate to `http://localhost:5000`

---

## πŸ“ Project Structure

```
multi-language-chatbot/
β”œβ”€β”€ app.py # Main Flask application
β”œβ”€β”€ run.py # Application runner
β”œβ”€β”€ config.py # Configuration settings
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ .env.example # Environment variables template
β”œβ”€β”€ README.md # This file
β”œβ”€β”€ modules/ # Core modules
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ language_detector.py # Language detection
β”‚ β”œβ”€β”€ translator.py # Translation services
β”‚ β”œβ”€β”€ cultural_adapter.py # Cultural adaptation
β”‚ └── chatbot_core.py # Chatbot logic
β”œβ”€β”€ templates/ # HTML templates
β”‚ └── index.html # Main interface
β”œβ”€β”€ static/ # Static assets
β”‚ β”œβ”€β”€ css/
β”‚ β”‚ └── style.css # Stylesheets
β”‚ └── js/
β”‚ └── chatbot.js # JavaScript functionality
β”œβ”€β”€ tests/ # Test files
β”œβ”€β”€ logs/ # Log files
└── instance/ # Instance files
```

---

## πŸ› οΈ Configuration

### Environment Variables

Create a `.env` file based on `.env.example`:

```bash
# Required for AI responses
OPENAI_API_KEY=your_openai_api_key_here

# Optional for enhanced translations
GOOGLE_TRANSLATE_API_KEY=your_google_translate_api_key_here

# Flask settings
FLASK_ENV=development
SECRET_KEY=your-secret-key-here

# Server settings
HOST=0.0.0.0
PORT=5000
```

### Supported Languages

The chatbot supports the following languages:

| Code | Language | Native Name |
|------|----------|-------------|
| en | English | English |
| hi | Hindi | ΰ€Ήΰ€Ώΰ€¨ΰ₯ΰ€¦ΰ₯€ |
| bn | Bengali | বাংলা |
| es | Spanish | EspaΓ±ol |
| fr | French | FranΓ§ais |
| de | German | Deutsch |
| zh | Chinese | δΈ­ζ–‡ |
| ja | Japanese | ζ—₯本θͺž |
| ar | Arabic | Ψ§Ω„ΨΉΨ±Ψ¨ΩŠΨ© |
| pt | Portuguese | PortuguΓͺs |
| ru | Russian | Русский |
| it | Italian | Italiano |

---

## 🎯 Usage

### Basic Usage

1. **Open the web interface** at `http://localhost:5000`
2. **Type your message** in any supported language
3. **The chatbot will**:
- Detect your language automatically
- Process your message
- Respond in the same language
- Adapt responses culturally

### Advanced Features

- **Language Selection**: Manually select your preferred language
- **Language Detection**: Detect the language of any text
- **Chat Export**: Export conversation history as JSON
- **Session Stats**: View message count and languages used
- **Cultural Adaptation**: Responses are adapted for cultural context

### API Endpoints

- `POST /chat` - Send a message and get response
- `POST /detect_language` - Detect language of text
- `POST /translate` - Translate text between languages
- `GET /languages` - Get supported languages
- `GET /health` - Health check

---

## πŸ”§ Development

### Running Tests

```bash
# Install test dependencies
pip install pytest pytest-flask

# Run tests
pytest tests/
```

### Code Style

```bash
# Format code
black .

# Check linting
flake8 .
```

### Adding New Languages

1. Update `SUPPORTED_LANGUAGES` in `config.py`
2. Add language patterns in `language_detector.py`
3. Update language mappings in `translator.py`
4. Add cultural context in `cultural_adapter.py`

---

## 🌐 API Reference

### Chat Endpoint

**POST** `/chat`

```json
{
"message": "Hello, how are you?",
"language": "en"
}
```

**Response:**
```json
{
"response": "I'm doing well, thank you! How can I help you today?",
"detected_language": "en",
"language_name": "English",
"confidence": 0.95
}
```

### Language Detection Endpoint

**POST** `/detect_language`

```json
{
"text": "Bonjour, comment allez-vous?"
}
```

**Response:**
```json
{
"language": "fr",
"language_name": "FranΓ§ais (French)",
"confidence": 0.92
}
```

### Translation Endpoint

**POST** `/translate`

```json
{
"text": "Hello, world!",
"source_language": "en",
"target_language": "es"
}
```

**Response:**
```json
{
"translated_text": "Β‘Hola, mundo!",
"source_language": "en",
"target_language": "es"
}
```

---

## πŸ”’ Security

- Input validation and sanitization
- Rate limiting to prevent abuse
- CORS configuration
- Environment variable protection
- Secure session handling

---

## πŸ“Š Monitoring

### Logging

- Application logs stored in `logs/chatbot.log`
- Configurable log levels
- Error tracking and reporting

### Analytics

- Message count tracking
- Language usage statistics
- Performance monitoring
- User session analytics

---

## 🀝 Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

---

## πŸ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## πŸ“ž Support

**RSK World**
- πŸ“§ Email: help@rskworld.in
- πŸ“± Phone: +91 93305 39277
- 🌐 Website: https://rskworld.in
- πŸ“ Address: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147

---

## πŸ™ Acknowledgments

- OpenAI for GPT API
- Google for Translate API
- Flask web framework
- Bootstrap for UI components
- Font Awesome for icons

---

## πŸ“ˆ Version History

- **v1.0.0** (2026) - Initial release with multi-language support
- Features: Language detection, translation, cultural adaptation, web interface

---

**Β© 2026 RSK World. All rights reserved.**
*Content used for educational purposes only.*
.env.example
Raw Download
Find: Go to:
# Multi-language Chatbot Environment Configuration
# Author: RSK World (https://rskworld.in)
# Founder: Molla Samser
# Designer & Tester: Rima Khatun
# Contact: help@rskworld.in, +91 93305 39277
# Year: 2026

# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here

# Flask Configuration
FLASK_ENV=development
FLASK_DEBUG=True
SECRET_KEY=your-secret-key-here

# Server Configuration
HOST=0.0.0.0
PORT=5000

# Translation Service Configuration
GOOGLE_TRANSLATE_API_KEY=your_google_translate_api_key_here

# Logging Configuration
LOG_LEVEL=INFO
LOG_FILE=logs/chatbot.log

# Database Configuration (Optional)
DATABASE_URL=sqlite:///chatbot.db

# Redis Configuration (Optional for caching)
REDIS_URL=redis://localhost:6379/0

# Rate Limiting
RATE_LIMIT_PER_MINUTE=60

# Chatbot Configuration
MAX_CONVERSATION_LENGTH=20
DEFAULT_LANGUAGE=en
SUPPORTED_LANGUAGES=en,hi,bn,es,fr,de,zh,ja,ar,pt,ru,it

# Cultural Adaptation
CULTURAL_ADAPTATION_ENABLED=True
TIMEZONE_AWARENESS=True

# Security
CORS_ORIGINS=*
ENABLE_HTTPS=False

# Monitoring and Analytics
ENABLE_ANALYTICS=False
ANALYTICS_API_KEY=your_analytics_api_key_here
52 linesβ€’1.1 KB
text

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer