abidnurulhakim / foma

Automatically exported from code.google.com/p/foma
0 stars 0 forks source link

Some help applying rules #59

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi there with the change of my code I lost the ability to analyse 
reduplication, but working on that I have come up with a solution, the only 
thing is I can not find the way to apply rules to the resulting reduplicated 
root, so here we go
file: slot-36.foma
# Slot 36 > Verbalizers
  ["+VRB""@Ø36"] : 0
| ["+VRB""@nge36"] : {nge}
| ["+VRB""@tu36"] : {tu}
| ["+VRB""@ntu36"] : ["@N"{tu}]
| ["+VRB""@l36"] : l
| ["+VRB""@ye36"] : {ye}

# Slot 36 > Stem formatives
| ["+SFR""@tu36"] : {tu}
| ["+SFR""@nge36"] : {nge}
| ["+SFR""@ye36"] : {ye}
| ["+SFR""@Ø36"] : 0
;

file: onroot.foma
# OTC onomatopeic roots, Spanish translations
["@ON"{graznido, croar, cacareo}] : {kar}
| ["@ON"{chirrido, risita}] : {kid}
| ["@ON"{maullido}] : {ñaw}
| ["@ON"{rebuznar, relinchar}] : {ngay}
| ["@ON"{gorjeo, piar}] : {pish}
| ["@ON"{ronquido}] : {tral}
| ["@ON"{castañeteo de dientes, tiritar}] : {tril}
| ["@ON"{derramamiento, desbordamiento}] : {truf}
| ["@ON"{fluir líquidos, correr el agua}] : {wal}
| ["@ON"{chillido del chancho}] : {wir}
| ["@ON"{sonido de golpes}] : {tray}
;

FST Code:
# Read in slots
define SFRVRB @re"slots/28-36-Fixed-Derivational-Suffixes/slot-36.foma";
define ONROOT @re"roots/onroot.foma";   ! Onomatopoeic Roots

define TagONOff [ 0 <- "@ON" ];
define ONROOTNoTag TagONOff .o. ONROOT;
define ONROOTx2 "@ONRR"%< ONROOTNoTag %> (%< \[%<|%>]+ %> );
define REDONR _eq(ONROOTx2, %<,%>) .o. %<|%>|"@ONRR" -> 0;

define RuRROnom [[?* "@ONRR"] => _ ["+SFR""@Ø36"] ?* ];

define FORM REDONR|REDVBR SFRVRB;

Ok, I've tried adding the rule (RuRROnom) in many different places but it never 
works, at some points does nothing and at some others it blocks the results, I 
mean if I do an up karkar I get ???, while without the rule I get:
@ONRR<graznido, croar, cacareo><kar>+VRB@Ø36
@ONRR<graznido, croar, cacareo><kar>+SFR@Ø36

with the rule applying correctly it should only be this: 
@ONRR<graznido, croar, cacareo><kar>+SFR@Ø36

I hope you can give an advice, maybe it is just a simple thing, but I can not 
find it...
Thanks

Original issue reported on code.google.com by andreschandiaf on 7 Apr 2015 at 4:03

GoogleCodeExporter commented 8 years ago
I forgot this line at the end of the FST code:
read regex FORM;

Original comment by andreschandiaf on 7 Apr 2015 at 4:55

GoogleCodeExporter commented 8 years ago
Sorry another mistake, for this example this line:
define FORM REDONR|REDVBR SFRVRB;

should be:
define FORM REDONR SFRVRB;

Original comment by andreschandiaf on 8 Apr 2015 at 11:40

GoogleCodeExporter commented 8 years ago
I'm thinking that it is maybe something in the notation, I mean the symbols 
that remain, I don't know if that is correct, but there is something that 
prevents me from applying the rule, maybe my idea is wrong, but this is what I 
see that should happen:
1. I take off the "@ON" tag, this is because the rules for an element with this 
tag are different from the ones for elements with the "@ONRR" tag.
2. I add the new tag "@ONRR" and the operators to reduplicate de root
3. I run the operation _eq(.... and clean out the result
4. I apply the rule to the element that has the the new tag "@ONRR"

Original comment by andreschandiaf on 8 Apr 2015 at 9:07