This package includes powerful tools to perform natural language processing on English texts.
Project description
messageanalyzer
messageanalyzer is a Python package designed for performing comprehensive Natural Language Processing (NLP) tasks on text messages. This package provides tools for sentiment analysis, keyword extraction, topic modeling, and language patterns detection, making it ideal for text mining and content analysis projects. Full documentation and tutorial is hosted on ReadtheDocs.
messageanalyzeris built for developers, data scientists, and researchers working in text mining, social media analysis, and customer feedback evaluation. Its easy-to-use design makes it a great fit for both NLP beginners who want straightforward solutions and experienced professionals seeking a quick, efficient way to draw insights from text data. Whether you’re analyzing customer reviews, survey responses, or social media content, this package offers a reliable tool to support business decisions, sentiment monitoring, and academic research in a practical and user-friendly way.
Installation
$ pip install messageanalyzer
Usage
Activate Python
Ensure you have Python installed on your system. To get started, activate it by running:
python
Here’s a sample text list that will be used in the examples below:
sample_text = [
"Artificial intelligence and machine learning are transforming industries around the globe.",
"The basketball team secured a thrilling victory in the final seconds of the game.",
"Yoga and meditation are excellent for reducing stress and improving mental health.",
"Exploring the hidden beaches of Bali is an unforgettable experience for any traveler.",
"Quantum computing is expected to revolutionize data processing and cryptography."
]
You can now test the package with the examples below.
-
analyze_sentiment(messages: List[str], model: str = "Default") -> List[dict]:
This function analyzes the sentiment of a list of given messages and returns the sentiment scores and labels for each message.Example:
from messageanalyzer.sentiment_analysis import analyze_sentiment result = analyze_sentiment(sample_text) print(result)
-
topic_modeling(messages: List[str], n_topics: int = 5, n_words: int = 10, random_state: int = 123) -> dict:
This function extracts topics from a list of messages and returns the words that represent the extracted topics using Nonnegative Matrix Factorization.Example:
from messageanalyzer.topic_modeling import topic_modeling topics = topic_modeling(sample_text, n_topics=2, n_words=3) print(topics)
-
extract_keywords(messages: List[str], num_keywords: int = 5) -> list:
This function extracts the top keywords from a list of messages.Example:
from messageanalyzer.extract_keywords import extract_keywords keywords = extract_keywords(sample_text, num_keywords=3) print(keywords)
-
detect_language_patterns(messages: List[str], method: str = "language", n: int = 2, top_n: int = 5) -> list:
This function detects language patterns such as detected languages, common n-grams, or character usage patterns from a list of messages.Example:
from messageanalyzer.detect_language_patterns import detect_language_patterns patterns = detect_language_patterns(sample_text, method="language") print(patterns)
Running Test
Here is the code we’ve written for testing using pytest. Under the project root, run this following code :
poetry run pytest tests
Ecosystem Fit
messageanalyzer integrates into the Python NLP ecosystem by offering a simple yet powerful toolkit for analyzing text data. While other Python libraries like NLTK and spaCy provide extensive NLP functionalities, messageanalyzer focuses on making sentiment analysis, keyword extraction, and language pattern visualization more accessible and user-friendly.
For keyword extraction, packages like YAKE and RAKE-NLTK provide similar functionality. However, messageanalyzer combines these tasks into a unified and streamlined workflow.
Contributing
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
Dependencies
TextBlob: For sentiment analysis.langdetect: For language detection.scikit-learn: For keyword extraction, n-gram analysis (CountVectorizer), and topic modeling.collections.Counter: For frequency analysis.
License
messageanalyzer was created by Quanhua Huang, Adrian Leung, Anna Nandar, Colombe Tolokin. It is licensed under the terms of the MIT license.
Credits
messageanalyzer was created with cookiecutter and the py-pkgs-cookiecutter template.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file messageanalyzer-2.0.3.tar.gz.
File metadata
- Download URL: messageanalyzer-2.0.3.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a1e971f8b46f1579910ee03682c0de1abca6e650642307188768fda848c278a
|
|
| MD5 |
874184a755cc0caea682aac4b6bb4c4b
|
|
| BLAKE2b-256 |
ab7b4c50c7f4a0934644440595325efc6968dcbee1f6ac1726092a645e427e4a
|
File details
Details for the file messageanalyzer-2.0.3-py3-none-any.whl.
File metadata
- Download URL: messageanalyzer-2.0.3-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fc881447d85a8f29939e44a32617ea439ab1f3edcee785a79c5185fbef6024a
|
|
| MD5 |
9ca484472ea7c841d919fd50cc7efbf2
|
|
| BLAKE2b-256 |
f4a1c8a18090e867d1801a28790e33ccb77223f8da22c110bd70c0273d913c50
|