summaryrefslogtreecommitdiff
path: root/examples/miniresource
diff options
context:
space:
mode:
Diffstat (limited to 'examples/miniresource')
-rw-r--r--examples/miniresource/Miniresource.gf47
-rw-r--r--examples/miniresource/MiniresourceChi.gf208
-rw-r--r--examples/miniresource/MiniresourceEng.gf268
-rw-r--r--examples/miniresource/MiniresourceFin.gf2
-rw-r--r--examples/miniresource/MiniresourceFre.gf2
-rw-r--r--examples/miniresource/MiniresourceI.gf76
-rw-r--r--examples/miniresource/MiniresourceIChi.gf2
-rw-r--r--examples/miniresource/MiniresourceIEng.gf2
-rw-r--r--examples/miniresource/MiniresourceIta.gf391
-rw-r--r--examples/miniresource/MiniresourceSan.gf262
-rw-r--r--examples/miniresource/MiniresourceSwe.gf2
11 files changed, 0 insertions, 1262 deletions
diff --git a/examples/miniresource/Miniresource.gf b/examples/miniresource/Miniresource.gf
deleted file mode 100644
index e37b8fa03..000000000
--- a/examples/miniresource/Miniresource.gf
+++ /dev/null
@@ -1,47 +0,0 @@
-abstract Miniresource = {
-
--- module Grammar in GF book, Chapter 9: syntax and structural words
-
- flags startcat = S ;
-
- cat
- S ; Cl ; NP ; VP ; AP ; CN ;
- Det ; N ; A ; V ; V2 ; AdA ;
- Tense ; Pol ;
- Conj ;
- data
- 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 ;
- ConjNP : Conj -> NP -> NP -> NP ;
-
- UseV : V -> VP ;
- UseN : N -> CN ;
- UseA : 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 ;
-
- Pos, Neg : Pol ;
- Pres, Perf : Tense ;
-
- and_Conj, or_Conj : Conj ;
-
--- module Test: content word lexicon for testing
-
- man_N, woman_N, house_N, tree_N : N ;
- big_A, small_A, green_A : A ;
- walk_V, arrive_V : V ;
- love_V2, please_V2 : V2 ;
-
-}
diff --git a/examples/miniresource/MiniresourceChi.gf b/examples/miniresource/MiniresourceChi.gf
deleted file mode 100644
index 204d0be8a..000000000
--- a/examples/miniresource/MiniresourceChi.gf
+++ /dev/null
@@ -1,208 +0,0 @@
-concrete MiniresourceChi of Miniresource = open Prelude in {
-
--- module GrammarChi
-
- flags coding = utf8;
-
- lincat
- S = {s : Str} ;
- Cl = {s : Bool => Str} ;
- NP = NounPhrase ;
- -- {s : Str} ;
- VP = VerbPhrase ;
- -- {verb : Verb ; compl : Str} ;
- AP = {s : Str; monoSyl: Bool} ;
- CN = Noun ; -- {s : Str; c : Str} ;
- Det = {s : Str ; n : Number} ;
- N = Noun ; -- {s : Str; c : Str} ;
- A = Adj ; -- {s : Str; monoSyl: Bool} ;
- V = Verb; -- {s : Str ; pp,ds,dp,ep : Str ; neg : Str}
- V2 = Verb ;
- AdA = {s : Str} ;
- Pol = {s : Str ; b : Bool} ;
- Tense = {s : Str} ;
- Conj = {s : SForm => Str} ;
-
- lin
- UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! p.b} ;
-
- PredVP np vp = {
- s = \\p => np.s ++ neg p ++ vp.verb.s ++ vp.compl
- } ;
-
- ComplV2 v2 np = {
- verb = v2 ;
- compl = np.s
- } ;
-
- UseV v = {
- verb = v ;
- compl = []
- } ;
-
- DetCN det cn = case det.n of {
- Sg => {s = det.s ++ cn.c ++ cn.s ; n = Sg } ;
- Pl => {s = det.s ++ "些" ++ cn.s ; n = Pl }
- } ;
-
- ModCN ap cn = case ap.monoSyl of {
- True => {s = ap.s ++ cn.s ; c = cn.c} ;
- False => {s = ap.s ++ "的" ++ cn.s ; c = cn.c}
- } ;
-
- CompAP ap = {
- verb = copula ;
- compl = ap.s ++ "的"
- } ;
-
- AdAP ada ap = {
- s = ada.s ++ ap.s ;
- monoSyl = False
- } ;
-
- ConjNP co x y = {
- s = x.s ++ co.s ! Phr NPhrase ++ y.s
- } ;
-
- ConjS co x y = {s = x.s ++ co.s ! Sent ++ y.s} ;
-
- UseN n = n ;
- UseA adj = adj ;
-
- a_Det = mkDet "一" Sg ;
- every_Det = mkDet "每" Sg ;
- the_Det = mkDet "那" Sg ;
-
- this_Det = mkDet "这" Sg ;
- these_Det = mkDet "这" Pl ;
- that_Det = mkDet "那" Sg ;
- those_Det = mkDet "那" Pl ;
-
- i_NP = pronNP "我" ;
- youSg_NP = pronNP "你" ;
- he_NP = pronNP "他" ;
- she_NP = pronNP "她" ;
- we_NP = pronNP "我们" ;
- youPl_NP = pronNP "你们" ;
- they_NP = pronNP "他们" ;
-
- very_AdA = ss (word "非常") ;
-
- and_Conj = {s = table {
- Phr NPhrase => "和" ;
- Phr APhrase => "而" ;
- Phr VPhrase => "又" ;
- Sent => []
- }
- } ;
-
- or_Conj = {s = table {
- Phr _ => "或" ;
- Sent => word "还是"
- }
- } ;
-
- Pos = {s = [] ; b = True} ;
- Neg = {s = [] ; b = False} ;
- Pres = {s = []} ;
- Perf = {s = []} ;
-
--- module TestChi
-
-lin
- man_N = mkN "男人" ;
- woman_N = mkN "女人" ;
- house_N = mkN "房子" ;
- tree_N = mkN "树" "棵";
- big_A = mkA "大" ;
- small_A = mkA "小" ;
- green_A = mkA "绿" ;
- walk_V = mkV "走" ;
- arrive_V = mkV "到" ;
- love_V2 = mkV2 "爱" ;
- please_V2 = mkV2 "麻烦" ;
-
--- module ResChi
-
--- parameters
-
-param
- Number = Sg | Pl ;
- SForm = Phr PosType | Sent;
- PosType = APhrase | NPhrase | VPhrase ;
-
--- parts of speech
-
-oper
-
- VerbPhrase = {verb : Verb ; compl : Str} ;
- NounPhrase = {s : Str} ;
-
--- for morphology
-
- Noun : Type = {s : Str; c : Str} ;
- Adj : Type = {s : Str; monoSyl: Bool} ;
- Verb : Type = {s : Str} ;
-
- mkNoun : Str -> Str -> Noun = \s,c -> {s = word s ; c = word c};
-
- mkAdj : Str -> Adj = \s -> case s of {
- ? => {s = word s ; monoSyl = True} ;
- _ => {s = word s ; monoSyl = False}
- } ;
-
- copula : Verb = mkVerb "是" ;
-
- mkVerb : (v : Str) -> Verb = \v ->
- {s = word v} ;
-
- neg : Bool -> Str = \b -> case b of {True => [] ; False => "不"} ;
-
--- for structural words
-
- mkDet : Str -> Number -> {s : Str ; n : Number} = \s,n -> {
- s = word s ;
- n = n
- } ;
-
- pronNP : (s : Str) -> NounPhrase = \s -> {
- s = word s
- } ;
-
--- Write the characters that constitute a word separately.
--- This enables straightforward tokenization.
-
- bword : Str -> Str -> Str = \x,y -> x ++ y ;
- -- change to x + y to treat words as single tok ens
-
- word : Str -> Str = \s -> case s of {
- x@? + y@? + z@? + u@? => bword x (bword y (bword z u)) ;
- x@? + y@? + z@? => bword x (bword y z) ;
- x@? + y@? => bword x y ;
- _ => s
- } ;
-
--- module ParadigmsChi
-
-oper
- mkN = overload {
- mkN : (man : Str) -> N
- = \n -> lin N (mkNoun n "个") ;
- mkN : (man : Str) -> Str -> N
- = \n,c -> lin N (mkNoun n c)
- } ;
-
- mkA : (small : Str) -> A
- = \a -> lin A (mkAdj a) ;
-
- mkV : (walk : Str) -> V
- = \s -> lin V (mkVerb s) ;
-
- mkV2 = overload {
- mkV2 : (love : Str) -> V2
- = \love -> lin V2 (mkVerb love) ;
- mkV2 : (love : V) -> V2
- = \love -> lin V2 love ;
- } ;
-
-}
diff --git a/examples/miniresource/MiniresourceEng.gf b/examples/miniresource/MiniresourceEng.gf
deleted file mode 100644
index 7fb85394e..000000000
--- a/examples/miniresource/MiniresourceEng.gf
+++ /dev/null
@@ -1,268 +0,0 @@
-concrete MiniresourceEng of Miniresource = open Prelude in {
-
--- module GrammarEng
-
- lincat
- S = {s : Str} ;
- Cl = {s : ClForm => TTense => Bool => Str} ;
- NP = NounPhrase ;
- -- {s : Case => Str ; a : Agr} ;
- VP = VerbPhrase ;
- -- {v : AgrVerb ; compl : Str} ;
- AP = {s : Str} ;
- CN = Noun ; -- {s : Number => Str} ;
- Det = {s : Str ; n : Number} ;
- N = Noun ; -- {s : Number => Str} ;
- A = Adj ; -- {s : Str} ;
- V = Verb ; -- {s : VForm => Str} ;
- V2 = Verb ** {c : Str} ;
- AdA = {s : Str} ;
- Tense = {s : Str ; t : TTense} ;
- Pol = {s : Str ; b : Bool} ;
- Conj = {s : Str ; n : Number} ;
- lin
- UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! ClDir ! t.t ! p.b} ;
- PredVP np vp = {
- s = \\d,t,b =>
- let
- vps = vp.verb.s ! d ! t ! b ! np.a
- in case d of {
- ClDir => np.s ! Nom ++ vps.fin ++ vps.inf ++ vp.compl ;
- ClInv => vps.fin ++ np.s ! Nom ++ vps.inf ++ vp.compl
- }
- } ;
-
- ComplV2 v2 np = {
- verb = agrV v2 ;
- compl = v2.c ++ np.s ! Acc
- } ;
-
- UseV v = {
- verb = agrV v ;
- compl = []
- } ;
-
- DetCN det cn = {
- s = \\_ => det.s ++ cn.s ! det.n ;
- a = Ag det.n Per3
- } ;
-
- ModCN ap cn = {
- s = \\n => ap.s ++ cn.s ! n
- } ;
-
- CompAP ap = {
- verb = copula ;
- compl = ap.s
- } ;
-
- AdAP ada ap = {
- s = ada.s ++ ap.s
- } ;
-
- ConjS co x y = {s = x.s ++ co.s ++ y.s} ;
-
- ConjNP co nx ny = {
- s = \\c => nx.s ! c ++ co.s ++ ny.s ! c ;
- a = conjAgr co.n nx.a ny.a
- } ;
-
- UseN n = n ;
-
- UseA adj = adj ;
-
- a_Det = mkDet (pre {#vowel => "an" ; _ => "a"}) Sg ;
-
- every_Det = mkDet "every" Sg ;
-
- the_Det = mkDet "the" Sg ;
- this_Det = mkDet "this" Sg ;
- these_Det = mkDet "these" Pl ;
- that_Det = mkDet "that" Sg ;
- those_Det = mkDet "those" Pl ;
-
- i_NP = pronNP "I" "me" Sg Per1 ;
- youSg_NP = pronNP "you" "you" Sg Per2 ;
- he_NP = pronNP "he" "him" Sg Per3 ;
- she_NP = pronNP "she" "her" Sg Per3 ;
- we_NP = pronNP "we" "us" Pl Per1 ;
- youPl_NP = pronNP "you" "you" Pl Per2 ;
- they_NP = pronNP "they" "them" Pl Per3 ;
-
- very_AdA = ss "very" ;
-
- Pos = {s = [] ; b = True} ;
- Neg = {s = [] ; b = False} ;
- Pres = {s = [] ; t = TPres} ;
- Perf = {s = [] ; t = TPerf} ;
-
- and_Conj = {s = "and" ; n = Pl} ;
- or_Conj = {s = "or" ; n = Sg} ;
-
--- module TestEng
-
- man_N = mkN "man" "men" ;
- woman_N = mkN "woman" "women" ;
- house_N = mkN "house" ;
- tree_N = mkN "tree" ;
- big_A = mkA "big" ;
- small_A = mkA "small" ;
- green_A = mkA "green" ;
- walk_V = mkV "walk" ;
- arrive_V = mkV "arrive" ;
- love_V2 = mkV2 "love" ;
- please_V2 = mkV2 "please" ;
-
--- module ResEng
-
-param
- Number = Sg | Pl ;
- Case = Nom | Acc ;
- Agr = Ag Number Person ;
- TTense = TPres | TPerf ;
- Person = Per1 | Per2 | Per3 ;
- VForm = VInf | VPres | VPast | VPart ;
-
- ClForm = ClDir | ClInv ;
-
-oper
- VerbPhrase = {
- verb : AgrVerb ;
- compl : Str
- } ;
-
- NounPhrase = {
- s : Case => Str ;
- a : Agr
- } ;
-
--- verb as in VP, including copula
-
- AgrVerb : Type = {
- s : ClForm => TTense => Bool => Agr => {fin,inf : Str} ;
- inf : Str
- } ;
-
- copula : AgrVerb = {
- s = \\d,t,p,a => case <t,a> of {
- <TPres,Ag Sg Per1> => {fin = "am" ; inf = neg p} ;
- <TPres,Ag Sg Per3> => {fin = "is" ; inf = neg p} ;
- <TPres,_ > => {fin = "are" ; inf = neg p} ;
- <TPerf,Ag Sg Per3> => {fin = "has" ; inf = neg p ++ "been"} ;
- <TPerf,_ > => {fin = "have" ; inf = neg p ++ "been"}
- } ;
- inf = "be"
- } ;
-
- agrV : Verb -> AgrVerb = \v ->
- let
- vinf = v.s ! VInf ;
- vpart = v.s ! VPart
- in {
- s = \\d,t,p,a => case <d,t,p,a> of {
- <ClDir,TPres,True, Ag Sg Per3> => {fin = v.s ! VPres ; inf = []} ;
- <_, TPres,_, Ag Sg Per3> => {fin = "does" ; inf = neg p ++ vinf} ;
- <ClDir,TPres,True, _ > => {fin = vinf ; inf = []} ;
- <_, TPres,_, _ > => {fin = "do" ; inf = neg p ++ vinf} ;
- <_, TPerf,_, Ag Sg Per3> => {fin = "has" ; inf = neg p ++ vpart} ;
- <_, TPerf,_, _ > => {fin = "have" ; inf = neg p ++ vpart}
- } ;
- inf = vinf
- } ;
-
- neg : Bool -> Str = \b -> case b of {True => [] ; False => "not"} ;
-
--- for coordination
-
- conjAgr : Number -> Agr -> Agr -> Agr = \n,xa,ya ->
- case <xa,ya> of {
- <Ag xn xp, Ag yn yp> =>
- Ag (conjNumber (conjNumber xn yn) n) (conjPerson xp yp)
- } ;
-
- conjNumber : Number -> Number -> Number = \m,n ->
- case m of {Pl => Pl ; _ => n} ;
-
- conjPerson : Person -> Person -> Person = \p,q ->
- case <p,q> of {
- <Per1,_> | <_,Per1> => Per1 ;
- <Per2,_> | <_,Per2> => Per2 ;
- _ => Per3
- } ;
-
- Noun : Type = {s : Number => Str} ;
- Adj : Type = {s : Str} ;
- Verb : Type = {s : VForm => Str} ;
-
- mkNoun : Str -> Str -> Noun = \man,men -> {
- s = table {Sg => man ; Pl => men}
- } ;
-
- regNoun : Str -> Noun = \s ->
- mkNoun s (s + "s") ; ----
-
- mkAdj : Str -> Adj = \s -> ss s ;
-
- mkVerb : (_,_,_,_ : Str) -> Verb =
- \go,goes,went,gone -> {
- s = table {
- VInf => go ;
- VPres => goes ;
- VPast => went ;
- VPart => gone
- }
- } ;
-
- regVerb : Str -> Verb = \v -> case v of {
- _ + "e" => mkVerb v (v + "s") (v + "d") (v + "d") ;
- _ => mkVerb v (v + "s") (v + "ed") (v + "ed")
- } ;
-
- mkDet : Str -> Number -> {s : Str ; n : Number} = \s,n -> {
- s = s ;
- n = n
- } ;
-
- pronNP : (s,a : Str) -> Number -> Person -> NounPhrase =
- \s,a,n,p -> {
- s = table {
- Nom => s ;
- Acc => a
- } ;
- a = Ag n p
- } ;
-
- vowel : pattern Str = #("a" | "e" | "i" | "o") ;
-
--- module ParadigmsEng
-
-oper
- mkN = overload {
- mkN : (dog : Str) -> N
- = \n -> lin N (regNoun n) ;
- mkN : (man, men : Str) -> N
- = \s,p -> lin N (mkNoun s p) ;
- } ;
-
- mkA = overload {
- mkA : (small : Str) -> A
- = \a -> lin A (mkAdj a) ;
- } ;
-
- mkV = overload {
- mkV : (walk : Str) -> V
- = \v -> lin V (regVerb v) ;
- mkV : (go,goes,went,gone : Str) -> V
- = \p1,p2,p3,p4 -> lin V (mkVerb p1 p2 p3 p4) ;
- } ;
-
- mkV2 = overload {
- mkV2 : Str -> V2
- = \s -> lin V2 (regVerb s ** {c = []}) ;
- mkV2 : V -> V2
- = \v -> lin V2 (v ** {c = []}) ;
- mkV2 : V -> Str -> V2
- = \v,p -> lin V2 (v ** {c = p}) ;
- } ;
-
-}
diff --git a/examples/miniresource/MiniresourceFin.gf b/examples/miniresource/MiniresourceFin.gf
deleted file mode 100644
index 13544b9a5..000000000
--- a/examples/miniresource/MiniresourceFin.gf
+++ /dev/null
@@ -1,2 +0,0 @@
-concrete MiniresourceFin of Miniresource = MiniresourceI with
- (Grammar = GrammarFin), (Lexicon = LexiconFin) ;
diff --git a/examples/miniresource/MiniresourceFre.gf b/examples/miniresource/MiniresourceFre.gf
deleted file mode 100644
index b188d91f1..000000000
--- a/examples/miniresource/MiniresourceFre.gf
+++ /dev/null
@@ -1,2 +0,0 @@
-concrete MiniresourceFre of Miniresource = MiniresourceI with
- (Grammar = GrammarFre), (Lexicon = LexiconFre) ;
diff --git a/examples/miniresource/MiniresourceI.gf b/examples/miniresource/MiniresourceI.gf
deleted file mode 100644
index 26b79b044..000000000
--- a/examples/miniresource/MiniresourceI.gf
+++ /dev/null
@@ -1,76 +0,0 @@
-incomplete concrete MiniresourceI of Miniresource = open Grammar, Lexicon in {
-
--- module Grammar in GF book, Chapter 9: syntax and structural words
-
- lincat
- S = Grammar.S ;
- Cl = Grammar.Cl ;
- NP = Grammar.NP ;
- VP = Grammar.VP ;
- AP = Grammar.AP ;
- CN = Grammar.CN ;
- Det = Grammar.Det ;
- N = Grammar.N ;
- A = Grammar.A ;
- V = Grammar.V ;
- V2 = Grammar.V2 ;
- AdA = Grammar.AdA ;
- Tense = Grammar.Temp ;
- Pol = Grammar.Pol ;
- Conj = Grammar.Conj ;
- lin
- UseCl = Grammar.UseCl ;
- PredVP = Grammar.PredVP ;
- ComplV2 v np = Grammar.ComplSlash (Grammar.SlashV2a v) np ;
- DetCN = Grammar.DetCN ;
- ModCN = Grammar.AdjCN ;
-
- CompAP ap = Grammar.UseComp (Grammar.CompAP ap) ;
- AdAP = Grammar.AdAP ;
-
- ConjS c x y = Grammar.ConjS c (Grammar.BaseS x y) ;
- ConjNP c x y = Grammar.ConjNP c (Grammar.BaseNP x y) ;
-
- UseV = Grammar.UseV ;
- UseN = Grammar.UseN ;
- UseA = Grammar.PositA ;
-
- a_Det = Grammar.DetQuant Grammar.IndefArt Grammar.NumSg ;
- the_Det = Grammar.DetQuant Grammar.DefArt Grammar.NumSg ;
- every_Det = Grammar.every_Det ;
- this_Det = Grammar.DetQuant Grammar.this_Quant Grammar.NumSg ;
- these_Det = Grammar.DetQuant Grammar.this_Quant Grammar.NumPl ;
- that_Det = Grammar.DetQuant Grammar.that_Quant Grammar.NumSg ;
- those_Det = Grammar.DetQuant Grammar.that_Quant Grammar.NumPl ;
- i_NP = Grammar.UsePron Grammar.i_Pron ;
- youSg_NP = Grammar.UsePron Grammar.youSg_Pron ;
- he_NP = Grammar.UsePron Grammar.he_Pron ;
- she_NP = Grammar.UsePron Grammar.she_Pron ;
- we_NP = Grammar.UsePron Grammar.we_Pron ;
- youPl_NP = Grammar.UsePron Grammar.youPl_Pron ;
- they_NP = Grammar.UsePron Grammar.they_Pron ;
- very_AdA = Grammar.very_AdA ;
-
- Pos = Grammar.PPos ;
- Neg = Grammar.PNeg ;
- Pres = Grammar.TTAnt Grammar.TPres Grammar.ASimul ;
- Perf = Grammar.TTAnt Grammar.TPres Grammar.AAnter ;
-
- and_Conj = Grammar.and_Conj ;
- or_Conj = Grammar.or_Conj ;
-
--- module Test: content word lexicon for testing
-
- man_N = Lexicon.man_N ;
- woman_N = Lexicon.woman_N ;
- house_N = Lexicon.house_N ;
- tree_N = Lexicon.tree_N ;
- big_A = Lexicon.big_A ;
- small_A = Lexicon.small_A ;
- green_A = Lexicon.green_A ;
- walk_V = Lexicon.walk_V ;
- arrive_V = Lexicon.come_V ; -----
- love_V2 = Lexicon.love_V2 ;
- please_V2 = Lexicon.hear_V2 ; ----
-
-}
diff --git a/examples/miniresource/MiniresourceIChi.gf b/examples/miniresource/MiniresourceIChi.gf
deleted file mode 100644
index fce80208b..000000000
--- a/examples/miniresource/MiniresourceIChi.gf
+++ /dev/null
@@ -1,2 +0,0 @@
-concrete MiniresourceIChi of Miniresource = MiniresourceI with
- (Grammar = GrammarChi), (Lexicon = LexiconChi) ;
diff --git a/examples/miniresource/MiniresourceIEng.gf b/examples/miniresource/MiniresourceIEng.gf
deleted file mode 100644
index 9711b4295..000000000
--- a/examples/miniresource/MiniresourceIEng.gf
+++ /dev/null
@@ -1,2 +0,0 @@
-concrete MiniresourceIEng of Miniresource = MiniresourceI with
- (Grammar = GrammarEng), (Lexicon = LexiconEng) ;
diff --git a/examples/miniresource/MiniresourceIta.gf b/examples/miniresource/MiniresourceIta.gf
deleted file mode 100644
index c5a8f1402..000000000
--- a/examples/miniresource/MiniresourceIta.gf
+++ /dev/null
@@ -1,391 +0,0 @@
-concrete MiniresourceIta of Miniresource = open Prelude in {
-
--- module GrammarIta
-
- flags coding = utf8 ;
-
- lincat
- S = {s : Str} ;
- Cl = {s : TTense => Bool => Str} ;
- NP = NounPhrase ;
- -- {s : Case => {clit,obj : Str ; isClit : Bool} ; a : Agr} ;
- VP = VerbPhrase ;
- -- {v : Verb ; clit : Str ; clitAgr : ClitAgr ; obj : Agr => Str} ;
- AP = {s : Gender => Number => Str ; isPre : Bool} ;
- CN = Noun ; -- {s : Number => Str ; g : Gender} ;
- Det = {s : Gender => Case => Str ; n : Number} ;
- N = Noun ; -- {s : Number => Str ; g : Gender} ;
- A = Adj ; -- {s : Gender => Number => Str ; isPre : Bool} ;
- V = Verb ; -- {s : VForm => Str ; aux : Aux} ;
- V2 = Verb ** {c : Case} ;
- AdA = {s : Str} ;
- Pol = {s : Str ; b : Bool} ;
- Tense = {s : Str ; t : TTense} ;
- Conj = {s : Str ; n : Number} ;
- lin
- UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! p.b} ;
- PredVP np vp =
- let
- subj = (np.s ! Nom).obj ;
- obj = vp.obj ! np.a ;
- clit = vp.clit ;
- verb = table {
- TPres => agrV vp.v np.a ;
- TPerf => agrV (auxVerb vp.v.aux) np.a ++ agrPart vp.v np.a vp.clitAgr
- }
- in {
- s = \\t,b => subj ++ neg b ++ clit ++ verb ! t ++ obj
- } ;
-
- ComplV2 v2 np =
- let
- nps = np.s ! v2.c
- in {
- v = v2 ;
- clit = nps.clit ;
- clitAgr = case <nps.isClit,v2.c> of {
- <True,Acc> => CAgr np.a ;
- _ => CAgrNo
- } ;
- obj = \\_ => nps.obj
- } ;
-
- UseV v = {
- v = v ;
- clit = [] ;
- clitAgr = CAgrNo ;
- obj = \\_ => []
- } ;
-
- DetCN det cn = {
- s = \\c => {
- obj = det.s ! cn.g ! c ++ cn.s ! det.n ;
- clit = [] ;
- isClit = False
- } ;
- a = Ag cn.g det.n Per3
- } ;
-
- ModCN ap cn = {
- s = \\n => preOrPost ap.isPre (ap.s ! cn.g ! n) (cn.s ! n) ;
- g = cn.g
- } ;
-
- CompAP ap = {
- v = essere_V ;
- clit = [] ;
- clitAgr = CAgrNo ;
- obj = \\ag => case ag of {
- Ag g n _ => ap.s ! g ! n
- }
- } ;
-
- AdAP ada ap = {
- s = \\g,n => ada.s ++ ap.s ! g ! n ;
- isPre = ap.isPre ;
- } ;
-
---- known issue: this comes out wrong for pronouns
- ConjNP co nx ny = {
- s = \\c => {
- obj = (nx.s ! c).clit ++ (nx.s ! c).obj ++ co.s ++ (ny.s ! c).clit ++ (ny.s ! c).obj ;
- clit = [] ;
- isClit = False
- } ;
- a = conjAgr co.n nx.a ny.a
- } ;
-
- ConjS co x y = {s = x.s ++ co.s ++ y.s} ;
-
- UseN n = n ;
-
- UseA adj = adj ;
-
- a_Det = adjDet (mkAdj "un" "una" [] [] True) Sg ;
-
- every_Det = adjDet (regAdj "ogni") Sg ;
-
- the_Det = {
- s = table {
- Masc => table {
- Nom | Acc => elisForms "lo" "l'" "il" ;
- Dat => elisForms "allo" "all'" "al"
- } ;
- Fem => table {
- Nom | Acc => elisForms "la" "'l" "la" ;
- Dat => elisForms "alla" "all'" "alla"
- }
- } ;
- n = Sg
- } ;
-
- this_Det = adjDet (regAdj "questo") Sg ;
- these_Det = adjDet (regAdj "questo") Pl ;
- that_Det = adjDet quello_A Sg ;
- those_Det = adjDet quello_A Pl ;
-
- i_NP = pronNP "io" "mi" "mi" Masc Sg Per1 ;
- youSg_NP = pronNP "tu" "ti" "ti" Masc Sg Per2 ;
- he_NP = pronNP "lui" "lo" "gli" Masc Sg Per3 ;
- she_NP = pronNP "lei" "la" "le" Fem Sg Per3 ;
- we_NP = pronNP "noi" "ci" "ci" Masc Pl Per1 ;
- youPl_NP = pronNP "voi" "vi" "vi" Masc Pl Per2 ;
- they_NP = pronNP "loro" "li" "glie" Masc Pl Per3 ;
-
- very_AdA = ss "molto" ;
-
- Pos = {s = [] ; b = True} ;
- Neg = {s = [] ; b = False} ;
- Pres = {s = [] ; t = TPres} ;
- Perf = {s = [] ; t = TPerf} ;
-
- and_Conj = {s = "e" ; n = Pl} ;
- or_Conj = {s = "o" ; n = Sg} ;
-
- oper
- quello_A : Adj = mkAdj
- (elisForms "quello" "quell'" "quel") "quella"
- (elisForms "quegli" "quegli" "quei") "quelle"
- True ;
-
--- module TestIta
-
-lin
- man_N = mkN "uomo" "uomini" masculine ;
- woman_N = mkN "donna" ;
- house_N = mkN "casa" ;
- tree_N = mkN "albero" ;
- big_A = preA (mkA "grande") ;
- small_A = preA (mkA "piccolo") ;
- green_A = mkA "verde" ;
- walk_V = mkV "camminare" ;
- arrive_V = essereV (mkV "arrivare") ;
- love_V2 = mkV2 "amare" ;
- please_V2 = mkV2 (essereV (mkV "piacere" "piaccio" "piaci" "piace"
- "piacciamo" "piacete" "piacciono" "piaciuto")) dative ;
-
-
--- module ResIta
-
--- parameters
-
-param
- Number = Sg | Pl ;
- Gender = Masc | Fem ;
- Case = Nom | Acc | Dat ;
- Agr = Ag Gender Number Person ;
- Aux = Avere | Essere ;
- TTense = TPres | TPerf ;
- Person = Per1 | Per2 | Per3 ;
-
- VForm = VInf | VPres Number Person | VPart Gender Number ;
-
- ClitAgr = CAgrNo | CAgr Agr ;
-
--- parts of speech
-
-oper
- VerbPhrase = {
- v : Verb ;
- clit : Str ;
- clitAgr : ClitAgr ;
- obj : Agr => Str
- } ;
- NounPhrase = {
- s : Case => {clit,obj : Str ; isClit : Bool} ;
- a : Agr
- } ;
-
--- the preposition word of an abstract case
-
- prepCase : Case -> Str = \c -> case c of {
- Dat => "a" ;
- _ => []
- } ;
-
--- for predication
-
- agrV : Verb -> Agr -> Str = \v,a -> case a of {
- Ag _ n p => v.s ! VPres n p
- } ;
-
- auxVerb : Aux -> Verb = \a -> case a of {
- Avere =>
- mkVerb "avere" "ho" "hai" "ha" "abbiamo" "avete" "hanno" "avuto" Avere ;
- Essere =>
- mkVerb "essere" "sono" "sei" "è" "siamo" "siete" "sono" "stato" Essere
- } ;
-
- agrPart : Verb -> Agr -> ClitAgr -> Str = \v,a,c -> case v.aux of {
- Avere => case c of {
- CAgr (Ag g n _) => v.s ! VPart g n ;
- _ => v.s ! VPart Masc Sg
- } ;
- Essere => case a of {
- Ag g n _ => v.s ! VPart g n
- }
- } ;
-
- neg : Bool -> Str = \b -> case b of {True => [] ; False => "non"} ;
-
- essere_V = auxVerb Essere ;
-
--- for coordination
-
- conjAgr : Number -> Agr -> Agr -> Agr = \n,xa,ya ->
- let
- x = agrFeatures xa ; y = agrFeatures ya
- in Ag
- (conjGender x.g y.g)
- (conjNumber (conjNumber x.n y.n) n)
- (conjPerson x.p y.p) ;
-
- agrFeatures : Agr -> {g : Gender ; n : Number ; p : Person} = \a ->
- case a of {Ag g n p => {g = g ; n = n ; p = p}} ;
-
- conjGender : Gender -> Gender -> Gender = \g,h ->
- case g of {Masc => Masc ; _ => h} ;
-
- conjNumber : Number -> Number -> Number = \m,n ->
- case m of {Pl => Pl ; _ => n} ;
-
- conjPerson : Person -> Person -> Person = \p,q ->
- case <p,q> of {
- <Per1,_> | <_,Per1> => Per1 ;
- <Per2,_> | <_,Per2> => Per2 ;
- _ => Per3
- } ;
-
-
-
--- for morphology
-
- Noun : Type = {s : Number => Str ; g : Gender} ;
- Adj : Type = {s : Gender => Number => Str ; isPre : Bool} ;
- Verb : Type = {s : VForm => Str ; aux : Aux} ;
-
- mkNoun : Str -> Str -> Gender -> Noun = \vino,vini,g -> {
- s = table {Sg => vino ; Pl => vini} ;
- g = g
- } ;
-
- regNoun : Str -> Noun = \vino -> case vino of {
- fuo + c@("c"|"g") + "o" => mkNoun vino (fuo + c + "hi") Masc ;
- ol + "io" => mkNoun vino (ol + "i") Masc ;
- vin + "o" => mkNoun vino (vin + "i") Masc ;
- cas + "a" => mkNoun vino (cas + "e") Fem ;
- pan + "e" => mkNoun vino (pan + "i") Masc ;
- _ => mkNoun vino vino Masc
- } ;
-
- mkAdj : (_,_,_,_ : Str) -> Bool -> Adj = \buono,buona,buoni,buone,p -> {
- s = table {
- Masc => table {Sg => buono ; Pl => buoni} ;
- Fem => table {Sg => buona ; Pl => buone}
- } ;
- isPre = p
- } ;
-
- regAdj : Str -> Adj = \nero -> case nero of {
- ner + "o" => mkAdj nero (ner + "a") (ner + "i") (ner + "e") False ;
- verd + "e" => mkAdj nero nero (verd + "i") (verd + "i") False ;
- _ => mkAdj nero nero nero nero False
- } ;
-
- mkVerb : (_,_,_,_,_,_,_,_ : Str) -> Aux -> Verb =
- \amare,amo,ami,ama,amiamo,amate,amano,amato,aux -> {
- s = table {
- VInf => amare ;
- VPres Sg Per1 => amo ;
- VPres Sg Per2 => ami ;
- VPres Sg Per3 => ama ;
- VPres Pl Per1 => amiamo ;
- VPres Pl Per2 => amate ;
- VPres Pl Per3 => amano ;
- VPart g n => (regAdj amato).s ! g ! n
- } ;
- aux = aux
- } ;
-
- regVerb : Str -> Verb = \amare -> case amare of {
- am + "are" => mkVerb amare (am+"o") (am+"i") (am+"a")
- (am+"iamo") (am+"ate") (am+"ano") (am+"ato") Avere ;
- tem + "ere" => mkVerb amare (tem+"o") (tem+"i") (tem+"e")
- (tem+"iamo") (tem+"ete") (tem+"ono") (tem+"uto") Avere ;
- fin + "ire" => mkVerb amare (fin+"isco") (fin+"isci") (fin+"isce")
- (fin+"iamo") (fin+"ite") (fin+"iscono") (fin+"ito") Avere
- } ;
-
--- for structural words
-
- adjDet : Adj -> Number -> {s : Gender => Case => Str ; n : Number} =
- \adj,n -> {
- s = \\g,c => prepCase c ++ adj.s ! g ! n ;
- n = n
- } ;
-
- pronNP : (s,a,d : Str) -> Gender -> Number -> Person -> NounPhrase =
- \s,a,d,g,n,p -> {
- s = table {
- Nom => {clit = [] ; obj = s ; isClit = False} ;
- Acc => {clit = a ; obj = [] ; isClit = True} ;
- Dat => {clit = d ; obj = [] ; isClit = True}
- } ;
- a = Ag g n p
- } ;
-
--- phonological auxiliaries
-
- vowel : pattern Str = #("a" | "e" | "i" | "o" | "u" | "h") ;
- s_impuro : pattern Str = #("z" | "s" + ("b"|"c"|"d"|"f"|"m"|"p"|"q"|"t")) ;
-
- elisForms : (_,_,_ : Str) -> Str = \lo,l',il ->
- pre {#s_impuro => lo ; #vowel => l' ; _ => il} ;
-
--- module ParadigmsIta
-
-oper
- masculine : Gender = Masc ;
- feminine : Gender = Fem ;
-
- accusative : Case = Acc ;
- dative : Case = Dat ;
-
- mkN = overload {
- mkN : (vino : Str) -> N
- = \n -> lin N (regNoun n) ;
- mkN : (uomo, uomini : Str) -> Gender -> N
- = \s,p,g -> lin N (mkNoun s p g) ;
- } ;
-
- mkA = overload {
- mkA : (nero : Str) -> A
- = \a -> lin A (regAdj a) ;
- mkA : (buono,buona,buoni,buone : Str) -> Bool -> A
- = \sm,sf,pm,pf,p -> lin A (mkAdj sm sf pm pf False) ;
- } ;
-
- preA : A -> A
- = \a -> lin A {s = a.s ; isPre = True} ;
-
- mkV = overload {
- mkV : (finire : Str) -> V
- = \v -> lin V (regVerb v) ;
- mkV : (andare,vado,vadi,va,andiamo,andate,vanno,andato : Str) -> V
- = \i,p1,p2,p3,p4,p5,p6,p -> lin V (mkVerb i p1 p2 p3 p4 p5 p6 p Avere) ;
- } ;
-
- essereV : V -> V
- = \v -> lin V {s = v.s ; aux = Essere} ;
-
- mkV2 = overload {
- mkV2 : Str -> V2
- = \s -> lin V2 (regVerb s ** {c = accusative}) ;
- mkV2 : V -> V2
- = \v -> lin V2 (v ** {c = accusative}) ;
- mkV2 : V -> Case -> V2
- = \v,c -> lin V2 (v ** {c = c}) ;
- } ;
-
-
-}
diff --git a/examples/miniresource/MiniresourceSan.gf b/examples/miniresource/MiniresourceSan.gf
deleted file mode 100644
index dbeecebf2..000000000
--- a/examples/miniresource/MiniresourceSan.gf
+++ /dev/null
@@ -1,262 +0,0 @@
-concrete MiniresourceSan of Miniresource = open Prelude in {
-
--- module GrammarSan
-
- flags coding = utf8;
-
- lincat
- S = {s : Str} ;
- Cl = {s : Bool => Str} ;
- NP = NounPhrase ;
- VP = VerbPhrase ;
- AP = Adj ;
- CN = Noun ;
- Det = {s : Gender => Case => Str ; n : Number} ;
- N = Noun ;
- A = Adj ;
- V = Verb;
- V2 = Verb ** {c : Case} ;
- AdA = {s : Str} ;
- Pol = {s : Str ; b : Bool} ;
- Tense = {s : Str} ;
- Conj = {s : Str} ;
-
-
- lin
-
- UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! p.b} ;
-
- PredVP np vp = {
- s = \\p => np.s ! Nom ++ neg p ++ vp.compl ! np.a ++ vp.verb.s ! VPres np.a.n np.a.p
- } ;
-
- ComplV2 v2 np = {
- verb = v2 ;
- compl = \\_ => np.s ! v2.c
- } ;
-
- UseV v = {
- verb = v ;
- compl = \\_ => []
- } ;
-
- DetCN det cn = {
- s = \\c => det.s ! cn.g ! c ++ cn.s ! det.n ! c ;
- a = agr cn.g det.n P3
- } ;
-
- ModCN ap cn = {s = \\n,c => ap.s ! cn.g ! n ! c ++ cn.s ! n ! c ; g = cn.g} ;
-
- CompAP ap = {
- verb = copula ;
- compl = \\a => ap.s ! a.g ! a.n ! Nom
- } ;
-
- AdAP ada ap = {
- s = \\g,n,c => ada.s ++ ap.s ! g ! n ! c
- } ;
-
- ConjNP co x y = {
- s = \\c => x.s ! c ++ co.s ++ y.s ! c ;
- a = y.a ----
- } ;
-
- ConjS co x y = {s = x.s ++ co.s ++ y.s} ;
-
- UseN n = n ;
- UseA adj = adj ;
-
- a_Det = mkDet "" Sg ;
- every_Det = mkDet "प्रति" Sg ;
- the_Det = mkDet "" Sg ;
-
- this_Det = mkDet "एतद्" Sg ;
--- these_Det = mkDet "这" Pl ;
- that_Det = mkDet "तद्" Sg ;
--- those_Det = mkDet "那" Pl ;
-
- i_NP = pronNP "" Sg P1 ;
- youSg_NP = pronNP "" Sg P2 ;
- he_NP = pronNP "" Sg P3 ;
- she_NP = pronNP "" Sg P3 ;
- we_NP = pronNP "" Pl P1 ;
- youPl_NP = pronNP "" Pl P2 ;
- they_NP = pronNP "" Pl P3 ;
-
- very_AdA = ss "अति" ;
-
- and_Conj = {s = " च"} ;
-
- or_Conj = {s = "अथवा"} ;
-
- Pos = {s = [] ; b = True} ;
- Neg = {s = [] ; b = False} ;
- Pres = {s = []} ;
- Perf = {s = []} ;
-
--- module TestChi
-
-lin
- man_N = mkN "नरः" ;
- woman_N = mkN "स्त्री" ;
- house_N = mkN "गृहं" ;
- tree_N = mkN "वृक्ष";
- big_A = mkA "महाकाय" ;
- small_A = mkA "अल्प" ;
- green_A = mkA "हरित" ;
- walk_V = mkV "गम्" ;
- arrive_V = mkV "अभि-उपा-गम्" ;
- love_V2 = mkV2 "कम्" ;
- please_V2 = mkV2 "प्री" ;
-
-
-
-
-
-
-
-
--- module ResSan
-
--- parameters
-
-param
- Number = Sg | Dl | Pl ;
- Case = Nom | Acc | Ins | Dat | Abl | Gen | Loc | Voc ;
- Gender = Masc | Fem | Neutr ;
- Person = P3 | P2 | P1 ;
-
-
- VForm = VPres Number Person ;
-
-oper
- Agr = {g : Gender ; n : Number ; p : Person} ;
-
- agr : Gender -> Number -> Person -> Agr = \g,n,p -> {g = g ; n = n ; p = p} ;
-
--- parts of speech
-
-oper
-
- VerbPhrase = {verb : Verb ; compl : Agr => Str} ;
- NounPhrase = {s : Case => Str ; a : Agr} ;
-
--- for morphology
-
- Noun : Type = {s : Number => Case => Str; g : Gender} ;
- Adj : Type = {s : Gender => Number => Case => Str} ;
- Verb : Type = {s : VForm => Str} ;
-
- mkNoun : (s1,_,_,_,_,_,_,_, _,_,_, _,_,_,_,_,s17 : Str) -> Gender -> Noun =
- \snom,sacc,sins,sdat,sabl,sgen,sloc,svoc,
- dnomaccvoc,dinsdatabl,dgenloc,
- pnomvoc,pacc,pins,pdatabl,pgen,ploc,
- gen -> {
- s = table {
- Sg => table {
- Nom => snom ; Acc => sacc ; Ins => sins ; Dat => sdat ; Abl => sabl ; Gen => sgen ; Loc => sloc ; Voc => svoc
- } ;
- Dl => table {
- Nom | Acc | Voc => dnomaccvoc ; Ins | Dat | Abl => dinsdatabl ; Gen | Loc => dgenloc
- } ;
- Pl => table {
- Nom | Voc => pnomvoc ; Acc => pacc ; Ins => pins ; Dat | Abl => pdatabl ; Gen => pgen ; Loc => ploc
- }
- } ;
- g = gen
- } ;
-
- endingNoun : Str -> (s1,_,_,_,_,_,_,_, _,_,_, _,_,_,_,_,s17 : Str) -> Gender -> Noun =
- \stem,
- snom,sacc,sins,sdat,sabl,sgen,sloc,svoc,
- dnomaccvoc,dinsdatabl,dgenloc,
- pnomvoc,pacc,pins,pdatabl,pgen,ploc,
- gen ->
- mkNoun
- (stem + snom) (stem + sacc) (stem + sins) (stem + sdat) (stem + sabl) (stem + sgen) (stem + sloc) (stem + svoc)
- (stem + dnomaccvoc) (stem + dinsdatabl) (stem + dgenloc)
- (stem + pnomvoc) (stem + pacc) (stem + pins) (stem + pdatabl) (stem + pgen) (stem + ploc)
- gen ;
-
-
- ramaNoun : Str -> Noun = \rama ->
- let ram = init rama in
- endingNoun ram
- "ः" "म्" "ॆणॆ" "ाय" "ात्" "स्य" "ॆ" ""
- "ौ" "ाथ्याम्" "यो"
- "ाः" "ान्" "ैः" "ेथयः" "ाणाम" "ेषु"
- Masc ;
-
- mkAdj : (m,f,n : Noun) -> Adj = \m,f,n -> {s = table {Masc => m.s ; Fem => f.s ; Neutr => n.s}} ;
-
-
- mkVerb : (s1,_,_,_,_,_,_,_,s9 : Str) -> Verb =
- \s3,s2,s1,d3,d2,d1,p3,p2,p1 -> {
- s = table {
- VPres Sg P3 => s3 ;
- VPres Sg P2 => s2 ;
- VPres Sg P1 => s1 ;
- VPres Dl P3 => d3 ;
- VPres Dl P2 => d2 ;
- VPres Dl P1 => d1 ;
- VPres Pl P3 => p3 ;
- VPres Pl P2 => p2 ;
- VPres Pl P1 => p1
- }
- } ;
-
- endingVerb : Str -> (s1,_,_,_,_,_,_,_,s9 : Str) -> Verb =
- \stem,s3,s2,s1,d3,d2,d1,p3,p2,p1 ->
- mkVerb
- (stem + s3) (stem + s2) (stem + s1) (stem + d3) (stem + d2) (stem + d1) (stem + p3) (stem + p2) (stem + p1) ;
-
- patVerb : Str -> Verb = \pat ->
- endingVerb pat
- "ित" "िस" "िम" "तः" "थः" "ावः" "िनख़त" "थ" "ामः" ;
-
- copula : Verb = {s = \\_ => []} ;
-
- neg : Bool -> Str = \b -> case b of {True => [] ; False => "न"} ;
-
-
--- for structural words
-
- mkDet : Str -> Number -> {s : Gender => Case => Str ; n : Number} = \s,n -> {
- s = \\_,_ => s ;
- n = n
- } ;
-
- pronNP : (s : Str) -> Number -> Person -> NounPhrase = \s,n,p -> {
- s = \\_ => s ;
- a = agr Masc n p
- } ;
-
-
-
--- module ParadigmsSan
-
-oper
- mkN = overload {
- mkN : (man : Str) -> N
- = \s -> lin N (ramaNoun s) ;
- } ;
-
- mkA : (small : Str) -> A
- = \s -> let n = ramaNoun s in lin A (mkAdj n n n) ;
-
- mkV : (walk : Str) -> V
- = \s -> lin V (patVerb s) ;
-
- mkV2 = overload {
- mkV2 : (love : Str) -> V2
- = \love -> lin V2 (mkV love ** {c = Acc}) ;
---- mkV2 : (love : V) -> V2
---- = \love -> lin V2 love ;
- } ;
-
-}
-
-
-
-
-
diff --git a/examples/miniresource/MiniresourceSwe.gf b/examples/miniresource/MiniresourceSwe.gf
deleted file mode 100644
index d24eef7e2..000000000
--- a/examples/miniresource/MiniresourceSwe.gf
+++ /dev/null
@@ -1,2 +0,0 @@
-concrete MiniresourceSwe of Miniresource = MiniresourceI with
- (Grammar = GrammarSwe), (Lexicon = LexiconSwe) ;