cat-aspect-extraction🐈
Easy to use library for implement Contrastive Attention Topic Modeling describe in Embarrassingly Simple Unsupervised Aspect Extraction
Read the paper & the original repository for details about the algorithm !
- PAPER : https://aclanthology.org/2020.acl-main.290/
- REPOSITORY : https://github.com/clips/cat/
Installation
pip install cat-aspect-extraction
or
git clone
python -m pip install .
Example
from cat-aspect-extraction import CAt, RBFAttention # for using the model
from reach import Reach # for loading word embeddings
# Load in-domain word embeddings and create a CAt instance
r = Reach.load("path/to/embeddings", unk_word="UNK")
cat = CAt(r)
# Initialize candidate aspects
candidates = [
"food",
"service",
"ambiance",
"price",
"location",
"experience"
]
for aspect in candidates:
cat.add_candidate(aspect)
# Add topics
cat.add_topic("food", ["taste", "flavor", "quality", "portion", "menu", "dish", "cuisine", "ingredient"])
cat.add_topic("service", ["staff", "waiter", "waitress", "service", "server", "host", "manager", "bartender"])
cat.add_topic("ambiance", ["atmosphere", "decor", "interior", "design", "lighting", "music", "noise", "vibe"])
# Compute topic score
sentence = "The food was great !".split() # tokenize your sentence
cat.get_scores(sentence, attention=RBFAttention())
>>> [('food', 1), ('service', 0.5), ('ambiance', 0.0)]
Citations
I'm not the author of the original paper, so if you use this library, please cite the original paper :
@inproceedings{tulkens2020embarrassingly,
title = "Embarrassingly Simple Unsupervised Aspect Extraction",
author = "Tulkens, St{\'e}phan and van Cranenburgh, Andreas",
booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
month = jul,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://www.aclweb.org/anthology/2020.acl-main.290",
doi = "10.18653/v1/2020.acl-main.290",
pages = "3182--3187",
}
License
GNU General Public License v3.0
Metadata
Release files for cat-aspect-extraction 1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cat-aspect-extraction-1.tar.gz | 16.9 kB | Without provenance | Details for cat-aspect-extraction-1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cat_aspect_extraction-1-py3-none-any.whl | Python 3 | none | any | Details for cat_aspect_extraction-1-py3-none-any.whl |
Total release size: 34.4 kB
Release files / cat-aspect-extraction-1.tar.gz
| Download URL | cat-aspect-extraction-1.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b531287a0f643f10eb0dbb4851447be9ec8ff5663ab32cb66622a36c4e65436
|
|
BLAKE2b-256 checksum How to use checksums |
cd82f7debdbacf627239aaa713682fe70ed1931160790f74f534c2242f9f759d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / cat_aspect_extraction-1-py3-none-any.whl
| Download URL | cat_aspect_extraction-1-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a18c1b9c2e357eac343ffed4db40e6f1f486efe082841347a0662b885a01ecd
|
|
BLAKE2b-256 checksum How to use checksums |
2faaa773fd4e1136c72d333c89927bac3f1e6ff2ecf7a151fb1538e5b29b686b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for cat-aspect-extraction 1
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.