forked from GitHub/gf-core
test grs
This commit is contained in:
@@ -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
|
||||
|
||||
43
lib/resource/abstract/Minimal.gf
Normal file
43
lib/resource/abstract/Minimal.gf
Normal file
@@ -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 ;
|
||||
} ;
|
||||
9
lib/resource/abstract/Test.gf
Normal file
9
lib/resource/abstract/Test.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
--# -path=.:../../prelude
|
||||
|
||||
abstract Test =
|
||||
Rules,
|
||||
Clause,
|
||||
Structural,
|
||||
Minimal
|
||||
** {
|
||||
} ;
|
||||
34
lib/resource/english/MinimalEng.gf
Normal file
34
lib/resource/english/MinimalEng.gf
Normal file
@@ -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") ;
|
||||
|
||||
} ;
|
||||
9
lib/resource/english/TestEng.gf
Normal file
9
lib/resource/english/TestEng.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete TestEng of Test =
|
||||
RulesEng,
|
||||
ClauseEng,
|
||||
StructuralEng,
|
||||
MinimalEng
|
||||
** {
|
||||
} ;
|
||||
Reference in New Issue
Block a user