asent


Nameasent JSON
Version 0.8.3 PyPI version JSON
download
home_page
SummaryA python package for flexible and transparent sentiment analysis.
upload_time2023-11-30 19:18:33
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2021 Kenneth Enevoldsen 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.
keywords nlp sentiment analysis spacy spacy spacy 3 text analysis aspect-based sentiment analysis absa
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <a href="https://github.com/kennethenevoldsen/asent"><img src="https://github.com/KennethEnevoldsen/asent/blob/main/docs/img/logo_black_font.png?raw=true" width="300" align="right" /></a>
# Asent: Fast, flexible and transparent sentiment analysis


[![PyPI version](https://badge.fury.io/py/asent.svg)](https://pypi.org/project/asent/)
[![python version](https://img.shields.io/badge/Python-%3E=3.9-blue)](https://github.com/kennethenevoldsen/asent)
[![Code style: black](https://img.shields.io/badge/Code%20Style-Black-black)](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html)
[![github actions pytest](https://github.com/kennethenevoldsen/asent/actions/workflows/tests.yml/badge.svg)](https://github.com/kennethenevoldsen/asent/actions)
[![github actions docs](https://github.com/kennethenevoldsen/asent/actions/workflows/documentation.yml/badge.svg)](https://kennethenevoldsen.github.io/asent/)
[![pip downloads](https://img.shields.io/pypi/dm/asent.svg)](https://pypi.org/project/asent/)


Asent is a rule-based sentiment analysis library for Python made using [SpaCy](https://spacy.io). 
It is inspired by [Vader](https://github.com/cjhutto/vaderSentiment), but uses a more modular ruleset, that allows the user to change e.g. the method for finding negations. Furthermore, it includes visualizers to visualize model predictions, making the model easily interpretable.


## Installation

Installing Asent is simple using pip:

```
pip install asent
```

There is no reason to update from GitHub as the version on pypi should always be the same of on GitHub.

## Simple Example
The following shows a simple example of how you can quickly apply sentiment analysis using asent. For more on using asent see the [usage guides].

```python
import spacy
import asent

# create spacy pipeline
nlp = spacy.blank('en')
nlp.add_pipe('sentencizer')

# add the rule-based sentiment model
nlp.add_pipe("asent_en_v1")

# try an example
text = "I am not very happy, but I am also not especially sad"
doc = nlp(text)

# print polarity of document, scaled to be between -1, and 1
print(doc._.polarity)
# neg=0.0 neu=0.631 pos=0.369 compound=0.7526
```

Naturally, a simple score can be quite unsatisfying, thus Asent implements a series of visualizer to interpret the results: 
```python
# visualize model prediction
asent.visualize(doc, style="prediction")
```

<img src="https://raw.githubusercontent.com/KennethEnevoldsen/asent/main/docs/img/model_pred.png" width="500" />

If we want to know why the model comes the result it does we can use the `analysis` style:
```python
# visualize the analysis performed by the model:
asent.visualize(doc[:5], style="analysis")
```
<img src="https://raw.githubusercontent.com/KennethEnevoldsen/asent/main/docs/img/model_analysis.png" width="700" />

Where the value in the parenthesis (2.7) indicates the human-rating of the word, while
the value outside the parenthesis indicates the value accounting for the negation.
Asent also accounts for contrastive conjugations (e.g. but), casing, emoji's and
punctuations. For more on how the model works check out the [usage guide].

# 📖 Documentation

| Documentation              |                                                                                                                         |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| 🔧 **[Installation]**       | Installation instructions for Asent                                                                                     |
| 📚 **[Usage Guides]**       | Guides and instructions on how to use asent and its features. It also gives short introduction to how the models works. |
| 📰 **[News and changelog]** | New additions, changes and version history.                                                                             |
| 🎛 **[Documentation]**      | The detailed reference for Asents's API. Including function documentation                                               |

[Documentation]: https://kennethenevoldsen.github.io/asent/index.html
[Installation]: https://kennethenevoldsen.github.io/asent/installation.html
[usage guides]: https://kennethenevoldsen.github.io/asent/introduction.html
[News and changelog]: https://kennethenevoldsen.github.io/asent/news.html

# 💬 Where to ask questions

| Type                           |                        |
| ------------------------------ | ---------------------- |
| 🚨 **FAQ**                      | [FAQ]                  |
| 🚨 **Bug Reports**              | [GitHub Issue Tracker] |
| 🎁 **Feature Requests & Ideas** | [GitHub Issue Tracker] |
| 👩‍💻 **Usage Questions**          | [GitHub Discussions]   |
| 🗯 **General Discussion**       | [GitHub Discussions]   |


[FAQ]: https://kennethenevoldsen.github.io/asent/faq.html
[github issue tracker]: https://github.com/kennethenevoldsen/asent/issues
[github discussions]: https://github.com/kennethenevoldsen/asent/discussions

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "asent",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "nlp,sentiment analysis,spacy,spaCy,spaCy 3,text analysis,aspect-based sentiment analysis,ABSA",
    "author": "",
    "author_email": "Kenneth Enevoldsen <kennethcenevoldsen@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d1/74/a7bcb034dc79eb4179ab62c804ca2cff91a33ddf403d4f084d4bcf6754e9/asent-0.8.3.tar.gz",
    "platform": null,
    "description": "<a href=\"https://github.com/kennethenevoldsen/asent\"><img src=\"https://github.com/KennethEnevoldsen/asent/blob/main/docs/img/logo_black_font.png?raw=true\" width=\"300\" align=\"right\" /></a>\n# Asent: Fast, flexible and transparent sentiment analysis\n\n\n[![PyPI version](https://badge.fury.io/py/asent.svg)](https://pypi.org/project/asent/)\n[![python version](https://img.shields.io/badge/Python-%3E=3.9-blue)](https://github.com/kennethenevoldsen/asent)\n[![Code style: black](https://img.shields.io/badge/Code%20Style-Black-black)](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html)\n[![github actions pytest](https://github.com/kennethenevoldsen/asent/actions/workflows/tests.yml/badge.svg)](https://github.com/kennethenevoldsen/asent/actions)\n[![github actions docs](https://github.com/kennethenevoldsen/asent/actions/workflows/documentation.yml/badge.svg)](https://kennethenevoldsen.github.io/asent/)\n[![pip downloads](https://img.shields.io/pypi/dm/asent.svg)](https://pypi.org/project/asent/)\n\n\nAsent is a rule-based sentiment analysis library for Python made using [SpaCy](https://spacy.io). \nIt is inspired by [Vader](https://github.com/cjhutto/vaderSentiment), but uses a more modular ruleset, that allows the user to change e.g. the method for finding negations. Furthermore, it includes visualizers to visualize model predictions, making the model easily interpretable.\n\n\n## Installation\n\nInstalling Asent is simple using pip:\n\n```\npip install asent\n```\n\nThere is no reason to update from GitHub as the version on pypi should always be the same of on GitHub.\n\n## Simple Example\nThe following shows a simple example of how you can quickly apply sentiment analysis using asent. For more on using asent see the [usage guides].\n\n```python\nimport spacy\nimport asent\n\n# create spacy pipeline\nnlp = spacy.blank('en')\nnlp.add_pipe('sentencizer')\n\n# add the rule-based sentiment model\nnlp.add_pipe(\"asent_en_v1\")\n\n# try an example\ntext = \"I am not very happy, but I am also not especially sad\"\ndoc = nlp(text)\n\n# print polarity of document, scaled to be between -1, and 1\nprint(doc._.polarity)\n# neg=0.0 neu=0.631 pos=0.369 compound=0.7526\n```\n\nNaturally, a simple score can be quite unsatisfying, thus Asent implements a series of visualizer to interpret the results: \n```python\n# visualize model prediction\nasent.visualize(doc, style=\"prediction\")\n```\n\n<img src=\"https://raw.githubusercontent.com/KennethEnevoldsen/asent/main/docs/img/model_pred.png\" width=\"500\" />\n\nIf we want to know why the model comes the result it does we can use the `analysis` style:\n```python\n# visualize the analysis performed by the model:\nasent.visualize(doc[:5], style=\"analysis\")\n```\n<img src=\"https://raw.githubusercontent.com/KennethEnevoldsen/asent/main/docs/img/model_analysis.png\" width=\"700\" />\n\nWhere the value in the parenthesis (2.7) indicates the human-rating of the word, while\nthe value outside the parenthesis indicates the value accounting for the negation.\nAsent also accounts for contrastive conjugations (e.g. but), casing, emoji's and\npunctuations. For more on how the model works check out the [usage guide].\n\n# \ud83d\udcd6 Documentation\n\n| Documentation              |                                                                                                                         |\n| -------------------------- | ----------------------------------------------------------------------------------------------------------------------- |\n| \ud83d\udd27 **[Installation]**       | Installation instructions for Asent                                                                                     |\n| \ud83d\udcda **[Usage Guides]**       | Guides and instructions on how to use asent and its features. It also gives short introduction to how the models works. |\n| \ud83d\udcf0 **[News and changelog]** | New additions, changes and version history.                                                                             |\n| \ud83c\udf9b **[Documentation]**      | The detailed reference for Asents's API. Including function documentation                                               |\n\n[Documentation]: https://kennethenevoldsen.github.io/asent/index.html\n[Installation]: https://kennethenevoldsen.github.io/asent/installation.html\n[usage guides]: https://kennethenevoldsen.github.io/asent/introduction.html\n[News and changelog]: https://kennethenevoldsen.github.io/asent/news.html\n\n# \ud83d\udcac Where to ask questions\n\n| Type                           |                        |\n| ------------------------------ | ---------------------- |\n| \ud83d\udea8 **FAQ**                      | [FAQ]                  |\n| \ud83d\udea8 **Bug Reports**              | [GitHub Issue Tracker] |\n| \ud83c\udf81 **Feature Requests & Ideas** | [GitHub Issue Tracker] |\n| \ud83d\udc69\u200d\ud83d\udcbb **Usage Questions**          | [GitHub Discussions]   |\n| \ud83d\uddef **General Discussion**       | [GitHub Discussions]   |\n\n\n[FAQ]: https://kennethenevoldsen.github.io/asent/faq.html\n[github issue tracker]: https://github.com/kennethenevoldsen/asent/issues\n[github discussions]: https://github.com/kennethenevoldsen/asent/discussions\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2021 Kenneth Enevoldsen  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. ",
    "summary": "A python package for flexible and transparent sentiment analysis.",
    "version": "0.8.3",
    "project_urls": {
        "Homepage": "https://github.com/KennethEnevoldsen/asent",
        "documentation": "https://kennethenevoldsen.github.io/asent/",
        "repository": "https://github.com/KennethEnevoldsen/asent"
    },
    "split_keywords": [
        "nlp",
        "sentiment analysis",
        "spacy",
        "spacy",
        "spacy 3",
        "text analysis",
        "aspect-based sentiment analysis",
        "absa"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed102f28d5a606a83a1c8ae696cd275815d8aa746f464086a25ca07d46bff7e9",
                "md5": "5c3476757b041f03b144ed0613202f04",
                "sha256": "596aea37fd0392c60151047c50190f9b7960d82036091c37b1596658fa226536"
            },
            "downloads": -1,
            "filename": "asent-0.8.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c3476757b041f03b144ed0613202f04",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.9",
            "size": 1044908,
            "upload_time": "2023-11-30T19:18:31",
            "upload_time_iso_8601": "2023-11-30T19:18:31.124702Z",
            "url": "https://files.pythonhosted.org/packages/ed/10/2f28d5a606a83a1c8ae696cd275815d8aa746f464086a25ca07d46bff7e9/asent-0.8.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d174a7bcb034dc79eb4179ab62c804ca2cff91a33ddf403d4f084d4bcf6754e9",
                "md5": "a6ece76a216b3c1fb76cf64ebbb303dd",
                "sha256": "860f8311954ce05a82f9d5830844ed1a9b812b8829661ddf003fb874a5311611"
            },
            "downloads": -1,
            "filename": "asent-0.8.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a6ece76a216b3c1fb76cf64ebbb303dd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 2352022,
            "upload_time": "2023-11-30T19:18:33",
            "upload_time_iso_8601": "2023-11-30T19:18:33.495855Z",
            "url": "https://files.pythonhosted.org/packages/d1/74/a7bcb034dc79eb4179ab62c804ca2cff91a33ddf403d4f084d4bcf6754e9/asent-0.8.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-30 19:18:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KennethEnevoldsen",
    "github_project": "asent",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "asent"
}
        
Elapsed time: 0.14550s