Stance Target Mining
A tool for mining stance targets from a corpus of documents.
Installation
pip install stancemining
Documentation
Documentation is available at stancemining.readthedocs.io
Usage
To get stance targets and stance from a corpus of documents
import stancemining
model = stancemining.StanceMining()
document_df = model.fit_transform(docs)
target_info_df = model.get_target_info()
To get stance target, stance, and stance trends from a corpus of documents
import stancemining
model = stancemining.StanceMining()
document_df = model.fit_transform(docs)
trend_df = stancemining.get_trends_for_all_targets(document_df)
StanceMining App
This library comes with a web app to explore the results of the output.
Here is a video demo of the app: StanceMining App Demo
To deploy stancemining app
The should be either an absolute path, or a path relative to the app directory where the compose.yaml file is located.
It should contain a doc_stance directory with the output of the fit_transform method saved as .parquet.zstd files, and a target_trends directory with the outputs from the infer_stance_trends_for_all_targets or infer_stance_trends_for_target method saved as .parquet.zstd files. There can be multiple files in each directory, and the app will automatically load all of them and concatenate them.
If you need authentication for the app, you can set the environment variable STANCE_AUTH_URL_PATH to the URL of your authentication service (e.g., myauth.com/login). That path must accept a POST request with a JSON body containing username and password fields, and return a JSON response with a token field.
If you do not need authentication, you can leave the environment variable unset.
export STANCE_DATA_PATH=<your-data-path>
export STANCE_AUTH_URL_PATH=<your-auth-url/login>
docker compose -f ./app/compose.yaml up
To reproduce experimental results
Rename ./config/config_default.yaml to ./config/config.yaml and set the parameters in the file.
Run:
python ./experiments/scripts/main.py
You may need to setup a WanDB project. Run
python ./experiments/scripts/get_results.py
To have the metrics written to a latex table saved as a tex file.
Metadata
Release files for stancemining 0.2.0
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 |
|---|---|---|---|---|
| stancemining-0.2.0.tar.gz | 45.3 MB | Without provenance | Details for stancemining-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stancemining-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for stancemining-0.2.0-py3-none-any.whl |
Total release size: 45.4 MB
Release files / stancemining-0.2.0.tar.gz
| Download URL | stancemining-0.2.0.tar.gz |
|---|---|
| Size | 45.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbb543661636f1c81a626e0a2c5f35013c446e5e9ffe99b5b91f5c8f3128c4c0
|
|
BLAKE2b-256 checksum How to use checksums |
2cadc286e52897beff33bd5fddc1558aa6bb013d457b69243317c4bc7ff9ab23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.14
|
Release files / stancemining-0.2.0-py3-none-any.whl
| Download URL | stancemining-0.2.0-py3-none-any.whl |
|---|---|
| Size | 56.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62d1f52986101ee9cf6474ad566590a8b2a3d571837932abdcf43d96753b0b86
|
|
BLAKE2b-256 checksum How to use checksums |
286f4a1a4697dc59587f5638ac0a30238a78975af4833c140ce835ad220e8880
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.14
|
Security for stancemining 0.2.0
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.