From cbcac43e31fabed18586c99ede222be548b6ed1e Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 11 Oct 2005 15:03:44 +0000 Subject: [PATCH] test grs --- lib/resource/MkLexicon.hs | 17 ++++++++++++ lib/resource/abstract/Minimal.gf | 43 ++++++++++++++++++++++++++++++ lib/resource/abstract/Test.gf | 9 +++++++ lib/resource/english/MinimalEng.gf | 34 +++++++++++++++++++++++ lib/resource/english/TestEng.gf | 9 +++++++ 5 files changed, 112 insertions(+) create mode 100644 lib/resource/abstract/Minimal.gf create mode 100644 lib/resource/abstract/Test.gf create mode 100644 lib/resource/english/MinimalEng.gf create mode 100644 lib/resource/english/TestEng.gf diff --git a/lib/resource/MkLexicon.hs b/lib/resource/MkLexicon.hs index 750e94880..5da8c0672 100644 --- a/lib/resource/MkLexicon.hs +++ b/lib/resource/MkLexicon.hs @@ -118,3 +118,20 @@ lin2fun s = case words s of _ -> s where cat fun = reverse (takeWhile (/='_') (reverse fun)) + +-- filter from a given file those lines whose first word is in a sought-set + +allThose :: [String] -> [String] -> [String] +allThose soughts givens = concatMap seek soughts where + seek w = let s = [line | line <- givens, w':_ <- [words line], w == w'] + in if null s then ["-- " ++ w] else s + +-- do this with files +-- example: getAllThose "abstract/Mtmp" "english/BasicEng.gf" + +getAllThose :: FilePath -> FilePath -> IO () +getAllThose sought given = do + s <- readFile sought + gi <- readFile given + let so = [w | l <- lines s, w:_ <- [words l]] + mapM_ putStrLn $ allThose so $ lines gi diff --git a/lib/resource/abstract/Minimal.gf b/lib/resource/abstract/Minimal.gf new file mode 100644 index 000000000..a1eddbe5b --- /dev/null +++ b/lib/resource/abstract/Minimal.gf @@ -0,0 +1,43 @@ +--# -path=.:../../prelude + +abstract Minimal = Categories ** { + +-- a minimum sample of lexicon to test resource grammar with + +fun + -- nouns: count and mass, relational + man_N : N ; + wine_N : N ; + mother_N2 : N2 ; + distance_N3 : N3 ; + + -- proper names + john_PN : PN ; + + -- adjectives: with and without degree + blue_ADeg : ADeg ; + american_A : A ; + + -- adjectives: noun phase, sentence, and verb complements + married_A2 : A2 ; + probable_AS : AS ; + important_A2S : A2S ; + easy_A2V : A2V ; + + -- adverbs + now_Adv : Adv ; + + -- verbs + walk_V : V ; + love_V2 : V2 ; + give_V3 : V3 ; + believe_VS : VS ; + try_VV : VV ; + wonder_VQ : VQ ; + become_VA : VA ; + paint_V2A : V2A ; + promise_V2V : V2V ; + ask_V2Q : V2Q ; + tell_V2S : V2S ; + rain_V0 : V0 ; +} ; diff --git a/lib/resource/abstract/Test.gf b/lib/resource/abstract/Test.gf new file mode 100644 index 000000000..fcceff27a --- /dev/null +++ b/lib/resource/abstract/Test.gf @@ -0,0 +1,9 @@ +--# -path=.:../../prelude + +abstract Test = + Rules, + Clause, + Structural, + Minimal + ** { +} ; diff --git a/lib/resource/english/MinimalEng.gf b/lib/resource/english/MinimalEng.gf new file mode 100644 index 000000000..43391b2fd --- /dev/null +++ b/lib/resource/english/MinimalEng.gf @@ -0,0 +1,34 @@ +--# -path=.:../abstract:../../prelude + +concrete MinimalEng of Minimal = CategoriesEng ** open ParadigmsEng in { + +flags + optimize=all ; + +lin + man_N = mk2N "man" "men" ; + wine_N = regN "wine" ; + mother_N2 = regN2 "mother" ; + distance_N3 = mkN3 (regN "distance") "from" "to" ; + john_PN = regPN "John" masculine ; + blue_ADeg = regADeg "blue" ; + american_A = regA "american" ; + married_A2 = mkA2 (regA "married") "to" ; + probable_AS = mkAS (regA "probable") ; + important_A2S = mkA2S (regA "important") "to" ; + easy_A2V = mkA2V (regA "easy") "for" ; + now_Adv = mkAdv "now" ; + walk_V = (regV "walk") ; + love_V2 = dirV2 (regV "love") ; + give_V3 = dirV3 (irregV "give" "gave" "given") "to" ; + believe_VS = mkVS (regV "believe") ; + try_VV = mkVV (regV "try") ; + wonder_VQ = mkVQ (regV "wonder") ; + become_VA = mkVA (irregV "become" "became" "become") ; + paint_V2A = mkV2A (regV "paint") [] ; + promise_V2V = mkV2V (regV "promise") [] "to" ; + ask_V2Q = mkV2Q (regV "ask") [] ; + tell_V2S = mkV2S (irregV "tell" "told" "told") [] ; + rain_V0 = mkV0 (regV "rain") ; + +} ; diff --git a/lib/resource/english/TestEng.gf b/lib/resource/english/TestEng.gf new file mode 100644 index 000000000..218f9dda1 --- /dev/null +++ b/lib/resource/english/TestEng.gf @@ -0,0 +1,9 @@ +--# -path=.:../abstract:../../prelude + +concrete TestEng of Test = + RulesEng, + ClauseEng, + StructuralEng, + MinimalEng + ** { +} ;