Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Advanced sentiment analysis platform for text, web content, audio data and Image data
Here’s a detailed documentation for your Sentimatrix
project, including the functionalities and sample code for accessing them.
Sentimatrix
is a sentiment analysis and web scraping toolkit designed to analyze and visualize sentiments from various sources, including text, audio, and images. It offers integration with local and remote sentiment analysis models and web scrapers.
Please Note: This is a beta version of the project, and it is in the initial stages of development. Updates will be patched frequently. Ensure you review the latest documentation and updates regularly.
Before using this product, make sure to:
Get API Keys:
API Notes:
Audio Files:
.wav
format before processing.Quick Sentiment Analysis
Feedback Sentiment from Websites
Overall Summary Sentiment Analysis
Analytical Visualization
Sentiment Analysis from Audio Files
Product Comparison
Sentiment Analysis from Image Files
Multi-Language Sentiment Analysis
Local Scraper Configuration
Save Reviews to CSV
You can install Sentimatrix
using pip:
pip install sentimatrix
from Sentimatrix.sentiment_generation import SentConfig
sent = SentConfig(
Use_Local_Sentiment_LLM=True,
Use_Local_Scraper=True,
device_map="auto"
)
Description: Analyze the sentiment of short text messages quickly using local sentiment models.
Usage:
from Sentimatrix.sentiment_generation import SentConfig
Sent = SentConfig(
Use_Local_Sentiment_LLM=True,
)
sentiments = ["I am very happy", "I am very sad", "I am alright"]
sentiment_result = Sent.get_Quick_sentiment(text_message=sentiments, device_map="auto")
print(sentiment_result)
Description: Scrape reviews from e-commerce websites and analyze their sentiments.
Usage:
Initialization and Scraping:
from Sentimatrix.utils.web_scraper import ReviewScraper
scraper = ReviewScraper(Use_Local_Scraper=True)
url = "https://www.amazon.com/Razer-Huntsman-Esports-Gaming-Keyboard/dp/B0CG7FQML2"
reviews_local = scraper.fetch_reviews(url)
list_of_sentences = [' '.join(sublist) for sublist in reviews_local]
for sentence in list_of_sentences:
print(sentence)
Adding and Checking Review Patterns:
scraper.add_review_pattern('div', {'class': 'new-review-class'})
current_patterns = scraper.get_review_patterns()
print("Current review patterns:", current_patterns)
Description: Analyze sentiments from reviews on a given website. Supports both local and API-based scraping.
Usage:
Without Scraper API:
from Sentimatrix.sentiment_generation import SentConfig
Sent = SentConfig(
Use_Local_Sentiment_LLM=True,
device_map="auto"
)
target = 'https://www.amazon.in/ASUS-Battery-i7-13650HX-Windows-G614JU-N3200WS/dp/B0C4TVHMR9?th=1'
result = Sent.get_sentiment_from_website_each_feedback_sentiment(
target_website=target,
Use_Local_Scraper=True,
get_Groq_Review=False
)
print(result)
With Scraper API:
from Sentimatrix.sentiment_generation import SentConfig
Sent = SentConfig(
Use_Local_Sentiment_LLM=True,
device_map="auto",
Use_Scraper_API=True,
Scraper_api_key=""
)
target = 'https://www.amazon.in/ASUS-Battery-i7-13650HX-Windows-G614JU-N3200WS/dp/B0C4TVHMR9?th=1'
result = Sent.get_sentiment_from_website_each_feedback_sentiment(
target_website=target,
get_Groq_Review=False
)
print(result)
Description: Scrape and analyze sentiments from multiple sites simultaneously.
Usage:
from Sentimatrix.sentiment_generation import SentConfig
Sent = SentConfig(
Use_Local_Sentiment_LLM=True,
device_map="auto"
)
targets = [
'https://www.amazon.in/ASUS-Battery-i7-13650HX-Windows-G614JU-N3200WS/dp/B0C4TVHMR9?th=1',
'https://www.amazon.com/Legendary-Whitetails-Journeyman-Jacket-Tarmac/dp/B013KW38RQ/ref=cm_cr_arp_d_product_top?ie=UTF8'
]
result = Sent.get_sentiment_from_website_each_feedback_sentiment(
target_website=targets,
Use_Local_Scraper=True,
get_Groq_Review=False
)
print(result)
Description: Analyze sentiment from audio files.
Usage:
from Sentimatrix.sentiment_generation import SentConfig
Sent = SentConfig(
Use_Local_Scraper=True,
Use_Local_Sentiment_LLM=True
)
audio_path = r'D:\Sentimatrix\tests\voice_datasets-wav\review_1.wav'
result = Sent.get_Sentiment_Audio_file(audio_path)
print(result)
Description: Compare sentiments of reviews for two different products.
Usage:
from Sentimatrix.sentiment_generation import SentConfig
Sent = SentConfig(
Use_Local_Scraper=True,
Use_Groq_API=True,
Use_Local_Sentiment_LLM=True,
Groq_API=''
)
targetsite1 = 'https://www.amazon.in/ASUS-Battery-i7-13650HX-Windows-G614JU-N3200WS/dp/B0C4TVHMR9?th=1'
targetsite2 = 'https://www.amazon.in/dp/B0CV9S7ZV6/ref=sspa_dk_detail_0?pd_rd_i=B0CV9S7ZV6'
result = Sent.compare_product_on_reviews(
target_website1=targetsite1,
target_website2=targetsite2
)
print(result)
Description: Analyze sentiment from images containing text.
Usage:
from Sentimatrix.sentiment_generation import SentConfig
Sent = SentConfig(
Use_Local_Scraper=True,
Use_Local_Sentiment_LLM=True
)
image_path = ''
result = Sent.get_Sentiment_Image_file(Image_File_path=image_path, Image_to_Text_Model='microsoft/Florence-2-large')
print(result)
Description: Perform sentiment analysis on text in multiple languages.
Usage:
from Sentimatrix.sentiment_generation import SentConfig
SENT = SentConfig(
Use_Local_Sentiment_LLM=True
)
message = 'நான் இந்த தயாரிப்பை வெறுக்கிறேன்'
result = SENT.Multi_language_Sentiment(message)
print(result)
Description: Manage local scraper configurations and save reviews to CSV.
Usage:
Configuring Local Scraper:
from Sentimatrix.sentiment_generation import SentConfig
Sent = SentConfig()
result = Sent.Config_Local_Scraper(action='get')
print(result)
Saving Reviews to CSV:
from Sentimatrix.sentiment_generation import SentConfig
Sent = SentConfig(
Use_Local_Scraper=True,
Use_Local_Sentiment_LLM=True
)
target = 'https://www.amazon.in/ASUS-Battery-i7-13650HX-Windows-G614JU-N3200WS/dp/B0C4TVHMR9?th=1'
Sent.Save_reviews_to_CSV(
target_site=target,
output_dir=r'',
file_name='review.csv'
)
get_sentiment_from_website_overall_summary
: This function is still under development. It will be updated in future releases.compare_product_on_reviews
: Features for this function will be updated soon, including additional mathematical comparisons.Use_Local_Sentiment_LLM
(bool): Whether to use a local sentiment analysis model.Use_Scraper_API
(bool): Whether to use an external scraper API.Scraper_api_key
(str): API key for accessing the external scraper.Use_Local_Scraper
(bool): Whether to use a local web scraper.Use_Groq_API
(bool): Whether to use the Groq API for sentiment analysis.Groq_API
(str): API key for accessing the Groq API.Use_Local_General_LLM
(bool): Whether to use a general local LLM for analysis.device_map
(str): Device configuration for model inference (e.g., "auto").This documentation provides an overview of Sentimatrix
functionalities and usage. For more detailed configurations and advanced features, refer to the specific function implementations or the project's source code.
Feel free to modify any details or add additional sections based on specific project needs.
To ensure the correctness of your implementation, you can run the unit tests included in the tests/test_sent_config.py
file. Use the following command to run the tests:
pytest
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
Advanced sentiment analysis platform for text, web content, audio data and Image data
We found that Sentimatrix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.