Skip to main content

psymarkers

License: GPL v3 Python Version

Biblioteca de Python rápida y eficiente para extraer marcadores psicológicos y lingüísticos de textos. Está basada en literatura clínica y psicológica, y cuantifica patrones del lenguaje comúnmente asociados con estados de depresión, ansiedad, rumiación cognitiva o ideación suicida.

Instalación

Puedes instalar la biblioteca directamente desde PyPi:

pip install psymarkers

Nota: Requiere la descarga previa de los recursos léxicos de nltk si no los tienes en tu entorno. Puedes descargarlos todos automáticamente usando la función download_nltk_resources, integrada en la biblioteca:

import nltk

from psymarkers.resources import download_nltk_resources

download_nltk_resources()
nltk.download('punkt')
nltk.download('punkt_tab')
nltk.download('vader_lexicon')
nltk.download('averaged_perceptron_tagger_eng')

Nota: Los léxicos NRC son de uso exclusivamente no comercial (investigación o educación), por lo que no se distribuyen con la biblioteca. Para usar los indicadores que dependen de ellos, descárgalos desde la web de sus autores (EmoLex y VAD v1) e indica su ruta en las variables de entorno PSYMARKERS_NRC_EMOLEX (fichero NRC-Emotion-Lexicon/NRC-Emotion-Lexicon-Wordlevel-v0.92.txt del zip) y PSYMARKERS_NRC_VAD (fichero NRC-VAD-Lexicon/NRC-VAD-Lexicon.txt del zip de la v1, no el de la carpeta BipolarScale).

Indicadores disponibles

Los indicadores actuales incluyen:

Ejemplos de uso

Como pipeline en aprendizaje automático

Ya que (intentamos) que todos los indicadores compartan una interfaz común, se puede usar para crear vectores de características limpios y listos para entrenar modelos:

from psymarkers import markers

text = "I am completely exhausted and have no future."
date = "2023-10-27T03:15:00Z"

# 1. Define your feature extraction pipeline
metrics_pipeline = [
    markers.absolutist_ratio,
    markers.pronouns_ratio,
    markers.hopelessness_ratio,
    markers.negative_sentiment,
    markers.temporal_myopia_index,
    markers.type_token_ratio
]

# 2. Extract all features into a dictionary in a single pass
features = {
    metric.__name__: metric(text, date=date)
    for metric in metrics_pipeline
}

# 3. Do whatever you like with the data
print(features)

Licencia

Este proyecto está licenciado bajo los términos de la GNU General Public License v3.0 (GPLv3). Eres libre de usar, modificar y distribuir este software, siempre y cuando las obras derivadas se distribuyan bajo la misma licencia abierta. Para más información, por favor consulta el fichero LICENSE.

Metadata

Release files for psymarkers 0.2.0

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

Source distribution (sdist)

Source distribution for psymarkers 0.2.0
File Size Uploaded Provenance Actions
psymarkers-0.2.0.tar.gz 13.6 kB Without provenance Details for psymarkers-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for psymarkers 0.2.0
File Interpreter ABI Platform Actions
psymarkers-0.2.0-py3-none-any.whl Python 3 none any Details for psymarkers-0.2.0-py3-none-any.whl

Total release size: 28.2 kB

Release files / psymarkers-0.2.0.tar.gz

Download URL psymarkers-0.2.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b80d105e47457a5d5d5c6c59ccaf41899a564c61b681a38ddbf65ed215e0670e
BLAKE2b-256 checksum
How to use checksums
d7b000d8e74bdb32bbe0b11a9ed94b7279685ec7f53b48789ffb73af2b1cfd3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / psymarkers-0.2.0-py3-none-any.whl

Download URL psymarkers-0.2.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a25df441e93a598a2dd9f51694b8a8153216c385d8be09f7546bfc1cea7dd4ab
BLAKE2b-256 checksum
How to use checksums
b2db3e76600e3227f81d58defd6efacbb2594f1c9245d909526e090fd7e572a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for psymarkers 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.

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