This package lets one infer agency and communion codes from life narratives based on RoBERTa transformer embeddings.
Project description
Automatic Narratives
Automatic Narratives is a Python module for predicting agency or communion codes from natural language text using transformer-based embeddings (RoBERTa) and ridge regression.
Features
- Uses
roberta-baseto generate contextual embeddings - Predicts codes for either agency or communion using pretrained ridge regression models
- Fully compatible with scikit-learn pipelines
Installation
Clone the repository and install dependencies:
from automatic_narratives import AutomaticNarratives
import pandas as pd
# Example texts
texts = pd.Series([
"She took charge of the situation and led the team with confidence.",
"He cared deeply for others and always made time to listen."
])
# Choose device: "cpu" or "cuda" (if available)
device = "cpu"
# Initialize predictor for agency
agency_predictor = AutomaticNarratives(rating_domain="agency", device=device)
# Predict agency scores
agency_scores = agency_predictor.predict(texts)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file automatic_narratives-0.0.6.tar.gz.
File metadata
- Download URL: automatic_narratives-0.0.6.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5192c7da239285643e80ca27235af122956c5c83c1b45d3e68bdfa1ee4896de1
|
|
| MD5 |
f992a1925acd5822eb56857941b41573
|
|
| BLAKE2b-256 |
e9679cf9b1a030f45f64a60cc796afb61815610a5fcce41f2579b3bbeae55c2c
|
File details
Details for the file automatic_narratives-0.0.6-py3-none-any.whl.
File metadata
- Download URL: automatic_narratives-0.0.6-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cfbca89b8bd2c096db6fb8c308efe27169bfd60cb82b508062d6de7b110422d
|
|
| MD5 |
17e5359615c4fdb9b0485ed830343866
|
|
| BLAKE2b-256 |
6cee98306a68ebba6255ba9f5c2c48a335f9abf278f28484d7a4dd7be0c33eda
|