Absa Pytorch

Aspect Based Sentiment Analysis, PyTorch Implementations. 基于方面的情感分析,使用PyTorch实现。
Alternatives To Absa Pytorch
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Nlp.js5,6441812 days ago38March 28, 202278mitJavaScript
An NLP library for building bots, with entity extraction, sentiment analysis, automatic language identify, and so more
Course Nlp3,271
2 months ago55Jupyter Notebook
A Code-First Introduction to NLP course
Pytorch Sentiment Analysis2,905
2 years ago16mitJupyter Notebook
Tutorials on getting started with PyTorch and TorchText for sentiment analysis.
Sentiment2,2089801043 years ago26August 22, 201914mitJavaScript
AFINN-based sentiment analysis for Node.js.
Scattertext2,08582a month ago135March 26, 202219apache-2.0Python
Beautiful visualizations of how language differs among document types.
6 months ago8apache-2.0Python
Stock market analyzer and predictor using Elasticsearch, Twitter, News headlines and Python natural language processing and sentiment analysis
Absa Pytorch1,446
a year ago74mitPython
Aspect Based Sentiment Analysis, PyTorch Implementations. 基于方面的情感分析,使用PyTorch实现。
2 years ago6May 21, 202050apache-2.0Python
Baidu's open-source Sentiment Analysis System.
Tidytext1,12768602 days ago16July 11, 20208otherR
Text mining using tidy tools :sparkles::page_facing_up::sparkles:
Text Analytics With Python1,073
2 years agoapache-2.0Jupyter Notebook
Learn how to process, classify, cluster, summarize, understand syntax, semantics and sentiment of text data with the power of Python! This repository contains code and datasets used in my book, "Text Analytics with Python" published by Apress/Springer.
Alternatives To Absa Pytorch
Select To Compare

Alternative Project Comparisons


Aspect Based Sentiment Analysis, PyTorch Implementations.



All Contributors


  • pytorch >= 0.4.0
  • numpy >= 1.13.3
  • sklearn
  • python 3.6 / 3.7
  • transformers

To install requirements, run pip install -r requirements.txt.



python train.py --model_name bert_spc --dataset restaurant


  • Refer to infer_example.py for both non-BERT-based models and BERT-based models.


  • For non-BERT-based models, training procedure is not very stable.
  • BERT-based models are more sensitive to hyperparameters (especially learning rate) on small data sets, see this issue.
  • Fine-tuning on the specific task is necessary for releasing the true power of BERT.


For flexible training/inference and aspect term extraction, try PyABSA, which includes all the models in this repository.

Reviews / Surveys

Qiu, Xipeng, et al. "Pre-trained Models for Natural Language Processing: A Survey." arXiv preprint arXiv:2003.08271 (2020). [pdf]

Zhang, Lei, Shuai Wang, and Bing Liu. "Deep Learning for Sentiment Analysis: A Survey." arXiv preprint arXiv:1801.07883 (2018). [pdf]

Young, Tom, et al. "Recent trends in deep learning based natural language processing." arXiv preprint arXiv:1708.02709 (2017). [pdf]

BERT-based models

BERT-ADA (official)

Rietzler, Alexander, et al. "Adapt or get left behind: Domain adaptation through bert language model finetuning for aspect-target sentiment classification." arXiv preprint arXiv:1908.11860 (2019). [pdf]

BERR-PT (official)

Xu, Hu, et al. "Bert post-training for review reading comprehension and aspect-based sentiment analysis." arXiv preprint arXiv:1904.02232 (2019). [pdf]

ABSA-BERT-pair (official)

Sun, Chi, Luyao Huang, and Xipeng Qiu. "Utilizing bert for aspect-based sentiment analysis via constructing auxiliary sentence." arXiv preprint arXiv:1903.09588 (2019). [pdf]

LCF-BERT (lcf_bert.py) (official)

Zeng Biqing, Yang Heng, et al. "LCF: A Local Context Focus Mechanism for Aspect-Based Sentiment Classification." Applied Sciences. 2019, 9, 3389. [pdf]

AEN-BERT (aen.py)

Song, Youwei, et al. "Attentional Encoder Network for Targeted Sentiment Classification." arXiv preprint arXiv:1902.09314 (2019). [pdf]

BERT for Sentence Pair Classification (bert_spc.py)

Devlin, Jacob, et al. "Bert: Pre-training of deep bidirectional transformers for language understanding." arXiv preprint arXiv:1810.04805 (2018). [pdf]

Non-BERT-based models

ASGCN (asgcn.py) (official)

Zhang, Chen, et al. "Aspect-based Sentiment Classification with Aspect-specific Graph Convolutional Networks." Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing. 2019. [pdf]

MGAN (mgan.py)

Fan, Feifan, et al. "Multi-grained Attention Network for Aspect-Level Sentiment Classification." Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. 2018. [pdf]

AOA (aoa.py)

Huang, Binxuan, et al. "Aspect Level Sentiment Classification with Attention-over-Attention Neural Networks." arXiv preprint arXiv:1804.06536 (2018). [pdf]

TNet (tnet_lf.py) (official)

Li, Xin, et al. "Transformation Networks for Target-Oriented Sentiment Classification." arXiv preprint arXiv:1805.01086 (2018). [pdf]

Cabasc (cabasc.py)

Liu, Qiao, et al. "Content Attention Model for Aspect Based Sentiment Analysis." Proceedings of the 2018 World Wide Web Conference on World Wide Web. International World Wide Web Conferences Steering Committee, 2018.

RAM (ram.py)

Chen, Peng, et al. "Recurrent Attention Network on Memory for Aspect Sentiment Analysis." Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing. 2017. [pdf]

MemNet (memnet.py) (official)

Tang, Duyu, B. Qin, and T. Liu. "Aspect Level Sentiment Classification with Deep Memory Network." Conference on Empirical Methods in Natural Language Processing 2016:214-224. [pdf]

IAN (ian.py)

Ma, Dehong, et al. "Interactive Attention Networks for Aspect-Level Sentiment Classification." arXiv preprint arXiv:1709.00893 (2017). [pdf]

ATAE-LSTM (atae_lstm.py)

Wang, Yequan, Minlie Huang, and Li Zhao. "Attention-based lstm for aspect-level sentiment classification." Proceedings of the 2016 conference on empirical methods in natural language processing. 2016.

TD-LSTM (td_lstm.py, tc_lstm.py) (official)

Tang, Duyu, et al. "Effective LSTMs for Target-Dependent Sentiment Classification." Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers. 2016. [pdf]

LSTM (lstm.py)

Hochreiter, Sepp, and Jürgen Schmidhuber. "Long short-term memory." Neural computation 9.8 (1997): 1735-1780. [pdf]

Note on running with RTX30*

If you are running on RTX30 series there may be some compatibility issues between installed/required versions of torch, cuda. In that case try using requirements_rtx30.txt instead of requirements.txt.


Thanks goes to these wonderful people:

Alberto Paz












Yikai Zhang


Alexey Naiden






This project follows the all-contributors specification. Contributions of any kind welcome!



Popular Sentiment Projects
Popular Natural Language Processing Projects
Popular Machine Learning Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Natural Language Processing
Sentiment Analysis
Sentiment Classification