Skip to main content

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

  1. Signal Extraction - Extract 7 orthogonal cognitive signals from raw text
  2. Temporal Analysis - Detect trends, slopes, and momentum in signals over time
  3. Semantic Motion - Track drift in embedding space and identify thematic shifts
  4. HMM Segmentation - Discover latent psychological states using Hidden Markov Models
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cognitive_signal-0.1.0.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cognitive_signal-0.1.0-py3-none-any.whl (40.4 kB view details)

Uploaded Python 3

File details

Details for the file cognitive_signal-0.1.0.tar.gz.

File metadata

  • Download URL: cognitive_signal-0.1.0.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for cognitive_signal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 11500166e131d8e8319ac375cf5879447b2a6d4d81b42a9db5d7fd9936d277c8
MD5 fe1a3135e42ed4fcaa56908a510e3191
BLAKE2b-256 ddbc67939410105f2e25d4c809d7a24dc6122f238d1b5a55c089c4af8ad6a020

See more details on using hashes here.

File details

Details for the file cognitive_signal-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cognitive_signal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2cb9551d272b5408b1806ac1f7e2d16193e3e7cf3cf8ff8145424a7e848648f
MD5 89e842002674cfa3e4d3638c2e2d7a3f
BLAKE2b-256 9a9d50f5964210ba0e5347016f738b66131236d6bf662321839ebddb105d92e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page