Analyze word-level syllable distribution in text lines. Get syllable patterns, compare against targets, and score pattern quality. Use when matching word rhythm in lyrics translation.
Analyze how syllables are distributed across words in each line.
python skills/syllable-pattern-analyzer/scripts/pattern_analysis.py "<language>" "<line1>" "<line2>" ...
Output shows per-word syllable counts for each line, e.g., Line 1: [1, 2, 1] (total: 4).
from pattern_analysis import get_syllable_patterns, analyze_pattern_alignment, score_syllable_patterns
# Get patterns
patterns = get_syllable_patterns(["Let it go", "Can't hold it back"], "en-us")
# [[1, 1, 1], [1, 1, 1, 1]]
# Compare against target
result = analyze_pattern_alignment([1, 1, 1], [2, 1])
# {'matches': False, 'similarity': 0.58, 'differences': [...], 'suggestions': [...]}
# Score multiple lines
score = score_syllable_patterns(target_patterns, current_patterns)
# {'overall_score': 0.85, 'exact_match_rate': 0.5, ...}