How to change hyphen interpretation

Dear Sirs,

Please inform how to make keyboard to consider hyphen (-) as a usual letter inside of word and not as divider of two words ?

It’s needed in such languages as Romanian for which a lot of words look like:

la-ți
nu-i
v-am
de-a
scuzați-mă
etc.

By default after typing (-) keyman starts to search in lexical model for a new word.

Thanks

There is a way to make this happen.

https://help.keyman.com/developer/16.0/guides/lexical-models/advanced/unicode-breaker-extension

I don’t know Romanian, but if it’s safe to assume that a hyphen is always, without fail, treated as a letter…

propertyMapping: (char) => {
  let hyphens = ['\u002d', '\u2010', '\u058a', '\u30a0'];
  if(hyphens.includes(char)) {
      return "ALetter";
  } else {
    // Don't modify any others.
    return null;
  }
}

You may prefer to instead adopt the "Hyphen"-class approach from the linked documentation so that predictions extending from the - are possible; this would allow hyphens to still act like English hyphens if not attached to normal letters and words. I believe that "ALetter" is sufficient for your needs, though.

If this has unwanted side-effects or doesn’t cover everything you need regarding hyphens, things are likely to get pretty technical - the Unicode word-breaking spec isn’t exactly “light reading.” Feel free to reach back out for additional guidance if needed.

1 Like