a simpler and better Demo file set for resource grammars

This commit is contained in:
aarne
2010-01-21 09:16:34 +00:00
parent a039808141
commit 37223e742d
42 changed files with 187 additions and 361 deletions

View File

@@ -10,7 +10,7 @@ import System.Exit
-- Make commands for compiling and testing resource grammars.
-- usage: runghc Make ((present? OPT?) | (clone FILE))? LANGS?
-- where
-- - OPT = (lang | api | math | pgf | test | demo | parse | clean)
-- - OPT = (lang | api | math | pgf | test | parse | clean | clone)
-- - LANGS has the form e.g. langs=Eng,Fin,Rus
-- - clone with a flag file=FILENAME clones the file to the specified languages,
-- by replacing the 3-letter language name of the original in both
@@ -67,7 +67,7 @@ langsMinimal = langs `only` ["Ara","Eng","Bul","Rus"]
langsTest = langsLang `except` ["Ara","Bul","Cat","Hin","Rus","Spa","Tha"]
-- languages for which to run demo test
langsDemo = langsLang `except` ["Ara","Hin","Ina","Tha"]
langsDemo = langsLang `except` ["Ara","Hin","Ina","Lat","Tha"]
-- languages for which to compile parsing grammars
langsParse = langs `only` ["Eng"]
@@ -115,9 +115,10 @@ make xx = do
ifxx "test" $ do
let ls = optl langsTest
gf (treeb "Lang" ls) $ unwords [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- ls]
ifxx "demo" $ do
let ls = optl langsDemo
gf (demos "Demo" ls) $ unwords ["demo/Demo" ++ la ++ ".gf" | (_,la) <- ls]
-- use 'make demo'
-- ifxx "demo" $ do
-- let ls = optl langsDemo
-- gf (demos "Demo" ls) $ unwords ["demo/Demo" ++ la ++ ".gf" | (_,la) <- ls]
ifxx "parse" $ do
mapM_ (gfc pres [] . parse) (optl langsParse)
copy "parse/*.gfo parse/oald/*.gfo" dir

View File

@@ -41,7 +41,16 @@ test:
$(RUNMAKE) test
demo:
$(RUNMAKE) demo
gf -make -name=Demo1 demo/DemoDan.gf demo/DemoDut.gf demo/DemoEng.gf
gf -make -name=Demo2 demo/DemoFin.gf +RTS -K48M
gf -make -name=Demo3 demo/DemoFre.gf demo/DemoGer.gf demo/DemoIta.gf demo/DemoNor.gf demo/DemoPol.gf +RTS -K48M
gf -make -name=Demo4 -parser=off demo/DemoRon.gf +RTS -K48M
gf -make -name=Demo5 demo/DemoRus.gf demo/DemoSpa.gf demo/DemoSwe.gf
gf -make Demo1.pgf Demo2.pgf Demo3.pgf Demo4.pgf Demo5.pgf
rm Demo?.pgf
demoex:
echo "gr -number=100 -cat=S | l -treebank | ps -to_html | wf -file=resdemo.html" | gf Demo.pgf
parse:
$(RUNMAKE) parse

View File

@@ -1,12 +0,0 @@
PredVS : NP -> VS -> S -> Cl ;
PredVVV2A : NP -> VV -> V2A -> NP -> AP -> Cl ;
RelCNAdvPrep : CN -> NP -> V -> Adv -> Prep -> CN ;
PredVS np vs s = PredVP np (ComplVS vs s) ;
PredVVV2A np vv v2 np2 ap = PredVP np (ComplVV vv (ComplSlash (SlashV2A v2 ap) np2)) ;
RelCNAdvPrep cn np v adv prep = RelCN cn (UseRCl TPast ASimul PPos
(RelSlash IdRP (SlashPrep (PredVP np (AdvVP (UseV v) adv)) prep))) ;

View File

@@ -1,21 +0,0 @@
abstract Clause = Cat ** {
fun
PredV : NP -> V -> Cl ;
PredV2 : NP -> V2 -> NP -> Cl ;
PredAP : NP -> AP -> Cl ;
PredAdv : NP -> Adv -> Cl ;
UseCl : Temp -> Pol -> Cl -> S ;
QuestV : IP -> V -> QCl ;
QuestV2 : IP -> V2 -> NP -> QCl ;
-- QuestV2Slash : IP -> NP -> V2 -> QCl ;
UseQCl : Temp -> Pol -> QCl -> QS ;
ImpV : V -> Imp ;
-- ImpV2 : V2 -> NP -> Imp ;
}

View File

@@ -1,2 +0,0 @@
concrete ClauseAra of Clause = CatAra ** ClauseI
with (Grammar = GrammarAra) ;

View File

@@ -1 +0,0 @@
concrete ClauseBul of Clause = CatBul ** ClauseI with (Grammar = GrammarBul) ;

View File

@@ -1 +0,0 @@
concrete ClauseCat of Clause = CatCat ** ClauseI with (Grammar = GrammarCat) ;

View File

@@ -1 +0,0 @@
concrete ClauseDan of Clause = CatDan ** ClauseI with (Grammar = GrammarDan) ;

View File

@@ -1 +0,0 @@
concrete ClauseEng of Clause = CatEng ** ClauseI with (Grammar = GrammarEng) ;

View File

@@ -1 +0,0 @@
concrete ClauseFin of Clause = CatFin ** ClauseI with (Grammar = GrammarFin) ;

View File

@@ -1 +0,0 @@
concrete ClauseFre of Clause = CatFre ** ClauseI with (Grammar = GrammarFre) ;

View File

@@ -1 +0,0 @@
concrete ClauseGer of Clause = CatGer ** ClauseI with (Grammar = GrammarGer) ;

View File

@@ -1,22 +0,0 @@
incomplete concrete ClauseI of Clause = Cat ** open Grammar in {
lin
PredV np v = PredVP np (UseV v) ;
PredV2 s v o = PredVP s (ComplSlash (SlashV2a v) o) ;
PredAP s a = PredVP s (UseComp (CompAP a)) ;
PredAdv s a = PredVP s (UseComp (CompAdv a)) ;
UseCl = Grammar.UseCl ;
QuestV np v = QuestVP np (UseV v) ;
QuestV2 s v o = QuestVP s (ComplSlash (SlashV2a v) o) ;
-- QuestV2Slash ip s v = QuestSlash ip (SlashVP s (SlashV2a v)) ;
UseQCl = Grammar.UseQCl ;
ImpV v = ImpVP (UseV v) ;
-- ImpV2 v o = ImpVP (ComplSlash (SlashV2a v) o) ;
}

View File

@@ -1 +0,0 @@
concrete ClauseIta of Clause = CatIta ** ClauseI with (Grammar = GrammarIta) ;

View File

@@ -1 +0,0 @@
concrete ClauseNor of Clause = CatNor ** ClauseI with (Grammar = GrammarNor) ;

View File

@@ -1 +0,0 @@
concrete ClauseRus of Clause = CatRus ** ClauseI with (Grammar = GrammarRus) ;

View File

@@ -1 +0,0 @@
concrete ClauseSpa of Clause = CatSpa ** ClauseI with (Grammar = GrammarSpa) ;

View File

@@ -1 +0,0 @@
concrete ClauseSwe of Clause = CatSwe ** ClauseI with (Grammar = GrammarSwe) ;

View File

@@ -1,21 +1,30 @@
abstract Demo =
Noun - [AdvCN,PredetNP,PPartNP,RelNP,RelCN,SentCN,ApposCN,MassNP,DetNP],
-- Verb,
Clause, --
Adjective - [SentAP,ReflA2],
Adverb,
Numeral,
-- Sentence,
Question - [QuestVP,QuestSlash],
---- Relative,
---- Conjunction,
Phrase,
---- Text,
---- Idiom,
Structural - [everybody_NP,everything_NP,something_NP],
Lexicon, Tense ** {
Lang - [
PredetNP, PPartNP, AdvNP, RelNP, DetNP, DetQuantOrd,
NumDigits, AdNum, OrdDigits, OrdNumeral, OrdSuperl, MassNP,
ComplN2, ComplN3, UseN2, Use2N3, Use3N3, AdjCN, RelCN,
AdvCN, SentCN, ApposCN,
PassV2, CompAdv,
-- CompNP,
SlashV2V, SlashV2VNP, ---
ComparA, ComplA2, ReflA2, UseA2, UseComparA, CAdvAP, AdjOrd, SentAP, AdAP,
PredSCVP, AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, UseSlash, AdvS, RelS,
CompIP,
PConjConj, VocNP, UttVP,
FunRP,
nothing_NP, nobody_NP, please_Voc, otherwise_PConj, therefore_PConj, but_PConj,
language_title_Utt, whatPl_IP, whoPl_IP, if_then_Conj, either7or_DConj,
both7and_DConj, much_Det, that_Subj, no_Quant,
ImpersCl, GenericCl, CleftNP, CleftAdv, ProgrVP, ImpPl1, ImpP3,
-- ExistNP, ---
ConsNP, ConsAdv, ConsS, ConsRS, ConsAP
]
** {
flags startcat = S ;
fun
AdjN : AP -> N -> CN ;
AdAdj : AdA -> A -> AP ;
}

View File

@@ -1,24 +1,10 @@
--# -path=.:alltenses
concrete DemoAra of Demo =
NounAra - [AdvCN,PredetNP,PPartNP,RelNP,RelCN,SentCN,
ApposCN,MassNP,DetNP,ComplN3,Use2N3,Use3N3,AdvNP],
-- VerbAra,
ClauseAra, --
AdjectiveAra - [SentAP,ComplA2,UseA2,DemoA2],
AdverbAra,
NumeralAra,
---- SentenceAra,
QuestionAra - [QuestVP,QuestSlash],
---- RelativeAra,
---- ConjunctionAra,
---- PhraseAra,
---- TextX,
---- IdiomAra,
StructuralAra - [everybody_NP,everything_NP,something_NP],
LexiconAra
** {
concrete DemoAra of Demo = LangAra **
open LangAra in {
flags startcat = Phr ; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoBul of Demo =
NounBul,
ClauseBul,
AdjectiveBul,
AdverbBul,
NumeralBul,
QuestionBul,
StructuralBul,
LexiconBul
** {
concrete DemoBul of Demo = LangBul **
open LangBul in {
flags language = bg; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoCat of Demo =
NounCat,
ClauseCat,
AdjectiveCat,
AdverbCat,
NumeralCat,
QuestionCat,
StructuralCat,
LexiconCat
** {
concrete DemoCat of Demo = LangCat **
open LangCat in {
flags language = ca; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoDan of Demo =
NounDan,
ClauseDan,
AdjectiveDan,
AdverbDan,
NumeralDan,
QuestionDan,
StructuralDan,
LexiconDan, TenseX
** {
concrete DemoDan of Demo = LangDan **
open LangDan in {
flags language = da; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

10
lib/src/demo/DemoDut.gf Normal file
View File

@@ -0,0 +1,10 @@
--# -path=.:alltenses
concrete DemoDut of Demo = LangDut **
open LangDut in {
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoEng of Demo =
NounEng,
ClauseEng,
AdjectiveEng,
AdverbEng,
NumeralEng,
QuestionEng,
StructuralEng,
LexiconEng
** {
concrete DemoEng of Demo = LangEng **
open LangEng in {
flags language = en; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoFin of Demo =
NounFin,
ClauseFin,
AdjectiveFin,
AdverbFin,
NumeralFin,
QuestionFin,
StructuralFin,
LexiconFin
** {
concrete DemoFin of Demo = LangFin **
open LangFin in {
flags language = fi; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoFre of Demo =
NounFre,
ClauseFre,
AdjectiveFre,
AdverbFre,
NumeralFre,
QuestionFre,
StructuralFre,
LexiconFre
** {
concrete DemoFre of Demo = LangFre **
open LangFre in {
flags language = fr; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoGer of Demo =
NounGer,
ClauseGer,
AdjectiveGer,
AdverbGer,
NumeralGer,
QuestionGer,
StructuralGer,
LexiconGer
** {
concrete DemoGer of Demo = LangGer **
open LangGer in {
flags language = de; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,24 +1,10 @@
--# -path=.:alltenses
concrete DemoHin of Demo =
NounHin - [AdvCN,PredetNP,PPartNP,RelNP,RelCN,SentCN,
ApposCN,MassNP,DetNP,ComplN3,Use2N3,Use3N3,AdvNP],
-- VerbHin,
ClauseHin, --
AdjectiveHin - [SentAP,ComplA2,UseA2,DemoA2],
AdverbHin,
NumeralHin,
---- SentenceHin,
QuestionHin - [QuestVP,QuestSlash],
---- RelativeHin,
---- ConjunctionHin,
---- PhraseHin,
---- TextX,
---- IdiomHin,
StructuralHin - [everybody_NP,everything_NP,something_NP],
LexiconHin
** {
concrete DemoHin of Demo = LangHin **
open LangHin in {
flags startcat = Phr ; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,24 +1,10 @@
--# -path=.:alltenses
concrete DemoIna of Demo =
NounIna - [AdvCN,PredetNP,PPartNP,RelNP,RelCN,SentCN,
ApposCN,MassNP,DetNP,ComplN3,Use2N3,Use3N3,AdvNP],
-- VerbIna,
ClauseIna, --
AdjectiveIna - [SentAP,ComplA2,UseA2,DemoA2],
AdverbIna,
NumeralIna,
---- SentenceIna,
QuestionIna - [QuestVP,QuestSlash],
---- RelativeIna,
---- ConjunctionIna,
---- PhraseIna,
---- TextX,
---- IdiomIna,
StructuralIna - [everybody_NP,everything_NP,something_NP],
LexiconIna
** {
concrete DemoIna of Demo = LangIna **
open LangIna in {
flags startcat = Phr ; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoIta of Demo =
NounIta,
ClauseIta,
AdjectiveIta,
AdverbIta,
NumeralIta,
QuestionIta,
StructuralIta,
LexiconIta
** {
concrete DemoIta of Demo = LangIta **
open LangIta in {
flags language = it; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,24 +0,0 @@
--# -path=.:alltenses
incomplete concrete DemoJ of Demo =
Noun - [AdvCN,PredetNP,PPartNP,RelNP,RelCN,SentCN,
ApposCN,MassNP,DetNP,ComplN3,Use2N3,Use3N3,AdvNP],
-- Verb,
Clause, --
Adjective - [SentAP,ComplA2,UseA2,DemoA2],
Adverb,
Numeral,
---- Sentence,
Question - [QuestVP,QuestSlash],
---- Relative,
---- Conjunction,
---- Phrase,
---- TextX,
---- Idiom,
Structural - [everybody_NP,everything_NP,something_NP],
Lexicon
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;
} ;

View File

@@ -1,22 +0,0 @@
--# -path=.:alltenses
concrete DemoJEng of Demo = DemoJ with
(Noun = NounEng),
(Clause = ClauseEng), --
(Adjective = AdjectiveEng),
(Adverb = AdverbEng),
(Numeral = NumeralEng),
---- Sentence,
(Question )- [QuestVP,QuestSlash],
---- Relative,
---- Conjunction,
---- Phrase,
---- TextX,
---- Idiom,
Structural - [everybody_NP,everything_NP,something_NP],
Lexicon
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;
} ;

10
lib/src/demo/DemoLat.gf Normal file
View File

@@ -0,0 +1,10 @@
--# -path=.:alltenses
concrete DemoLat of Demo = LangLat **
open LangLat in {
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoNor of Demo =
NounNor,
ClauseNor,
AdjectiveNor,
AdverbNor,
NumeralNor,
QuestionNor,
StructuralNor,
LexiconNor, TenseX
** {
concrete DemoNor of Demo = LangNor **
open LangNor in {
flags language = no; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

10
lib/src/demo/DemoPol.gf Normal file
View File

@@ -0,0 +1,10 @@
--# -path=.:alltenses
concrete DemoPol of Demo = LangPol **
open LangPol in {
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
}

10
lib/src/demo/DemoRon.gf Normal file
View File

@@ -0,0 +1,10 @@
--# -path=.:alltenses
concrete DemoRon of Demo = LangRon **
open LangRon in {
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoRus of Demo =
NounRus,
ClauseRus,
AdjectiveRus,
AdverbRus,
NumeralRus,
QuestionRus,
StructuralRus,
LexiconRus
** {
concrete DemoRus of Demo = LangRus **
open LangRus in {
flags language = ru; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoSpa of Demo =
NounSpa,
ClauseSpa,
AdjectiveSpa,
AdverbSpa,
NumeralSpa,
QuestionSpa,
StructuralSpa,
LexiconSpa
** {
concrete DemoSpa of Demo = LangSpa **
open LangSpa in {
flags language = es; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,16 +1,10 @@
--# -path=.:alltenses
concrete DemoSwe of Demo =
NounSwe,
ClauseSwe,
AdjectiveSwe,
AdverbSwe,
NumeralSwe,
QuestionSwe,
StructuralSwe,
LexiconSwe, TenseX
** {
concrete DemoSwe of Demo = LangSwe **
open LangSwe in {
flags language = sv; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

View File

@@ -1,24 +1,10 @@
--# -path=.:alltenses
concrete DemoTha of Demo =
NounTha - [AdvCN,PredetNP,PPartNP,RelNP,RelCN,SentCN,
ApposCN,MassNP,DetNP,ComplN3,Use2N3,Use3N3,AdvNP],
-- VerbTha,
ClauseTha, --
AdjectiveTha - [SentAP,ComplA2,UseA2,DemoA2],
AdverbTha,
NumeralTha,
---- SentenceTha,
QuestionTha - [QuestVP,QuestSlash],
---- RelativeTha,
---- ConjunctionTha,
---- PhraseTha,
---- TextX,
---- IdiomTha,
StructuralTha - [everybody_NP,everything_NP,something_NP],
LexiconTha
** {
concrete DemoTha of Demo = LangTha **
open LangTha in {
flags startcat = Phr ; unlexer = text ; lexer = text ;
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
} ;
}

10
lib/src/demo/DemoTur.gf Normal file
View File

@@ -0,0 +1,10 @@
--# -path=.:alltenses
concrete DemoTur of Demo = LangTur **
open LangTur in {
lin
AdjN ap n = AdjCN ap (UseN n) ;
AdAdj ad a = AdAP ad (PositA a) ;
}