Skip to main content

Short-text-analyzer

This ShortTextAnalyzer was created to help analyze the open-ended survey response which usually has less than three sentences. The analysis includes topic modeling, sentiment analysis, and visualization. This topic modeling was done using pre-trained representations of language, namely BERT, combine with the clustering algorithm.

Documentation Page: https://thisisphume.github.io/short-text-analyzer/

Install

pip install short-text-analyzer

Install all the required packages in requirement file.

pip install -r requirements.txt

How to use

from shorttextanalyzer.core import *

analyzer = shortTextAnalyzer(comments_series, 4)
output_result = analyzer.analyze_getResult()

Here we specify that we want 4 clusters/topic from this data.

Output: result

  • sentimentScore: Polarity score ranges from [-1,1] where 1 means positive statement and -1 means a negative statement.
  • Subjective: score ranges from [0,1] where 1 refer to personal opinion, emotion or judgment and 0 means it is factual information.
  • clusterByKMeans: assigned cluster number for each comments using KMeans
  • clusterByHDBSCAN: assigned cluster number for each comments using HDBSCAN
output_result.sample(2)
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
comments comment_lang comments_clean sentimentScore subjectiveScore clusterByKMeans clusterByHDBSCAN
50 sondage parfait fr perfect poll 1.00 1.000000 2 1
875 it wasn't very clear what the purpose of the f... en it wasn't very clear what the purpose of the f... 0.19 0.415833 1 1

Visualization: how good is our clusters? HDBSCAN and KMeans

analyzer.plot_output()

png

png

Reference

Release files for short-text-analyzer 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for short-text-analyzer 0.1
File Size Uploaded
short_text_analyzer-0.1.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for short-text-analyzer 0.1
File Interpreter ABI Platform
short_text_analyzer-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.8 kB

Release files / short_text_analyzer-0.1.tar.gz

Download URL short_text_analyzer-0.1.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4758f4579e3d99138a5097ed29f4c25dd853fd6174b3d7230cc4e7b70ba72f65
BLAKE2b-256 checksum
How to use checksums
4c5f53bd84d396063c4d7ac0ddec435ee4bcd37823fb0a62056f4043381e56b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release files / short_text_analyzer-0.1-py3-none-any.whl

Download URL short_text_analyzer-0.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
657d2304eb77c31aacd5cd80469f72deac6f7606aee4f7f3de91d98ab3d9fd4e
BLAKE2b-256 checksum
How to use checksums
4e73050ba4ba4e43074123f803d321be272093df94129fb0f12387788c3c8fa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page