pysentiment
Overview
This is a library for sentiment analysis in dictionary framework. Two dictionaries are provided in the library, namely, Harvard IV-4 and Loughran and McDonald Financial Sentiment Dictionaries, which are sentiment dictionaries for general and financial sentiment analysis.
See also http://www.wjh.harvard.edu/~inquirer/ and https://www3.nd.edu/~mcdonald/Word_Lists.html .
Introduction
Positive and Negative are word counts for the words in positive and negative sets.
Polarity and Subjectivity are calculated in the same way of Lydia system.
See also http://www.cs.sunysb.edu/~skiena/lydia/
Getting Started
Install pysentiment2:
pip install pysentiment2
A simple example:
import pysentiment2
# Do something with pysentiment2
Usage
To use the Harvard IV-4 dictionary, create an instance of the HIV4 class
import pysentiment2 as ps
hiv4 = ps.HIV4()
tokens = hiv4.tokenize(text) # text can be tokenized by other ways
# however, dict in HIV4 is preprocessed
# by the default tokenizer in the library
score = hiv4.get_score(tokens)
HIV4 is a subclass for pysentiment2.base.BaseDict. BaseDict can be inherited by
implmenting init_dict to initialize _posset and _negset for the dictionary
to calculate 'positive' or 'negative' scores for terms.
Similarly, to use the Loughran and McDonald dictionary:
import pysentiment2 as ps
lm = ps.LM()
tokens = lm.tokenize(text)
score = lm.get_score(tokens)
Links
See the documentation here.
Author
pysentiment2 created by Nick DeRobertis but based on pysentiment by Zhichao Han. GNU GPL License.
Metadata
Release files for pysentiment2 0.1.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 | Actions |
|---|---|---|---|---|
| pysentiment2-0.1.1.tar.gz | 1.8 MB | Without provenance | Details for pysentiment2-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysentiment2-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pysentiment2-0.1.1-py3-none-any.whl |
Total release size: 3.6 MB
Release files / pysentiment2-0.1.1.tar.gz
| Download URL | pysentiment2-0.1.1.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec1a3c5b8a53fb4beb8ad8d8b591c28ea13163a452fd044d698fba29d97e1185
|
|
BLAKE2b-256 checksum How to use checksums |
7fc4ace65f578d79e40f71dd41589114f2fecd8ca92988dcfe410d4c3c388a6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|
Release files / pysentiment2-0.1.1-py3-none-any.whl
| Download URL | pysentiment2-0.1.1-py3-none-any.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0ff7a0b702654baeff6a6bec231e56ba4c4c9bc9ad4730856e8ca69335450c7
|
|
BLAKE2b-256 checksum How to use checksums |
d17c596f3028260310d6206b7b88fe7d37fdb367913bfac9195912b27ab3cadb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|
Security for pysentiment2 0.1.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.