Skip to main content

A sentiment analysis and topic modeling package

Project description

SenTop

Python 3.8 Python 3.8

SenTop combines sentiment analysis and topic modeling into a single capability allowing for sentiments to be derived per topic and for topics to be derived per sentiment.

Installation

To install with pypi, use:

pip install sentop

Quick Start

Create a SenTop object and pass your list of documents to run_analysis().

st = SenTop()
st.run_analysis(docs, annotation="My dataset")

Sentiment Analysis

Sentiment analysis is performed using AdaptNLP with state-of-the-art (SOTA) Hugging Face Transformers. SenTop provides multiple sentiment analyses (confidence scores also available):

  1. RoBERTa Base Sentiment for 3-class sentiment -- based on Facebook AI's RoBERTa
  2. BERT Base Multilingual Uncased Sentiment for 5-class sentiment -- based on Google's Bidirectional Encoder Representations from Transformers (BERT)
  3. Twitter roBERTa-base for Emotion Recognition for 4-class emotion recognition
  4. BERT-base-cased Geomotions (Original) for 28-class emotion recognition
  5. Twitter roBERTa-base for Offensive Language Identification for 2-class offensive language detection

Topic Modeling

SenTop provides two types of topic modeling: Latent Dirichlet Allocation (LDA) using Tomotopy and transformer-based BERTopic. While LDA provides de facto, statistical-based topic modeling, BERTopic provides SOTA-level performance using Hugging Face Transformers. Transformers that have been tested include:

  1. BERT Base Uncased -- based on Google's Bidirectional Encoder Representations from Transformers (BERT)
  2. XLM RoBERTa Base -- based on XLM-RoBERTa

Combining Sentiment Analysis and Topic Modeling

SenTop combines sentiment analysis and topic modeling by copmuting both at the document level for a corpus, the results of which can then be represented by a table as shown below.

Document BERT Topic LDA Topic 3-Class Sentiment 5-Class Sentiment
"Having to report to work without being provided PPE." 3 0 negative 1_star
"Teleworking at home." 1 2 neutral 3_stars
"Things are good. Im ready to do the mission." 2 1 positive 4_stars

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

sentop-0.2.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file sentop-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: sentop-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.7

File hashes

Hashes for sentop-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 98b8dca24f7af214deacbf4b78abe5ae8fb1b4bd1e76d4ac72351cef172e432e
MD5 ae0a5f6f586daf60e399c956e22ef51c
BLAKE2b-256 26c7babdba61a32d42355aae3898aefbf445a5345b440b227763f48a3a346b4c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page