fourshade / spectra_lexer

Stroke and rule analyzer for stenography
GNU General Public License v2.0
35 stars 3 forks source link

Instructions to rules.cson and others #10

Open flamenco108 opened 2 years ago

flamenco108 commented 2 years ago

Hello. Thanks to my colleague we have already working Spectra Lexer for Polish language. BUT. I have to write all rules to rules.cson by hand. BUT. I don't know, where to look for manual or any other explanation for it. :(

Specifically now I'm concerned about the 'flags' from https://github.com/fourshade/spectra_lexer/blob/master/doc/rules_format.txt I already know, how to use the 'INVERSION' flag and it works - partially, as it does it in rather random way:

Below the example of usage of one onset 'chc' with word 'chcę' (khtsem = I want). The onset is ZKT which in fact means that it's concatenation of KT=ch(kh) and indicates Z= but translates into C AND INVERSION of KT and Z.

It's written in rules this way: "chc.": ["ZKT", "(ch.)(c|z.)", "", "ONSET INVERSION", "CHC- jak chcę"],

spectra-chce-ss

Above you see that arrows show inversion between K and T which is wrong.

spectra-chce-st

Above you see that arrows show inversion between resulting shounds and it's proper.

Is there a way to control these arrows?

Where can I find some descriptions of other flags (eg. RARE - what does it result?)? I'm still at the beginning of work, but that's why I would like to be able to write the rules immediately in a max creative way.

(In fact we decided, that rules.cson will be our main, basic document of the whole steno-system, as Spectra Lexer is designed to show all system dependecies and nuances - the scripts (with dictionary) will distill all the necessary rules from it to create a ready-made language-steno plug-in and dictionaries.)

Anyway, thanks for this wonderful software :)

fourshade commented 1 year ago

Sorry for being so incredibly late to the party here...I'm going to start looking for another maintainer on this project.

The flags themselves are defined in the StenoRule class as boolean fields following the naming pattern "is_rare", "is_inversion", and so on. Some flags affect how the rule is applied by the parser (RARE means it is uncommon and has low priority when finding the best match), but some only affect how the rule is drawn graphically. INVERSION is one of these: it draws arrows between two key shapes in sounds and text mode. If the rule has more than two key shapes (in either mode), the arrows will end up connecting an arbitrary pair. To appear correctly in sounds mode, any base rule that uses more than one key (like "KT=ch") needs to have an entry in the third field to tell it what to draw in sounds mode. Something like:

"ch.": ["KT", "ch", "CH", "", "description..."]

would cause that rule to show "CH" across both keys in sounds mode, and then the inversion using it would consist of two shapes and the arrows would connect them like they do in your second screenshot.