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

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.1.15
File Size Uploaded Provenance Actions
psymarkers-0.1.15.tar.gz 12.3 kB Without provenance Details for psymarkers-0.1.15.tar.gz

Built distribution (wheel)

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

Total release size: 25.4 kB

Release files / psymarkers-0.1.15.tar.gz

Download URL psymarkers-0.1.15.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
aa27330adae0a1582be9247bb9102e1efac0d41987f527a5d16da51c0186348e
BLAKE2b-256 checksum
How to use checksums
9645a4dacce6031842c8923d92cb1b3c2182b2f74f660b077848eb491f7b7d38
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.1.15-py3-none-any.whl

Download URL psymarkers-0.1.15-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cee6820d7b81bba9151444e05ce369a0ca4fa02efc4a87e6bbf7cb64a581332
BLAKE2b-256 checksum
How to use checksums
82354cc0d1a137153e6132002cf2c5de57bdd504962365a41c1f605e68eb3276
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.1.15

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