SFST főnévragozás tesztje egy szóra

A Programozás Wiki wikiből
%%%%%%%%%%%%%%% mm1.fst %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%   Hungarian noun mű %%%%%%%%%%%%%%5
#cons# = bcdfghjklmnprstvwxyz
#vowel# = aeiouáéíóúöüőű
#letter# = #cons##vowel#
#magas# = eéiíöőüű
#mely# = aáouóú
#oe# =öüőű
#ei# = eéií
%%%%%%%%%%%%%%% phonetic rules %%%%%%%%%%%%%%%%%%%%
#marker# = <call><tpos><tpl>
ALPHABET = [#cons#] [#vowel#] \
          <plv>:v <plv>:<> \ % füvek
          <OEOE1>:a <OEOE1>:e \
          <oeoez1>:e <oeoez1>:a  \ % lovak, kövek
          <oeoe>:e <oeoe>:ö <oeoe>:o  \ % hoz, hez, höz, 
          <Noun>[#marker#]
$Del_pV$ = .*

% sounds
$pv4$  = (<Noun>[^#letter#]*[<tpl><tpos>]) <plv> <=> v
$ma1$ = $pv4$ 

$Ds1$ =  ([#mely#] [#cons#]* <Noun> .*) <oeoe> <=>  o 
#magasito# = #ei#<oeoez1><OEOE1>
%$Ds2$ =  (([#magas#] [#cons#]* <Noun> .*[#magasito#].*<call>.*)| \
%            ([#ei#] [#cons#]* <Noun> .*<call>.*)) <oeoe> <=>  e 
$Ds2$ =  ([#oe#] [#cons#]* <Noun>[^#magasito#]*<call>.*) <oeoe> <=>  ö 
$ma2$ = $Ds1$ & $Ds2$   

$oeoe11$ =  ([#mely#] [#cons#]* <Noun> .*) <OEOE1> <=>  a 
$ma3$ = $oeoe11$

$Dsz11$ =  (([#mely#] [#cons#]* <Noun>[^#vowel#]* <tpl> .*)| \
           ([#mely#] [#cons#]* <Noun>.*[#cons#]+[^#vowel#]*<tpl> .*) | \
           ([#mely#] [#cons#]* <Noun>.*[#mely#]+[#cons#]+<tpl> .*)) <oeoez1> <=>  a 
$ma4$ = $Dsz11$ 

$ma$ = ($ma1$ & $ma2$ & $ma3$ & $ma4$) || $Del_pV$


ALPHABET = [#cons#] [#vowel#] [<Noun>#marker#]:<>
$delete-POS$ =  .*

%%%% inflection of nouns %%%%%%%%%%%%
$plu$ = <pl>:{<tpl><plv><oeoez1>k}

$posss1$ =  {<posss1>}:{<tpos><plv><OEOE1>m} 
$poss$ =  $posss1$ 
$gen$ =  {<gen>}:{é} 
$nom$ =  <nom>:{}
$all$ =  <all>:{<call>h<oeoe>z} 
$case$ = $nom$ | $all$
$CASEP$ = ($plu$?  | $poss$? ) $gen$? $case$

%%%%%%%%%%% build transductor
$morph$ =  "mm-reg.lex" <Noun>  %  read in
$morph$ >> "morph1.a"
$morph$ = $morph$ $CASEP$
$morph$ >> "morph2.a"
$morph$ = $morph$ || $ma$                       % inflect
$morph$ >> "morph3.a"
$morph$ = $morph$ ||  $delete-POS$ %  clean up
$morph$

%%%%%%%%%%% mm-reg.lex %%%%%%%%%%%
% mű
%%%%%%%%%%%% sample result %%%%%%%%
% műhöz  sav:'<Noun><all>'
% mű  sav:'<Noun><nom>'
% művemhez  sav:'<Noun><posss1><all>'
% műveméhez  sav:'<Noun><posss1><gen><all>'
% művemé  sav:'<Noun><posss1><gen><nom>'
% művem  sav:'<Noun><posss1><nom>'
% művekéhez  sav:'<Noun><pl><gen><all>'
% műveké  sav:'<Noun><pl><gen><nom>'
% művekhez  sav:'<Noun><pl><all>'
% művek  sav:'<Noun><pl><nom>'
% műéhez  sav:'<Noun><gen><all>'
% műé  sav:'<Noun><gen><nom>'

Lásd még[szerkesztés]