mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 11:19:32 -06:00
renamed lib/src/mini/MiniGrammar to lib/src/demo/ResourceDemo ; added Jap
This commit is contained in:
45
lib/src/demo/Compile.hs
Normal file
45
lib/src/demo/Compile.hs
Normal file
@@ -0,0 +1,45 @@
|
||||
import List
|
||||
import System
|
||||
|
||||
-- (c) Aarne Ranta 2010 under GNU LGPL
|
||||
|
||||
-- Compile files into pgf, in chosen combinations.
|
||||
|
||||
-- Usage: runghc Compile (-make | -link)? Eng Fre Fin ...
|
||||
-- The -make option links all pgf files to one in the end
|
||||
-- The -link option only links, without first compiling
|
||||
-- Arguments whose length are 3 characters are prefixed with mainmodu.
|
||||
-- Other arguments are passed literally.
|
||||
|
||||
-- Thus, for instance, to produce an English-Swedish-Romanian phrasebook with English
|
||||
-- disambiguation, the command is
|
||||
--
|
||||
-- runghc Compile -link Eng Swe Ron DisambPhrasebookEng
|
||||
|
||||
|
||||
-- change this to apply to another project; alternatively, just use full file names
|
||||
mainmodu = "ResourceDemo"
|
||||
|
||||
main = do
|
||||
(opts,langs) <- getArgs >>= return . partition ((=='-') . head)
|
||||
let modus = [mkFile la | la <- langs]
|
||||
putStrLn $ unwords modus
|
||||
if notElem "-link" opts
|
||||
then mapM_ compileOne modus >> return ()
|
||||
else return ()
|
||||
case opts of
|
||||
_ | elem "-make" opts || elem "-link" opts -> do
|
||||
let comm = "gf -make -s " ++ unwords (map (++ ".pgf") modus)
|
||||
putStrLn comm
|
||||
system comm
|
||||
return ()
|
||||
_ -> return ()
|
||||
|
||||
compileOne modu = do
|
||||
let comm = "gf -make -s -optimize-pgf -name=" ++
|
||||
modu ++ " " ++ modu ++ ".gf" ++
|
||||
" +RTS -K32M"
|
||||
putStrLn comm
|
||||
system comm
|
||||
|
||||
mkFile la = if length la == 3 then mainmodu ++ la else la
|
||||
@@ -1,30 +0,0 @@
|
||||
abstract Demo =
|
||||
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
|
||||
]
|
||||
** {
|
||||
|
||||
fun
|
||||
AdjN : AP -> N -> CN ;
|
||||
AdAdj : AdA -> A -> AP ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoAra of Demo = LangAra **
|
||||
open LangAra in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoBul of Demo = LangBul **
|
||||
open LangBul in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoCat of Demo = LangCat **
|
||||
open LangCat in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoDan of Demo = LangDan **
|
||||
open LangDan in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -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) ;
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoEng of Demo = LangEng - [
|
||||
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
|
||||
] **
|
||||
open LangEng in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoFin of Demo = LangFin - [
|
||||
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
|
||||
] **
|
||||
open LangFin in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoFre of Demo = LangFre **
|
||||
open LangFre in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoGer of Demo = LangGer - [
|
||||
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
|
||||
] **
|
||||
open LangGer in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoHin of Demo = LangHin **
|
||||
open LangHin in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoIna of Demo = LangIna **
|
||||
open LangIna in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoIta of Demo = LangIta **
|
||||
open LangIta in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -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) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoNor of Demo = LangNor **
|
||||
open LangNor in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -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) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoRon of Demo = LangRon - [SlashVP] **
|
||||
open LangRon in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoRus of Demo = LangRus **
|
||||
open LangRus in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoSpa of Demo = LangSpa - [
|
||||
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
|
||||
] **
|
||||
open LangSpa in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoSwe of Demo = LangSwe - [
|
||||
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
|
||||
] **
|
||||
open LangSwe in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoTha of Demo = LangTha **
|
||||
open LangTha in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -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) ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete DemoUrd of Demo = LangUrd **
|
||||
open LangUrd in {
|
||||
|
||||
lin
|
||||
AdjN ap n = AdjCN ap (UseN n) ;
|
||||
AdAdj ad a = AdAP ad (PositA a) ;
|
||||
|
||||
}
|
||||
12
lib/src/demo/Makefile
Normal file
12
lib/src/demo/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
compile = runghc Compile
|
||||
|
||||
all: src compdemo linkdemo
|
||||
|
||||
src:
|
||||
runghc MkMini.hs
|
||||
|
||||
compdemo:
|
||||
$(compile) Afr Bul Cat Dan Dut Eng Fin Fre Ger Hin Ita Jap Lav Nep Nor Pes Pnb Pol Ron Rus Snd Spa Swe Tha Urd
|
||||
|
||||
linkdemo:
|
||||
$(compile) -link Afr Bul Cat Dan Dut Eng Fin Fre Ger Hin Ita Jap Lav Nep Nor Pes Pnb Pol Ron Rus Snd Spa Swe Tha Urd
|
||||
23
lib/src/demo/MkMini.hs
Normal file
23
lib/src/demo/MkMini.hs
Normal file
@@ -0,0 +1,23 @@
|
||||
src = "Eng"
|
||||
langs = [
|
||||
"Afr","Bul","Cat","Dan","Dut",
|
||||
"Fin","Fre","Ger","Hin","Ita",
|
||||
"Jap","Lav","Nep","Nor","Pes",
|
||||
"Pol","Pnb","Ron","Rus","Snd",
|
||||
"Spa","Swe","Tha","Urd"
|
||||
]
|
||||
|
||||
file lng = "ResourceDemo" ++ lng ++ ".gf"
|
||||
|
||||
main = do
|
||||
s <- readFile (file src)
|
||||
mapM_ (mkMiniFile s) langs
|
||||
|
||||
mkMiniFile s lng =
|
||||
writeFile (file lng) (mkMini lng s)
|
||||
|
||||
mkMini lng s = case s of
|
||||
'E':'n':'g':cs -> lng ++ mkMini lng cs
|
||||
c:cs -> c : mkMini lng cs
|
||||
_ -> s
|
||||
|
||||
139
lib/src/demo/ResourceDemo.gf
Normal file
139
lib/src/demo/ResourceDemo.gf
Normal file
@@ -0,0 +1,139 @@
|
||||
abstract ResourceDemo = Lexicon, Grammar [
|
||||
|
||||
-- the "mini" resource of GF book, chapter 9
|
||||
|
||||
-- cat
|
||||
S, -- sentence
|
||||
Cl, -- clause
|
||||
NP, -- noun phrase
|
||||
VP, -- verb phrase
|
||||
AP, -- adjectival phrase
|
||||
CN, -- common noun
|
||||
Det, -- determiner
|
||||
N, -- noun
|
||||
A, -- adjective
|
||||
V, -- verb (one-place, intransitive)
|
||||
V2, -- two-place verb (two-place, transitive or prepositional)
|
||||
AdA, -- ad-adjective
|
||||
Tense, -- tense
|
||||
Pol, -- polarity
|
||||
Conj, -- conjunction
|
||||
|
||||
-- fun
|
||||
UseCl , -- Tense -> Pol -> Cl -> S,
|
||||
PredVP , -- NP -> VP -> Cl,
|
||||
--- ComplV2, -- V2 -> NP -> VP,
|
||||
DetCN , -- Det -> CN -> NP,
|
||||
--- ModCN , -- AP -> CN -> CN,
|
||||
|
||||
--- CompAP , -- AP -> VP,
|
||||
AdAP , -- AdA -> AP -> AP,
|
||||
|
||||
--- ConjS , -- Conj -> S -> S -> S,
|
||||
--- ConjAP , -- Conj -> AP -> AP -> AP,
|
||||
--- ConjNP , -- Conj -> NP -> NP -> NP,
|
||||
|
||||
UseV , -- V -> VP,
|
||||
UseN , -- N -> CN,
|
||||
PositA, -- A -> AP,
|
||||
|
||||
--- a_Det, the_Det,
|
||||
every_Det, -- Det,
|
||||
--- this_Det, these_Det, -- Det,
|
||||
--- that_Det, those_Det, -- Det,
|
||||
--- i_NP, youSg_NP, he_NP, she_NP, we_NP, youPl_NP, they_NP, -- NP,
|
||||
very_AdA, -- AdA,
|
||||
|
||||
TTAnt, -- Tense -> Ant -> Temp ;
|
||||
PPos, PNeg, -- Pol,
|
||||
TPres, TPast, TFut, TCond, -- Tense,
|
||||
ASimul, AAnter,
|
||||
|
||||
and_Conj, or_Conj, -- Conj,
|
||||
|
||||
-- extension of the mini grammar
|
||||
|
||||
-- cat
|
||||
Utt, -- utterance (sentence or question) e.g. "does she walk"
|
||||
QS, -- question (fixed tense) e.g. "who doesn't walk"
|
||||
QCl, -- question clause (variable tense) e.g. "who walks"
|
||||
ClSlash, -- clause missing noun phrase e.g. "she walks with"
|
||||
Adv, -- adverb e.g. "here"
|
||||
Prep, -- preposition (and/or case) e.g. "with"
|
||||
VS, -- sentence-complement verb e.g. "know"
|
||||
VQ, -- question-complement verb e.g. "wonder"
|
||||
VV, -- verb-phrase-complement verb e.g. "want"
|
||||
IP, -- interrogative pronoun e.g. "who"
|
||||
PN, -- proper name e.g. "John"
|
||||
Subj, -- subjunction e.g. "because"
|
||||
IAdv, -- interrogative adverb e.g. "why"
|
||||
|
||||
ListAP,
|
||||
ListNP,
|
||||
ListS,
|
||||
Temp,
|
||||
Comp,
|
||||
Ant,
|
||||
Imp,
|
||||
|
||||
-- fun
|
||||
UttS , -- S -> Utt,
|
||||
UttQS, -- QS -> Utt,
|
||||
|
||||
UseQCl, -- Tense -> Pol -> QCl -> QS,
|
||||
|
||||
QuestCl , -- Cl -> QCl, -- does she walk
|
||||
QuestVP , -- IP -> VP -> QCl, -- who walks
|
||||
QuestSlash, -- IP -> ClSlash -> QCl, -- who does she walk with
|
||||
QuestIAdv , -- IAdv -> Cl -> QCl, -- why does she walk
|
||||
|
||||
--- SubjCl, -- Cl -> Subj -> S -> Cl, -- she walks because we run
|
||||
|
||||
--- CompAdv, -- Adv -> VP, -- be here
|
||||
PrepNP , -- Prep -> NP -> Adv, -- in the house
|
||||
|
||||
ComplVS, -- VS -> S -> VP, -- know that she walks
|
||||
ComplVQ, -- VQ -> QS -> VP, -- wonder who walks
|
||||
ComplVV, -- VV -> VP -> VP, -- want to walk
|
||||
|
||||
--- SlashV2 , -- NP -> V2 -> ClSlash, -- she loves
|
||||
--- SlashPrep, -- Cl -> Prep -> ClSlash, -- she walks with
|
||||
|
||||
AdvVP, -- VP -> Adv -> VP, -- walk in the city
|
||||
|
||||
UsePN, -- PN -> NP, -- John
|
||||
--- AdvNP, -- NP -> Adv -> NP, -- the man in the city
|
||||
|
||||
who_IP , -- IP,
|
||||
here_Adv, -- Adv,
|
||||
by_Prep, in_Prep, of_Prep, with_Prep, -- Prep,
|
||||
can_VV, must_VV, want_VV, -- VV,
|
||||
although_Subj, because_Subj, when_Subj, if_Subj, -- Subj,
|
||||
when_IAdv, where_IAdv, why_IAdv-- IAdv,
|
||||
|
||||
] ** {
|
||||
|
||||
flags startcat = Utt ;
|
||||
|
||||
-- functions with different type
|
||||
|
||||
fun
|
||||
ComplV2 : V2 -> NP -> VP ;
|
||||
ModCN : AP -> CN -> CN ;
|
||||
CompAP : AP -> VP ;
|
||||
ConjS : Conj -> S -> S -> S ;
|
||||
ConjAP : Conj -> AP -> AP -> AP ;
|
||||
ConjNP : Conj -> NP -> NP -> NP ;
|
||||
a_Det, the_Det : Det ;
|
||||
this_Det, these_Det : Det ;
|
||||
that_Det, those_Det : Det ;
|
||||
i_NP, youSg_NP, he_NP, she_NP, we_NP, youPl_NP, they_NP : NP ;
|
||||
SubjS : Subj -> S -> S -> Utt ; -- if she walks we run
|
||||
CompAdv : Adv -> VP ; -- be here
|
||||
-- SlashV2 : NP -> V2 -> ClSlash ; -- she loves
|
||||
SlashPrep : Cl -> Prep -> ClSlash ; -- she walks with
|
||||
AdvCN : CN -> Prep -> NP -> CN ; -- man in the city
|
||||
|
||||
|
||||
}
|
||||
|
||||
147
lib/src/demo/ResourceDemoEng.gf
Normal file
147
lib/src/demo/ResourceDemoEng.gf
Normal file
@@ -0,0 +1,147 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete ResourceDemoEng of ResourceDemo = LexiconEng, GrammarEng [
|
||||
|
||||
-- the "mini" resource of GF book, chapter 9
|
||||
|
||||
-- cat
|
||||
S, -- sentence
|
||||
Cl, -- clause
|
||||
NP, -- noun phrase
|
||||
VP, -- verb phrase
|
||||
AP, -- adjectival phrase
|
||||
CN, -- common noun
|
||||
Det, -- determiner
|
||||
N, -- noun
|
||||
A, -- adjective
|
||||
V, -- verb (one-place, intransitive)
|
||||
V2, -- two-place verb (two-place, transitive or prepositional)
|
||||
AdA, -- ad-adjective
|
||||
Tense, -- tense
|
||||
Pol, -- polarity
|
||||
Conj, -- conjunction
|
||||
|
||||
-- fun
|
||||
UseCl , -- Tense -> Pol -> Cl -> S,
|
||||
PredVP , -- NP -> VP -> Cl,
|
||||
--- ComplV2, -- V2 -> NP -> VP,
|
||||
DetCN , -- Det -> CN -> NP,
|
||||
--- ModCN , -- AP -> CN -> CN,
|
||||
|
||||
--- CompAP , -- AP -> VP,
|
||||
AdAP , -- AdA -> AP -> AP,
|
||||
|
||||
--- ConjS , -- Conj -> S -> S -> S,
|
||||
--- ConjAP , -- Conj -> AP -> AP -> AP,
|
||||
--- ConjNP , -- Conj -> NP -> NP -> NP,
|
||||
|
||||
UseV , -- V -> VP,
|
||||
UseN , -- N -> CN,
|
||||
PositA, -- A -> AP,
|
||||
|
||||
--- a_Det, the_Det,
|
||||
every_Det, -- Det,
|
||||
--- this_Det, these_Det, -- Det,
|
||||
--- that_Det, those_Det, -- Det,
|
||||
--- i_NP, youSg_NP, he_NP, she_NP, we_NP, youPl_NP, they_NP, -- NP,
|
||||
very_AdA, -- AdA,
|
||||
|
||||
TTAnt, -- Tense -> Ant -> Temp ;
|
||||
PPos, PNeg, -- Pol,
|
||||
TPres, TPast, TFut, TCond, -- Tense,
|
||||
STense, SCond, SFut, SPast, SPres, -- scand tense
|
||||
ASimul, AAnter,
|
||||
|
||||
and_Conj, or_Conj, -- Conj,
|
||||
|
||||
-- extension of the mini grammar
|
||||
|
||||
-- cat
|
||||
Utt, -- utterance (sentence or question) e.g. "does she walk"
|
||||
QS, -- question (fixed tense) e.g. "who doesn't walk"
|
||||
QCl, -- question clause (variable tense) e.g. "who walks"
|
||||
ClSlash, -- clause missing noun phrase e.g. "she walks with"
|
||||
Adv, -- adverb e.g. "here"
|
||||
Prep, -- preposition (and/or case) e.g. "with"
|
||||
VS, -- sentence-complement verb e.g. "know"
|
||||
VQ, -- question-complement verb e.g. "wonder"
|
||||
VV, -- verb-phrase-complement verb e.g. "want"
|
||||
IP, -- interrogative pronoun e.g. "who"
|
||||
PN, -- proper name e.g. "John"
|
||||
Subj, -- subjunction e.g. "because"
|
||||
IAdv, -- interrogative adverb e.g. "why"
|
||||
|
||||
ListAP,
|
||||
ListNP,
|
||||
ListS,
|
||||
Temp,
|
||||
Comp,
|
||||
Ant,
|
||||
|
||||
Imp, Bool, True, False, Voc,
|
||||
|
||||
-- fun
|
||||
UttS , -- S -> Utt,
|
||||
UttQS, -- QS -> Utt,
|
||||
|
||||
UseQCl, -- Tense -> Pol -> QCl -> QS,
|
||||
|
||||
QuestCl , -- Cl -> QCl, -- does she walk
|
||||
QuestVP , -- IP -> VP -> QCl, -- who walks
|
||||
QuestSlash, -- IP -> ClSlash -> QCl, -- who does she walk with
|
||||
QuestIAdv , -- IAdv -> Cl -> QCl, -- why does she walk
|
||||
|
||||
--- SubjCl, -- Cl -> Subj -> S -> Cl, -- she walks because we run
|
||||
|
||||
--- CompAdv, -- Adv -> VP, -- be here
|
||||
PrepNP , -- Prep -> NP -> Adv, -- in the house
|
||||
|
||||
--- ComplVS, -- VS -> S -> VP, -- know that she walks
|
||||
--- ComplVQ, -- VQ -> QS -> VP, -- wonder who walks
|
||||
--- ComplVV, -- VV -> VP -> VP, -- want to walk
|
||||
|
||||
--- SlashV2 , -- NP -> V2 -> ClSlash, -- she loves
|
||||
--- SlashPrep, -- Cl -> Prep -> ClSlash, -- she walks with
|
||||
|
||||
AdvVP, -- VP -> Adv -> VP, -- walk in the city
|
||||
|
||||
UsePN, -- PN -> NP, -- John
|
||||
--- AdvNP, -- NP -> Adv -> NP, -- the man in the city
|
||||
|
||||
who_IP , -- IP,
|
||||
here_Adv, -- Adv,
|
||||
by_Prep, in_Prep, of_Prep, with_Prep, -- Prep,
|
||||
can_VV, must_VV, want_VV, -- VV,
|
||||
although_Subj, because_Subj, when_Subj, if_Subj, -- Subj,
|
||||
when_IAdv, where_IAdv, why_IAdv-- IAdv,
|
||||
|
||||
] ** open SyntaxEng, (S = SyntaxEng) in {
|
||||
|
||||
-- functions with different type
|
||||
|
||||
lin
|
||||
ComplV2 v np = mkVP v np ;
|
||||
ModCN ap cn = lin CN (mkCN <lin AP ap : AP> <lin CN cn : CN>) ;
|
||||
CompAP ap = mkVP (lin AP ap) ;
|
||||
ConjS co x y = mkS (lin Conj co) (lin S x) (lin S y) ;
|
||||
ConjAP co x y = mkAP co x y ;
|
||||
ConjNP co x y = mkNP co x y ;
|
||||
a_Det = mkDet a_Quant ;
|
||||
the_Det = mkDet the_Quant ;
|
||||
this_Det = S.this_Det ;
|
||||
these_Det = S.these_Det ;
|
||||
that_Det = S.that_Det ;
|
||||
those_Det = S.those_Det ;
|
||||
i_NP = S.i_NP ;
|
||||
youSg_NP = S.you_NP ;
|
||||
he_NP = S.he_NP ;
|
||||
she_NP = S.she_NP ;
|
||||
we_NP = S.we_NP ;
|
||||
youPl_NP = S.youPl_NP ;
|
||||
they_NP = S.they_NP ;
|
||||
SubjS subj a b = mkUtt (mkS (S.mkAdv <subj : Subj> <a : S>) b) ;
|
||||
CompAdv adv = mkVP (lin Adv adv) ;
|
||||
-- SlashV2 np v2 = mkClSlash np v2 ;
|
||||
SlashPrep cl p = mkClSlash (lin Cl cl) <p : Prep> ;
|
||||
AdvCN cn p pp = mkCN <lin CN cn : CN> (mkAdv <p : Prep> <pp : NP>) ;
|
||||
}
|
||||
Reference in New Issue
Block a user