Skip to main content

NLPAP - NLP Analyzer Package

A comprehensive Natural Language Processing library that provides easy-to-use tools for text preprocessing, semantic analysis, and information extraction.

Features

Q1: Text Preprocessing & Representation

  • ✅ Advanced tokenization using NLTK
  • ✅ Stop word removal and text cleaning
  • ✅ Lemmatization and stemming
  • ✅ Bag-of-Words (BoW) representation
  • ✅ TF-IDF calculation and analysis
  • ✅ Vocabulary analysis and word frequency

Q2: Semantic Understanding & Language Modeling

  • ✅ WordNet integration for synonyms, antonyms, and hypernyms
  • ✅ N-gram language models (unigram, bigram, trigram)
  • ✅ Laplace smoothing for probability estimation
  • ✅ Next word prediction capabilities
  • ✅ Semantic relationship extraction

Q3: Information Extraction & Sentiment Analysis

  • ✅ Named Entity Recognition (NER)
  • ✅ Rule-based sentiment analysis
  • ✅ Word similarity analysis using co-occurrence
  • ✅ Entity classification (Person, Organization, Location)
  • ✅ Sentiment distribution analysis

Installation

pip install nlpap

Quick Start

from nlpap import ComprehensiveNLP

# Initialize the analyzer
nlp = ComprehensiveNLP()

# Sample texts (Mental Health domain example)
texts = [
    "I feel overwhelmed with anxiety and stress lately. Need professional help.",
    "The therapy sessions have been very helpful for my mental health recovery.",
    "Depression affects many students during exam periods. Support is crucial."
]

# Run complete analysis
results = nlp.run_complete_analysis(texts)

# Access individual components
processed_data, tokens = nlp.preprocess_text(texts)
semantic_data = nlp.semantic_analysis(tokens)
entities, sentiments = nlp.information_extraction_and_sentiment(texts)

Detailed Usage

Text Preprocessing & Representation

# Initialize analyzer
nlp = ComprehensiveNLP()

# Preprocess texts
processed_data, all_tokens = nlp.preprocess_text(your_texts)

# The method returns:
# - Tokenized text
# - Filtered tokens (no stopwords/punctuation)
# - Lemmatized tokens
# - Stemmed tokens
# - BoW and TF-IDF representations

Semantic Analysis

# Analyze semantic relationships
semantic_data = nlp.semantic_analysis(tokens)

# Returns WordNet analysis:
# - Definitions
# - Synonyms and antonyms
# - Hypernyms (broader categories)
# - Language model with Laplace smoothing

Information Extraction & Sentiment

# Extract entities and analyze sentiment
entities, sentiments = nlp.information_extraction_and_sentiment(texts)

# Returns:
# - Named entities (Person, Organization, Location)
# - Sentiment classification (Positive, Negative, Neutral)
# - Word similarity analysis

Command Line Interface

After installation, you can use the command line interface:

# Analyze a single text
nlpap-analyze --text "Your text here"

# Analyze a file
nlpap-analyze --file path/to/your/textfile.txt

# Get help
nlpap-analyze --help

Dependencies

  • nltk >= 3.7
  • numpy >= 1.19.0
  • pandas >= 1.2.0
  • matplotlib >= 3.3.0

Educational Use

This library is designed for educational purposes and covers fundamental NLP concepts:

  1. Text Preprocessing: Learn how to clean and prepare text data
  2. Representation Methods: Understand BoW vs TF-IDF approaches
  3. Semantic Analysis: Explore word relationships using WordNet
  4. Language Modeling: Implement N-gram models with smoothing
  5. Information Extraction: Practice NER and sentiment analysis
  6. Word Embeddings: Analyze word similarity and relationships

Examples

Mental Health Text Analysis

from nlpap import ComprehensiveNLP

# Mental health related texts
mental_health_texts = [
    "Feeling stressed about exams, need support and guidance.",
    "Therapy has been helpful for managing anxiety effectively.",
    "University counseling services provide excellent mental health support."
]

nlp = ComprehensiveNLP()
results = nlp.run_complete_analysis(mental_health_texts)

print("Analysis complete!")
print(f"Entities found: {results['entities']}")
print(f"Sentiments: {results['sentiments']}")

Custom Domain Analysis

# Use with your own domain-specific texts
your_texts = [
    "Your domain-specific text here...",
    "Another text for analysis...",
]

nlp = ComprehensiveNLP()

# Run individual analyses
processed_data, tokens = nlp.preprocess_text(your_texts)
semantic_data = nlp.semantic_analysis(tokens)
entities, sentiments = nlp.information_extraction_and_sentiment(your_texts)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this library in your research or projects, please cite:

@software{nlp_comprehensive_analyzer,
  title={NLP Comprehensive Analyzer},
  author={Your Name},
  year={2024},
  url={https://github.com/yourusername/nlp-comprehensive-analyzer}
}

Support

For support, please open an issue on GitHub or contact [your.email@example.com]


Perfect for students, researchers, and developers learning NLP fundamentals!

Metadata

Release files for nlpap 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nlpap 1.0.1
File Size Uploaded Provenance
nlpap-1.0.1.tar.gz 16.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nlpap 1.0.1
File Interpreter ABI Platform
nlpap-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.6 kB

Release files / nlpap-1.0.1.tar.gz

Download URL nlpap-1.0.1.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4a1da664c87c11038c5e6c0911de2493c8e5ea70970cf56ae59bf6338f5929c3
BLAKE2b-256 checksum
How to use checksums
c2858158dcc7e8c45194ccfde54291a092b8854e8994fbd9e9f41846cdb000dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / nlpap-1.0.1-py3-none-any.whl

Download URL nlpap-1.0.1-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a1d7e119e6d0e36bb7fb07de77c2614c051fd3a3023bfafa57789588ff2924a
BLAKE2b-256 checksum
How to use checksums
35c056bf23d5a008d7165cadd80e3e10c5c4d7f3e1700b38fdf4f24e240a6991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for nlpap 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page