Name | PyABSA JSON |
Version |
2.3.3
JSON |
| download |
home_page | https://github.com/yangheng95/PyABSA |
Summary | This tool provides the state-of-the-art models for aspect term extraction (ATE), aspect polarity classification (APC), and text classification (TC). |
upload_time | 2023-08-11 13:51:43 |
maintainer | |
docs_url | None |
author | Yang, Heng |
requires_python | >=3.8 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# [PyABSA - Open Framework for Aspect-based Sentiment Analysis](https://arxiv.org/pdf/2208.01368)
![PyPI - Python Version](https://img.shields.io/badge/python-3.8-gold.svg)
[![PyPI](https://img.shields.io/pypi/v/pyabsa)](https://pypi.org/project/pyabsa/)
[![Downloads](https://pepy.tech/badge/pyabsa)](https://pepy.tech/project/pyabsa)
[![Downloads](https://pepy.tech/badge/pyabsa/month)](https://pepy.tech/project/pyabsa)
![License](https://img.shields.io/pypi/l/pyabsa?logo=PyABSA)
[![Documentation Status](https://readthedocs.org/projects/pyabsa/badge/?version=v2)](https://pyabsa.readthedocs.io/en/latest/)
## Try our demos on Huggingface Space
Apart from the [paper](https://arxiv.org/pdf/2208.01368), there are two new features in PyABSA: Aspect sentiment triplet extraction and Aspect quadruple extraction.
We have deployed the demos on Huggingface Space, you can try them online.
- **[Aspect sentiment quadruple extraction](https://huggingface.co/spaces/yangheng/PyABSA) (English) New feature**
- **[Aspect sentiment triplet extraction](https://huggingface.co/spaces/yangheng/PyABSA) (English) New feature**
- [(Gradio) Aspect term extraction & sentiment classification](https://huggingface.co/spaces/Gradio-Blocks/Multilingual-Aspect-Based-Sentiment-Analysis) (
English, Chinese, Arabic, Dutch, French, Russian, Spanish, Turkish, etc.)
- [(Prototype) Aspect term extraction & sentiment classification](https://huggingface.co/spaces/yangheng/PyABSA-ATEPC) (
English,
Chinese, Arabic, Dutch, French, Russian, Spanish, Turkish, etc.)
- [Aspect-based sentiment classification (Multilingual)](https://huggingface.co/spaces/yangheng/PyABSA-APC) (English,
Chinese, etc.)
## Usage Examples
We have prepared many examples for different tasks. Please refer to [Examples](./examples-v2) for more usage examples.
## Installation
### Install Anaconda (Optional)
Install [Anaconda](https://www.anaconda.com/products/individual) if you do not have it.
### Create a new environment (Optional)
```bash
conda create -n pyabsa python=3.8
conda activate pyabsa
```
### Install Pytorch
Install Pytorch following the [official instructions](https://pytorch.org/get-started/locally/).
You need to select your environment, operating system, package, Python version, and CUDA version.
### install via pip
To use PyABSA, install the latest version from pip or source code:
```bash
pip install -U pyabsa
```
### install via source
```bash
git clone https://github.com/yangheng95/PyABSA --depth=1
cd PyABSA
python setup.py install
```
## Quick-Start
### Extract aspect terms and classify sentiments
```python3
from pyabsa import AspectTermExtraction as ATEPC, available_checkpoints
# you can view all available checkpoints by calling available_checkpoints()
checkpoint_map = available_checkpoints()
aspect_extractor = ATEPC.AspectExtractor('multilingual',
auto_device=True, # False means load model on CPU
cal_perplexity=True,
)
# instance inference
aspect_extractor.predict(['I love this movie, it is so great!'],
save_result=True,
print_result=True, # print the result
ignore_error=True, # ignore the error when the model cannot predict the input
)
inference_source = ATEPC.ATEPCDatasetList.Restaurant16
atepc_result = aspect_extractor.batch_predict(target_file=inference_source, #
save_result=True,
print_result=True, # print the result
pred_sentiment=True, # Predict the sentiment of extracted aspect terms
)
print(atepc_result)
```
### Aspect-based sentiment analysis
```python3
from pyabsa import AspectPolarityClassification as APC, available_checkpoints
# you can view all available checkpoints by calling available_checkpoints()
checkpoint_map = available_checkpoints(show_ckpts=True)
classifier = APC.SentimentClassifier('multilingual',
auto_device=True, # False means load model on CPU
cal_perplexity=True,
)
# instance inference
classifier.predict(['I love this movie, it is so great!'],
save_result=True,
print_result=True, # print the result
ignore_error=True, # ignore the error when the model cannot predict the input
)
inference_source = APC.APCDatasetList.Laptop14
apc_result = classifier.batch_predict(target_file=inference_source, #
save_result=True,
print_result=True, # print the result
pred_sentiment=True, # Predict the sentiment of extracted aspect terms
)
print(apc_result)
```
## Dataset Annotation and Model Training
please refer to the documentation: [PyABSA Documentation](https://pyabsa.readthedocs.io/en/v2/).
If you have any questions about the docs, please feel free to raise an issue. Also, you can join to improve the docs.
## Notice
This repository is based on our papers for ABSA research. Here are the papers that you can cite or refer to for your
implementations:
<details>
<summary>
Aspect sentiment polarity classification models
</summary>
1. [Back to Reality: Leveraging Pattern-driven Modeling to Enable Affordable Sentiment Dependency Learning](https://arxiv.org/abs/2110.08604) (
e.g., Fast-LSA, 2020)
2. [Learning for target-dependent sentiment based on local context-aware embedding](https://link.springer.com/article/10.1007/s11227-021-04047-1) (
e.g., LCA-Net, 2020)
3. [LCF: A Local Context Focus Mechanism for Aspect-Based Sentiment Classification](https://www.mdpi.com/2076-3417/9/16/3389) (
e.g., LCF-BERT, 2019)
</details>
<details>
<summary>
Aspect sentiment polarity classification & Aspect term extraction models
</summary>
1. [A multi-task learning model for Chinese-oriented aspect polarity classification and aspect term extraction](https://www.sciencedirect.com/science/article/pii/S0925231220312534)] (
e.g., Fast-LCF-ATEPC, 2020)
2. [(Arxiv) A multi-task learning model for Chinese-oriented aspect polarity classification and aspect term extraction](https://arxiv.org/pdf/1912.07976.pdf)
</details>
If you are looking for the original proposal of local context focus, here are some introduction at
[here](https://github.com/yangheng95/PyABSA/tree/release/demos/documents).
## Citation
```bibtex
@article{YangL22,
author = {Heng Yang and
Ke Li},
title = {A Modularized Framework for Reproducible Aspect-based Sentiment Analysis},
journal = {CoRR},
volume = {abs/2208.01368},
year = {2022},
url = {https://doi.org/10.48550/arXiv.2208.01368},
doi = {10.48550/arXiv.2208.01368},
eprinttype = {arXiv},
eprint = {2208.01368},
timestamp = {Tue, 08 Nov 2022 21:46:32 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-2208-01368.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
```
## Contribution
This repository is developed and maintained by HENG YANG ([yangheng95@GitHub](https://github.com/yangheng95)),
with great contribution from community researchers.
We expect that you can help us improve this project, and your contributions are welcome. You can make a contribution in
many ways, including:
- Share your custom dataset in PyABSA and [ABSADatasets](https://github.com/yangheng95/ABSADatasets)
- Integrates your models in PyABSA. (You can share your models whether it is or not based on PyABSA. if you are
interested, we will help you)
- Raise a bug report while you use PyABSA or review the code (PyABSA is a individual project driven by enthusiasm so
your help is needed)
- Give us some advice about feature design/refactor (You can advise to improve some feature)
- Correct/Rewrite some error-messages or code comment (The comments are not written by native english speaker, you can
help us improve documents)
- Create an example script in a particular situation (Such as specify a SpaCy model, pretrained-bert type, some
hyper-parameters)
- Star this repository to keep it active
## License
PyABSA is released under MIT licence, please cite this repo (or papers) or attach the author information in your work
(repository, blog, product, etc.)
Raw data
{
"_id": null,
"home_page": "https://github.com/yangheng95/PyABSA",
"name": "PyABSA",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Yang, Heng",
"author_email": "hy345@exeter.ac.uk",
"download_url": "",
"platform": null,
"description": "# [PyABSA - Open Framework for Aspect-based Sentiment Analysis](https://arxiv.org/pdf/2208.01368)\n\n![PyPI - Python Version](https://img.shields.io/badge/python-3.8-gold.svg)\n[![PyPI](https://img.shields.io/pypi/v/pyabsa)](https://pypi.org/project/pyabsa/)\n[![Downloads](https://pepy.tech/badge/pyabsa)](https://pepy.tech/project/pyabsa)\n[![Downloads](https://pepy.tech/badge/pyabsa/month)](https://pepy.tech/project/pyabsa)\n![License](https://img.shields.io/pypi/l/pyabsa?logo=PyABSA)\n[![Documentation Status](https://readthedocs.org/projects/pyabsa/badge/?version=v2)](https://pyabsa.readthedocs.io/en/latest/)\n\n\n## Try our demos on Huggingface Space\n\nApart from the [paper](https://arxiv.org/pdf/2208.01368), there are two new features in PyABSA: Aspect sentiment triplet extraction and Aspect quadruple extraction.\nWe have deployed the demos on Huggingface Space, you can try them online.\n- **[Aspect sentiment quadruple extraction](https://huggingface.co/spaces/yangheng/PyABSA) (English) New feature**\n- **[Aspect sentiment triplet extraction](https://huggingface.co/spaces/yangheng/PyABSA) (English) New feature**\n- [(Gradio) Aspect term extraction & sentiment classification](https://huggingface.co/spaces/Gradio-Blocks/Multilingual-Aspect-Based-Sentiment-Analysis) (\n English, Chinese, Arabic, Dutch, French, Russian, Spanish, Turkish, etc.)\n- [(Prototype) Aspect term extraction & sentiment classification](https://huggingface.co/spaces/yangheng/PyABSA-ATEPC) (\n English,\n Chinese, Arabic, Dutch, French, Russian, Spanish, Turkish, etc.)\n- [Aspect-based sentiment classification (Multilingual)](https://huggingface.co/spaces/yangheng/PyABSA-APC) \uff08English,\n Chinese, etc.\uff09\n\n## Usage Examples\nWe have prepared many examples for different tasks. Please refer to [Examples](./examples-v2) for more usage examples.\n\n## Installation\n\n### Install Anaconda (Optional)\nInstall [Anaconda](https://www.anaconda.com/products/individual) if you do not have it.\n\n### Create a new environment (Optional)\n```bash\nconda create -n pyabsa python=3.8\nconda activate pyabsa\n```\n\n### Install Pytorch\nInstall Pytorch following the [official instructions](https://pytorch.org/get-started/locally/). \nYou need to select your environment, operating system, package, Python version, and CUDA version.\n\n### install via pip\n\nTo use PyABSA, install the latest version from pip or source code:\n\n```bash\npip install -U pyabsa\n```\n\n### install via source\n\n```bash\ngit clone https://github.com/yangheng95/PyABSA --depth=1\ncd PyABSA \npython setup.py install\n```\n\n## Quick-Start\n\n### Extract aspect terms and classify sentiments\n\n```python3\nfrom pyabsa import AspectTermExtraction as ATEPC, available_checkpoints\n\n# you can view all available checkpoints by calling available_checkpoints()\ncheckpoint_map = available_checkpoints()\n\naspect_extractor = ATEPC.AspectExtractor('multilingual',\n auto_device=True, # False means load model on CPU\n cal_perplexity=True,\n )\n\n# instance inference\naspect_extractor.predict(['I love this movie, it is so great!'],\n save_result=True,\n print_result=True, # print the result\n ignore_error=True, # ignore the error when the model cannot predict the input\n )\n\ninference_source = ATEPC.ATEPCDatasetList.Restaurant16\natepc_result = aspect_extractor.batch_predict(target_file=inference_source, #\n save_result=True,\n print_result=True, # print the result\n pred_sentiment=True, # Predict the sentiment of extracted aspect terms\n )\n\nprint(atepc_result)\n\n\n```\n### Aspect-based sentiment analysis\n\n```python3\nfrom pyabsa import AspectPolarityClassification as APC, available_checkpoints\n\n# you can view all available checkpoints by calling available_checkpoints()\ncheckpoint_map = available_checkpoints(show_ckpts=True)\n\nclassifier = APC.SentimentClassifier('multilingual',\n auto_device=True, # False means load model on CPU\n cal_perplexity=True,\n )\n\n# instance inference\nclassifier.predict(['I love this movie, it is so great!'],\n save_result=True,\n print_result=True, # print the result\n ignore_error=True, # ignore the error when the model cannot predict the input\n )\n\ninference_source = APC.APCDatasetList.Laptop14\napc_result = classifier.batch_predict(target_file=inference_source, #\n save_result=True,\n print_result=True, # print the result\n pred_sentiment=True, # Predict the sentiment of extracted aspect terms\n )\n\nprint(apc_result)\n\n```\n## Dataset Annotation and Model Training\nplease refer to the documentation: [PyABSA Documentation](https://pyabsa.readthedocs.io/en/v2/).\nIf you have any questions about the docs, please feel free to raise an issue. Also, you can join to improve the docs.\n\n## Notice\n\nThis repository is based on our papers for ABSA research. Here are the papers that you can cite or refer to for your\nimplementations:\n\n<details>\n<summary>\nAspect sentiment polarity classification models\n</summary>\n\n1. [Back to Reality: Leveraging Pattern-driven Modeling to Enable Affordable Sentiment Dependency Learning](https://arxiv.org/abs/2110.08604) (\n e.g., Fast-LSA, 2020)\n2. [Learning for target-dependent sentiment based on local context-aware embedding](https://link.springer.com/article/10.1007/s11227-021-04047-1) (\n e.g., LCA-Net, 2020)\n3. [LCF: A Local Context Focus Mechanism for Aspect-Based Sentiment Classification](https://www.mdpi.com/2076-3417/9/16/3389) (\n e.g., LCF-BERT, 2019)\n\n</details>\n\n<details>\n<summary>\nAspect sentiment polarity classification & Aspect term extraction models\n</summary>\n\n1. [A multi-task learning model for Chinese-oriented aspect polarity classification and aspect term extraction](https://www.sciencedirect.com/science/article/pii/S0925231220312534)] (\n e.g., Fast-LCF-ATEPC, 2020)\n2. [(Arxiv) A multi-task learning model for Chinese-oriented aspect polarity classification and aspect term extraction](https://arxiv.org/pdf/1912.07976.pdf)\n\n</details>\n\nIf you are looking for the original proposal of local context focus, here are some introduction at\n[here](https://github.com/yangheng95/PyABSA/tree/release/demos/documents).\n\n## Citation\n```bibtex\n@article{YangL22,\n author = {Heng Yang and\n Ke Li},\n title = {A Modularized Framework for Reproducible Aspect-based Sentiment Analysis},\n journal = {CoRR},\n volume = {abs/2208.01368},\n year = {2022},\n url = {https://doi.org/10.48550/arXiv.2208.01368},\n doi = {10.48550/arXiv.2208.01368},\n eprinttype = {arXiv},\n eprint = {2208.01368},\n timestamp = {Tue, 08 Nov 2022 21:46:32 +0100},\n biburl = {https://dblp.org/rec/journals/corr/abs-2208-01368.bib},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n}\n```\n## Contribution\n\nThis repository is developed and maintained by HENG YANG ([yangheng95@GitHub](https://github.com/yangheng95)),\nwith great contribution from community researchers.\nWe expect that you can help us improve this project, and your contributions are welcome. You can make a contribution in\nmany ways, including:\n\n- Share your custom dataset in PyABSA and [ABSADatasets](https://github.com/yangheng95/ABSADatasets)\n- Integrates your models in PyABSA. (You can share your models whether it is or not based on PyABSA. if you are\n interested, we will help you)\n- Raise a bug report while you use PyABSA or review the code (PyABSA is a individual project driven by enthusiasm so\n your help is needed)\n- Give us some advice about feature design/refactor (You can advise to improve some feature)\n- Correct/Rewrite some error-messages or code comment (The comments are not written by native english speaker, you can\n help us improve documents)\n- Create an example script in a particular situation (Such as specify a SpaCy model, pretrained-bert type, some\n hyper-parameters)\n- Star this repository to keep it active\n\n\n\n## License\n\nPyABSA is released under MIT licence, please cite this repo (or papers) or attach the author information in your work\n(repository, blog, product, etc.)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "This tool provides the state-of-the-art models for aspect term extraction (ATE), aspect polarity classification (APC), and text classification (TC).",
"version": "2.3.3",
"project_urls": {
"Homepage": "https://github.com/yangheng95/PyABSA"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a0e474eb720562ddcd958db1c404334a0f8f60e6746fae79e7cd983c55675b17",
"md5": "b578fac04cf33d4102cdf1a2fba25fa9",
"sha256": "58909e42d126056a68d130316c4dddd7844488253fd573735f0f8c73e4ab8303"
},
"downloads": -1,
"filename": "pyabsa-2.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b578fac04cf33d4102cdf1a2fba25fa9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 526522,
"upload_time": "2023-08-11T13:51:43",
"upload_time_iso_8601": "2023-08-11T13:51:43.926842Z",
"url": "https://files.pythonhosted.org/packages/a0/e4/74eb720562ddcd958db1c404334a0f8f60e6746fae79e7cd983c55675b17/pyabsa-2.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-11 13:51:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yangheng95",
"github_project": "PyABSA",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pyabsa"
}