Orthogonal cognitive signal extraction and pattern detection from journal entries. Extracts valence, arousal, agency, self-focus, social orientation, and action ratio as independent signals, then discovers temporal trends, semantic drift, latent psychological states, and structural change points.
Project description
cognitive-signal
Extract orthogonal cognitive signals from journal entries.
Installation
pip install cognitive-signal
Download the spaCy model:
python -m spacy download en_core_web_sm
Quick Start
from datetime import datetime
from cognitive_signal import SignalDetectionPipeline, JournalEntry
# Create journal entries
entries = [
JournalEntry(
text="I felt empowered today. Made a big decision at work.",
timestamp=datetime(2024, 1, 1),
entry_id="1"
),
JournalEntry(
text="Worried about the consequences. Maybe I was too hasty.",
timestamp=datetime(2024, 1, 2),
entry_id="2"
),
JournalEntry(
text="Talked to my team and we aligned on the approach.",
timestamp=datetime(2024, 1, 3),
entry_id="3"
),
]
# Run the pipeline
pipeline = SignalDetectionPipeline()
result = pipeline.process_journal(entries)
# Access signal values
for entry_id, signal in result.signals.items():
print(f"Entry {entry_id}:")
print(f" Valence: {signal.valence:.2f}")
print(f" Arousal: {signal.arousal:.2f}")
print(f" Agency: {signal.agency:.2f}")
# Temporal trends
for signal_name, trend in result.temporal_trends.items():
print(f"{signal_name}: slope={trend.slope:.3f}, direction={trend.direction}")
# HMM states
print(f"States: {result.segmentation.states}")
print(f"Phases: {result.segmentation.phases}")
# Change points
for cp in result.change_points:
print(f"Change at index {cp.index}: {cp.signals_changed}")
The 7 Signals
| Signal | Description |
|---|---|
| Valence | Emotional polarity from negative (-1) to positive (+1) |
| Arousal | Activation level from calm (0) to excited (1) |
| Agency | Internal locus of control vs. external attribution |
| Self-Focus | First-person singular pronoun density |
| Social Orientation | References to others and relationships |
| Temporal Orientation | Focus on past, present, or future |
| Action Ratio | Verb density indicating action vs. reflection |
Processing Layers
- Signal Extraction - Extract 7 orthogonal cognitive signals from raw text
- Temporal Analysis - Detect trends, slopes, and momentum in signals over time
- Semantic Motion - Track drift in embedding space and identify thematic shifts
- HMM Segmentation - Discover latent psychological states using Hidden Markov Models
- Change Point Detection - Identify structural breaks in signal patterns
Layer 1.5: Dissonance Detection
Between signal extraction and temporal analysis, dissonance detection identifies contradictions:
- Valence-Agency Dissonance: Positive emotions but low agency (or vice versa)
- Self-Social Dissonance: High self-focus combined with high social orientation
- Temporal Dissonance: Conflicting temporal orientations within same entry
- Action-Reflection Dissonance: High action words but reflective/uncertain tone
License
MIT
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 cognitive_signal-0.1.1.tar.gz.
File metadata
- Download URL: cognitive_signal-0.1.1.tar.gz
- Upload date:
- Size: 34.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
972196704f6db71d5f6dc8a0469a1f2e6241cbce212be97177ec29842ea5a9d5
|
|
| MD5 |
6c8ce15b06373e31cd4128f626f291a5
|
|
| BLAKE2b-256 |
7081b87247a4c260acd3e82b1a5f7c1b8f1314c0fa0e56d5cff84d7693c332a3
|
File details
Details for the file cognitive_signal-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cognitive_signal-0.1.1-py3-none-any.whl
- Upload date:
- Size: 42.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c3a7816b8a8b9c7194854a4e8720a7e3403d1ea1dd7113a84245338c39c3dd0
|
|
| MD5 |
c7c6cf120153bd5fc2f5da3cfefa8d7b
|
|
| BLAKE2b-256 |
7286f29235381e242d35ea146c7e83d9e3f5bec2c3406dd6b11700b58978e7d7
|