LostSideDead Pattern Analyzer (JavaScript)

Live analyzer with full logic explanation: CamelCase splitting, toggle-aware pair extraction, overlap chain, group numbering, and non-decreasing sequence enforcement—same semantics as the updated C++ version. Paste identifiers below.

1

High-Level Pattern

The analyzer identifies identifiers like LostSideDead by decomposing them into words, extracting structured two-letter pairs, connecting overlapping links, and verifying a progressive group-number sequence (non-decreasing). It surfaces the acronym, chain links, case toggles, and group cohesion.

2

Detailed Logic

  1. CamelCase splitting: Break tokens on uppercase boundaries, preserving consecutive uppercase (e.g., JSONDataJSON, Data).
  2. Pair extraction:
    • If a word’s first and last letters match ignoring case (e.g., Dead, Level), emit Upper(first)+lower(first) to expose a case-toggle (e.g., Dd, Ll).
    • Else if length ≥3, take first+third (e.g., LostLs).
    • Fallbacks: length 2 → first+second; length 1 → duplicated letter.
  3. Acronym: Uppercase first letters of each word (e.g., LSD).
  4. Overlap detection: Adjacent pairs chain when the second character of one equals the first of the next (case-insensitive). If the case differs, it is a case toggle.
  5. Group sequencing: Flatten pair letters (e.g., L s S d D d) and assign group numbers:
    • Start at 1 for the first letter.
    • The second letter of a pair increments if it differs (case-insensitive) from the first; otherwise reuses the same group.
    • The first letter of the next pair reuses previous group if it overlaps; otherwise increments.
    • The second letter of that pair behaves similarly relative to its own first.
    Require the sequence to be non-decreasing (e.g., 1 2 2 3 3 3) to reflect a coherent left-to-right progression. This can be toggled off.
3

Example: LostSideDead

Pattern found: LostSideDead Words: Lost, Side, Dead Pairs: Ls, Sd, Dd Acronym: LSD Groups: 1 2 2 3 3 3 Chain links: Ls -> Sd : overlap='yes' (case toggle on 's') Sd -> Dd : overlap='yes' (case toggle on 'd') Score: 2 / 2 overlaps

Shows the decomposition with the updated toggle rule (Dead → Dd) and the non-decreasing group sequence 1 2 2 3 3 3.

4

Interactive Analyzer

Enter text containing CamelCase-style tokens. The analyzer extracts candidate tokens, applies the full pattern logic, and displays matches. Use the checkbox to require the non-decreasing group property.

Ctrl+Enter also triggers analysis.
5

JavaScript Source

Below is the exact logic used by the analyzer. You can copy or download it as standalone code.