From 392b11ba78b919823a60565c07eb2c60f1bf3846 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 20 Jun 2008 10:12:50 +0000 Subject: [PATCH] restored Symbolic in 1.4, moved to mathematical; Int and Float don't work properly --- lib/resource-1.4/Make.hs | 3 ++ lib/resource-1.4/mathematical/Symbol.gf | 6 +-- lib/resource-1.4/mathematical/Symbolic.gf | 56 ++++++++++++++++++++ lib/resource-1.4/mathematical/SymbolicDan.gf | 5 ++ lib/resource-1.4/mathematical/SymbolicEng.gf | 5 ++ lib/resource-1.4/mathematical/SymbolicFin.gf | 5 ++ lib/resource-1.4/mathematical/SymbolicFre.gf | 5 ++ lib/resource-1.4/mathematical/SymbolicGer.gf | 5 ++ lib/resource-1.4/mathematical/SymbolicIta.gf | 5 ++ lib/resource-1.4/mathematical/SymbolicNor.gf | 5 ++ lib/resource-1.4/mathematical/SymbolicSpa.gf | 5 ++ lib/resource-1.4/mathematical/SymbolicSwe.gf | 5 ++ 12 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 lib/resource-1.4/mathematical/Symbolic.gf create mode 100644 lib/resource-1.4/mathematical/SymbolicDan.gf create mode 100644 lib/resource-1.4/mathematical/SymbolicEng.gf create mode 100644 lib/resource-1.4/mathematical/SymbolicFin.gf create mode 100644 lib/resource-1.4/mathematical/SymbolicFre.gf create mode 100644 lib/resource-1.4/mathematical/SymbolicGer.gf create mode 100644 lib/resource-1.4/mathematical/SymbolicIta.gf create mode 100644 lib/resource-1.4/mathematical/SymbolicNor.gf create mode 100644 lib/resource-1.4/mathematical/SymbolicSpa.gf create mode 100644 lib/resource-1.4/mathematical/SymbolicSwe.gf diff --git a/lib/resource-1.4/Make.hs b/lib/resource-1.4/Make.hs index 0b242b03f..a94e21fc0 100644 --- a/lib/resource-1.4/Make.hs +++ b/lib/resource-1.4/Make.hs @@ -62,6 +62,8 @@ make xx = do ifx "math" $ do mapM_ (gfc False [] . math) langsMath system $ "cp mathematical/*.gfo ../mathematical" + mapM_ (gfc False [] . symbolic) langsMath + system $ "cp mathematical/Symbolic*.gfo ../mathematical" ifxx "pgf" $ do system $ "gfc -s --make --name=langs --parser=off --output-dir=" ++ dir ++ " " ++ unwords [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- langsPGF] ++ @@ -88,6 +90,7 @@ treeb = "rf -lines -tree -file=" ++ treebankExx ++ lang (lla,la) = lla ++ "/Lang" ++ la ++ ".gf" try (lla,la) = "api/Try" ++ la ++ ".gf" math (lla,la) = "mathematical/Mathematical" ++ la ++ ".gf" +symbolic (lla,la) = "mathematical/Symbolic" ++ la ++ ".gf" except ls es = filter (flip notElem es . snd) ls only ls es = filter (flip elem es . snd) ls diff --git a/lib/resource-1.4/mathematical/Symbol.gf b/lib/resource-1.4/mathematical/Symbol.gf index 57aff8946..a8ac9ca1b 100644 --- a/lib/resource-1.4/mathematical/Symbol.gf +++ b/lib/resource-1.4/mathematical/Symbol.gf @@ -12,8 +12,8 @@ fun SymbPN : Symb -> PN ; -- x IntPN : Int -> PN ; -- 27 FloatPN : Float -> PN ; -- 3.14159 - NumPN : Num -> PN ; - CNNumNP : CN -> Num -> NP ; -- level five ; level 5 + NumPN : Card -> PN ; + CNNumNP : CN -> Card -> NP ; -- level five ; level 5 CNSymbNP : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y @@ -23,7 +23,7 @@ fun --2 Symbols as numerals - SymbNum : Symb -> Num ; -- n + SymbNum : Symb -> Card ; -- n SymbOrd : Symb -> Ord ; -- n'th --2 Symbol lists diff --git a/lib/resource-1.4/mathematical/Symbolic.gf b/lib/resource-1.4/mathematical/Symbolic.gf new file mode 100644 index 000000000..7413ff60c --- /dev/null +++ b/lib/resource-1.4/mathematical/Symbolic.gf @@ -0,0 +1,56 @@ +--1 Symbolic: Noun Phrases with mathematical symbols + +incomplete resource Symbolic = open Symbol, Grammar in { + + oper + symb : overload { + symb : Str -> NP ; -- x + symb : Integer -> NP ; -- 23 + symb : Float -> NP ; -- 0.99 + symb : N -> Digits -> NP ; -- level 4 + symb : N -> Card -> NP ; -- level four + symb : CN -> Card -> NP ; -- advanced level four + symb : Det -> N -> Num -> NP ; -- the number four + symb : Det -> CN -> Num -> NP ; -- the even number four + symb : Det -> N -> Str -> Str -> NP ; -- the levels i and j + symb : Det -> CN -> [Symb] -> NP -- the basic levels i, j, and k + } ; + + mkSymb : Str -> Symb ; + mkInteger : Predef.Int -> Integer ; + mkFloating : Predef.Float -> Floating ; + +--. + + symb = overload { + symb : Str -> NP + = \s -> UsePN (SymbPN (mkSymb s)) ; + symb : Integer -> NP + = \i -> UsePN (IntPN i) ; + symb : Floating -> NP + = \i -> UsePN (FloatPN i) ; + symb : N -> Digits -> NP + = \c,i -> CNNumNP (UseN c) (NumDigits i) ; + symb : N -> Num -> NP + = \c,n -> CNNumNP (UseN c) n ; + symb : CN -> Num -> NP + = \c,n -> CNNumNP c n ; + symb : Det -> N -> Num -> NP + = \d,n,x -> DetCN d (ApposCN (UseN n) (UsePN (NumPN x))) ; + symb : Det -> CN -> Num -> NP + = \d,n,x -> DetCN d (ApposCN n (UsePN (NumPN x))) ; + symb : Det -> N -> Str -> Str -> NP + = \c,n,x,y -> CNSymbNP c (UseN n) (BaseSymb (mkSymb x) (mkSymb y)) ; + symb : Det -> CN -> [Symb] -> NP + = CNSymbNP + } ; + + mkSymb : Str -> Symb = \s -> {s = s ; lock_Symb = <>} ; + + mkInteger i = {s = Predef.show Predef.Int i ; lock_Int = <>} ; + mkFloating f = {s = Predef.show Predef.Float f ; lock_Float = <>} ; + + Integer : Type = {s : Str ; lock_Int : {}} ; + Floating : Type = {s : Str ; lock_Float : {}} ; + +} diff --git a/lib/resource-1.4/mathematical/SymbolicDan.gf b/lib/resource-1.4/mathematical/SymbolicDan.gf new file mode 100644 index 000000000..cbbe7e0ad --- /dev/null +++ b/lib/resource-1.4/mathematical/SymbolicDan.gf @@ -0,0 +1,5 @@ +--# -path=.:present:mathematical:prelude + +resource SymbolicDan = Symbolic with + (Symbol = SymbolDan), + (Grammar = GrammarDan) ; diff --git a/lib/resource-1.4/mathematical/SymbolicEng.gf b/lib/resource-1.4/mathematical/SymbolicEng.gf new file mode 100644 index 000000000..c9b559a22 --- /dev/null +++ b/lib/resource-1.4/mathematical/SymbolicEng.gf @@ -0,0 +1,5 @@ +--# -path=.:present:mathematical:prelude + +resource SymbolicEng = Symbolic with + (Symbol = SymbolEng), + (Grammar = GrammarEng) ; diff --git a/lib/resource-1.4/mathematical/SymbolicFin.gf b/lib/resource-1.4/mathematical/SymbolicFin.gf new file mode 100644 index 000000000..f8b88526b --- /dev/null +++ b/lib/resource-1.4/mathematical/SymbolicFin.gf @@ -0,0 +1,5 @@ +--# -path=.:present:mathematical:prelude + +resource SymbolicFin = Symbolic with + (Symbol = SymbolFin), + (Grammar = GrammarFin) ; diff --git a/lib/resource-1.4/mathematical/SymbolicFre.gf b/lib/resource-1.4/mathematical/SymbolicFre.gf new file mode 100644 index 000000000..ee0b2acc9 --- /dev/null +++ b/lib/resource-1.4/mathematical/SymbolicFre.gf @@ -0,0 +1,5 @@ +--# -path=.:present:mathematical:prelude + +resource SymbolicFre = Symbolic with + (Symbol = SymbolFre), + (Grammar = GrammarFre) ; diff --git a/lib/resource-1.4/mathematical/SymbolicGer.gf b/lib/resource-1.4/mathematical/SymbolicGer.gf new file mode 100644 index 000000000..8b8d7111d --- /dev/null +++ b/lib/resource-1.4/mathematical/SymbolicGer.gf @@ -0,0 +1,5 @@ +--# -path=.:present:mathematical:prelude + +resource SymbolicGer = Symbolic with + (Symbol = SymbolGer), + (Grammar = GrammarGer) ; diff --git a/lib/resource-1.4/mathematical/SymbolicIta.gf b/lib/resource-1.4/mathematical/SymbolicIta.gf new file mode 100644 index 000000000..d4b578c8d --- /dev/null +++ b/lib/resource-1.4/mathematical/SymbolicIta.gf @@ -0,0 +1,5 @@ +--# -path=.:present:mathematical:prelude + +resource SymbolicIta = Symbolic with + (Symbol = SymbolIta), + (Grammar = GrammarIta) ; diff --git a/lib/resource-1.4/mathematical/SymbolicNor.gf b/lib/resource-1.4/mathematical/SymbolicNor.gf new file mode 100644 index 000000000..b4eff28e0 --- /dev/null +++ b/lib/resource-1.4/mathematical/SymbolicNor.gf @@ -0,0 +1,5 @@ +--# -path=.:present:mathematical:prelude + +resource SymbolicNor = Symbolic with + (Symbol = SymbolNor), + (Grammar = GrammarNor) ; diff --git a/lib/resource-1.4/mathematical/SymbolicSpa.gf b/lib/resource-1.4/mathematical/SymbolicSpa.gf new file mode 100644 index 000000000..ae44431f5 --- /dev/null +++ b/lib/resource-1.4/mathematical/SymbolicSpa.gf @@ -0,0 +1,5 @@ +--# -path=.:present:mathematical:prelude + +resource SymbolicSpa = Symbolic with + (Symbol = SymbolSpa), + (Grammar = GrammarSpa) ; diff --git a/lib/resource-1.4/mathematical/SymbolicSwe.gf b/lib/resource-1.4/mathematical/SymbolicSwe.gf new file mode 100644 index 000000000..193d8e84d --- /dev/null +++ b/lib/resource-1.4/mathematical/SymbolicSwe.gf @@ -0,0 +1,5 @@ +--# -path=.:present:mathematical:prelude + +resource SymbolicSwe = Symbolic with + (Symbol = SymbolSwe), + (Grammar = GrammarSwe) ;