Python-SentiStrength
Python 3 Wrapper for SentiStrength, reads a single or multiple input with options for binary class or scale output.
Ensure that you have SentiStrength.jar file and SentiStrengthData Language folders, otherwise you can download them from http://sentistrength.wlv.ac.uk/. For jar file, you will have to email Dr. Mike Thelwall.
Installation
Pip:
pip install sentistrength
Examples
Example use (single string):
>>> from sentistrength import PySentiStr
>>> senti = PySentiStr()
>>> result = senti.getSentiment('What a lovely day')
>>> print(result)
... [0.25]
Example use (list of strings or pandas Series):
>>> from sentistrength import PySentiStr
>>> senti = PySentiStr()
>>> str_arr = ['What a lovely day', 'What a bad day']
>>> result = senti.getSentiment(str_arr, score='scale')
>>> print(result)
... [1, -1]
# OR, if you want dual scoring (a score each for positive rating and negative rating)
>>> result = senti.getSentiment(str_arr, score='dual')
>>> print(result)
... [(2, -1), (1, -2)]
# OR, if you want binary scoring (1 for positive sentence, -1 for negative sentence)
>>> result = senti.getSentiment(str_arr, score='binary')
>>> print(result)
... [1, -1]
# OR, if you want trinary scoring (a score each for positive rating, negative rating and neutral rating)
>>> result = senti.getSentiment(str_arr, score='trinary')
>>> print(result)
... [(2, -1, 1), (1, -2, -1)]
Path Setup
Specify the paths as such:
>>> senti = PySentiStr()
>>> senti.setSentiStrengthPath('C:/Documents/SentiStrength.jar') # Note: Provide absolute path instead of relative path
>>> senti.setSentiStrengthLanguageFolderPath('C:/Documents/SentiStrengthData/') # Note: Provide absolute path instead of relative path
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Big thanks to Dr. Mike Thelwall for access to SentiStrength.
Metadata
Release files for sentistrength 0.0.9
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 | Actions |
|---|---|---|---|---|
| sentistrength-0.0.9.tar.gz | 2.7 kB | Without provenance | Details for sentistrength-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sentistrength-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for sentistrength-0.0.9-py3-none-any.whl |
Total release size: 6.5 kB
Release files / sentistrength-0.0.9.tar.gz
| Download URL | sentistrength-0.0.9.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
285cf1f02fc1ed42621333c4c13fda536d08fe45c0effd38e2dc29179e6828d4
|
|
BLAKE2b-256 checksum How to use checksums |
5d972eb388878314bb351026ef9b5d43213d9cad9a9bff4522a474e6aed6b011
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
|
Release files / sentistrength-0.0.9-py3-none-any.whl
| Download URL | sentistrength-0.0.9-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e49f0f8486f8b424f68b1e6ff8a1901aef28d49bebdb77ea5a1418b452407083
|
|
BLAKE2b-256 checksum How to use checksums |
ddccffa07c024a6f90ad976a523fb696b689baab3459e1b8900f5553c42d3e19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
|
Security for sentistrength 0.0.9
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.