(Som) WIP: subordinate clauses

This commit is contained in:
Inari Listenmaa
2019-07-25 18:42:16 +03:00
parent e5aa8a6499
commit e4bc20e482
11 changed files with 120 additions and 100 deletions

View File

@@ -1,4 +1,4 @@
concrete AdverbSom of Adverb = CatSom ** open ResSom, ParamSom, Prelude in { concrete AdverbSom of Adverb = CatSom ** open ResSom, ParamSom, ParadigmsSom, Prelude in {
lin lin
@@ -24,15 +24,10 @@ lin
-- Subordinate clauses can function as adverbs. -- Subordinate clauses can function as adverbs.
-- : Subj -> S -> Adv ; -- : Subj -> S -> Adv ;
-- SubjS subj s = {} ; SubjS subj s = mkAdv (subj.s ++ s.s ! True) ;
-- Comparison adverbs also work as numeral adverbs. -- Comparison adverbs also work as numeral adverbs.
--AdnCAdv : CAdv -> AdN ; -- less (than five) --AdnCAdv : CAdv -> AdN ; -- less (than five)
--AdnCAdv cadv = {s = } ; --AdnCAdv cadv = {s = } ;
} ; } ;
{-
gt PrepNP in_Prep (DetCN (DetQuant DefArt ?) (UseN ?) | l -bind
gt PrepNP from_Prep (DetCN (DetQuant DefArt ?) (UseN ?)) | l -bind
-}

View File

@@ -8,8 +8,8 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
-- Constructed in SentenceSom, and also in IdiomSom -- Constructed in SentenceSom, and also in IdiomSom
S = ResSom.Sentence ; S = ResSom.Sentence ;
QS = ResSom.Sentence ; QS = SS ;
RS = { s : Agreement => Str } ; RS = {s : {-Agreement =>-} Str} ; -- TODO
-- relative sentence. Tense and polarity fixed, -- relative sentence. Tense and polarity fixed,
-- but agreement may depend on the CN/NP it modifies. -- but agreement may depend on the CN/NP it modifies.
@@ -28,11 +28,9 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
IDet = ResSom.Determiner ; -- interrogative determiner e.g. "how many" IDet = ResSom.Determiner ; -- interrogative determiner e.g. "how many"
IQuant = ResSom.Quant ; -- interrogative quantifier e.g. "which" IQuant = ResSom.Quant ; -- interrogative quantifier e.g. "which"
--2 Relative clauses and pronouns --2 Subord clauses and pronouns
-- Constructed in RelativeSom. RCl = ResSom.QClause ;
RCl = ResSom.RClause ;
RP = SS ; RP = SS ;
--2 Verb phrases --2 Verb phrases
@@ -85,7 +83,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
-- Constructed in StructuralSom. -- Constructed in StructuralSom.
Conj = { s1,s2 : Str ; n : Number } ; Conj = { s1,s2 : Str ; n : Number } ;
Subj = { s : Str ; isPre : Bool } ; --ba+dut vs. dut+en Subj = SS ;
Prep = ResSom.Prep ** {c2 : Preposition ; berri, sii, dhex : Str} ; Prep = ResSom.Prep ** {c2 : Preposition ; berri, sii, dhex : Str} ;

View File

@@ -1,7 +1,15 @@
--# -path=.:../common:../abstract --# -path=.:../common:../abstract
concrete ExtendSom of Extend = {} ; concrete ExtendSom of Extend = CatSom
-- CatSom ** ExtendFunctor -- ** ExtendFunctor -- Add this back when all relevant functions are implemented
-- with (Grammar=GrammarSom) -- with (Grammar=GrammarSom)
-- ** open Prelude, ResSom in { ** open Prelude, ResSom in {
-- } ;
lin
-- : NP -> SSlash -> Utt ; -- her I love -- Sayeed p. 189-
FocusObj np sslash =
-- FocusAdv : Adv -> S -> Utt ; -- today I will sleep
-- FocusAdV : AdV -> S -> Utt ; -- never will I sleep
-- FocusAP : AP -> NP -> Utt ; -- green was the tree
} ;

View File

@@ -69,7 +69,9 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
--AdvNP,ExtAdvNP = \np,adv -> np ** {} ; --adverbs are complicated --AdvNP,ExtAdvNP = \np,adv -> np ** {} ; --adverbs are complicated
-- : NP -> RS -> NP ; -- Paris, which is here -- : NP -> RS -> NP ; -- Paris, which is here
-- RelNP np rs = np ** { s = \\c => rs.s ! np.agr ++ np.s ! c } ; RelNP np rs = np ** {
s = \\c => np.s ! c ++ rs.s
} ;
-- Determiners can form noun phrases directly. -- Determiners can form noun phrases directly.
@@ -225,11 +227,13 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
hasMod = True hasMod = True
} ; } ;
{-
-- : CN -> RS -> CN ; -- : CN -> RS -> CN ;
RelCN cn rs = cn ** { } ; RelCN cn rs = cn ** {
mod = \\n,c => cn.mod ! n ! c ++ rs.s
} ;
{-
-- : CN -> Adv -> CN ; -- : CN -> Adv -> CN ;
AdvCN cn adv = cn ** { } ; AdvCN cn adv = cn ** { } ;

View File

@@ -280,4 +280,12 @@ oper
Sg2|Sg3 Fem => Sg2_Sg3Fem ; Sg2|Sg3 Fem => Sg2_Sg3Fem ;
Pl1 _ => Pl1_ ; Pl2 => Pl2_ ; Pl3 => Pl3_ Pl1 _ => Pl1_ ; Pl2 => Pl2_ ; Pl3 => Pl3_
} ; } ;
--------------------------------------------------------------------------------
-- Clauses
param
ClType = Statement | Question | Subord ;
} }

View File

@@ -3,7 +3,7 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in {
lin lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
UttS s = s ; UttS s = {s = s.s ! False} ;
UttQS qs = qs ; UttQS qs = qs ;
UttImpSg pol imp = UttImpSg pol imp =

View File

@@ -6,7 +6,7 @@ concrete QuestionSom of Question = CatSom ** open
lin lin
-- : Cl -> QCl ; -- : Cl -> QCl ;
QuestCl cl = {s = cl.s ! True} ; QuestCl cl = {s = cl.s ! Question} ;
-- : IP -> VP -> QCl ; -- : IP -> VP -> QCl ;
-- QuestVP ip vp = ; -- QuestVP ip vp = ;

View File

@@ -1,36 +1,36 @@
concrete RelativeSom of Relative = CatSom ** open concrete RelativeSom of Relative = CatSom ** open
ResSom, Prelude, (NS=NounSom), (SS=StructuralSom) in { ResSom, Prelude, (NS=NounSom), (SS=StructuralSom) in {
{-
lin lin
-- : Cl -> RCl ; -- such that John loves her -- : Cl -> RCl ; -- such that John loves her
RelCl cl = { } ; -- RelCl cl = {s = cl.s ! Subord} ;
{-
-- Sayeed p. 95-96 + ch 8 -- Sayeed p. 95-96 + ch 8
Reduced present general in relative clauses; as absolutive Reduced present general in relative clauses; as absolutive
1/2SG/3SG M/2PL/3PL sugá -- same as imperative (TODO check if for all conjugations) 1/2SG/3SG M/2PL/3PL sugá -- same as imperative (TODO check if for all conjugations)
3 SG F sugtá -- doesn't exist 3 SG F sugtá -- not yet in the grammar
1PL sugná -- doesn't exist 1PL sugná -- not yet in the grammar
(18) (a) nimánka buugágga keená men-the books-the bring
'the men who bring the books'
(b) buugágga nimanku keenàan
books-the men-the bring 'the books which the men bring'
-}
-- : RP -> VP -> RCl ; -- : RP -> VP -> RCl ;
RelVP rp vp = ; RelVP rp vp = RelSlash rp (predVPSlash emptyNP vp) ;
-- : RP -> ClSlash -> RCl ; -- whom John loves -- : RP -> ClSlash -> RCl ; -- whom John loves
RelSlash rp cls = ; RelSlash rp cls = {
s = \\t,a,p => rp.s ++ cls.s ! True ! t ! a ! p
} ;
-- : RP ; -- : RP ;
IdRP = { s = "" } ; IdRP = {s = "waxa"} ;
-- : Prep -> NP -> RP -> RP ; -- the mother of whom -- : Prep -> NP -> RP -> RP ; -- the mother of whom
FunRP prep np rp = { s = applyPost prep whom ++ np.s ! Abs } --FunRP prep np rp = {} ;
where { num = case np.agr of {
Sg3 _ => NS.NumSg ;
_ => NS.NumPl } ;
whom = NS.DetNP (NS.DetQuant SS.which_IQuant num) } ;
-}
} }

View File

@@ -749,19 +749,24 @@ oper
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Sentences etc. -- Sentences etc.
Clause : Type = {s : Bool {-is question-} => Tense => Anteriority => Polarity => Str} ; Clause : Type = {s : ClType => Tense => Anteriority => Polarity => Str} ;
QClause : Type = {s : Tense => Anteriority => Polarity => Str} ; QClause : Type = {s : Tense => Anteriority => Polarity => Str} ;
RClause, ClSlash : Type = {s : Bool {-is subordinate-} => Tense => Anteriority => Polarity => Str} ;
ClSlash, Sentence : Type = {s : Bool {-is subordinate-} => Str} ;
Sentence : Type = SS ; ---- TODO
predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps ->
let cl = predVP np vps in {s = table {
True => cl.s ! Subord ;
False => cl.s ! Statement }
} ;
predVP : NounPhrase -> VerbPhrase -> Clause = \np,vps -> { predVP : NounPhrase -> VerbPhrase -> Clause = \np,vps -> {
s = \\isQ,t,a,p => s = \\cltyp,t,a,p =>
let predRaw : {fin : Str ; inf : Str} = vf t a p subj.a vp ; let predRaw : {fin : Str ; inf : Str} = vf cltyp t a p subj.a vp ;
pred : {fin : Str ; inf : Str} = case <isQ,p,vp.pred> of { pred : {fin : Str ; inf : Str} = case <cltyp,p,vp.pred> of {
<False,Pos,NoCopula> => {fin,inf = []} ; <Statement,Pos,NoCopula> => {fin,inf = []} ;
<_ , _,Copula> => {fin = presCopula ! {agr=subj.a ; pol=p} ; inf=[]} ; <_ , _, Copula> => {fin = presCopula ! {agr=subj.a ; pol=p} ; inf=[]} ;
_ => predRaw _ => predRaw
} ; } ;
subjnoun : Str = if_then_Str np.isPron np.empty (subj.s ! Nom) ; subjnoun : Str = if_then_Str np.isPron np.empty (subj.s ! Nom) ;
subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) np.empty ; subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) np.empty ;
@@ -774,21 +779,18 @@ oper
Pos => o ; Pos => o ;
Neg => {p2 = [] ; p1 = o.p1 ++ o.p2 ++ bind} -- object pronoun, prepositions and negation all contract Neg => {p2 = [] ; p1 = o.p1 ++ o.p2 ++ bind} -- object pronoun, prepositions and negation all contract
} ; } ;
stm : Str = case <isQ,p,vp.pred,subj.a> of { stm : Str = case cltyp of {
<False,Pos,Copula|NoCopula,Sg3 _|Impers> => "waa" ; Subord => if_then_Pol p [] "aan" ++ subjpron ; -- if we form a ClSlash, no sentence type marker; negation with aan (Sayeed p. 210)
<True ,Pos,_ ,_ > => "ma" ; Question => "ma" ; -- TODO find out how negative questions work
_ => case <np.isPron,p> of { Statement => case <p,vp.pred,subj.a> of {
<True,Pos> => "waa" ++ subjpron ; -- to force some string from NP to show in the tree <Pos,Copula|NoCopula,Sg3 _|Impers> => "waa" ;
<True,Neg> => "ma" ; -- ++ subjpron ; -- TODO check subj pron or not? _ => stmarkerNoContr ! subj.a ! p }} ;
<False> => stmarkerNoContr ! subj.a ! p
}
} ;
in wordOrder subjnoun subjpron stm obj pred vp ; in wordOrder subjnoun subjpron stm obj pred vp ;
} where { } where {
vp = case vps.isPassive of { vp = case vps.isPassive of {
True => complSlash (insertComp vps np) ; True => complSlash (insertComp vps np) ;
_ => complSlash vps } ; _ => complSlash vps } ;
subj = case vps.isPassive of {True => impersNP ; _ => np} ; subj = case vps.isPassive of {True => impersNP ; _ => np}
} ; } ;
wordOrder : (sn,sp,stm : Str) -> {p1,p2 : Str} -> {fin,inf : Str} -> VerbPhrase -> Str = wordOrder : (sn,sp,stm : Str) -> {p1,p2 : Str} -> {fin,inf : Str} -> VerbPhrase -> Str =
@@ -806,8 +808,13 @@ oper
++ vp.miscAdv ; ---- NB. Only used if there are several adverbs. ++ vp.miscAdv ; ---- NB. Only used if there are several adverbs.
---- Primary places for adverbs are obj, sii or dhex. ---- Primary places for adverbs are obj, sii or dhex.
vf : Tense -> Anteriority -> Polarity -> Agreement -> Verb VFun : Type = Tense -> Anteriority -> Polarity -> Agreement -> Verb
-> {fin : Str ; inf : Str} = \t,ant,p,agr,vp -> -> {fin : Str ; inf : Str} ;
vf : ClType -> VFun = \clt -> case clt of {
Subord => vfSubord ; _ => vfStatement } ;
vfStatement : VFun = \t,ant,p,agr,vp ->
case <t,ant> of { case <t,ant> of {
<Pres,Simul> => {fin = presV vp ; inf = [] } ; <Pres,Simul> => {fin = presV vp ; inf = [] } ;
<Past,Simul> => {fin = pastV vp ; inf = [] } ; <Past,Simul> => {fin = pastV vp ; inf = [] } ;
@@ -827,17 +834,24 @@ oper
presV : Verb -> Str = \v -> v.s ! VPres Simple (agr2vagr agr) p ; presV : Verb -> Str = \v -> v.s ! VPres Simple (agr2vagr agr) p ;
} ; } ;
vfSubord : VFun = \t,ant,p,agr,vp ->
case <t,ant,p> of {
<Pres,Simul,Pos> => vfStatement Pres ant Neg agr vp ;
_ => vfStatement t ant p agr vp
} ; -- TODO other relative forms
infVP : VerbPhrase -> Str = \vp -> infVP : VerbPhrase -> Str = \vp ->
let inf = (vf Past Anter Pos (Sg3 Masc) vp) ** {fin=[]} let inf = {inf = vp.s ! VInf ; fin=[]}
in wordOrder [] [] [] (vp.comp ! Pl3) inf vp ; in wordOrder [] [] [] (vp.comp ! Pl3) inf vp ;
stmarker : Agreement => Polarity => Str = \\a,b => stmarkerContr : Agreement => Polarity => Str = \\a,b =>
let stm = if_then_Pol b "w" "m" let stm = if_then_Pol b "w" "m"
in stm + subjpron ! a ; in stm + subjpron ! a ;
stmarkerNoContr : Agreement => Polarity => Str = \\a,b => stmarkerNoContr : Agreement => Polarity => Str = \\a,p =>
let stm = if_then_Pol b "waa" "ma" case p of {
in stm ++ subjpron ! a ; Pos => "waa" ++ subjpron ! a ;
Neg => "ma" } ;
subjpron : Agreement => Str = table { subjpron : Agreement => Str = table {
Sg1|Pl1 Excl => "aan" ; Sg1|Pl1 Excl => "aan" ;

View File

@@ -10,14 +10,13 @@ lin
-- : NP -> VP -> Cl -- : NP -> VP -> Cl
PredVP = predVP ; PredVP = predVP ;
{- -- : SC -> VP -> Cl ; -- that she goes is good (Sayeed p. 94)
-- : SC -> VP -> Cl ; -- that she goes is good --PredSCVP sc vp = ;
PredSCVP sc vp = ;
--2 Clauses missing object noun phrases --2 Clauses missing object noun phrases
-- : NP -> VPSlash -> ClSlash ; -- : NP -> VPSlash -> ClSlash ;
SlashVP np vps = ; SlashVP = predVPSlash ;
{-
-- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today -- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today
AdvSlash cls adv = cls ** insertAdv adv cls ; AdvSlash cls adv = cls ** insertAdv adv cls ;
@@ -26,17 +25,17 @@ lin
-- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves -- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves
-- SlashVS np vs ss = {} ; -- SlashVS np vs ss = {} ;
-}
-- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen -- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
UseSlash t p cls = UseCl t p (PredVP he_Pron cls) ; UseSlash t p cls = {s = \\b => t.s ++ p.s ++ cls.s ! b ! t.t ! t.a ! p.p} ;
--2 Imperatives --2 Imperatives
-- : VP -> Imp ; -- : VP -> Imp ;
ImpVP vp = { s = linVP vp } ; --ImpVP vp = { s = linVP vp } ;
--2 Embedded sentences --2 Embedded sentences
{-
-- : S -> SC ; -- : S -> SC ;
EmbedS s = { } ; EmbedS s = { } ;
@@ -50,35 +49,31 @@ lin
-} -}
-- : Temp -> Pol -> Cl -> S ; -- : Temp -> Pol -> Cl -> S ;
UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! False ! t.t ! t.a ! p.p} ; UseCl t p cl = {s = \\b =>
let cltyp = if_then_else ClType b Subord Statement in
t.s ++ p.s ++ cl.s ! cltyp ! t.t ! t.a ! p.p
} ;
-- : Temp -> Pol -> QCl -> QS ; -- : Temp -> Pol -> QCl -> QS ;
UseQCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p} ; UseQCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p} ;
{-
-- : Temp -> Pol -> RCl -> RS ; -- : Temp -> Pol -> RCl -> RS ;
UseRCl t p cl = { s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p } ; UseRCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p} ;
-- An adverb can be added to the beginning of a sentence, either with comma ("externally") -- AdvS : Adv -> S -> S ; -- then I will go home
-- or without: -- ExtAdvS : Adv -> S -> S ; -- next week, I will go home
AdvS, ExtAdvS = advS ;
-- : Adv -> S -> S ; -- then I will go home
AdvS = advS ;
-- : Adv -> S -> S ; -- next week, I will go home
ExtAdvS adv = advS {s = adv.s ++ SOFT_BIND ++ ","} ;
-- There's an SubjS already in AdverbSom -- should this be deprecated? -- There's an SubjS already in AdverbSom -- should this be deprecated?
-- : S -> Subj -> S -> S ; -- : S -> Subj -> S -> S ;
SSubjS s1 subj s2 = AdvS (AS.SubjS subj s2) s1 ; SSubjS s1 subj s2 = AdvS (AS.SubjS subj s2) s1 ;
-- A sentence can be modified by a relative clause referring to its contents.
-- : S -> RS -> S ; -- she sleeps, which is good -- : S -> RS -> S ; -- she sleeps, which is good
RelS sent rs = advS { s = rs.s ! Sg3 Masc ++ SOFT_BIND ++ ","} sent ; -- RelS sent rs = advS {s = rs.s ! Sg3 Masc ++ SOFT_BIND ++ ","} sent ;
oper oper
advS : Adv -> SS -> SS = \a,s -> {s = a.s ++ s.s} ; advS : Adverb -> S -> S = \a,s -> s ** {s = \\b =>
-} linAdv a ++ s.s ! b} ;
} }

View File

@@ -133,20 +133,18 @@ lin whatSg_IP = ;
lin whoPl_IP = ; lin whoPl_IP = ;
lin whoSg_IP = ; lin whoSg_IP = ;
-}
------- -------
-- Subj -- Subj
lin although_Subj = mkSubj "" False ; -- lin although_Subj = mkSubj "" False ;
lin because_Subj = mkSubj "" False ; -- lin because_Subj = mkSubj "" False ;
lin if_Subj = mkSubj "" True ; -- lin if_Subj = mkSubj "" True ;
lin that_Subj = mkSubj "" False ; lin that_Subj = {s = "in" ++ BIND} ;
lin when_Subj = mkSubj "" False ; -- lin when_Subj = mkSubj "" False ;
-}
------ ------
-- Utt -- Utt