Skip to main content

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-base to 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

automatic_narratives-0.0.6.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

automatic_narratives-0.0.6-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

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

Hashes for automatic_narratives-0.0.6.tar.gz
Algorithm Hash digest
SHA256 5192c7da239285643e80ca27235af122956c5c83c1b45d3e68bdfa1ee4896de1
MD5 f992a1925acd5822eb56857941b41573
BLAKE2b-256 e9679cf9b1a030f45f64a60cc796afb61815610a5fcce41f2579b3bbeae55c2c

See more details on using hashes here.

File details

Details for the file automatic_narratives-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for automatic_narratives-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7cfbca89b8bd2c096db6fb8c308efe27169bfd60cb82b508062d6de7b110422d
MD5 17e5359615c4fdb9b0485ed830343866
BLAKE2b-256 6cee98306a68ebba6255ba9f5c2c48a335f9abf278f28484d7a4dd7be0c33eda

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page