forked from GitHub/gf-core
added coordination to tutorial grammar example.
This commit is contained in:
@@ -19,6 +19,7 @@ abstract Grammar = {
|
|||||||
V ; -- intransitive verb e.g. "boil"
|
V ; -- intransitive verb e.g. "boil"
|
||||||
V2 ; -- two-place verb e.g. "eat"
|
V2 ; -- two-place verb e.g. "eat"
|
||||||
Pol ; -- polarity (pos or neg)
|
Pol ; -- polarity (pos or neg)
|
||||||
|
Conj ; -- conjunction e.g. "and"
|
||||||
|
|
||||||
fun
|
fun
|
||||||
PhrS : S -> Phr ;
|
PhrS : S -> Phr ;
|
||||||
@@ -41,6 +42,9 @@ abstract Grammar = {
|
|||||||
|
|
||||||
IDetCN : IDet -> CN -> IP ;
|
IDetCN : IDet -> CN -> IP ;
|
||||||
|
|
||||||
|
ConjS : Conj -> S -> S -> S ;
|
||||||
|
ConjNP : Conj -> NP -> NP -> NP ;
|
||||||
|
|
||||||
-- lexical insertion
|
-- lexical insertion
|
||||||
|
|
||||||
UseN : N -> CN ;
|
UseN : N -> CN ;
|
||||||
@@ -64,6 +68,7 @@ abstract Grammar = {
|
|||||||
|
|
||||||
very_AdA : AdA ;
|
very_AdA : AdA ;
|
||||||
|
|
||||||
|
and_Conj : Conj ;
|
||||||
-- polarities
|
-- polarities
|
||||||
|
|
||||||
PPos, PNeg : Pol ;
|
PPos, PNeg : Pol ;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ concrete GrammarEng of Grammar = open Prelude, MorphoEng in {
|
|||||||
A = {s : Str} ;
|
A = {s : Str} ;
|
||||||
V = Verb ;
|
V = Verb ;
|
||||||
V2 = Verb2 ;
|
V2 = Verb2 ;
|
||||||
|
Conj = {s : Str} ;
|
||||||
Pol = {s : Str ; p : Bool} ;
|
Pol = {s : Str ; p : Bool} ;
|
||||||
|
|
||||||
lin
|
lin
|
||||||
@@ -52,6 +53,9 @@ concrete GrammarEng of Grammar = open Prelude, MorphoEng in {
|
|||||||
|
|
||||||
IDetCN det cn = {s = det.s ++ cn.s ! det.n ; n = det.n} ;
|
IDetCN det cn = {s = det.s ++ cn.s ! det.n ; n = det.n} ;
|
||||||
|
|
||||||
|
ConjS c a b = {s = a.s ++ c.s ++ b.s} ;
|
||||||
|
ConjNP c a b = {s = a.s ++ c.s ++ b.s ; n = Pl} ;
|
||||||
|
|
||||||
UseN n = n ;
|
UseN n = n ;
|
||||||
UseA a = a ;
|
UseA a = a ;
|
||||||
UseV v = {s = \\q,b,n => predVerb v q b n} ;
|
UseV v = {s = \\q,b,n => predVerb v q b n} ;
|
||||||
@@ -71,6 +75,8 @@ concrete GrammarEng of Grammar = open Prelude, MorphoEng in {
|
|||||||
|
|
||||||
which_IDet = {s = "which" ; n = Sg} ;
|
which_IDet = {s = "which" ; n = Sg} ;
|
||||||
|
|
||||||
|
and_Conj = {s = "and"} ;
|
||||||
|
|
||||||
PPos = {s = [] ; p = True} ;
|
PPos = {s = [] ; p = True} ;
|
||||||
PNeg = {s = [] ; p = False} ;
|
PNeg = {s = [] ; p = False} ;
|
||||||
|
|
||||||
@@ -113,4 +119,5 @@ concrete GrammarEng of Grammar = open Prelude, MorphoEng in {
|
|||||||
|
|
||||||
artIndef : Str =
|
artIndef : Str =
|
||||||
pre {"a" ; "an" / strs {"a" ; "e" ; "i" ; "o"}} ;
|
pre {"a" ; "an" / strs {"a" ; "e" ; "i" ; "o"}} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ concrete GrammarIta of Grammar = open Prelude, MorphoIta in {
|
|||||||
A = Adjective ;
|
A = Adjective ;
|
||||||
V = Verb ;
|
V = Verb ;
|
||||||
V2 = Verb2 ;
|
V2 = Verb2 ;
|
||||||
|
Conj = {s : Str} ;
|
||||||
Pol = {s : Str ; p : Bool} ;
|
Pol = {s : Str ; p : Bool} ;
|
||||||
|
|
||||||
|
|
||||||
@@ -36,12 +37,16 @@ concrete GrammarIta of Grammar = open Prelude, MorphoIta in {
|
|||||||
ComplAP ap = {s = \\b,g,n => posneg b ++ copula n ++ ap.s ! g ! n} ;
|
ComplAP ap = {s = \\b,g,n => posneg b ++ copula n ++ ap.s ! g ! n} ;
|
||||||
|
|
||||||
DetCN det cn = {s = det.s ! cn.g ++ cn.s ! det.n ; g = cn.g ; n = det.n} ;
|
DetCN det cn = {s = det.s ! cn.g ++ cn.s ! det.n ; g = cn.g ; n = det.n} ;
|
||||||
IDetCN det cn = {s = det.s ! cn.g ++ cn.s ! det.n ; g = cn.g ; n = det.n} ;
|
|
||||||
|
|
||||||
ModCN ap cn = {s = \\n => cn.s ! n ++ ap.s ! cn.g ! n ; g = cn.g} ;
|
ModCN ap cn = {s = \\n => cn.s ! n ++ ap.s ! cn.g ! n ; g = cn.g} ;
|
||||||
|
|
||||||
AdAP ada ap = {s = \\n,g => ada.s ++ ap.s ! n ! g} ;
|
AdAP ada ap = {s = \\n,g => ada.s ++ ap.s ! n ! g} ;
|
||||||
|
|
||||||
|
IDetCN det cn = {s = det.s ! cn.g ++ cn.s ! det.n ; g = cn.g ; n = det.n} ;
|
||||||
|
|
||||||
|
ConjS c a b = {s = a.s ++ c.s ++ b.s} ;
|
||||||
|
ConjNP c a b = {s = a.s ++ c.s ++ b.s ; n = Pl ; g = conjGender a.g b.g} ;
|
||||||
|
|
||||||
UseN n = n ;
|
UseN n = n ;
|
||||||
UseA a = a ;
|
UseA a = a ;
|
||||||
UseV v = {s = \\b,_,n => posneg b ++ v.s ! n} ;
|
UseV v = {s = \\b,_,n => posneg b ++ v.s ! n} ;
|
||||||
@@ -58,6 +63,7 @@ concrete GrammarIta of Grammar = open Prelude, MorphoIta in {
|
|||||||
two_Det = {s = \\_ => "due" ; n = Pl} ;
|
two_Det = {s = \\_ => "due" ; n = Pl} ;
|
||||||
very_AdA = {s = "molto"} ;
|
very_AdA = {s = "molto"} ;
|
||||||
which_IDet = {s = \\_ => "quale" ; n = Sg} ;
|
which_IDet = {s = \\_ => "quale" ; n = Sg} ;
|
||||||
|
and_Conj = {s = "e"} ;
|
||||||
|
|
||||||
PPos = {s = [] ; p = True} ;
|
PPos = {s = [] ; p = True} ;
|
||||||
PNeg = {s = [] ; p = False} ;
|
PNeg = {s = [] ; p = False} ;
|
||||||
@@ -95,7 +101,13 @@ concrete GrammarIta of Grammar = open Prelude, MorphoIta in {
|
|||||||
Fem => pre {"una" ; "un'" / vowel}
|
Fem => pre {"una" ; "un'" / vowel}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
conjGender : Gender -> Gender -> Gender = \g,h -> case g of {
|
||||||
|
Masc => Masc ;
|
||||||
|
_ => h
|
||||||
|
} ;
|
||||||
|
|
||||||
sImpuro : Strs = strs {"sb" ; "sp" ; "sy" ; "z"} ;
|
sImpuro : Strs = strs {"sb" ; "sp" ; "sy" ; "z"} ;
|
||||||
vowel : Strs = strs {"a" ; "e" ; "i" ; "o" ; "u"} ;
|
vowel : Strs = strs {"a" ; "e" ; "i" ; "o" ; "u"} ;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user