""" @author: Pradeep Yadav """
A persona-based conversational AI built with Hugging Face Transformers and NLP techniques. This chatbot can switch between different character personas and maintain contextual conversations.
- Multiple Personas: Switch between different character personas with unique personalities
- Intent Recognition: ML-based intent classification using TF-IDF and Random Forest
- Contextual Responses: Maintains conversation history and context
- NLP Preprocessing: Text cleaning, tokenization, and normalization
- Hugging Face Integration: DialoGPT for state-of-the-art dialogue generation
- Python - Core programming language
- Hugging Face Transformers - Dialogue generation
- Pandas - Data handling and processing
- Scikit-learn - Machine learning for intent classification
- NLTK - Natural language processing
- PyTorch - Deep learning framework
Persona-chatbot/ ├── 📁 chatbot/ # Core chatbot modules │ ├── init.py │ ├── persona_bot.py # Main chatbot class │ ├── intent_classifier.py # ML intent classification │ ├── data_processor.py # NLP preprocessing │ └── config.py # Configuration settings ├── 📁 data/ # Training data │ ├── intents.csv │ └── persona_data.csv ├── 📁 scripts/ # Utility scripts │ ├── create_data_files.py │ ├── enhance_intents.py │ ├── verify_data.py │ └── fix_data_files.py ├── 📁 tests/ # Test files │ ├── test_installation.py │ ├── test_data_processor.py │ ├── test_intents.py │ ├── simple_test.py │ └── test_fixed_chatbot.py ├── 📄 app.py # Main application ├── 📄 demo_chatbot.py # Demo showcase ├── 📄 minimal_chatbot.py # Minimal version ├── 📄 requirements.txt # Dependencies ├── 📄 README.md # Documentation └── 📄 .gitignore # Git ignore file
- Clone the repository:
git clone https://github.com/PRADEEP930/Persona-chatbot.git
cd persona-chatbot- Create virtual environment:
conda create -n persona-chatbot python=3.10
conda activate persona-chatbot- Install dependencies:
pip install -r requirements.txtUsage
For a quick start and basic understanding, check out simple_chatbot.py - a minimal implementation using GPT-2 that demonstrates the core concept in less than 20 lines of code.
File: simple_chatbot.py - Basic GPT-2 chatbot for quick testing and learning.
python simple_chatbot.pyFor Full Features (Main Project):
Run the main chatbot:
python app.pyRun the demo:
python demo_chatbot.pyRun tests:
python tests/final_test.py🎭 Available Personas Alex: Friendly tech support specialist
Dr. Smith: Empathetic medical professional
Professor Davis: Analytical academic researcher
Creative Casey: Enthusiastic artistic designer
🔧 Customization
Adding New Personas Edit data/persona_data.csv:
name,description,personality,expertise Your Persona,a new character,traits,keywords expertise
Adding New Intents Edit data/intents.csv:
tag,patterns,responses new_intent,pattern1|pattern2|pattern3,Response text
📊 Model Details Base Model: Microsoft DialoGPT-small
Intent Classifier: TF-IDF + Random Forest
Training Data: Custom intents and patterns
Response Generation: Conditional text generation with persona context
🤝 Contributing Fork the repository
Create a feature branch (git checkout -b feature/amazing-feature)
Commit your changes (git commit -m 'Add amazing feature')
Push to the branch (git push origin feature/amazing-feature)
Open a Pull Request
📝 License This project is licensed under the MIT License - see the LICENSE file for details.