markdown
A minimal, functional guide for operating the Humanistic Drift Diagnostic Lab.
The H-Drift Lab provides tools to measure humanistic drift signals in text:
- Emotion words
- Relational language
- Hedging / uncertainty
- Anthropomorphism
- Politeness softeners
These signals accumulate over time and can reflect:
- LLM drift
- User affect
- Interaction dynamics
The lab offers:
- A dataset in simple CSV form
- A feature extractor (
features_politeness.py) - A drift metric script (
metrics.py)
This forms a reproducible baseline for future comparative studies.
h-drift-lab/
│
├── data/
│ ├── raw/
│ │ └── stanford_politeness/
│ └── processed/
│
├── src/
│ ├── h_drift/
│ │ ├── __init__.py
│ │ ├── lexicon.py
│ │ ├── features_politeness.py
│ │ └── metrics.py
│ └── utils/
│ └── __init__.py
│
├── notebooks/
├── experiments/
│
├── README.md
└── USER_GUIDE.md
Requires Python 3.9+.
Install minimal dependencies:
pip install pandas pyarrow(You already have these installed if the extractor and metrics scripts run.)
The extractor expects a CSV at:
data/raw/stanford_politeness/stanford_politeness.csv
Minimum requirement:
- A text column (any of):
text,Request,request,sentence,utterance.
Optional (recommended):
- A label column (any of):
label,is_polite,politeness,Binary,y.
Example minimal CSV:
text,label
Could you please review my code when you have a moment?,polite
Review my code.,impolite
I really appreciate your help with this.,polite
You need to fix this now.,impolite
Thank you for taking the time to look at this.,polite
Why didn't you do what I asked?,impolitePlace this file at:
data/raw/stanford_politeness/stanford_politeness.csv
From the repo root:
python .\src\h_drift\features_politeness.pyWhat it does:
-
Loads the CSV
-
Detects the text and label columns
-
Computes counts for each utterance:
h1_emotionh2_relationalh3_hedgingh4_anthroh5_softeners
-
Writes the output to:
data/processed/stanford_politeness_h_drift.parquet
Each row in the Parquet file corresponds to one input row and includes:
row_id- H-class counts
h_total(sum of all H-classes)politeness_label(if present in the CSV)
From the repo root:
python .\src\h_drift\metrics.pyThis will:
-
Load
data/processed/stanford_politeness_h_drift.parquet -
Add
H_drift_index(currently defined ash_total) -
Print:
- Overall summary statistics for all H-class counts +
H_drift_index - Grouped statistics by
politeness_label(if present)
- Overall summary statistics for all H-class counts +
This provides a first check that H-drift is meaningfully different between classes (e.g., polite vs impolite).
Per row:
-
Higher H_drift_index = more humanistic markers in that utterance.
-
Decomposition by H-class:
h1_emotion– emotional languageh2_relational– relational / affiliative languageh3_hedging– uncertainty / hedgingh4_anthro– anthropomorphic self-reportsh5_softeners– politeness softeners
Typical uses:
- Compare polite vs impolite language
- Study how humanistic markers accumulate over a conversation
- Use as a feature in downstream drift diagnostics
CSV not found
- Ensure the file exists at:
data/raw/stanford_politeness/stanford_politeness.csv
No text column detected
- Make sure your CSV has one of:
text,Request,request,sentence,utterance.
Parquet error
-
Install
pyarrow:pip install pyarrow
All counts zero
- Text may be too neutral or very short.
- Check
lexicon.pyto see which phrases are being counted.
Planned extensions:
- Conversation-level drift curves (time series).
- Multi-model comparison of drift signatures.
- Integration with interrogative geometry (WWWWHW cube).
- Early-warning signals for pathological drift patterns.
Code is released under the MIT License (see LICENSE.txt).
Datasets remain under their original licenses.