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
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
conversational-ai-bot
RSK World
conversational-ai-bot
Conversational AI Bot - Python + NLP + Flask + Machine Learning + Chatbot + AI
conversational-ai-bot
  • __pycache__
  • static
  • templates
  • .gitignore577 B
  • ADVANCED_FEATURES.md5.7 KB
  • CHANGELOG.md2.2 KB
  • INSTALLATION.md1.8 KB
  • LICENSE1.2 KB
  • PROJECT_INFO.md2.8 KB
  • PROJECT_STATUS.md3.4 KB
  • QUICKSTART.md2.5 KB
  • README.md4.8 KB
  • __init__.py448 B
  • api_integrations.py6 KB
  • app.py4.2 KB
  • chatbot.py14.8 KB
  • config.py1.1 KB
  • context_manager.py5.8 KB
  • conversation_analytics.py5.9 KB
  • conversation_history.json413 B
  • conversation_history.py4.9 KB
  • entity_extractor.py6.6 KB
  • example_usage.py4.3 KB
  • intent_recognizer.py6.6 KB
  • language_support.py5 KB
  • main.py4.7 KB
  • requirements.txt311 B
  • response_templates.py7.2 KB
  • sentiment_analyzer.py5.6 KB
  • setup.py1.6 KB
  • test_chatbot.py5 KB
  • validate_project.py4.1 KB
PROJECT_INFO.mdrequirements.txtQUICKSTART.mdhandlers.pysemantic_understanding.pyai_recommendation_engine.pyconversation_analytics.py
PROJECT_INFO.md
Raw Download

PROJECT_INFO.md

# Project Information

<!--
Project: Conversational AI Bot
Developer: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277
Year: 2026
-->

## Project Overview

**Conversational AI Bot** is an advanced conversational chatbot with context management and multi-turn dialogue support.

## Project Details

- **ID**: 3
- **Title**: Conversational AI Bot
- **Category**: Conversational AI
- **Difficulty**: Intermediate
- **Version**: 1.0.0

## Description

This chatbot project implements advanced conversational AI with context awareness, multi-turn dialogue handling, and intelligent response generation. Features include conversation history, context management, and natural language understanding.

## Features

- ✅ Context-aware conversations
- ✅ Multi-turn dialogue support
- ✅ Intent recognition
- ✅ Entity extraction
- ✅ Conversation history

## Technologies

- Python 3.8+
- Natural Language Processing (NLP)
- Machine Learning
- Rasa (optional integration)
- Dialogflow (optional integration)

## Project Structure

```
conversational-ai-bot/
├── main.py # Main entry point
├── chatbot.py # Core chatbot class
├── context_manager.py # Context management
├── intent_recognizer.py # Intent recognition
├── entity_extractor.py # Entity extraction
├── conversation_history.py # Conversation history management
├── config.py # Configuration settings
├── example_usage.py # Usage examples
├── test_chatbot.py # Test suite
├── setup.py # Installation script
├── requirements.txt # Python dependencies
├── README.md # Main documentation
├── QUICKSTART.md # Quick start guide
├── INSTALLATION.md # Installation guide
├── LICENSE # License file
└── .gitignore # Git ignore file
```

## Installation

See [INSTALLATION.md](INSTALLATION.md) for detailed installation instructions.

## Quick Start

See [QUICKSTART.md](QUICKSTART.md) for quick start guide.

## Usage

### Interactive Mode

```bash
python main.py
```

### Programmatic Usage

```python
from chatbot import ConversationalAIBot

bot = ConversationalAIBot()
response = bot.chat("Hello, my name is John")
print(response)
```

## Developer Information

- **Developer**: RSK World
- **Website**: https://rskworld.in
- **Email**: help@rskworld.in
- **Phone**: +91 93305 39277
- **Year**: 2026

## License

MIT License - See [LICENSE](LICENSE) for details.

## Support

For support, questions, or issues:
- Visit: https://rskworld.in
- Email: help@rskworld.in
- Phone: +91 93305 39277

---

© 2026 RSK World. All rights reserved.

requirements.txt
Raw Download
Find: Go to:
# Conversational AI Bot - Requirements
# Developer: RSK World (https://rskworld.in)
# Email: help@rskworld.in
# Phone: +91 93305 39277
# Year: 2026

numpy>=1.21.0
scikit-learn>=1.0.0
nltk>=3.6
spacy>=3.4.0
python-dateutil>=2.8.2
colorama>=0.4.4
setuptools>=65.0.0
flask>=2.3.0
requests>=2.28.0

17 lines•311 B
text
QUICKSTART.md
Raw Download

QUICKSTART.md

# Quick Start Guide

<!--
Project: Conversational AI Bot
Developer: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277
Year: 2026
-->

## Quick Start (5 Minutes)

### Step 1: Install Dependencies

```bash
pip install -r requirements.txt
```

### Step 2: Download NLTK Data

```bash
python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords')"
```

### Step 3: Run the Bot

```bash
python main.py
```

That's it! You're ready to chat.

## Basic Usage

### Interactive Mode

```bash
python main.py
```

Then type your messages and press Enter.

### Programmatic Usage

```python
from chatbot import ConversationalAIBot

# Create bot instance
bot = ConversationalAIBot()

# Chat with the bot
response = bot.chat("Hello, my name is John")
print(response)

# Bot remembers context
response = bot.chat("What's my name?")
print(response) # Output: "Your name is John..."
```

## Example Commands

When running in interactive mode, you can use:

- `help` - Show available commands
- `context` - Show current conversation context
- `history` - Show conversation history
- `clear` - Clear conversation history
- `quit` or `exit` - Exit the chatbot

## Example Conversations

### Example 1: Basic Introduction

```
You: Hello
Bot: Hello! I'm a conversational AI bot. How can I assist you today?

You: My name is Alice
Bot: Nice to meet you, Alice! I'll remember that. How can I help you today?

You: What's my name?
Bot: Your name is Alice. I remember you from our previous conversation!
```

### Example 2: Asking Questions

```
You: What can you do?
Bot: I'm a conversational AI bot with the following capabilities:
• Context-aware conversations
• Multi-turn dialogue support
• Intent recognition
• Entity extraction
• Conversation history

You: What time is it?
Bot: The current time is 03:45 PM.

You: What's the date?
Bot: Today's date is January 01, 2026.
```

## Run Examples

To see more examples:

```bash
python example_usage.py
```

## Run Tests

To run the test suite:

```bash
python test_chatbot.py
```

## Need Help?

- Check the full [README.md](README.md) for detailed documentation
- See [INSTALLATION.md](INSTALLATION.md) for installation help
- Visit https://rskworld.in for more resources

## Contact

- **Website**: https://rskworld.in
- **Email**: help@rskworld.in
- **Phone**: +91 93305 39277

---

© 2026 RSK World. All rights reserved.

conversation_analytics.py
Raw Download
Find: Go to:
"""
Conversation Analytics Module
Tracks and analyzes conversation metrics and statistics.

Developer: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277
Year: 2026
"""

from typing import Dict, List
from datetime import datetime, timedelta
from collections import Counter, defaultdict


class ConversationAnalytics:
    """
    Tracks and analyzes conversation metrics.
    """
    
    def __init__(self):
        """Initialize conversation analytics."""
        self.metrics = {
            'total_conversations': 0,
            'total_messages': 0,
            'total_sessions': 0,
            'average_messages_per_session': 0.0,
            'intent_distribution': Counter(),
            'entity_distribution': Counter(),
            'sentiment_distribution': Counter(),
            'most_common_intents': [],
            'most_common_entities': [],
            'session_durations': [],
            'peak_hours': Counter(),
            'language_distribution': Counter()
        }
        
        self.session_start_times = {}
        self.session_messages = defaultdict(int)
    
    def track_message(self, session_id: str, intent: str = None, 
                     entities: Dict = None, sentiment: str = None,
                     language: str = 'en'):
        """
        Track a message in analytics.
        
        Args:
            session_id: Session identifier
            intent: Detected intent
            entities: Extracted entities
            sentiment: Sentiment analysis result
            language: Language code
        """
        self.metrics['total_messages'] += 1
        self.session_messages[session_id] += 1
        
        # Track intent
        if intent:
            self.metrics['intent_distribution'][intent] += 1
        
        # Track entities
        if entities:
            for entity_type, entity_values in entities.items():
                if entity_values:
                    self.metrics['entity_distribution'][entity_type] += 1
        
        # Track sentiment
        if sentiment:
            self.metrics['sentiment_distribution'][sentiment] += 1
        
        # Track language
        self.metrics['language_distribution'][language] += 1
        
        # Track peak hours
        current_hour = datetime.now().hour
        self.metrics['peak_hours'][current_hour] += 1
    
    def start_session(self, session_id: str):
        """
        Track session start.
        
        Args:
            session_id: Session identifier
        """
        self.session_start_times[session_id] = datetime.now()
        self.metrics['total_sessions'] += 1
    
    def end_session(self, session_id: str):
        """
        Track session end and calculate duration.
        
        Args:
            session_id: Session identifier
        """
        if session_id in self.session_start_times:
            start_time = self.session_start_times[session_id]
            duration = (datetime.now() - start_time).total_seconds()
            self.metrics['session_durations'].append(duration)
            del self.session_start_times[session_id]
    
    def get_metrics(self) -> Dict:
        """
        Get all analytics metrics.
        
        Returns:
            Dictionary with all metrics
        """
        # Calculate average messages per session
        if self.metrics['total_sessions'] > 0:
            self.metrics['average_messages_per_session'] = \
                self.metrics['total_messages'] / self.metrics['total_sessions']
        
        # Get most common intents
        self.metrics['most_common_intents'] = \
            self.metrics['intent_distribution'].most_common(10)
        
        # Get most common entities
        self.metrics['most_common_entities'] = \
            self.metrics['entity_distribution'].most_common(10)
        
        return self.metrics.copy()
    
    def get_summary(self) -> str:
        """
        Get human-readable analytics summary.
        
        Returns:
            Formatted summary string
        """
        metrics = self.get_metrics()
        
        summary = f"""
Conversation Analytics Summary
{'=' * 50}
Total Sessions: {metrics['total_sessions']}
Total Messages: {metrics['total_messages']}
Average Messages per Session: {metrics['average_messages_per_session']:.2f}

Top Intents:
"""
        for intent, count in metrics['most_common_intents'][:5]:
            summary += f"  - {intent}: {count}\n"
        
        summary += "\nTop Entities:\n"
        for entity, count in metrics['most_common_entities'][:5]:
            summary += f"  - {entity}: {count}\n"
        
        if metrics['sentiment_distribution']:
            summary += "\nSentiment Distribution:\n"
            for sentiment, count in metrics['sentiment_distribution'].items():
                summary += f"  - {sentiment}: {count}\n"
        
        if metrics['session_durations']:
            avg_duration = sum(metrics['session_durations']) / len(metrics['session_durations'])
            summary += f"\nAverage Session Duration: {avg_duration:.2f} seconds\n"
        
        return summary
    
    def reset(self):
        """Reset all analytics."""
        self.metrics = {
            'total_conversations': 0,
            'total_messages': 0,
            'total_sessions': 0,
            'average_messages_per_session': 0.0,
            'intent_distribution': Counter(),
            'entity_distribution': Counter(),
            'sentiment_distribution': Counter(),
            'most_common_intents': [],
            'most_common_entities': [],
            'session_durations': [],
            'peak_hours': Counter(),
            'language_distribution': Counter()
        }
        self.session_start_times = {}
        self.session_messages = defaultdict(int)

179 lines•5.9 KB
python
🚀 Support RSK World

Subscribe to our YouTube channel for latest tutorials & updates!



Click subscribe & support our work ❤️

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