# finnum.script 

# Needs three other files:
# numbers-to-finnish.xfst
# finnish-numeral.lexc
# finnish-rules.xfst

# Copyright (C) 2004 Lauri Karttunen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Ê See the
# GNU General Public License for more details.

# This script defines a lexical transducer for inflected
# Finnish numerals. The lexical side consists of numbers
# followed by an optional +Ord (ordinal) tag, a number
# (+Sg or +Pl) and a case tag. The cases are:
# +Nom (nominative), +Gen (genetive), +Par (partitive),
# +Ess (essive), +Tra (translative), +Ine (inessive),
# +Ela (elative), +Ill (illative), +Ade (adessive),
# +Abl (ablative), +All (allative), +Abe (abessive)
# +Ins (instrumental) and +Com (comitative).

# The script consists of four steps.

# Step 1:

source numbers-to-finnish.xfst

# This script defines NumLex 1. It contains paths such as:
#
# 2 1 5 +Ord +Sg +Gen
# KAKSI +Ord +Sg +Gen SATA +Ord +Sg +Gen VIISI +Ord +Sg +Gen TOISTA
#
# Note that on the lexical side, only the last numeral has the
# tags but on the lower side each numeral has a tag except
# for the uninflected TOISTA at the end.

# Step 2: reads and compiles NumLex2. This lexicon contains paths such as:

read lexc < finnish-numeral.lexc
define NumLex2

# KAKSI +Ord +Sg +Gen SATA +Ord +Sg +Gen VIISI +Ord +Sg +Gen TOISTA
# kahde nne n sada nne n viide nne n toista
#
#

# Step 3: Composes NumLex1 with NumLex2 to yield NumLex3.

define NumLex3 [NumLex1 .o. NumLex2] ;

# NumLex3 contains paths such as:
#
# 2 1 5+Ord+Sg+Gen
# kahdennensadannenviidennentoista
#


# Step 4: loads and compiles FinnishRules and composes them on the
# lower side of NumLex3 to yield NumLex, the final result. The
# rules include Vowel Harmony, Consonant Gradation, and a dozen
# other stem and suffix alternations.

source finnish-rules.xfst
define NumLex [ NumLex3 .o. FinnishRules ];

# With the rules, intermediate forms such as
#
# 4+Sg+Part 5+Sg+Ill 6+Sg+Part
# neljTA viiteVn kuutTA
#
# are realized correctly as
#
# 4+Sg+Part 5+Sg+Ill 6+Sg+Part
# neljää viiteen kuutta

push NumLex

down 28+Ord+Pl+Gen
down 520+Sg+Nom