Tools for text analysis, embeddings, and lightweight modeling with a Streamlit app interface.
Project description
NLPsych
NLPsych (Natural Language Psychometrics) lets you upload a CSV file, pick your text columns, and get instant descriptive statistics, visualize semantic embeddings, and run predictive models all in one streamlined workflow.
โ๏ธ Features
- ๐ Descriptive statistics: word counts, sentence lengths, lexical diversity
- ๐ Embeddings: Sentence-Transformers + dimensionality reduction (PCA, UMAP, t-SNE)
- ๐ค Modeling: Quick logistic regression / ridge regression with cross-validation + permutation tests
- ๐ Reports: Auto-generated HTML/Markdown reports with interpretations
๐ก Tip: If you only need the functions, install via pip. If you want the interactive app, clone the repo and run it with Streamlit.
๐ฆ Installation (library only)
To use NLPsych functions in your own Python code:
pip install NLPsych
๐ Running the app locally
pip install "NLPsych[app]"
nlpsych-app
๐ Example Usage (library)
import pandas as pd
from nlpsych.descriptive_stats import spacy_descriptive_stats
from nlpsych.embedding import embed_text_columns_simple_base, reduce_embeddings
df = pd.DataFrame({"text": [
"Hello world. This is a tiny test.",
"Patient denies chest pain. Vitals stable."
]})
stats_df, overall = spacy_descriptive_stats(df["text"])
print(overall["lexical_diversity"])
meta_df, emb, texts = embed_text_columns_simple_base([df["text"]])
Z = reduce_embeddings(emb, method="pca", n_components=2)
๐ Project structure
root/
โโโ .devcontainer/
โโโ .streamlit/
โ โโโ config.toml
โโโ assets/
โ โโโ NLPsych_logo.png
โโโ src/
โ โโโ nlpsych
โ โ โโโ __init__.py
โ โ โโโ descriptive_stats.py
โ โ โโโ embedding.py
โ โ โโโ modeling.py
โ โ โโโ report.py
โ โ โโโ utils.py
โ โโโ nlpsych_app/
โ โ โโโ assets/
โ โ โ โโโ NLPsych_logo.png
โ โ โโโ __init__.py
โ โ โโโ app.py
โ โ โโโ launch.py
โโโ tests/
๐ License
MIT License ยฉ 2025 Shawn Manuel
๐ Contributing
PRs are welcome! If you have feature ideas or bug fixes, feel free to open an issue or submit a pull request.
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 nlpsych-0.1.3.tar.gz.
File metadata
- Download URL: nlpsych-0.1.3.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11c253830bd00f6b8a95b67a4fa27acd02ec0c58bb1c0167179dad64ef1ace9d
|
|
| MD5 |
fd5545774233f46f56ba60339cef5157
|
|
| BLAKE2b-256 |
05ff496c0cfc863852fc700a84ea4328a98f5e1c370a42ccf895a361c454bad8
|
File details
Details for the file nlpsych-0.1.3-py3-none-any.whl.
File metadata
- Download URL: nlpsych-0.1.3-py3-none-any.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a24a470013633834ece302e6f702d18797e553bfc2da348386afdced43d9ada
|
|
| MD5 |
17b0e9372e369c811e72e254a2c9ea58
|
|
| BLAKE2b-256 |
f3ca12d521c33a5d123ffb7a0368988d19e913944dd297f0fbbb6a655b4571a8
|