forked from GitHub/gf-rgl
(Som) WIP: Conjunctions
This commit is contained in:
@@ -82,7 +82,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
|
||||
--2 Structural words
|
||||
|
||||
-- Constructed in StructuralSom.
|
||||
Conj = { s1,s2 : Str ; n : Number } ;
|
||||
Conj = {s2 : State => Str ; s1 : Str ; n : Number } ;
|
||||
Subj = SS ;
|
||||
Prep = ResSom.Prep ** {c2 : Preposition ; berri, sii, dhex : Str} ;
|
||||
|
||||
@@ -96,7 +96,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
|
||||
V,
|
||||
-- TODO: eventually proper lincats
|
||||
VV, -- verb-phrase-complement verb e.g. "want"
|
||||
VS, -- sentence-complement verb e.g. "claim"
|
||||
VS, -- sentence-complement verb e.g. "claim" -- TODO: VPs that have VS use waxa as stm? see Nilsson p. 68
|
||||
VQ, -- question-complement verb e.g. "wonder"
|
||||
VA, -- adjective-complement verb e.g. "look"
|
||||
V2V, -- verb with NP and V complement e.g. "cause"
|
||||
|
||||
@@ -37,17 +37,17 @@ lin
|
||||
ConsAdv, ConsAdV, ConsIAdv = consrSS comma ;
|
||||
ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ;
|
||||
|
||||
{-
|
||||
--RS depends on agreement, otherwise exactly like previous.
|
||||
|
||||
--RS depends on gender and case, otherwise exactly like previous.
|
||||
lincat
|
||||
[RS] = {s1,s2 : Agr => Str } ;
|
||||
[RS] = {s1,s2 : Gender => Case => Str} ;
|
||||
|
||||
lin
|
||||
BaseRS x y = twoTable Agr x y ;
|
||||
ConsRS xs x = consrTable Agr comma xs x ;
|
||||
ConjRS co xs = conjunctDistrTable Agr co xs ;
|
||||
|
||||
BaseRS x y = twoTable2 Gender Case x y ;
|
||||
ConsRS xs x = consrTable2 Gender Case comma xs x ;
|
||||
ConjRS co xs = conjunctDistrTable2' Gender Case co xs ;
|
||||
|
||||
{-
|
||||
lincat
|
||||
[S] = {} ;
|
||||
|
||||
@@ -80,11 +80,11 @@ lin
|
||||
BaseDAP x y = x ** { pref2 = y.pref } ;
|
||||
ConsDAP xs x = xs ** { pref2 = x.pref } ;
|
||||
ConjDet conj xs = xs ** { pref = conj.s1 ++ xs.pref ++ conj.s2 ++ xs.pref2 } ;
|
||||
|
||||
-}
|
||||
|
||||
-- Noun phrases
|
||||
lincat
|
||||
[NP] = { s1,s2 : Case => Str } ** NPLight ;
|
||||
[NP] = {s1,s2 : Case => Str} ** BaseNP ;
|
||||
|
||||
lin
|
||||
BaseNP x y = twoTable Case x y ** consNP x y ;
|
||||
@@ -93,24 +93,36 @@ lin
|
||||
|
||||
oper
|
||||
|
||||
--NP without the s field; just to avoid copypaste and make things easier to change
|
||||
NPLight : Type = { } ;
|
||||
ConjDistr : Type = {s2 : State => Str ; s1 : Str} ;
|
||||
|
||||
consNP : NPLight -> NPLight -> NPLight = \x,y ->
|
||||
x ** { agr = conjAgr x.agr (getNum y.agr) } ;
|
||||
conjunctDistrSS : ConjDistr -> ListX -> SS = \or,xs ->
|
||||
ss (or.s1 ++ xs.s1 ++ or.s2 ! Indefinite ++ xs.s2) ;
|
||||
|
||||
conjNP : NPLight -> Conj -> NPLight = \xs,conj ->
|
||||
xs ** { agr = conjAgr xs.agr conj.nbr } ;
|
||||
conjunctDistrTable' :
|
||||
(P : PType) -> ConjDistr -> ListTable P -> {s : P => Str} = \P,or,xs ->
|
||||
{s = table P {p => or.s1 ++ xs.s1 ! p ++ or.s2 ! Indefinite ++ xs.s2 ! p}} ;
|
||||
|
||||
conjunctDistrTable2' :
|
||||
(P,Q : PType) -> ConjDistr -> ListTable2 P Q -> {s : P => Q => Str} =
|
||||
\P,Q,or,xs ->
|
||||
{s =
|
||||
table P {p => table Q {q => or.s1 ++ xs.s1 ! p ! q ++ or.s2 ! Indefinite ++ xs.s2 ! p ! q}}} ;
|
||||
|
||||
-- Like conjunctTable from prelude/Coordination.gf,
|
||||
-- but forces the first argument into absolutive.
|
||||
conjunctNPTable : Conj -> ListTable Case -> {s : Case => Str} = \co,xs ->
|
||||
{ s = table { cas => co.s1 ++ xs.s1 ! Abs ++ co.s2 ++ xs.s2 ! cas } } ;
|
||||
conjunctNPTable : ConjDistr -> ({s1,s2 : Case => Str} ** BaseNP) -> {s : Case => Str ; st : State} = \co,xs -> xs **
|
||||
{s = -- TODO if xs is a pronoun, make them use (pronTable ! xs.a).sp
|
||||
table { cas => co.s1 ++ xs.s1 ! Abs ++ co.s2 ! xs.st ++ xs.s2 ! cas}} ;
|
||||
|
||||
conjAgr : Agr -> Number -> Agr = \a,n ->
|
||||
consNP : BaseNP -> BaseNP -> BaseNP = \x,y ->
|
||||
x ** { agr = conjAgr x.agr (getNum y.agr) } ;
|
||||
|
||||
conjNP : BaseNP -> Conj -> BaseNP = \xs,conj ->
|
||||
xs ** { agr = conjAgr xs.agr conj.nbr } ;
|
||||
|
||||
conjAgr : Agreement -> Number -> Agreement = \a,n ->
|
||||
case n of { Pl => plAgr a ; _ => a } ;
|
||||
|
||||
conjNbr : Number -> Number -> Number = \n,m ->
|
||||
case n of { Pl => Pl ; _ => m } ;
|
||||
-}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
|
||||
-- : Det -> CN -> NP
|
||||
DetCN det cn = useN cn ** {
|
||||
s = sTable ;
|
||||
st = det.st ;
|
||||
a = getAgr det.n (gender cn) } where {
|
||||
sTable : Case => Str = \\c =>
|
||||
let nfc : {nf : NForm ; c : Case} =
|
||||
@@ -45,11 +46,12 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
|
||||
UsePN pn = pn ** {
|
||||
s = \\c => pn.s ;
|
||||
isPron = False ;
|
||||
st = Definite ;
|
||||
empty = [] ;
|
||||
} ;
|
||||
|
||||
-- : Pron -> NP ;
|
||||
UsePron pron = pron ;
|
||||
UsePron pron = pron ** {st = Definite} ;
|
||||
|
||||
-- : Predet -> NP -> NP ; -- only the man
|
||||
PredetNP predet np = np ** {
|
||||
|
||||
@@ -156,6 +156,12 @@ oper
|
||||
getNum : Agreement -> Number = \a ->
|
||||
case a of { Sg1|Sg2|Sg3 _ => Sg ; _ => Pl } ;
|
||||
|
||||
plAgr : Agreement -> Agreement = \agr ->
|
||||
case agr of { Sg1 => Pl1 Excl ;
|
||||
Sg2 => Pl2 ;
|
||||
Sg3 _ => Pl3 ;
|
||||
agr => agr } ;
|
||||
|
||||
agr2pagr : Agreement -> PrepAgr = \a -> case a of {
|
||||
Sg1 => Sg1_Prep ;
|
||||
Sg2 => Sg2_Prep ;
|
||||
|
||||
@@ -23,7 +23,7 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in {
|
||||
UttInterj i = i ;
|
||||
|
||||
NoPConj = {s = []} ;
|
||||
PConjConj conj = { s = conj.s1 ++ conj.s2 } ;
|
||||
PConjConj conj = {s = conj.s1 ++ conj.s2 ! Indefinite} ;
|
||||
|
||||
NoVoc = {s = []} ;
|
||||
VocNP np = { s = "," ++ np.s ! Abs } ; --TODO: vocative exists
|
||||
|
||||
@@ -134,6 +134,7 @@ oper
|
||||
BaseNP : Type = {
|
||||
a : Agreement ;
|
||||
isPron : Bool ;
|
||||
st : State ;
|
||||
empty : Str ;
|
||||
} ;
|
||||
|
||||
@@ -155,7 +156,7 @@ oper
|
||||
useN : Noun -> CNoun ** BaseNP = \n -> n **
|
||||
{ mod = \\_,_ => [] ; hasMod = False ;
|
||||
a = Sg3 (gender n) ; isPron,isPoss = False ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Indefinite
|
||||
} ;
|
||||
|
||||
emptyNP : NounPhrase = {
|
||||
@@ -163,6 +164,7 @@ oper
|
||||
a = Pl3 ;
|
||||
isPron = False ;
|
||||
empty = [] ;
|
||||
st = Indefinite
|
||||
} ;
|
||||
|
||||
impersNP : NounPhrase = emptyNP ** {
|
||||
@@ -186,55 +188,55 @@ oper
|
||||
Sg1 => {
|
||||
s = table {Nom => "aan" ; Abs => "i"} ;
|
||||
a = Sg1 ; isPron = True ; sp = table {Nom => "anigu" ; _ =>"aniga"} ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Definite ;
|
||||
poss = {s = quantTable "ayg" "ayd" ; short = quantTable "ay" ; sp = gnTable "ayg" "ayd" "uwayg"}
|
||||
} ;
|
||||
Sg2 => {
|
||||
s = table {Nom => "aad" ; Abs => "ku"} ;
|
||||
a = Sg2 ; isPron = True ; sp = table {Nom => "adigu" ; _ => "adiga"} ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Definite ;
|
||||
poss = {s = quantTable "aag" "aad" ; short = quantTable "aa" ; sp = gnTable "aag" "aad" "uwaag"}
|
||||
} ;
|
||||
Sg3 Masc => {
|
||||
s = table {Nom => "uu" ; Abs => []} ;
|
||||
a = Sg3 Masc ; isPron = True ; sp = table {Nom => "isagu" ; _ => "isaga"} ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Definite ;
|
||||
poss = {s, short = quantTable "iis" ; sp = gnTable "iis" "iis" "uwiis"}
|
||||
} ;
|
||||
Sg3 Fem => {
|
||||
s = table {Nom => "ay" ; Abs => []} ;
|
||||
a = Sg3 Fem ; isPron = True ; sp = table {Nom => "iyadu" ; _ => "iyada"} ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Definite ;
|
||||
poss = {s, short = quantTable "eed" ; sp = gnTable "eed" "eed" "uweed"}
|
||||
} ;
|
||||
Pl1 Excl => {
|
||||
s = table {Nom => "aan" ; Abs => "na"} ;
|
||||
a = Pl1 Excl ; isPron = True ; sp = table {Nom => "annagu" ; _ => "annaga"} ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Definite ;
|
||||
poss = {s = quantTable "eenn" ; short = quantTable "een" ; sp = gnTable "eenn" "eenn" "uweenn"}
|
||||
} ;
|
||||
Pl1 Incl => {
|
||||
s = table {Nom => "aynu" ; Abs => "ina"} ;
|
||||
a = Pl1 Incl ; isPron = True ; sp = table {Nom => "innagu" ; _ => "innaga"} ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Definite ;
|
||||
poss = {s = quantTable "eenn" ; short = quantTable "een" ; sp = gnTable "eenn" "eenn" "uweenn"}
|
||||
} ;
|
||||
Pl2 => {
|
||||
s = table {Nom => "aad" ; Abs => "idin"} ;
|
||||
a = Pl2 ; isPron = True ; sp = table {Nom => "idinku" ; _ => "idinka"} ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Definite ;
|
||||
poss = {s = quantTable "iinn" ; short = quantTable "iin" ; sp = gnTable "iinn" "iinn" "uwiinn"}
|
||||
} ;
|
||||
Pl3 => {
|
||||
s = table {Nom => "ay" ; Abs => []} ;
|
||||
a = Pl3 ; isPron = True ; sp = table {Nom => "iyagu" ; _ => "iyaga"} ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Definite ;
|
||||
poss = {s, short = quantTable "ood" ; sp = gnTable "ood" "ood" "uwood"}
|
||||
} ;
|
||||
Impers => {
|
||||
s = table {Nom => "la" ; Abs => "la"} ;
|
||||
a = Impers ; isPron = True ; sp = \\_ => "" ;
|
||||
empty = [] ;
|
||||
empty = [] ; st = Definite ;
|
||||
poss = {s, short = quantTable "??" ; sp = gnTable "??" "??" "??"}
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -38,8 +38,8 @@ lin there_Adv = ss "" ;
|
||||
-------
|
||||
-- Conj
|
||||
|
||||
lin and_Conj = {s1 = "oo" ; s2 = [] ; n = Pl} ;
|
||||
lin or_Conj = {s1 = "ama" ; s2 = [] ; n = Sg} ; -- mise with interrogatives
|
||||
lin and_Conj = {s2 = table {Definite => "ee" ; Indefinite => "oo"} ; s1 = [] ; n = Pl} ;
|
||||
lin or_Conj = {s2 = \\_ => "ama" ; s1 = [] ; n = Sg} ; -- mise with interrogatives
|
||||
-- lin if_then_Conj = mkConj
|
||||
-- lin both7and_DConj = mkConj "" "" pl ;
|
||||
-- lin either7or_DConj = mkConj "" "" pl ;
|
||||
|
||||
Reference in New Issue
Block a user