Kashmiri/FST Ideas

From Apertium
Jump to navigation Jump to search

Toy lexc:

Multichar_Symbols
%<n%> %<sg%> %<pl%>
%<nom%> %<erg%> %<dat%> %<abl%>
%{u%}
LEXICON Root
Nouns ;
LEXICON CASE-PL
%<nom%>:%>i # ;
%<erg%>:%>yav # ;
%<dat%>:%>yan # ;
%<abl%>:%>yav # ;
LEXICON CASE-OBL
%<erg%>: # ;
%<dat%>: # ;
%<abl%>: # ;
LEXICON N
%<n%>%<sg%>%<nom%>: # ;
%<n%>%<sg%>:%>i     CASE-OBL ;
%<n%>%<pl%>:        CASE-PL ;
LEXICON Nouns
koor:k%{u%}or N ;

Toy twol:

Alphabet
a b c d e f g h i j k l m n o p q r s t u v w x y z
%{u%}:u %{u%}:o
%>:0
;
Sets
Vow = a e i o u ;
Cns = b c d f g h j k l m n p q r s t v w x y z ;
Rules
"Assimilation in bare stem"
%{u%}:o <=> _ Vow Cns+ .#. ;
..

Compile and test:

$ hfst-lexc /tmp/hargle.lexc | hfst-compose-intersect -1 - -2 /tmp/hargle.twol.hfst | hfst-fst2strings
hfst-lexc: warning: Defaulting to OpenFst tropical type
Root...1 CASE-PL...4 CASE-OBL...3 N...3 Nouns...
koor<n><sg><nom>:koor
koor<n><pl><nom>:kuori
koor<n><pl><erg>:kuoryav
koor<n><pl><dat>:kuoryan
koor<n><pl><abl>:kuoryav
koor<n><sg><erg>:kuori
koor<n><sg><dat>:kuori
koor<n><sg><abl>:kuori