BenTalagan / glaemscribe

Glaemscribe, the tolkienian languages/writings transcription engine.
https://glaemscrafu.jrrvf.com/english/glaemscribe.html
Other
44 stars 8 forks source link

Is there a way to merge the rules? #6

Closed laicasaane closed 7 years ago

laicasaane commented 7 years ago

Could I possibly do something to merge these rules into 1 single rule, since the vowels are the only things that make them different?

_a [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_A_}       [{_TONES_FULL_}]
_ă [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_A_BREVE_} [{_TONES_FULL_}]
_â [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_A_HAT_}   [{_TONES_FULL_}]
_e [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_E_}       [{_TONES_FULL_}]
_ê [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_E_HAT_}   [{_TONES_FULL_}]
_i [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_I_}       [{_TONES_FULL_}]
_ơ [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_O_HORN_}  [{_TONES_FULL_}]
_ư [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_U_HORN_}  [{_TONES_FULL_}]
_y [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_Y_}       [{_TONES_FULL_}]
_ō [{TONES_FULL}] [{FINALS}] --> 1, 4, 2, 3 --> {_ZERO_} [{_FINALS_OPENED_}] {_OO_}      [{_TONES_FULL_}]

Note: {_ZERO_}, {_FINALS_OPENED_}, {_TONES_FULL_} are the Tengwar counterparts of {NULL}. {FINALS}, {TONES_FULL} which are Latin. The same for the others.

BenTalagan commented 7 years ago

Huuuuum this is embarrassing. I'm quite sure that there's a bug behind that case, since you're forced to use 4 indexes in your crossrule although there are only 2 sheaves that are iteratable in the left and right members of the expression.

I'm verifying this and I'll prepare a fix during the week-end and give you a solution to factorize your rules.

BenTalagan commented 7 years ago

Heya @laicasaane ,

Your example was really interesting, because it has shown that there was quite some confusion in my implementation of the crossrules. I've reworked that part of the engine and introduced a concept to clarify the rules homogeneity, which is the 'linkable sheaf'. The 'linkable sheaf' is the one that can be parallelized as opposed to the one which cannot. Linkable sheaves are the ones which are written thanks to the [ ... ... ... ] syntax.

I've pushed the update of glaemscribe on the repo, and on the official site. I've also updated the editor's documentation accordingly. You should be able to use now the correct syntax.

To answer your initial question, with the bug fix, a correct syntax to parallelize your rules would be :

{VOWELS} === a * ă * â * e * ê * i * ơ * ư * y * ō
{_VOWELS_} === {_A_} * {_A_BREVE_} * {_A_HAT_} * {_E_} * {_E_HAT_} * {_I_} * {_O_HORN_} * {_U_HORN_} * {_Y_} * {_OO_}      

_ [{VOWELS}] [{TONES_FULL}] [{FINALS}] --> 2, 3, 1 --> {_ZERO_} [{_FINALS_OPENED_}] [{_VOWELS_}] [{_TONES_FULL_}]

(You send VOWELS on _VOWELS_ , TONES_FULL on _TONESFULL\ and FINALS on _FINALSOPENED\ ). {ZERO} and _ are non-linkable sheaves and ignored in the prototypes matching.