Difference: HfstNumbersToNumerals (1 vs. 6)

Revision 62016-05-18 - KristerLinden

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

HFST: Numbers to English Numerals

Line: 97 to 97
 
<--  
-->
-- ErikAxelson - 2011-08-10 \ 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: Numbers to English Numerals

Line: 7 to 7
 that creates a transducer that maps English numerals from "one" to "ninety-nine" to the corresponding numerals "1" ... "99". $FORMAT is the implementation type of the transducer.
Added:
>
>
The solution given on this page can also be executed with a single script.
  From one to nine.

Revision 42011-08-23 - ErikAxelson

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

HFST: Numbers to English Numerals

Line: 30 to 30
 6:six 7:seven 8:eigh
Changed:
<
<
9:nine | hfst-strings2fst -j -f $FORMAT > TeenTen.hfst
>
>
9:nine" | hfst-strings2fst -j -f $FORMAT > TeenTen.hfst
 

Special numbers.

Revision 32011-08-22 - ErikAxelson

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

HFST: Numbers to English Numerals

Line: 8 to 8
 that maps English numerals from "one" to "ninety-nine" to the corresponding numerals "1" ... "99". $FORMAT is the implementation type of the transducer.
Added:
>
>
From one to nine.
 
echo "1:one
2:two
Line: 20 to 22
 9:nine" | hfst-strings2fst -j -f $FORMAT > OneToNine.hfst
Added:
>
>
Numbers to prefixes that can preceed "-teen" or "-ten".
 
echo "3:thir
5:fif
Line: 29 to 33
 9:nine | hfst-strings2fst -j -f $FORMAT > TeenTen.hfst
Added:
>
>
Special numbers.
 
echo "10:ten
11:eleven
12:twelve
Changed:
<
<
14:fourteen" | hfst-strings2fst -j -f $FORMAT > SpecialTeens.hfst
>
>
14:fourteen" | hfst-strings2fst -j -f $FORMAT > Special.hfst
 
Added:
>
>
Here we handle ordinary teens and disjunct them with the special numbers.
 echo ":teen" | hfst-strings2fst -f $FORMAT > Epsilon2Teen.hfst

echo "1:" | hfst-strings2fst -f $FORMAT > One2Epsilon.hfst

Changed:
<
<
hfst-concatenate One2Epsilon.hfst TeenTen.hfst | hfst-concatenate Epsilon2Teen.hfst > NormalTeens.hfst
>
>
hfst-concatenate One2Epsilon.hfst TeenTen.hfst | hfst-concatenate Epsilon2Teen.hfst > Teens_.hfst
 
Changed:
<
<
hfst-disjunct SpecialTeens.hfst NormalTeens.hfst > Teens.hfst
>
>
hfst-disjunct Special.hfst Teens_.hfst > Teens.hfst
 
Added:
>
>
Special stems.
 
echo "2:twen
4:for" | hfst-strings2fst -j -f $FORMAT | hfst-disjunct TeenTen.hfst > TenStem.hfst

TenStem is followed either by "ty" paired with a zero

Changed:
<
<
or by "ty-" mapped to an epsilon and folowed by a one
>
>
or by "ty-" mapped to an epsilon and followed by one
 number.
Line: 58 to 70
 echo "0:ty" | hfst-strings2fst -f $FORMAT | hfst-disjunct TMP | hfst-concatenate -1 TenStem.hfst > Tens.hfst
Added:
>
>
We finally disjunct all numbers.
 
hfst-disjunct OneToNine.hfst Teens.hfst | hfst-disjunct Tens.hfst > OneToNinetyNine.hfst
Changed:
<
<
Let's test the result
>
>
Let's test the result with random mappings and some test cases.
 
Changed:
<
<
hfst-fst2strings -r 10 OneToNinetyNine.hfst
>
>
hfst-fst2strings -r 10 OneToNinetyNine.hfst;
  echo " 21
Line: 74 to 88
 77 90 12
Changed:
<
<
6" > test_strings.txt; hfst-lookup OneToNinetyNine.hfst -I test_strings.txt
>
>
6" > test_strings.txt; hfst-lookup OneToNinetyNine.hfst -I test_strings.txt
 


Revision 22011-08-22 - ErikAxelson

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

HFST: Numbers to English Numerals

Changed:
<
<
We examplify the use of HFST command line tools with an example taken from Beesley & Karttunen that creates a transducer
>
>
We examplify the use of HFST command line tools with an example taken from Beesley & Karttunen that creates a transducer
 that maps English numerals from "one" to "ninety-nine" to the corresponding numerals "1" ... "99".
Changed:
<
<
$FORMAT is the implementation type of the transducer.
>
>
$FORMAT is the implementation type of the transducer.
 
echo "1:one
Line: 47 to 49
 4:for" | hfst-strings2fst -j -f $FORMAT | hfst-disjunct TeenTen.hfst > TenStem.hfst
Changed:
<
<
TenStem is followed either by "ty" paired with a zero
>
>
TenStem is followed either by "ty" paired with a zero
 or by "ty-" mapped to an epsilon and folowed by a one number.

Revision 12011-08-10 - ErikAxelson

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

HFST: Numbers to English Numerals

We examplify the use of HFST command line tools with an example taken from Beesley & Karttunen that creates a transducer that maps English numerals from "one" to "ninety-nine" to the corresponding numerals "1" ... "99". $FORMAT is the implementation type of the transducer.

echo "1:one
2:two
3:three
4:four
5:five
6:six
7:seven
8:eight
9:nine" | hfst-strings2fst -j -f $FORMAT > OneToNine.hfst

echo "3:thir
5:fif
6:six
7:seven
8:eigh
9:nine | hfst-strings2fst -j -f $FORMAT > TeenTen.hfst

echo "10:ten
11:eleven
12:twelve
14:fourteen" | hfst-strings2fst -j -f $FORMAT > SpecialTeens.hfst

echo ":teen" | hfst-strings2fst -f $FORMAT > Epsilon2Teen.hfst

echo "1:" | hfst-strings2fst -f $FORMAT > One2Epsilon.hfst

hfst-concatenate One2Epsilon.hfst TeenTen.hfst | hfst-concatenate Epsilon2Teen.hfst > NormalTeens.hfst

hfst-disjunct SpecialTeens.hfst NormalTeens.hfst > Teens.hfst

echo "2:twen
4:for" | hfst-strings2fst -j -f $FORMAT | hfst-disjunct TeenTen.hfst > TenStem.hfst

TenStem is followed either by "ty" paired with a zero or by "ty-" mapped to an epsilon and folowed by a one number.

echo ":ty-" | hfst-strings2fst -f $FORMAT | hfst-concatenate OneToNine.hfst > TMP
echo "0:ty" | hfst-strings2fst -f $FORMAT | hfst-disjunct TMP | hfst-concatenate -1 TenStem.hfst > Tens.hfst

hfst-disjunct OneToNine.hfst Teens.hfst | hfst-disjunct Tens.hfst > OneToNinetyNine.hfst

Let's test the result

hfst-fst2strings -r 10 OneToNinetyNine.hfst

echo "
21
44
62
77
90
12
6" > test_strings.txt; hfst-lookup OneToNinetyNine.hfst -I test_strings.txt


<--  
-->
-- ErikAxelson - 2011-08-10
 
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