Metadata-Version: 2.1
Name: sentimental-onix
Version: 0.0.2
Summary: spacy pipeline component for sentiment analysis using onnx
Author-email: sloev <johannes.valbjorn@gmail.com>
License: MIT License
        
        Copyright (c) 2023 sloev / Johannes Valbjørn
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/sloev/sentimental-onix
Keywords: spacy,onnx,sentiment,english,nlp
Classifier: Development Status :: 6 - Mature
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE

![spacy syllables](https://raw.githubusercontent.com/sloev/sentimental-onix/master/.github/onix.webp) <a href="https://www.buymeacoffee.com/sloev" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-pink.png" alt="Buy Me A Coffee" height="51px" width="217px"></a>

![example workflow](https://github.com/sloev/sentimental-onix/actions/workflows/test.yml/badge.svg) [![Latest Version](https://img.shields.io/pypi/v/sentimental-onix.svg)](https://pypi.python.org/pypi/sentimental-onix) [![Python Support](https://img.shields.io/pypi/pyversions/sentimental-onix.svg)](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 pipeline

nlp = 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

<details><summary>expand</summary>


### 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/*
```

</details>
