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
nlp-text-analysis-bot
RSK World
nlp-text-analysis-bot
NLP Text Analysis Bot - Python + NLP + Flask + Machine Learning + Text Analysis + AI
nlp-text-analysis-bot
  • static
  • templates
  • .gitignore393 B
  • ADVANCED_FEATURES.md5.4 KB
  • CHANGELOG.md1.3 KB
  • FINAL_CHECK.md4.6 KB
  • GITHUB_RELEASE_INSTRUCTIONS.md4.1 KB
  • LICENSE1.2 KB
  • PROJECT_INFO.md2.7 KB
  • PROJECT_STATUS.md4 KB
  • QUICKSTART.md3.1 KB
  • README.md5.8 KB
  • RELEASE_NOTES.md3.8 KB
  • advanced_keywords.py3.9 KB
  • app.py3 KB
  • config.py668 B
  • emotion_detection.py4.3 KB
  • entity_recognition.py3 KB
  • example_usage.py2.7 KB
  • install.bat853 B
  • install.sh808 B
  • language_detection.py2.7 KB
  • nlp_pipeline.py7.1 KB
  • pos_tagging.py2.9 KB
  • readability_analysis.py3.5 KB
  • requirements.txt334 B
  • semantic_understanding.py4 KB
  • sentiment_analysis.py3.9 KB
  • setup.py1.4 KB
  • test_analysis.py2.5 KB
  • text_classification.py5 KB
  • text_preprocessing.py4.2 KB
  • text_similarity.py4.1 KB
  • text_summarization.py5 KB
  • validate_project.py4.2 KB
nlp_pipeline.py
nlp_pipeline.py
Raw Download
Find: Go to:
"""
NLP Pipeline Orchestrator
Coordinates all NLP modules for comprehensive text analysis

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

from text_preprocessing import TextPreprocessor
from sentiment_analysis import SentimentAnalyzer
from entity_recognition import EntityRecognizer
from semantic_understanding import SemanticAnalyzer
from text_summarization import TextSummarizer
from language_detection import LanguageDetector
from text_classification import TextClassifier
from readability_analysis import ReadabilityAnalyzer
from emotion_detection import EmotionDetector
from advanced_keywords import AdvancedKeywordExtractor
from pos_tagging import POSTagger

class NLPPipeline:
    """
    Main NLP Pipeline class that orchestrates all NLP modules
    Developer: RSK World - https://rskworld.in
    """
    
    def __init__(self):
        """Initialize all NLP modules"""
        self.preprocessor = TextPreprocessor()
        self.sentiment_analyzer = SentimentAnalyzer()
        self.entity_recognizer = EntityRecognizer()
        self.semantic_analyzer = SemanticAnalyzer()
        self.text_summarizer = TextSummarizer()
        self.language_detector = LanguageDetector()
        self.text_classifier = TextClassifier()
        self.readability_analyzer = ReadabilityAnalyzer()
        self.emotion_detector = EmotionDetector()
        self.advanced_keywords = AdvancedKeywordExtractor()
        self.pos_tagger = POSTagger()
    
    def analyze(self, text):
        """
        Perform complete NLP analysis on input text
        
        Args:
            text (str): Input text to analyze
            
        Returns:
            dict: Complete analysis results
        """
        # Validate input
        if not text or not isinstance(text, str):
            return {
                'error': 'Invalid input: text must be a non-empty string',
                'original_text': text if text else ''
            }
        
        if len(text.strip()) < 1:
            return {
                'error': 'Text is too short for analysis',
                'original_text': text
            }
        
        try:
            # Step 1: Preprocess text
            preprocessed = self.preprocessor.preprocess(text)
            
            # Step 2: Language Detection
            try:
                language = self.language_detector.detect_language(text)
            except Exception as e:
                print(f"Error in language detection: {e}")
                language = {'language': 'unknown', 'confidence': 0.0, 'all_languages': []}
            
            # Step 3: Sentiment Analysis
            try:
                sentiment = self.sentiment_analyzer.analyze(preprocessed.get('cleaned_text', text))
            except Exception as e:
                print(f"Error in sentiment analysis: {e}")
                sentiment = {'label': 'neutral', 'score': 0.0}
            
            # Step 4: Emotion Detection
            try:
                emotions = self.emotion_detector.detect_emotions(preprocessed.get('cleaned_text', text))
            except Exception as e:
                print(f"Error in emotion detection: {e}")
                emotions = {'primary_emotion': 'neutral', 'primary_score': 0.0, 'top_3_emotions': []}
            
            # Step 5: Entity Recognition
            try:
                entities = self.entity_recognizer.extract_entities(preprocessed.get('cleaned_text', text))
            except Exception as e:
                print(f"Error in entity recognition: {e}")
                entities = {'entities': [], 'entity_types': {}, 'total_entities': 0}
            
            # Step 6: Semantic Understanding
            try:
                semantic = self.semantic_analyzer.analyze(preprocessed.get('cleaned_text', text))
            except Exception as e:
                print(f"Error in semantic analysis: {e}")
                semantic = {'keywords': [], 'topics': [], 'phrases': [], 'key_concepts': []}
            
            # Step 7: Text Classification
            try:
                classification = self.text_classifier.classify(preprocessed.get('cleaned_text', text))
            except Exception as e:
                print(f"Error in text classification: {e}")
                classification = {'primary_category': 'unknown', 'primary_score': 0.0, 'top_3': []}
            
            # Step 8: Text Summarization
            try:
                summarization = self.text_summarizer.summarize(text, method='extractive')
            except Exception as e:
                print(f"Error in text summarization: {e}")
                summarization = {'method': 'error', 'summary': None, 'summary_length': 0}
            
            # Step 9: Readability Analysis
            try:
                readability = self.readability_analyzer.analyze(text)
            except Exception as e:
                print(f"Error in readability analysis: {e}")
                readability = {'error': str(e)}
            
            # Step 10: Advanced Keywords
            try:
                advanced_keywords = self.advanced_keywords.extract_key_phrases(text)
            except Exception as e:
                print(f"Error in advanced keyword extraction: {e}")
                advanced_keywords = {'tfidf_keywords': [], 'bigrams': [], 'trigrams': [], 'top_keywords': []}
            
            # Step 11: POS Tagging
            try:
                pos_analysis = self.pos_tagger.get_pos_statistics(text)
            except Exception as e:
                print(f"Error in POS tagging: {e}")
                pos_analysis = {'error': str(e)}
            
            return {
                'original_text': text,
                'preprocessing': preprocessed,
                'language': language,
                'sentiment': sentiment,
                'emotions': emotions,
                'entities': entities,
                'semantic': semantic,
                'classification': classification,
                'summarization': summarization,
                'readability': readability,
                'advanced_keywords': advanced_keywords,
                'pos_analysis': pos_analysis,
                'summary': {
                    'word_count': preprocessed.get('word_count', 0),
                    'sentence_count': preprocessed.get('sentence_count', 0),
                    'language': language.get('language', 'unknown'),
                    'sentiment_label': sentiment.get('label', 'neutral'),
                    'sentiment_score': sentiment.get('score', 0.0),
                    'primary_emotion': emotions.get('primary_emotion', 'neutral'),
                    'entity_count': len(entities.get('entities', [])),
                    'category': classification.get('primary_category', 'unknown'),
                    'reading_level': readability.get('reading_level', 'N/A') if not readability.get('error') else 'N/A',
                    'key_topics': semantic.get('topics', [])[:5]
                }
            }
        except Exception as e:
            print(f"Error in NLP pipeline: {e}")
            return {
                'error': f'Analysis error: {str(e)}',
                'original_text': text
            }

174 lines•7.1 KB
python

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