A sentiment analysis toolkit using a trained TensorFlow model
Project description
SentiToolKit ย

SentiToolKit is a simple sentiment analysis library that leverages LSTM (Long Short-Term Memory) neural networks for predicting the sentiment of a given text. This toolkit provides a streamlined interface for text preprocessing, model loading, and prediction.
โจ Features
- Pre-trained Model: Uses a trained LSTM model for sentiment analysis.
- Tokenization Support: Handles text tokenization with a customizable vocabulary size.
- Sentiment Prediction: Predicts whether a text is
Positive,Neutral, orNegative. - Easy to Use: Minimal setup required to get predictions.
- Customizable: You can use your own tokenizer and model for fine-tuning.
๐ฆ Installation
You can install the SentiToolKit package via pip:
pip install SentiToolKit==1.0.8
Alternatively, if you'd like to build from source:
-
Clone the repository:
git clone https://github.com/yourusername/SentiToolKit.git
-
Navigate to the project directory and install the package:
cd SentiToolKit pip install .
๐ Quickstart
To get started with SentiToolKit, follow the example below:
# test_model.py
# Import the SentiToolKit class from your package
from SentiAnalyzer.Main_tensor_model import SentiToolKit
def main():
# Instantiate the model
model = SentiToolKit()
# Get user input for testing
review = input("Enter a review for sentiment analysis: ")
# Call the model to get the sentiment
sentiment = model.__call__(review)
# Print the result
print("Sentiment Analysis Result:", sentiment)
if __name__ == "__main__":
main()
๐งฐ Usage
- Loading the Pre-trained Model: The toolkit loads a pre-trained LSTM model from the provided
.kerasfile. - Text Tokenization: The input text is tokenized and padded using the stored tokenizer from
tokenizer.pkl. - Sentiment Prediction: Predicts the sentiment based on the input text:
PositiveNeutralNegative
๐ Project Structure
SentiToolKit/
โโโ converter.py
โโโ converter1.py
โโโ dataExtractor.py
โโโ tensor_model.py
โโโ usage.py
โโโ json/
โ โโโ backup.json
โ โโโ negative_reviews.json
โ โโโ neutral_reviews.json
โ โโโ positive_reviews.json
โ โโโ train.json
โโโ SentiAnalyzer/
โ โโโ __init__.py
โ โโโ Main_tensor_model.py
โ โโโ SentiToolKit.keras
โ โโโ tokenizer.pkl
โโโ tests/
โโโ text/
โโโ .env
โโโ .gitignore
โโโ LICENSE
โโโ MANIFEST.in
โโโ pyproject.toml
โโโ README.md
โโโ SentiToolKit.keras
โโโ setup.py
โโโ tokenizer.pkl
๐ License
This project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3,. See the LICENSE file for details.
๐ก Future Improvements
- Add support for additional languages.
- Fine-tune the pre-trained model for domain-specific tasks.
๐ฅ Contributing
Contributions are welcome! If youโd like to contribute to SentiToolKit, feel free to fork the repository and submit a pull request.
- Fork the repo.
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a pull request.
๐ฌ Contact
- Author: Niall Dcunha
- GitHub: https://github.com/Niall1985
Project details
Release history Release notifications | RSS feed
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 sentitoolkit-0.1.8.tar.gz.
File metadata
- Download URL: sentitoolkit-0.1.8.tar.gz
- Upload date:
- Size: 3.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00df6fd20bcc9b717e5a05c320c221f0bc8312761d1e706cc1161fa35dd70f41
|
|
| MD5 |
e9b2488021f29b7531a16439aaabe517
|
|
| BLAKE2b-256 |
16c8fc024fdd9b499f763f6062686eef62a5583f7cdd52f18c130f38b76feba4
|
File details
Details for the file SentiToolKit-0.1.8-py3-none-any.whl.
File metadata
- Download URL: SentiToolKit-0.1.8-py3-none-any.whl
- Upload date:
- Size: 3.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b71bb1ca5984a1e5a61f09882bef2ace66cde19a465cb29d958889692ef6973
|
|
| MD5 |
570980a22647b8a14593d4d5194daf6a
|
|
| BLAKE2b-256 |
40794c528bc32dff3fdbaca86db24df0091783bed340da2d6109abe5506aa1d4
|