https://github.com/sloev/sentimental-onix
sentiment analysis for spacy pipeline in python
https://github.com/sloev/sentimental-onix
onnx sentiment-analysis spacy spacy-pipeline
Last synced: 26 days ago
JSON representation
sentiment analysis for spacy pipeline in python
- Host: GitHub
- URL: https://github.com/sloev/sentimental-onix
- Owner: sloev
- License: mit
- Created: 2023-03-15T16:44:14.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-31T10:01:58.000Z (6 months ago)
- Last Synced: 2025-03-26T17:21:22.334Z (about 1 month ago)
- Topics: onnx, sentiment-analysis, spacy, spacy-pipeline
- Language: Python
- Homepage:
- Size: 24.3 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README

 [](https://pypi.python.org/pypi/sentimental-onix) [](https://pypi.python.org/pypi/sentimental-onix)
# Sentimental Onix
Sentiment Analysis using [onnx](https://github.com/onnx/onnx) for python with a focus on being [spacy](https://github.com/explosion/spaCy) compatible *and EEEEEASY to use*.
**Features**
- [x] English sentiment analysis
- [x] Spacy pipeline component
- [x] Sentiment model downloading from github## Install
```bash
$ pip install sentimental_onix
# download english sentiment model
$ python -m sentimental_onix download en
```## Usage
```python
import spacy
from sentimental_onix import pipelinenlp = spacy.load("en_core_web_sm")
nlp.add_pipe("sentencizer")
nlp.add_pipe("sentimental_onix", after="sentencizer")sentences = [
(sent.text, sent._.sentiment)
for doc in nlp.pipe(
[
"i hate pasta on tuesdays",
"i like movies on wednesdays",
"i find your argument ridiculous",
"soda with straws are my favorite",
]
)
for sent in doc.sents
]assert sentences == [
("i hate pasta on tuesdays", "Negative"),
("i like movies on wednesdays", "Positive"),
("i find your argument ridiculous", "Negative"),
("soda with straws are my favorite", "Positive"),
]```
## Benchmark
| library| result|
|----------------|---------|
| spacytextblob| 58.9%|
|sentimental_onix| 69%|
See [./benchmark/](./benchmark/) for info## Dev setup / testing
expand
### Install
install the dev package and pyenv versions
```bash
$ pip install -e ".[dev]"
$ python -m spacy download en_core_web_sm
$ python -m sentimental_onix download en
```### Run tests
```bash
$ black .
$ pytest -vvl
```### Packaging and publishing
```bash
python3 -m pip install --upgrade build twine
python3 -m build
python3 -m twine upload dist/*
```