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.1

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.1
File Size Uploaded Provenance Actions
psymarkers-0.2.1.tar.gz 13.6 kB Without provenance Details for psymarkers-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 28.2 kB

Release files / psymarkers-0.2.1.tar.gz

Download URL psymarkers-0.2.1.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
58314432c77f18b56d81fb8e2db595ae7d2e019ebcad6df3b1ad3e1b9636dd2c
BLAKE2b-256 checksum
How to use checksums
39a83687c1cf4ba8863fdb5bacfcc0897379c89ff57da5a0032cf186ccb39414
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.1-py3-none-any.whl

Download URL psymarkers-0.2.1-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5881234b6294a5e3609223366451c4ff1f4a3bc09e2b7e0a8259bd4f880105e2
BLAKE2b-256 checksum
How to use checksums
ddb868e19bc829bc211d4f0d3bf2abba06203a800b6b93295aa6babc199e0547
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.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.

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