Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Offline AI Assistant

A comprehensive offline AI assistant that provides Text-to-Speech (TTS), Speech-to-Text (STT), sentiment analysis, and document analysis capabilities without requiring an internet connection.

πŸš€ Features

Core Capabilities

  • Text-to-Speech (TTS): Convert text to speech using pyttsx3
  • Speech-to-Text (STT): Convert speech to text using speech recognition
  • Sentiment Analysis: Analyze text sentiment using VADER
  • Document Analysis: Analyze documents using Gensim (topic modeling, word frequency, etc.)
  • 100% Offline: All processing done locally without internet dependency

Operating Modes

  • Voice Mode: Full voice interaction (TTS + STT)
  • Text Mode: Text-based interaction for environments without audio

πŸ“‹ Requirements

System Requirements

  • Python 3.7 or higher
  • Windows 10/11, macOS, or Linux
  • Microphone and speakers (for voice mode)
  • At least 2GB RAM
  • 500MB free disk space

Python Dependencies

  • pyttsx3 (TTS)
  • SpeechRecognition (STT)
  • PyAudio (Audio processing)
  • vaderSentiment (Sentiment analysis)
  • gensim (Document analysis)
  • numpy, scipy (Numerical processing)

πŸ› οΈ Installation

1. Clone or Download

git clone <repository-url>
cd offline-ai-assistant

2. Install Python Dependencies

pip install -r requirements.txt

3. Platform-Specific Setup

Windows

  • PyAudio should install automatically
  • TTS uses Windows SAPI voices
  • No additional setup required

macOS

# Install portaudio (required for PyAudio)
brew install portaudio

# Install dependencies
pip install -r requirements.txt

Linux (Ubuntu/Debian)

# Install system dependencies
sudo apt-get update
sudo apt-get install python3-pyaudio portaudio19-dev espeak-ng

# Install Python dependencies
pip install -r requirements.txt

Linux (CentOS/RHEL/Fedora)

# Install system dependencies
sudo yum install portaudio-devel espeak-ng
# or for Fedora: sudo dnf install portaudio-devel espeak-ng

# Install Python dependencies
pip install -r requirements.txt

πŸš€ Usage

Running the Assistant

python main.py

Mode Selection

The assistant will prompt you to choose between:

  1. Voice Mode: Full voice interaction
  2. Text Mode: Text-based interaction

Available Commands

Basic Commands

  • hello / hi - Greeting
  • time - Get current time
  • date - Get current date
  • help - Show available commands
  • exit / quit - Close the assistant

Sentiment Analysis

  • sentiment or analyze - Analyze text sentiment
  • The assistant will prompt you to enter text for analysis

Document Analysis

  • document or analyze document - Analyze document content
  • The assistant will prompt you to enter text for analysis

πŸ”§ Configuration

TTS Settings

You can modify TTS settings in the initialize_tts() method:

  • Speech rate (default: 150)
  • Volume level (default: 0.9)
  • Voice selection

STT Settings

Adjust STT parameters in the initialize_stt() method:

  • Energy threshold (default: 4000)
  • Dynamic energy threshold (default: True)
  • Pause threshold (default: 0.8)

Audio Settings

Modify audio parameters in the __init__ method:

  • Sample rate (default: 44100 Hz)
  • Channels (default: 1)
  • Chunk size (default: 1024)

πŸ“Š Features in Detail

Text-to-Speech (TTS)

  • Engine: pyttsx3 with system TTS backends
  • Voices: Automatically selects best available voice
  • Customization: Adjustable speed and volume
  • Languages: Supports multiple languages based on system voices

Speech-to-Text (STT)

  • Engine: SpeechRecognition with Google's speech recognition
  • Noise Reduction: Automatic ambient noise adjustment
  • Timeout Handling: Configurable listening timeouts
  • Error Handling: Graceful fallback for recognition failures

Sentiment Analysis

  • Engine: VADER (Valence Aware Dictionary and sEntiment Reasoner)
  • Features:
    • Positive, negative, and neutral sentiment scores
    • Compound sentiment score (-1 to +1)
    • Sentiment categorization
  • Use Cases: Social media analysis, customer feedback, content analysis

Document Analysis

  • Engine: Gensim
  • Features:
    • Topic modeling (LDA)
    • Word frequency analysis
    • Key topic extraction
    • Document statistics
  • Use Cases: Content analysis, document clustering, topic discovery

πŸ› Troubleshooting

Common Issues

TTS Not Working

  • Check if system has TTS voices installed
  • On Linux, install espeak-ng: sudo apt-get install espeak-ng
  • Verify pyttsx3 installation: pip show pyttsx3

STT Not Working

  • Check microphone permissions
  • Verify PyAudio installation: pip show PyAudio
  • On Linux, install portaudio: sudo apt-get install portaudio19-dev

Import Errors

  • Ensure all dependencies are installed: pip install -r requirements.txt
  • Check Python version: python --version
  • Verify virtual environment if using one

Audio Quality Issues

  • Adjust microphone settings in system preferences
  • Modify audio parameters in the code
  • Check audio drivers and hardware

Performance Optimization

  • Reduce TTS speech rate for better clarity
  • Adjust STT energy threshold for your environment
  • Use text mode for faster processing without audio

πŸ”’ Privacy & Security

  • 100% Offline: No data sent to external services
  • Local Processing: All analysis done on your device
  • No Logging: Optional logging can be disabled
  • Secure: No network communication required

πŸ“ Logging

The assistant creates log files for debugging:

  • File: ai_assistant.log
  • Console: Real-time logging to terminal
  • Level: INFO by default

To disable logging, modify the setup_logging() method.

🀝 Contributing

Contributions are welcome! Areas for improvement:

  • Additional TTS engines
  • More STT options
  • Enhanced sentiment analysis
  • Better document analysis algorithms
  • UI improvements
  • Performance optimizations

πŸ“„ License

This project is open source. Please check the license file for details.

πŸ™ Acknowledgments

  • pyttsx3: Cross-platform TTS library
  • SpeechRecognition: Speech recognition library
  • VADER: Sentiment analysis tool
  • Gensim: Topic modeling and document analysis
  • PyAudio: Audio processing library

πŸ“ž Support

For issues and questions:

  1. Check the troubleshooting section
  2. Review the logs in ai_assistant.log
  3. Verify all dependencies are installed
  4. Check system audio settings

Note: This assistant is designed to work completely offline. For best results, ensure your system has good quality TTS voices and a working microphone.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages