Difference: HfstFinnishNumerals (1 vs. 6)

Revision 62016-05-18 - KristerLinden

Line: 1 to 1
 
META TOPICPARENT name="HfstAllPages"

HFST: Finnish Numerals from 1 to 99

Line: 100 to 100
 
<--  
-->
-- ErikAxelson - 2011-08-23 \ No newline at end of file
Added:
>
>
META PREFERENCE name="VIEW_TEMPLATE" title="VIEW_TEMPLATE" type="Set" value="FinCLARIN.ViewFinClarinWideEngTemplate"

Revision 52011-09-01 - ErikAxelson

Line: 1 to 1
 
META TOPICPARENT name="HfstAllPages"

HFST: Finnish Numerals from 1 to 99

Line: 60 to 60
 

To get transducers that map Finnish to English numerals and vice versa, we use

Changed:
<
<
composition and inversion:
>
>
composition and inversion. We assume that the transducer EnglishNumbersToNumerals.hfst is already constructed as shown in HfstNumbersToNumerals.
 
Changed:
<
<
hfst-invert FinnishNumerals.hfst | hfst-compose EnglishNumbersToNumerals > FinnishToEnglishNumerals.hfst;
>
>
hfst-invert FinnishNumerals.hfst | hfst-compose EnglishNumbersToNumerals.hfst > FinnishToEnglishNumerals.hfst;
 hfst-invert FinnishToEnglishNumerals.hfst EnglishToFinnishNumerals.hfst;

Revision 42011-09-01 - ErikAxelson

Line: 1 to 1
 
META TOPICPARENT name="HfstAllPages"

HFST: Finnish Numerals from 1 to 99

Line: 8 to 8
  We choose Finnish and show how to create the transducer with HFST command line tools. FORMAT defines the type of the transducer.
Added:
>
>
The solution given on this page can also be executed with a single script.
 

First, we create a transducer that maps numbers 2 ... 9 to the corresponding numerals:

Revision 32011-08-29 - ErikAxelson

Line: 1 to 1
 
META TOPICPARENT name="HfstAllPages"

HFST: Finnish Numerals from 1 to 99

Line: 26 to 26
 and 1 ... 9:
Changed:
<
<
echo "1:yksi" | hfst-strings2fst -f $FORMAT -j | hfst-disjunct 2to9.hfst > 1to9.hfst;
>
>
echo "1:yksi" | hfst-strings2fst -f $FORMAT | hfst-disjunct 2to9.hfst > 1to9.hfst;
 

10 is handled as a separate case:

Revision 22011-08-24 - ErikAxelson

Line: 1 to 1
 
META TOPICPARENT name="HfstAllPages"

HFST: Finnish Numerals from 1 to 99

Changed:
<
<
Under construction...
>
>
In Beesley & Karttunen, the following task is given: Construct a transducer that maps the numbers 1-99 to numerals in some language other than English, and construct a transducer that translates from English numerals to numerals in your language, and vice versa.
 
Changed:
<
<
Beesley & Karttunen
>
>
We choose Finnish and show how to create the transducer with HFST command line tools. FORMAT defines the type of the transducer.
 
Deleted:
<
<
An HFST commandline tool script that constructs a transducer that maps numbers 1 ... 99 to the equivalent Finnish numerals:
 
Changed:
<
<
FORMAT=openfst-tropical

# From 2 to 9
>
>
First, we create a transducer that maps numbers 2 ... 9 to the corresponding numerals:
 
Added:
>
>
 echo "2:kaksi 3:kolme 4:neljä
Line: 22 to 21
 7:seitsemän 8:kahdeksan 9:yhdeksän" | hfst-strings2fst -f $FORMAT -j > 2to9.hfst;
Added:
>
>
 
Changed:
<
<
# From 1 to 9
>
>
and 1 ... 9:
 
Added:
>
>
 echo "1:yksi" | hfst-strings2fst -f $FORMAT -j | hfst-disjunct 2to9.hfst > 1to9.hfst;
Added:
>
>
 
Changed:
<
<
# 10
>
>
10 is handled as a separate case:
 
Added:
>
>
 echo "10:kymmenen" | hfst-strings2fst -f $FORMAT > 10.hfst;
Added:
>
>
 
Changed:
<
<
# From 11 to 19: [ 1:0 1to9 0:toista ]
>
>
From 11 to 19, i.e. =[ 1:0 1to9 0:toista ] =:
 
Added:
>
>
 echo "1:" | hfst-strings2fst -f $FORMAT > 1toEps.hfst; echo ":toista" | hfst-strings2fst -f $FORMAT > EpsToToista.hfst; hfst-concatenate 1toEps.hfst 1to9.hfst | hfst-concatenate EpsToToista.hfst > 11to19.hfst;
Added:
>
>
 
Changed:
<
<
# From 20 to 99: [ 2to9 0:kymmentä ( "0":0 | 1to9 ) ]
>
>
From 20 to 99, i.e. [ 2to9 0:kymmentä ( "0":0 | 1to9 ) ]:
 
Added:
>
>
 echo ":kymmentä" | hfst-strings2fst -f $FORMAT > EpsToKymmenta.hfst; echo "0:" | hfst-strings2fst -f $FORMAT > 0toEps.hfst; hfst-concatenate 2to9.hfst EpsToKymmenta.hfst > TMP; hfst-disjunct 0toEps.hfst 1to9.hfst | hfst-concatenate -1 TMP > 20to99.hfst;
Added:
>
>
 
Changed:
<
<
# From 1 to 99
>
>
Finally, from 1 to 99:
 
Added:
>
>
 hfst-disjunct 1to9.hfst 10.hfst | hfst-disjunct 11to19.hfst | hfst-disjunct 20to99.hfst > FinnishNumerals.hfst;
Changed:
<
<

Finnish to English Numerals and Vice Versa

>
>
To get transducers that map Finnish to English numerals and vice versa, we use composition and inversion:
 
hfst-invert FinnishNumerals.hfst | hfst-compose EnglishNumbersToNumerals > FinnishToEnglishNumerals.hfst;
hfst-invert FinnishToEnglishNumerals.hfst EnglishToFinnishNumerals.hfst;
Added:
>
>
Now we can test the transducers:
 
$ hfst-fst2strings -r 10 EnglishToFinnishNumerals.hfst
seventeen:seitsemäntoista

Revision 12011-08-23 - ErikAxelson

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="HfstAllPages"

HFST: Finnish Numerals from 1 to 99

Under construction...

Beesley & Karttunen

An HFST commandline tool script that constructs a transducer that maps numbers 1 ... 99 to the equivalent Finnish numerals:

FORMAT=openfst-tropical

# From 2 to 9

echo "2:kaksi
3:kolme
4:neljä
5:viisi
6:kuusi
7:seitsemän
8:kahdeksan
9:yhdeksän" | hfst-strings2fst -f $FORMAT -j > 2to9.hfst;

# From 1 to 9

echo "1:yksi" | hfst-strings2fst -f $FORMAT -j | hfst-disjunct 2to9.hfst > 1to9.hfst;

# 10

echo "10:kymmenen" | hfst-strings2fst -f $FORMAT > 10.hfst;

# From 11 to 19:  [ 1:0 1to9 0:toista ] 

echo "1:" | hfst-strings2fst -f $FORMAT > 1toEps.hfst;
echo ":toista" | hfst-strings2fst -f $FORMAT > EpsToToista.hfst;
hfst-concatenate 1toEps.hfst 1to9.hfst | hfst-concatenate EpsToToista.hfst > 11to19.hfst;

# From 20 to 99:  [ 2to9 0:kymmentä ( "0":0 | 1to9 ) ]

echo ":kymmentä" | hfst-strings2fst -f $FORMAT > EpsToKymmenta.hfst;
echo "0:" | hfst-strings2fst -f $FORMAT > 0toEps.hfst;
hfst-concatenate 2to9.hfst EpsToKymmenta.hfst > TMP;
hfst-disjunct 0toEps.hfst 1to9.hfst | hfst-concatenate -1 TMP > 20to99.hfst;

# From 1 to 99

hfst-disjunct 1to9.hfst 10.hfst | hfst-disjunct 11to19.hfst | hfst-disjunct 20to99.hfst > FinnishNumerals.hfst;

Finnish to English Numerals and Vice Versa

hfst-invert FinnishNumerals.hfst | hfst-compose EnglishNumbersToNumerals > FinnishToEnglishNumerals.hfst;
hfst-invert FinnishToEnglishNumerals.hfst EnglishToFinnishNumerals.hfst;

$ hfst-fst2strings -r 10 EnglishToFinnishNumerals.hfst
seventeen:seitsemäntoista
eleven:yksitoista
fourteen:neljätoista
forty-five:neljäkymmentäviisi
twelve:kaksitoista
ten:kymmenen
eight:kahdeksan
four:neljä
two:kaksi
one:yksi
$
$ hfst-fst2strings -r 10 EnglishToFinnishNumerals.hfst
fifty:viisikymmentä
ninety-one:yhdeksänkymmentäyksi
eleven:yksitoista
fourteen:neljätoista
forty-one:neljäkymmentäyksi
ten:kymmenen
eight:kahdeksan
three:kolme
one:yksi


<--  
-->
-- ErikAxelson - 2011-08-23
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback