SFST magyar többesszám

A Programozás Wiki wikiből
%%%%%%%%%%%%%% vocharm9.fst %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% Plural for Hungarian %%%%%%%%%%%
%%% consonant ending
% vér-vérek    ek
% baj- bajok   ok
% bor- borok   ok
% tyúk- tyúkok ok
% bükk bükkök  ök
%%% vocal ending
% kapa- kapák  a->á, k
% kefe- kefék  e->é, k
% hajó- hajók  k
%
%%%%%%%%%%%%%%% symbols %%%%%%%%%%%%%%%%%%%%
#cons# = bcdfghjklmnprstvwxyz
#vowel# = aeiouáéíóúöüőű
#magas# = eéiíöőüű
#magas1# = eéií
#mely# = aáouóú
#mely1# = aáouóú
#oe# = öüőű
#aa# = aá
%%%%%%%%%%%%%%% vocal harmony - HU plural %%%%%%%%%%%%%%%%%%%%
ALPHABET = [#cons#] [#vowel#] <AA>:e <AA>:o <AA>:ö <AA>:<> <Noun> 
$As$ =  ([#mely1#] [#cons#]+ <Noun>) <AA> <=>  o 
$As1$ = ([#oe#] [#cons#]+ <Noun>) <AA> <=>  ö 
$As2$ = ([#magas1#] [#cons#]+ <Noun>) <AA> <=>  e 
$As4$ = ([#vowel#]+ <Noun>) <AA> <=>  <> 
$Del_pV$ = .*
$ma$ = ($As$ & $As1$ & $As2$ & $As4$ )||  $Del_pV$
% a to á and e to é if word ends with a or e
ALPHABET = [#cons#] [#vowel#] <Verb><Noun><Adj>
$a-to-aa$ = {a}:{á} ^-> (__ [<Noun>] k)
$e-to-ee$ = {e}:{é} ^-> (__ [<Noun>] k)
% delete pos tags
ALPHABET = [#cons#] [#vowel#] [<Verb><Noun><Adj>]:<>
$delete-POS$ =  .*

% <Noun> is needed to see the word''s end
$noun-reg-infl$ = <Noun> (\
  {<sg>}:{} |\
  {<pl>}:{<AA>k})
$morph$ = "noun-reg1.lex" $noun-reg-infl$ || $ma$ ||  $a-to-aa$ ||  $e-to-ee$ || $delete-POS$
$morph$

%%%%%%%%%%% noun-reg.lex %%%%%%%%%%%
% kapa
% kefe
% kör
% ház
% vér
% baj
% bor
% tyúk
%%%%%%%%%%%% sample result %%%%%%%%
% fst-mor vocharm9.a
% analyze> kefe
% kefe<Noun><sg>
% analyze> kefék
% kefe<Noun><pl>
% analyze> kefek
% no result for kefek
% analyze> kapa
% kapa<Noun><sg>
% analyze> kapák
% kapa<Noun><pl>
% analyze> kapak
% no result for kapak
% analyze> ház
% ház<Noun><sg>
% analyze> házak
% ház<Noun><pl>
% analyze> kör
% kör<Noun><sg>
% analyze> körök
% kör<Noun><pl>
% analyze> tyúk
% tyúk<Noun><sg>
% analyze> tyúkok
% tyúk<Noun><pl>
% analyze> baj
% baj<Noun><sg>
% analyze> bajok
% baj<Noun><pl>
% analyze> bor
% bor<Noun><sg>
% analyze> borok
% bor<Noun><pl>
%%%%%%%%%%%%%%%%% fst-generate vocharm9.a
% vér<Noun>:<><sg>:<>
% vér<Noun>:<><pl>:e<>:k
% baj<Noun>:<><pl>:o<>:k
% baj<Noun>:<><sg>:<>
% bor<Noun>:<><pl>:o<>:k
% bor<Noun>:<><sg>:<>
% kör<Noun>:<><pl>:ö<>:k
% kör<Noun>:<><sg>:<>
% kapa<Noun>:<><sg>:<>
% kapa:á<Noun>:<><pl>:<><>:k
% kefe:é<Noun>:<><pl>:<><>:k
% kefe<Noun>:<><sg>:<>
% ház<Noun>:<><pl>:a<>:k
% ház<Noun>:<><sg>:<>
% tyúk<Noun>:<><pl>:o<>:k
% tyúk<Noun>:<><sg>:<>

Lásd még[szerkesztés]