Ir al contenido

Sources, Positions, and Scope

Esta página aún no está disponible en tu idioma.

A source sets the windows a query counts. A projection changes what the next stage sees and retains the original source for frequency.

A same-finger skipgram compares two keys across one intervening event. Start with tri and use ends to apply the sfdk test to the endpoints for a same-finger skipgram:

tri.ends.sfdk

Report sources#

Unigram#

uni

One resolved keystroke event.

uni.keys(events:press,finger:LI)

Bigram#

bi

Two consecutive keystrokes.

bi.same_finger

Trigram#

tri

Three consecutive keystrokes.

tri.alternation

Four keystrokes#

quad

Four consecutive keystrokes.

quad.endpoints.same_key

Five keystrokes#

quint

Five consecutive keystrokes.

quint.endpoints.same_key

If a combo opens a bigram, that first event has several pressed keys. Use first, second, or last inside a window map; use current when a local expression needs the whole window. For example, count the keys pressed in the first event of each bigram:

bi.map(first.keys(events:press).count).sum

Event selectors#

First event#

first

Selects the first event of the current local window.

bi.map(first.keys(events:press).count).sum

Second event#

second

Selects the second event of the current local window.

bi.map(second.keys(events:press).count).sum

Last event#

last

Selects the last event of the current local window.

bi.map(last.keys(events:press).count).sum

Current window#

current

Selects the current local window explicitly.

uni.map(current.miss.count).sum

To measure distance from the first press of a triple to the last, use ends for the outer events of a longer window, then kp to project their physical key pairs. A chord can contribute several key pairs.

tri.ends.kp.map(d).sum

Window projections#

Endpoints#

endpoints

Selects the first and last keystrokes while retaining the original source window. Earlier filters can examine intervening keystrokes; a following key_pairs or keys selector chooses participating physical keys and held-key policy.

Aliases: ends.

tri.endpoints.same_finger

Physical key and pair selectors#

Physical key pairs#

window.key_pairs(first:press|release,second:press|acquire,sustained:all|transient)

Combines selected physical keys from two ordered events. The first defaults to press or release, and the second to press or acquire.

Aliases: kp.

bi.kp.sf.map(d ^ 2).sum

Physical key pairs: First roles#

first

Event roles for the first event.

Accepted values: press, release, acquire, sustain.

Physical key pairs: Second roles#

second

Event roles for the second event.

Accepted values: press, release, acquire, sustain.

Physical key pairs: Held keys#

sustained

Whether to include carried triggers unchanged throughout the original source window.

Accepted values: all, transient.

Active key pairs#

window.active_key_pairs

Combines keys actively involved in some movement within the window. Persistent held keys are excluded; held keys that enter or leave the window are included.

Aliases: akp.

bi.akp.sf.count

Finger position#

event.finger_position(finger:LI)

Averages the distinct physical keys assigned to one finger in this event, including held keys, or returns nil when the finger is absent.

Aliases: fpos.

uni.map(first.fpos(finger:LI).x).compact.sum

Finger position: Finger#

finger

One concrete finger.

Accepted values: LP, LR, LM, LI, LT, RP, RR, RM, RI, RT.

Local event keys#

event.keys(events:press|release|acquire|sustain, finger:set)

Selects physical keys by event role and, optionally, by their resolved fingers. Omitted events include press, release, acquire, and sustain.

bi.map(first.keys().count).sum
uni.map(first.keys(events:press|acquire|release,f:LH).count).sum

Local event keys: Events#

events

Event roles to select; omitted selects press, release, acquire, and sustain.

Accepted values: press, release, acquire, sustain.

Local event keys: Held keys#

sustained

Whether to include carried triggers unchanged throughout the original window.

Accepted values: all, transient.

Local event keys: Finger#

finger

Return only physical keys with a matching resolved finger.

Accepted values: LP, LR, LM, LI, LT, RP, RR, RM, RI, RT, P, R, M, I, LH, RH.

Cartesian product#

keys.cartesian_product(keys)

Combines two explicit local key collections into ordered physical pairs.

Aliases: cp.

bi.map(first.keys(events:press|release).cp(second.keys(events:press|acquire)).count).sum

The distance in bi.kp.map(d) belongs to a projected key pair. In uni.map(first.keys(events:press).map(hd).sum), the inner map instead sees one physical key. Compare d for a pair with hd for a key.

Implicit input#

Filter and map bodies use the current window, event, key pair, or mapped item implicitly; the language has no arrow-function syntax. Local cost expressions likewise run against one implicit candidate window and omit a report source.

Report sources cannot appear inside local costs or nested map scopes. weight is available only inside a map and is unavailable to local costs. corpus.graphemes is also unavailable to local costs.

first, second, and last select events from the current local window. Pair properties require key_pairs, active_key_pairs, or cartesian_product to produce physical pairs first.

current selects the whole local window explicitly. For a unigram, current.miss.count is 1 when the event uses a shadowed default through a miss, and 0 otherwise. At report scope, uni.miss selects these events.

Two ways to select event keys#

keystroke.keys(...) | event.keys(...)

On a keystroke, keys(...) is a Boolean condition: it flattens the selected trigger groups to physical keys and tests whether one key has all requested properties. It deliberately discards key-versus-chord trigger identity; use triggers(...) when that identity matters.

After first, second, or last, keys(...) is a numeric projection that returns a local key collection for count, cartesian_product, or another numeric operation. Use finger: (or f:) to keep only the physical keys assigned to the selected fingers in that event. In both forms, omitted events mean press, release, acquire, and sustain.

uni.keys(finger:LH)
bi.map(first.keys().count).sum