register-variation-code-switching

Installation
SKILL.md

Register Variation and Code-Switching Analysis

Overview

Measure how much a user's writing voice varies across different contexts by comparing feature distributions (vocabulary, formality, sentence length, sentiment) across context-defined sub-corpora, then classify the user as having a stable register (consistent voice across contexts) or a context-dependent register (systematic shifts between contexts). The core principle: compare distributions, not means -- two contexts can share the same average sentence length while having completely different distributions, and it is the distribution comparison that reveals register variation. When variation is significant, produce conditional style rules ("in context X, use register Y") rather than a single global profile.

Research foundation: Biber's (1988, 1995) multi-dimensional analysis framework established that register variation is best captured through co-occurring clusters of linguistic features across situational contexts, not individual features in isolation. Biber identified six dimensions of variation in English, with the "Involved vs. Informational" and "Narrative vs. Non-narrative" dimensions being the most robust cross-linguistically. Register-based code-switching (sometimes called style-shifting) refers to alternating between different levels of formality, vocabulary, or structural patterns within the same language depending on audience, topic, or community (Fraser, 1999; Auer, 1998). For statistical comparison of feature distributions across sub-corpora, Kilgarriff (2001) demonstrated that chi-square is unreliable for word frequency comparison and recommended rank-based alternatives; the two-sample Kolmogorov-Smirnov test and effect size measures (Cohen's d, Cliff's delta) provide more robust distributional comparisons that separate statistical significance from practical significance.

When to Use

  • Analyzing whether a user writes differently across different communities, forums, or contexts
  • Comparing vocabulary, formality, sentence structure, or sentiment distributions across sub-corpora defined by context
  • Determining if register variation is statistically significant and practically meaningful (effect size)
  • Classifying a user's overall profile as stable-register or context-dependent-register
  • Producing conditional replication rules when significant variation is detected ("in technical contexts, use X; in casual contexts, use Y")
  • Building a multi-context voice profile that captures both the shared core and the context-specific shifts

When NOT to use:

Installs
1
GitHub Stars
7
First Seen
Jul 5, 2026
register-variation-code-switching — aaddrick/written-voice-replication