Skip to content

N-gram Frequency Analysis

Layouts Wiki analyzes how a layout types a corpus. The default corpus is Monkeyracer. Its preprocessing preserves case, so typing uppercase text can require layer activation and release events.

A grapheme is one text unit, including a space. A keystroke event can press one key, press a chord, acquire a hold, or release held triggers. A sustained hold is part of an event’s state. Text and keystrokes therefore need not have the same length.

Analysis finds the minimum-cost typing paths for each corpus sequence. If several paths tie, each receives an equal share of that sequence’s occurrence count. Statistics use these exact weighted counts; they do not select one arbitrary winning path.

Query .freq normalizes a selection by the complete original source-window population of the same width. A bigram query divides by all weighted bigram windows; a trigram query, including an endpoint or skipgram query, divides by all weighted trigram windows.

rate=100×weighted matching source windowsweighted source windows of the same width\text{rate} = 100 \times \frac{\text{weighted matching source windows}}{\text{weighted source windows of the same width}}

For example, typing plot on QWERTY has one same-finger bigram, lo, among three adjacent bigram windows. Its query-based SFB frequency for that text alone is one third.

Filtering a query does not shrink its denominator. No thumbs changes which trigram windows qualify but retains the complete trigram population. Likewise, tri.ends examines the first and third events while retaining the complete trigram population.

A skip-two query retains the four-event population, and a skip-three query retains the five-event population. In general, skipping nn intervening events uses the original (n+2)(n+2)-event population, not a bigram denominator.

A predicate that counts each source window at most once has a frequency no greater than 100%. Several categories may overlap, so their sum can exceed 100%. A projection that produces multiple items per source window can also exceed 100%, because it retains the original window denominator.

A unigram examines one event; a bigram examines two adjacent events. Skip-one, skip-two, and skip-three pairs compare their endpoints with one, two, or three intervening events. Their intervening contents do not change the endpoint classification.

A chord can involve several fingers. Each relevant finger breakdown includes the occurrence, but a combined rollup includes it only once. For example, a two-event window can contain an SFB on each of two fingers. The overall SFB count is one matching window, while both finger breakdowns count it. Adding those breakdowns would double-count it.

The query evaluator computes these unions before display. The same rule applies to contributor lists: one matching window contributes its weight once to a rollup, even when it satisfies several of that rollup’s predicates. Different rollups may still overlap.

Rhythm rows are predicates over event patterns. Some displayed rows intentionally overlap: Weak is included in Redirect, and Weak + SFS is included in both Weak and SFS. They should not be added together.

The standard cost model charges 5 per event, adds 5 per adjacent same-finger active key pair, and adds 1 per same-finger active key pair between trigram endpoints. A layout supplies its complete uni, bi, and tri cost expressions. Values are integers; no automatic scaling or extra default penalties occur. For example, uni = "5 + 6 * current.miss.count" charges 5 normally and 11 for a shadowed-default miss.

Costs choose typing paths. Metric percentages describe the resulting paths; they are not the same thing as the path cost or a universal ranking of layout quality.

Occurrence counts remain exact rational numbers through analysis and query evaluation. .freq applies the source-window denominator; multiplying by 100 expresses the result as a percentage. A small nonzero value can round to 0.00%, while exact ratios remain available for comparisons.

Contributor queries read the retained analysis report when a statistic is opened. Results are uncapped and paginated. Opening a contributor view does not decode the full corpus again.

N-gram windows do not cross corpus sequence boundaries. Each source-width denominator includes only complete windows within those sequences.

Hand runs count action events. Sustained holds do not add to or interrupt a run. An action involving both hands interrupts both hands’ runs and belongs to neither.