Adding corresponding characters of stores

I would like to add only the corresponding character of the stores:
store(A) ‘T’ ‘D’ ‘G’
store(B) ‘ṭ’ ‘ḍ’ ‘ṅ’

any(B) + any(A) > index(A,1)

But only the corresponding any() should give the result.

For example only T + ṭ > T , but not T + ḍ > T !

As I can put the index () statement only in the output, I don’t find a way to add only the corresponding characters of the stores. Any solution for this?

I’m not entirely sure I understand what you would like to do, but the second parameter in the index() statement tells Keyman which of the “any()” statements to use as the index. See https://help.keyman.com/developer/language/reference/_index for more details.

If this doesn’t answer your question, please write again.

To get T + ṭ > T I would have to write any(B) + index(A1) > index(A1) , but that is wrong code!
Actually I want to press T and get ṭ (that I get working). Then press a second time T and get T again (for this part my question refers to!). And that with many different characters. I could write it all in single codes, but I thought it’s better to use stores and any/index statements, which works, but connects as well the non corresponding characters of the store. Hard for me to find the right words for explanation.

To put it in other words:
Is there a code to combine only the first character of a store with only the first character of a second or third store and so on?

If I understand correctly, you want to type “T” and get “ṭ”, but then if you immediately type another “T”, the “ṭ” would change to “T”. This can be written as:

  • “T” > “ṭ”
    “ṭ” + “T” > “T”

But I think the answer to your question is: No, there’s not a way to accomplish this for a large number of characters using “store()” and “any()” commands.

This rule works:

store(A) "TDG"
store(B) "ṭḍṅ"

+ any(A) > index(B,1)
any(B) index(B,1) + " " > index(A,1)

But you have to have the first index to the left of the plus and then something to the right of the “plus” (in this case a space) so it isn’t exactly what you are looking for.

1 Like

This is possible to do using multiple groups. Here’s an example:

group(main) using keys

store(A) "TDG"
store(B) "ṭḍṅ"

+ any(A) > index(B,1) use(rota)

group(rota)

any(B) index(B,1) > index(A,1)

The input of the rota group is the result of the rules applied in the main group. The rota group is a context-only group (as opposed to a using keys group), so it operates only on what is already in the text store/document.

The reason we can’t do this in a single group is mainly legacy – we don’t currently support the index() statement in the key part of a rule; this would be possible to implement but given we have the above pattern available to use already, we probably won’t prioritize implementing that functionality.

2 Likes

This is a good alternative, which works and gives me more possibilities! Thank you

I tried it, but this line gives an error while compiling. “4054 Statement index is not currently supported in context”. Any idea?

4054 Statement index is not currently supported in context

This functionality is supported in version 10 and later for mobile and web platforms, so make sure you have store(&VERSION) '10.0' in your keyboard header.

Thank you a lot! With this I managed to build a Transliteration keyboard for Sanskrit with just a few rules. As I have a german QWERTZ keyboard I had to build a mnemonic keyboard that works correctly.

To use your example for a Sanskrit Devanagari keyboard, is there a possibility to use combined characters in stores? That would save a lot of rules too!

For example:

store(A) “kgG”
store(B) “क्” “ग्” “ङ्”

Now it would be great to be able to combine them in the same way as above, but the characters in store(B) are acually two characters! So it would give wrong output (g would become ्). Is there another “trick” for this?

Sadly, we don’t currently have a good trick for this. It would be elegant, and I’d really like to be able to support this, but neither the compiler nor the Keyman Engine (on any platform) is really able to support this kind of transform without a lot of work.

Well done! Would you like to share the keyboard with the community? You can learn more at https://help.keyman.com/developer/keyboards

OK!
I just found another way, that works for me:

  • any(A) > index(B,1) U+094D

U+094D is the virama I want to join and in store(B) I can leave it out.
Let’s see how it works out in the full picture!

1 Like

Yes, I will try to. I will just put some more effort into it and hope to find a way to write a html help-file.
Thank you for your support!

1 Like

You’re welcome :slight_smile: