Skip to main content

Python 3 Wrapper for SentiStrength, reads a single or multiple input with options for binary class or scale output.

Project description

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/.

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)
>>> print(result)

... [0.25,-0.25]
# OR, if want binary scoring (a score each for positive rating and negativing rating) instead of scale
>>> result = senti.getSentiment(str_arr, score='binary')
>>> print(result)

... [(2, -1), (1, -2)]

Path Setup

Specify the paths as such:

>>> senti = PySentiStr()
>>> senti.setSentiStrengthPath = ... # e.g. 'C:\Documents\SentiStrength.jar'
>>> senti.setSentiStrengthLanguageFolderPath = ... # e.g. 'C:\Documents\SentiStrengthData\'

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.

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

sentistrength-0.0.5.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sentistrength-0.0.5-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file sentistrength-0.0.5.tar.gz.

File metadata

  • Download URL: sentistrength-0.0.5.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for sentistrength-0.0.5.tar.gz
Algorithm Hash digest
SHA256 65cb25b4dd5b6cb06bf99a5326c60fceab85042f4e67bc6b42fee9f1630ec168
MD5 9b4bde61eac295c5a0ce6d442041481e
BLAKE2b-256 3ef422e1a9a4794ab87a0822bb8071aeae1c41f76499529004b8a4d37ad9bd53

See more details on using hashes here.

File details

Details for the file sentistrength-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: sentistrength-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for sentistrength-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0a63f6fb4f2ad13f115cff8089d252f2c7c8c4287e7c69ce0752192c3d9764f0
MD5 a572d111fdb808f06b6a8e450e1fcfe3
BLAKE2b-256 4914d673ad96543ebee68a0748b1e71244f3f8d14e6f66764164ce88e331e3ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page