Skip to content

Advanced natural language processing with state-of-the-art AI analysis

License

Notifications You must be signed in to change notification settings

Awrsha/Modern-Text-Analysis-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 NLP Insight - Modern Text Analysis Platform

Advanced natural language processing with state-of-the-art AI analysis

πŸ” Overview

NLP Insight is a sophisticated text analysis platform that combines modern UI design principles with powerful natural language processing capabilities. This application enables users to gain deep insights from text through sentiment analysis, emotion detection, entity recognition, topic modeling, and more.

NLP Insight Demo

✨ Features

  • 🎭 Sentiment & Emotion Analysis - Detect the emotional tone and sentiment of any text
  • πŸ” Named Entity Recognition - Identify people, organizations, locations, and more
  • πŸ“Š Advanced Visualizations - Interactive word clouds, radar charts, and bar graphs
  • πŸ“ Text Summarization - Generate concise summaries of longer texts
  • πŸ“š Topic Modeling - Discover the main topics and themes within text
  • πŸ”€ Word & Phrase Analysis - Examine frequency, bigrams, and trigrams
  • πŸ“ Readability Metrics - Assess text complexity and readability
  • πŸ”„ Text Comparison - Compare two texts side-by-side with detailed metrics
  • πŸŒ“ Light/Dark Mode - Automatic theme switching based on system preferences
  • πŸ“± Responsive Design - Works beautifully across all devices

πŸ— System Architecture

graph TB
    Client[Client Browser] <-->|HTTP/HTTPS| WebServer[Web Server]
    WebServer <-->|WSGI| Flask[Flask Application]
    
    subgraph Backend
        Flask -->|Text Analysis| NLPCore[NLP Processing Core]
        NLPCore -->|Sentiment Analysis| SA[SentimentIntensityAnalyzer]
        NLPCore -->|Entity Recognition| NER[Spacy NER]
        NLPCore -->|Emotion Detection| ED[Emotion Classifier]
        NLPCore -->|Summarization| Sum[BART Summarizer]
        NLPCore -->|Topic Modeling| TM[BERTopic]
    end
    
    subgraph Frontend
        Client -->|User Input| UI[User Interface]
        UI -->|Text Input| Analysis[Analysis Request]
        UI -->|Visualization| Charts[Interactive Charts]
        UI -->|Display Results| Results[Analysis Results]
    end
    
    style Client fill:#f9f9f9,stroke:#333,stroke-width:1px
    style Backend fill:#e6f3ff,stroke:#333,stroke-width:1px
    style Frontend fill:#f9f2ff,stroke:#333,stroke-width:1px

Loading

πŸ“¦ Installation

Prerequisites

  • Python 3.9 or higher
  • pip package manager
  • Node.js and npm (for frontend development)

Setup Instructions

  1. Clone the repository
git clone https://github.com/Awrsha/Modern-Text-Analysis-Platform.git
cd NLP Insight - Modern Text Analysis Platform
  1. Create a virtual environment
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt
  1. Download required NLP models
python -m spacy download en_core_web_trf
python -m nltk.downloader stopwords
  1. Set up environment variables
# On Windows
set FLASK_APP=app.py
set FLASK_ENV=development
# On macOS/Linux
export FLASK_APP=app.py
export FLASK_ENV=development
  1. Run the application
flask run

The application will be available at http://localhost:5000.

πŸš€ Usage

Basic Text Analysis

  1. Enter or paste your text in the "Text Analysis" section
  2. Click "Analyze Text"
  3. View the comprehensive analysis results:
    • Sentiment and emotion detection
    • Text summary
    • Word cloud visualization
    • Entity recognition
    • Frequency analysis

Text Comparison

  1. Enter two different texts in the "Text Comparison" section
  2. Click "Compare Texts"
  3. Explore the comparative analysis:
    • Side-by-side sentiment and emotion analysis
    • Radar chart comparing key metrics
    • Comparative entity detection
    • Word frequency comparison

πŸ“˜ API Documentation

NLP Insight exposes RESTful API endpoints for integration with other applications.

Analyze Text

Endpoint: /analyze

Method: POST

Request Body:

{
  "text": "Your text content to analyze goes here."
}

Response:

{
  "sentiment": "Positive",
  "sentimentScore": 0.76,
  "emotion": "joy",
  "emotionScore": 0.82,
  "summary": "Concise summary of the text...",
  "entities": [
    {"entity": "Microsoft", "label": "ORGANIZATION"},
    {"entity": "New York", "label": "LOCATION"}
  ],
  "topics": [
    {"label": "technology software development", "score": 0.45},
    {"label": "business innovation strategy", "score": 0.31}
  ],
  "wordFreq": [
    ["technology", 12],
    ["innovation", 8]
  ],
  "bigrams": ["artificial intelligence", "machine learning"],
  "trigrams": ["natural language processing", "data science applications"],
  "complexity": 0.68,
  "readability": "College",
  "readabilityScore": 0.74
}

Compare Texts

Endpoint: /compare

Method: POST

Request Body:

{
  "text1": "First text content to compare.",
  "text2": "Second text content to compare."
}

Response:

{
  "text1": {
    "sentiment": "Positive",
    "sentimentScore": 0.65,
    "emotion": "approval",
    "emotionScore": 0.72,
    "entities": [...],
    "wordFreq": [...],
    "metrics": [0.45, 0.82, 0.56, 0.7, 0.68, 0.35]
  },
  "text2": {
    "sentiment": "Negative",
    "sentimentScore": 0.58,
    "emotion": "disappointment",
    "emotionScore": 0.64,
    "entities": [...],
    "wordFreq": [...],
    "metrics": [0.62, 0.28, 0.72, 0.45, 0.52, 0.7]
  }
}

πŸ”§ Technology Stack

graph TD
    subgraph Frontend
        HTML[HTML5]
        CSS[CSS3/Tailwind CSS]
        JS[JavaScript]
        Charts[Chart.js]
        D3[D3.js]
    end
    
    subgraph Backend
        Python[Python 3.9+]
        Flask[Flask]
        WSGI[WSGI Server]
    end
    
    subgraph "NLP Stack"
        Spacy[Spacy 3.5+]
        NLTK[NLTK]
        HF[HuggingFace Transformers]
        VADER[VADER Sentiment]
        BT[BERTopic]
        BART[BART Summarizer]
    end
    
    subgraph Deployment
        Docker[Docker]
        Nginx[Nginx]
        Cloud[Cloud Platform]
    end
    
    Frontend --> Backend
    Backend --> NLP
    NLP --> Backend
    Backend --> Deployment
    
    style Frontend fill:#f9f2ff,stroke:#333,stroke-width:1px
    style Backend fill:#e6f3ff,stroke:#333,stroke-width:1px
    style NLP fill:#fff2e6,stroke:#333,stroke-width:1px
    style Deployment fill:#f0f9e8,stroke:#333,stroke-width:1px

Loading

πŸ“Š Performance Considerations

Memory Requirements

  • Minimum RAM: 4GB (basic functionality)
  • Recommended RAM: 8GB+ (full feature set)

The application loads several NLP models that require significant memory:

  • Spacy's en_core_web_trf: ~1GB
  • HuggingFace models: ~2-4GB combined
  • BERTopic: ~500MB

Optimization Techniques

  1. Lazy Loading: Models are loaded only when needed
  2. Batching: Large texts are processed in chunks
  3. Caching: Frequent analysis results are cached to improve response time
  4. Asynchronous Processing: Long-running analyses are processed asynchronously

Scaling Considerations

For high-traffic deployments, consider:

  • Horizontal scaling with multiple instances
  • Redis for distributed caching
  • Load balancing for request distribution
  • Model quantization for reduced memory footprint

πŸ—“ Development Roadmap

gantt
    title NLP Insight Development Roadmap
    dateFormat  YYYY-MM-DD
    section Core Features
    UI/UX Enhancements           :done, 2024-07-01, 30d
    Performance Optimization     :done, 2024-08-01, 30d
    Multilingual Support         :active, 2024-09-01, 90d
    section Advanced Features
    Custom Model Training        :2024-10-15, 60d
    PDF/Document Analysis        :2024-11-15, 45d
    API Enhancements             :2024-01-01, 30d
    section Future Directions
    Real-time Analysis           :2025-02-01, 60d
    Advanced Visualization       :2025-03-15, 45d
    Enterprise Features          :2025-05-01, 90d

Loading

Upcoming Features

  • 🌐 Multilingual Support - Text analysis in multiple languages
  • πŸ“„ Document Analysis - Support for PDF, DOCX, and other document formats
  • πŸ”„ Real-time Analysis - Stream text analysis as you type
  • πŸ“± Mobile App - Native mobile applications
  • πŸ€– Custom Model Training - Train specialized models on your own data
  • πŸ” Enterprise Features - SSO, role-based access control, and audit logs

About

Advanced natural language processing with state-of-the-art AI analysis

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published