Sentiscope
Sentiscope is a powerful Python package for analyzing sentiment and extracting entities from financial news articles. It leverages multiple state-of-the-art sentiment analysis models and named entity recognition techniques to provide comprehensive insights into financial news.
Features
- Fetch financial news articles for specific sectors using NewsAPI
- Perform sentiment analysis using multiple models:
- FinBERT
- VADER
- ESG-BERT
- FinBERT-Tone
- Flair
- Extract named entities using:
- NLTK
- Flair
Installation
pip install sentiscope
Quick Start
from sentiscope import SentimentAnalyzer, NewsFetcher, EntityExtractor
# Initialize components
sentiment_analyzer = SentimentAnalyzer()
news_fetcher = NewsFetcher(api_key="your_newsapi_key_here")
entity_extractor = EntityExtractor()
# Fetch news
news = news_fetcher.fetch_financial_news("Banking")
# Analyze sentiment and extract entities
for article in news:
finbert_sentiment = sentiment_analyzer.analyze_sentiment_finbert(article['description'])
vader_sentiment = sentiment_analyzer.analyze_sentiment_vader(article['description'])
entities = entity_extractor.extract_entities_flair(article['description'])
print(f"Title: {article['title']}")
print(f"FinBERT Sentiment: {finbert_sentiment}")
print(f"VADER Sentiment: {vader_sentiment}")
print(f"Entities: {entities}")
print("---")
Detailed Usage
Sentiment Analysis
Sentiscope offers multiple sentiment analysis models:
text = "The company reported strong earnings, beating market expectations."
finbert_sentiment = sentiment_analyzer.analyze_sentiment_finbert(text)
vader_sentiment = sentiment_analyzer.analyze_sentiment_vader(text)
esgbert_sentiment = sentiment_analyzer.analyze_sentiment_esgbert(text)
finbert_tone_sentiment = sentiment_analyzer.analyze_sentiment_finbert_tone(text)
flair_sentiment = sentiment_analyzer.analyze_sentiment_flair(text)
News Fetching
Fetch financial news for specific sectors:
news = news_fetcher.fetch_financial_news("Technology")
Models
Sentiscope uses the following pre-trained models:
- FinBERT: Fine-tuned BERT for financial sentiment analysis
- ESG-BERT: BERT model for environmental, social, and governance (ESG) sentiment
- FinBERT-Tone: BERT model for financial sentiment tone analysis
- Flair: General-purpose sentiment analysis and named entity recognition
- VADER: Rule-based sentiment analysis tool
Dependencies
- transformers
- torch
- nltk
- flair
- requests
Note
This package requires an API key from NewsAPI to fetch financial news articles. You can obtain a key by registering at https://newsapi.org.
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have questions, please file an issue on the GitHub repository.
Acknowledgements
Sentiscope is built on top of several open-source projects and pre-trained models. We are grateful to the developers and researchers who have made their work available to the community.
Metadata
Release files for SENTISCOPE 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| SENTISCOPE-0.2.1.tar.gz | 4.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| SENTISCOPE-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / SENTISCOPE-0.2.1.tar.gz
| Download URL | SENTISCOPE-0.2.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c080438bd2e03ed8486c7b86ed9b71ebad3bbe785bca9acf99ed60f51596b3d0
|
|
BLAKE2b-256 checksum How to use checksums |
343b87bcfd3242794f9dd4114f26f31d3e81307a6ccedc5a7dafe9287bb8266e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.13
|
Release files / SENTISCOPE-0.2.1-py3-none-any.whl
| Download URL | SENTISCOPE-0.2.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96471b39a22586ba2e82c978251cc2fa680478607a84058a49e986e59dde944e
|
|
BLAKE2b-256 checksum How to use checksums |
078386e7a35ba18b223202417ee8ebead2e377c681cf32259b86fb6244a488c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.13
|
Security for SENTISCOPE 0.2.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.