Skip to main content

Aspect Detection NLP Toolkit

Aspect Detection NLP toolkit (https://pypi.org/project/aspectnlp/) is a Python package that performs various NLP tasks based on aspect detection and aspect based sentiment analysis.

Installation

As this package requires cpu-pytorch, please install with the find link arguments

pip install aspect-x.x.x-py3-none-any.whl -f https://download.pytorch.org/whl/torch_stable.html

For nightly version please visit our github page: https://github.com/daishuanglu/aspectnlp

Usage

To use this package,

from aspectnlp.aspect_detector import aspectDetector
from aspectnlp.aspect_sentiment import AspectSentimentScorer
from aspectnlp.vae_topic_model import VAETopic
from aspectnlp.w2v import fasttext_emb


corpus=[
    "While there's a decent menu, it shouldn't take ten minutes to get your drinks and 45 for a dessert pizza.",
    'Faster than old XBox, less crashing, definitely smoother experience.',
    'The product is really good but performance with things like sharing deals with partners is terrible and takes forever.',
    "Mostly still learning the tool. Things tend to change randomly from time to time... so that can be tricky. But its improving steadily!",
    "Office365 is improving, but there is a lot more we could do to make Office365 work for us and model best practices to our customers for how to use Excel.",
    "but it's not working now. Showing 'error loading accounts'.",
    "Changes in the new version of Chrome are in the right direction, but performance still feels mediocre at best. \
There are various places where it could prevent page-loading delays.",
    ]

asp_detector=aspectDetector()
sent_asp=asp_detector.detect(corpus,disp=True)


# Topic modeling based on aspect words
corpus=[i['aspect'] for i in sent_asp]
topic_model=VAETopic(corpus,n_topics=10)
topic_model.fit()
top_words,topics,topic_ids=topic_model.get_top_words_and_topics(disp=True)

# Aspect based on aspect words
analyzer=AspectSentimentScorer()
for sentId,sample in enumerate(sent_asp):
    content = list(analyzer.generateInputContent(sample))
    sentiment, scores = analyzer.scoreABSA(content)
    sent_asp[sentId]['sentiment']=sentiment
    sent_asp[sentId]['score']=scores
    sent_asp[sentId]['compound']=[analyzer.lin2compound(s) for s in scores]

for content in sent_asp:
    print(content)

# aspect fuzzy matcher
word_list=['menu','sales','account','User Interface','search','Note','telephony','portal','food']
fastext= fasttext_emb()
for i,v in enumerate(fastext.w2v(word_list)):
    print(word_list[i],':',v)

Key Features Supported with Aspect NLP toolkit

  • Aspect detection
  • Aspect based sentiment analysis
  • Text relevance
  • Keyword extraction
  • Topic summarization
  • sentiment analysis

Metadata

Release files for aspectnlp 0.0.4

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

Source distribution (sdist)

Source distribution for aspectnlp 0.0.4
File Size Uploaded Provenance
aspectnlp-0.0.4.tar.gz 40.4 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aspectnlp 0.0.4
File Interpreter ABI Platform
aspectnlp-0.0.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 81.3 MB

Release files / aspectnlp-0.0.4.tar.gz

Download URL aspectnlp-0.0.4.tar.gz
Size 40.4 MB
Tags Source
SHA-256 checksum
How to use checksums
b022b0ee666cfb69d7131ef259762cb7ff7836ba8e8370e9fd4f8556196e79b7
BLAKE2b-256 checksum
How to use checksums
b16d3aceff331df854e7beccacafa6c618a70f86462836834979728e1f966155
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7rc1

Release files / aspectnlp-0.0.4-py2.py3-none-any.whl

Download URL aspectnlp-0.0.4-py2.py3-none-any.whl
Size 40.9 MB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0c51bfd730b43b5466fbe1381708bdd58d57aa32c3c2e471b029b4c6eeb8cef5
BLAKE2b-256 checksum
How to use checksums
739c8e1db04c934d28ab73def479c0307b134e468048286d7c6a4ab5e7e8cb96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7rc1

Security for aspectnlp 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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