Keyman Cookbook: x- = x̄ | x_- = x̱ | x-_- = x̱̄ | x-- = x-

Not clear to me what the standard recipes are for these basic tasks
– could anybody possibly provide page 1 of the Keyman Cookbook?
Assume that ‘x’ is ‘any character’ (i.e. not one specific character),
and that the aspiring cook can sub in new ingredients for ‘-’ and
any Unicode combining diacritic values as needed.
Many thanks in advance, Doug

HI Doug
There’s a lot of documentation to sift through for understanding the Keyman keyboard language.

The main ones to understand are how the rules and context work to process your characters.

I’ve cobbled the following cookbook.kmn file with Keyman Developer 10.0.1203.0 stable that hopefully does what you asked.

(edit: @Marc corrected the rules to require an initial letter to base the marks)

The lines that start with c are just Keyman comments…

group(main) using keys

store(letter) 'abcdefghijklmnopqrstuvwxyz'

c x- = x̄
any(letter) + '-' > context U+0304

c x_- = x̱
any(letter) '_' + '-' > context(1) U+0320

c x-_- = x̱̄
any(letter) U+0304 '_' + '-' > context(1) U+0320 context(2) 

c x-- = x-
any(letter) U+0304 + '-' > context(1) '-'

Once you save the contents into a cookbook.kmn file and compile it in Keyman Developer (F7), you can then use the “Build” tab and debug the keyboard.

1 Like

[edited by Doug to correct context usage; successfully compiled/tested]

To generalize, below x = any character (or any vowel character, if restricted).
Input sequence is always NFD (the diacritics are not automagically turned into
Unicode composite characters). Any corrections would be much appreciated.

Keyman Cookbook: x- = x̄ | x_- = x̱ | x-_- = x̱̄ | x-- = x-

group(main) using keys     C define this set of rules

C define constants if desired
store(vowelSet) 'aeiou'     C define limited set of vowels
store(macronSet) U+0304 U+0331     C define set of macron above and macron below

C substitution rules, anonymous prior character (implied context) x- = x̄
+ '-' > context U+0304     C prior character is preserved automatically

C substitution rules, explicit prior context must be preserved  x- = x̄)
'a' + '-' > context U+0304     C same, but restricts context to 'a'
'a' + '-' > context(1) U+0304     C same, (1) is the default context
any(vowelSet) + '-' > context U+0304     C same, but restricts context to 'aeiou'

C two-character replacements,  prior context is not referenced, thus is discarded x_- = x̱
'_' + '-' > U+0331    C character sequence to macron below:   x_- = x̱
U+0304 + '-' > '-'     C macron-above + '-' to hyphen:  x-- = x-
any(macronSet) + '-' > '-'     C prior macron above/below plus '-' to hyphen:  x-- = x-

C similar, but using references to full or partial (and restricted) contexts:
any(vowelSet) + '-' > context U+0304     C x- = x̄  (context is equivalent to context(1) )
any(vowelSet) '_' + '-' > context(1) U+0331     C x_- = x̱  (ignore context(2) = '_')
any(vowelSet) U+0304 + '-' > context(1) '-'      C x-- = x-  (ignore context(2) = U+0304)
any(vowelSet) any(macronSet) + '-' > context(1) '-'     C x-- = x-  (ignore context(2) = U+0304 or U+0331)
any(vowelSet) any(macronSet) + '-' > context(1) '-'     C x_-- = x-  (ignore context(2) = U+0304 or U+0331)

C  similar, but with explicit reordering of the macron above / below (usually left up to external NFC call)
any(vowelSet) U+0304 '_' + '-' > context(1) context(2) U+0331      C x-_- = x̱̄   (ignore context(3) = '_')
any(vowelSet) U+0304 '_' + '-' > context(1) U+0331 context(2)      C x-_- = x̱̄   (ignore context(3) = '_')
1 Like

Respectfully, due to the inactiveness of the conversation, this topic is now closed for any further discussion.
Please feel free to create a new topic if there is any question or the issue persists.