remove -src from Setup; simplified str2numeral; bug fix in Finnish ordinal inflection

This commit is contained in:
aarne
2010-12-21 09:58:12 +00:00
parent 2c91730b9d
commit 4f244b6eec
5 changed files with 25 additions and 16 deletions

View File

@@ -154,7 +154,7 @@ gfc pres ppath file = do
let preproc = if pres then "-preproc=mkPresent" else ""
let path = if pres then ppath else ""
putStrLn $ "Compiling " ++ file
run_gfc ["-s","-src", preproc, path, file]
run_gfc ["-s","-src",preproc, path, file]
gfcmin path file = do
let preproc = "-preproc=mkMinimal"

View File

@@ -1646,13 +1646,18 @@ oper
Predef.PFalse => NumDigits (str2digits s)
} ;
str2numeral : Str -> Numeral = (\s -> case s of {
m@(? + _) + "000" => num (pot3 (s2s1000 m)) ;
m@(? + _) + "00" + n@? => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
m@(? + _) + "0" + n@(? + ?) => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
m@(? + _) + n@(? + ? + ?) => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
_ => num (pot2as3 (s2s1000 s))
})
str2numeral : Str -> Numeral =
(\s -> case s of {
? => num (pot2as3 (pot1as2 (pot0as1 (s2s10 s)))) ;
? + ? => num (pot2as3 (pot1as2 (s2s100 s))) ;
-- m@(? + _) + "000" => num (pot3 (s2s1000 m)) ;
-- m@(? + _) + "00" + n@? => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
-- m@(? + _) + "0" + n@(? + ?) => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
-- m@(? + _) + n@(? + ? + ?) => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
-- _ => num (pot2as3 (s2s1000 s))
_ => Predef.error ("no numeral for string" ++ s)
})
where {
s2d : Str -> Digit = \s -> case s of {
@@ -1681,13 +1686,14 @@ oper
d@#idigit + n@? => pot1plus (s2d d) (s2s10 n) ;
_ => pot0as1 (s2s10 s)
} ;
{-
s2s1000 : Str -> Sub1000 = \s -> case s of {
d@? + "00" => pot2 (s2s10 d) ;
d@? + "0" + n@? => pot2plus (s2s10 d) (s2s100 n) ;
d@? + n@(? + ?) => pot2plus (s2s10 d) (s2s100 n) ;
_ => pot1as2 (s2s100 s)
} ;
-}
} ;
idigit : pattern Str = #("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9") ;
digit : pattern Str = #("0" | #idigit) ;

View File

@@ -91,9 +91,9 @@ oper
sada = init sadas
in
mkN
sadas (sada + "nnen") (sada + "nten" + a) (sada + "tt" + a) (sada + "nteen")
(sada + "nsin" + a) (sada + "nsiss" + a) (sada + "nsien")
(sada + "nsi" + a) (sada + "nsiin") ;
sadas (sada + "nnen") (sada + "tt" + a) (sada + "nten" + a) (sada + "nteen")
(sada + "nsien") (sada + "nsi" + a) (sada + "nsin" + a)
(sada + "nsiss" + a) (sada + "nsiin") ;
param
NumPlace = NumIndep | NumAttr ;

View File

@@ -94,7 +94,7 @@ oper
mkN : (savi,savia : Str) -> N ; -- different pl.part
mkN : (vesi,veden,vesiä : Str) -> N ; -- also different sg.gen
mkN : (vesi,veden,vesiä,vettä : Str) -> N ; -- also different sg.part
mkN : (olo,n,na,a,oon,jen,ja,ina,issa,ihin : Str) -> N ; -- worst case, 10 forms
mkN : (olo,n,a,na,oon,jen,ja,ina,issa,ihin : Str) -> N ; -- worst case, 10 forms
mkN : (pika : Str) -> (juna : N) -> N ; -- compound with invariable prefix
mkN : (oma : N) -> (tunto : N) -> N ; -- compound with inflecting prefix
} ;