Skip to content

Feature: Item-Level Alliteration Detector for Candidate Phrases #79

@craigtrim

Description

@craigtrim

Overview

Given a list of text phrases (candidate parallel units), determine whether their first content words share an initial phoneme — and whether that constitutes full alliteration or partial assonance. This is the alliteration validation layer for tricolon candidate scoring.

Why It's Needed

Alliterative tricolon is one of the highest-confidence detections: "wild, wanton, and wicked" — the shared initial phoneme across all three items is near-proof of intentional parallelism. It dramatically reduces false positives and increases candidate confidence score.

Beyond tricolon, alliteration is an AI tell in its own right — LLMs generate alliterative lists because they've learned it signals "polished writing." High alliterative tricolon density is a compounding signal.

What Already Exists

In prosody/rhythm_prosody.py:

  • _get_initial_sound(word) — returns initial consonant phoneme from CMU dict, falls back to first letter. This is exactly what's needed.
  • _compute_alliteration(words) — counts alliterative consecutive word pairs per 100 words across a full document.

The gap: _compute_alliteration operates across a flat word list at document scale. It cannot answer "do the lead words of these three specific phrases alliterate with each other?" — which is what tricolon validation requires.

Proposed Implementation

def detect_item_alliteration(phrases: list[str]) -> ItemAlliterationResult:
    # Extract first content word of each phrase
    # Get initial phoneme via _get_initial_sound()
    # Compare across all items
    # full_alliteration: all items share the same initial phoneme
    # partial_alliteration: majority share
    # assonance: shared vowel onset rather than consonant

Output

ItemAlliterationResult:
  lead_phonemes: list[str | None]    # initial phoneme per phrase
  full_alliteration: bool            # all items match
  partial_alliteration: bool         # majority match
  assonance: bool                    # shared vowel sound (not consonant)
  alliteration_score: float          # 0-1, proportion of items that match lead

Acceptance Criteria

  • ["wild", "wanton", "wicked"]full_alliteration=True, alliteration_score=1.0
  • ["quick", "smart", "brave"]full_alliteration=False, alliteration_score=0.0
  • ["came", "saw", "conquered"]full_alliteration=False (K / S / K — partial)

Blockers / Downstream

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions