forked from GitHub/gf-rgl
@@ -16,29 +16,24 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
|
|||||||
Cl = ResSom.Clause ;
|
Cl = ResSom.Clause ;
|
||||||
ClSlash = ResSom.ClSlash ;
|
ClSlash = ResSom.ClSlash ;
|
||||||
SSlash = ResSom.Sentence ; -- sentence missing NP; e.g. "she has looked at"
|
SSlash = ResSom.Sentence ; -- sentence missing NP; e.g. "she has looked at"
|
||||||
Imp = { s : Str } ; -- imperative e.g. "look at this"
|
Imp = SS ; -- imperative e.g. "look at this"
|
||||||
|
|
||||||
--2 Questions and interrogatives
|
--2 Questions and interrogatives
|
||||||
|
|
||||||
-- Constructed in QuestionSom.
|
-- Constructed in QuestionSom.
|
||||||
|
|
||||||
QCl = ResSom.Clause ;
|
QCl = ResSom.QClause ;
|
||||||
IP = ResSom.NounPhrase ;
|
IP = ResSom.NounPhrase ;
|
||||||
IComp = { s : Str } ; -- interrogative complement of copula e.g. "where"
|
IComp = SS ; -- interrogative complement of copula e.g. "where"
|
||||||
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 Relative clauses and pronouns
|
||||||
|
|
||||||
-- Constructed in RelativeSom.
|
-- Constructed in RelativeSom.
|
||||||
|
|
||||||
RCl = ResSom.RClause ;
|
RCl = ResSom.RClause ;
|
||||||
RP = { s : Str } ;
|
RP = SS ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--2 Verb phrases
|
--2 Verb phrases
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ lin bread_N = mkN "rooti" ; --masc/fem
|
|||||||
-- lin brown_A = mkA "" ;
|
-- lin brown_A = mkA "" ;
|
||||||
-- lin burn_V = mkV "" ;
|
-- lin burn_V = mkV "" ;
|
||||||
-- lin butter_N = mkN "" ;
|
-- lin butter_N = mkN "" ;
|
||||||
-- lin buy_V2 = mkV2 "" ;
|
lin buy_V2 = mkV2 "iibsa" ;
|
||||||
|
|
||||||
----
|
----
|
||||||
-- C
|
-- C
|
||||||
@@ -361,7 +361,7 @@ lin speak_V2 = mkV2 "hadlo" ;
|
|||||||
-- lin tail_N = mkN "" ;
|
-- lin tail_N = mkN "" ;
|
||||||
-- lin talk_V3 = mkV3 "" ;
|
-- lin talk_V3 = mkV3 "" ;
|
||||||
lin teach_V2 = mkV2 "bar" ku ;
|
lin teach_V2 = mkV2 "bar" ku ;
|
||||||
-- lin teacher_N = mkN "" ;
|
lin teacher_N = mkN "macallin" ;
|
||||||
-- lin television_N = mkN "" ;
|
-- lin television_N = mkN "" ;
|
||||||
-- lin thick_A = mkA "" ;
|
-- lin thick_A = mkA "" ;
|
||||||
-- lin thin_A = mkA "" ;
|
-- lin thin_A = mkA "" ;
|
||||||
|
|||||||
@@ -213,6 +213,8 @@ param
|
|||||||
| VRel -- "som är/har/…" TODO is this used in other verbs?
|
| VRel -- "som är/har/…" TODO is this used in other verbs?
|
||||||
| VImp Number Polarity ;
|
| VImp Number Polarity ;
|
||||||
|
|
||||||
|
PredType = NoPred | Copula | NoCopula ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
if_then_Pol : Polarity -> Str -> Str -> Str = \p,t,f ->
|
if_then_Pol : Polarity -> Str -> Str -> Str = \p,t,f ->
|
||||||
case p of {Pos => t ; Neg => f } ;
|
case p of {Pos => t ; Neg => f } ;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in {
|
|||||||
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 ;
|
||||||
-- UttQS qs = qs ;
|
UttQS qs = qs ;
|
||||||
|
|
||||||
UttImpSg pol imp =
|
UttImpSg pol imp =
|
||||||
let ma = case pol.p of { Pos => [] ; Neg => "ma" }
|
let ma = case pol.p of { Pos => [] ; Neg => "ma" }
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
concrete QuestionSom of Question = CatSom ** open
|
concrete QuestionSom of Question = CatSom ** open
|
||||||
ResSom, (VS=VerbSom), (NS=NounSom), (AS=AdverbSom) in {
|
Prelude, ResSom, (VS=VerbSom), (NS=NounSom), (AS=AdverbSom) in {
|
||||||
|
|
||||||
-- A question can be formed from a clause ('yes-no question') or
|
-- A question can be formed from a clause ('yes-no question') or
|
||||||
-- with an interrogative.
|
-- with an interrogative.
|
||||||
|
|
||||||
lin
|
lin
|
||||||
-- : Cl -> QCl ;
|
-- : Cl -> QCl ;
|
||||||
-- QuestCl cl = ;
|
QuestCl cl = {s = cl.s ! True} ;
|
||||||
|
|
||||||
-- : IP -> VP -> QCl ;
|
-- : IP -> VP -> QCl ;
|
||||||
-- QuestVP ip vp = ;
|
-- QuestVP ip vp = ;
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ oper
|
|||||||
isPoss : Bool -- to prevent impossible forms in ComplN2 with Ns that have short possessive, e.g. "father"
|
isPoss : Bool -- to prevent impossible forms in ComplN2 with Ns that have short possessive, e.g. "father"
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
cn2str : Number -> Case -> CNoun -> Str = \n,c,cn ->
|
||||||
|
cn.s ! Indef n ++ cn.mod ! n ! c ;
|
||||||
|
|
||||||
PNoun : Type = {s : Str ; a : Agreement} ;
|
PNoun : Type = {s : Str ; a : Agreement} ;
|
||||||
|
|
||||||
mkPNoun : Str -> Agreement -> PNoun = \str,agr -> {s = str ; a = agr} ;
|
mkPNoun : Str -> Agreement -> PNoun = \str,agr -> {s = str ; a = agr} ;
|
||||||
@@ -611,11 +614,11 @@ oper
|
|||||||
c2 : Preposition ; np : NounPhrase} ; -- So that adverbs can also contribute to preposition contraction
|
c2 : Preposition ; np : NounPhrase} ; -- So that adverbs can also contribute to preposition contraction
|
||||||
|
|
||||||
Complement : Type = {
|
Complement : Type = {
|
||||||
comp : Agreement => {p1,p2 : Str} -- Agreement for AP complements
|
comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements
|
||||||
|
pred : PredType ; -- to choose right sentence type marker and copula
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
VerbPhrase : Type = Verb ** Complement ** {
|
VerbPhrase : Type = Verb ** Complement ** {
|
||||||
isPred : Bool ; -- to choose right sentence type marker
|
|
||||||
adv : Str ;
|
adv : Str ;
|
||||||
c2, c3 : Preposition ; -- can combine together and with object pronoun(s?)
|
c2, c3 : Preposition ; -- can combine together and with object pronoun(s?)
|
||||||
obj2 : {s : Str ; a : AgreementPlus} ;
|
obj2 : {s : Str ; a : AgreementPlus} ;
|
||||||
@@ -626,7 +629,7 @@ oper
|
|||||||
|
|
||||||
useV : Verb -> VerbPhrase = \v -> v ** {
|
useV : Verb -> VerbPhrase = \v -> v ** {
|
||||||
comp = \\_ => <[],[]> ;
|
comp = \\_ => <[],[]> ;
|
||||||
isPred = False ;
|
pred = NoPred ;
|
||||||
adv = [] ;
|
adv = [] ;
|
||||||
c2,c3 = noPrep ;
|
c2,c3 = noPrep ;
|
||||||
obj2 = {s = [] ; a = Unassigned} ;
|
obj2 = {s = [] ; a = Unassigned} ;
|
||||||
@@ -643,15 +646,11 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** {
|
complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** {
|
||||||
comp = \\agr =>
|
comp = \\agr => let cmp = vps.comp ! agr in
|
||||||
case np.a of {
|
{p1 = np.s ++ cmp.p1 ; -- if object is a noun, it will come before verb in the sentence.
|
||||||
Unassigned => vps.comp ! agr ;
|
-- if object is a pronoun, np.s is empty.
|
||||||
_ => {p1 = np.s ; -- if object is a noun, it will come before verb in the sentence.
|
p2 = cmp.p2 ++ compl np.a vps ++ vps.secObj} -- object combines with the preposition of the verb.
|
||||||
-- if object is a pronoun, np.s is empty.
|
} ; -- secObj in case there was a ditransitive verb.
|
||||||
p2 = compl np.a vps ++ vps.secObj} -- object combines with the preposition of the verb.
|
|
||||||
-- secObj in case there was a ditransitive verb.
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
compl : AgreementPlus -> VerbPhrase -> Str = \a,vp ->
|
compl : AgreementPlus -> VerbPhrase -> Str = \a,vp ->
|
||||||
let agr = case a of {IsPron x => x ; _ => Pl3} ;
|
let agr = case a of {IsPron x => x ; _ => Pl3} ;
|
||||||
@@ -686,7 +685,7 @@ oper
|
|||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
insertAdv : Adverb -> VerbPhrase -> VerbPhrase = \adv,vp ->
|
insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv ->
|
||||||
case adv.c2 of {
|
case adv.c2 of {
|
||||||
noPrep => vp ** {adv = adv.s} ; -- The adverb is not formed with PrepNP
|
noPrep => vp ** {adv = adv.s} ; -- The adverb is not formed with PrepNP
|
||||||
prep => case <vp.c2,vp.obj2.a,vp.c3> of {
|
prep => case <vp.c2,vp.obj2.a,vp.c3> of {
|
||||||
@@ -698,7 +697,8 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Sentences etc.
|
-- Sentences etc.
|
||||||
Clause : Type = {s : Tense => Anteriority => Polarity => Str} ;
|
Clause : Type = {s : Bool {-is question-} => Tense => Anteriority => Polarity => Str} ;
|
||||||
|
QClause : Type = {s : Tense => Anteriority => Polarity => Str} ;
|
||||||
RClause,
|
RClause,
|
||||||
ClSlash,
|
ClSlash,
|
||||||
Sentence : Type = SS ; ---- TODO
|
Sentence : Type = SS ; ---- TODO
|
||||||
@@ -746,6 +746,6 @@ oper
|
|||||||
-- linrefs
|
-- linrefs
|
||||||
|
|
||||||
oper
|
oper
|
||||||
linVP : VerbPhrase -> Str = \vp -> vp.s ! VInf ; ----
|
linVP : VerbPhrase -> Str = \vp -> let obj = vp.comp ! Sg3 Masc in obj.p1 ++ obj.p2 ++ vp.s ! VInf ; ----
|
||||||
linCN : CNoun -> Str = \cn -> cn.s ! NomSg ;
|
linCN : CNoun -> Str = \cn -> cn.s ! NomSg ++ cn.mod ! Sg ! Abs ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,19 @@ lin
|
|||||||
passive => complSlash (insertComp vps np) ;
|
passive => complSlash (insertComp vps np) ;
|
||||||
_ => complSlash vps } ;
|
_ => complSlash vps } ;
|
||||||
subj = case vps.c2 of {passive => impersNP ; _ => np} ;
|
subj = case vps.c2 of {passive => impersNP ; _ => np} ;
|
||||||
in { s = \\t,a,p =>
|
in { s = \\isQ,t,a,p =>
|
||||||
let pred : {fin : Str ; inf : Str} = vf t a p subj.a vp ;
|
let predRaw : {fin : Str ; inf : Str} = vf t a p subj.a vp ;
|
||||||
|
pred : {fin : Str ; inf : Str} = case vp.pred of {
|
||||||
|
NoCopula => {fin,inf = []} ;
|
||||||
|
_ => predRaw
|
||||||
|
} ;
|
||||||
subjnoun : Str = if_then_Str np.isPron [] (subj.s ! Nom) ;
|
subjnoun : Str = if_then_Str np.isPron [] (subj.s ! Nom) ;
|
||||||
subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) [] ;
|
subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) [] ;
|
||||||
obj : {p1,p2 : Str} = vp.comp ! subj.a ;
|
obj : {p1,p2 : Str} = vp.comp ! subj.a ;
|
||||||
stm : Str =
|
stm : Str =
|
||||||
case <p,vp.isPred,subj.a> of {
|
case <isQ,p,vp.pred,subj.a> of {
|
||||||
<Pos,True,Sg3 _|Impers> => "waa" ;
|
<True,_,_,_> => "ma" ;
|
||||||
|
<_,Pos,Copula|NoCopula,Sg3 _|Impers> => "waa" ;
|
||||||
-- _ => stmarker ! np.a ! b } -- marker+pronoun contract
|
-- _ => stmarker ! np.a ! b } -- marker+pronoun contract
|
||||||
_ => case <np.isPron,p> of {
|
_ => case <np.isPron,p> of {
|
||||||
<True,Pos> => "waa" ++ subjpron ; -- to force some string from NP to show in the tree
|
<True,Pos> => "waa" ++ subjpron ; -- to force some string from NP to show in the tree
|
||||||
@@ -74,14 +79,15 @@ lin
|
|||||||
|
|
||||||
-}
|
-}
|
||||||
-- : Temp -> Pol -> Cl -> S ;
|
-- : Temp -> Pol -> Cl -> S ;
|
||||||
UseCl t p cl = { s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p } ;
|
UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! False ! t.t ! t.a ! p.p} ;
|
||||||
|
|
||||||
|
-- : Temp -> Pol -> QCl -> QS ;
|
||||||
|
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 } ;
|
||||||
|
|
||||||
-- : Temp -> Pol -> QCl -> QS ;
|
|
||||||
UseQCl 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")
|
-- An adverb can be added to the beginning of a sentence, either with comma ("externally")
|
||||||
-- or without:
|
-- or without:
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ lin
|
|||||||
UseV = ResSom.useV ;
|
UseV = ResSom.useV ;
|
||||||
|
|
||||||
-- : V2 -> VP ; -- be loved
|
-- : V2 -> VP ; -- be loved
|
||||||
PassV2 = ResSom.passV2 ;
|
PassV2 = ResSom.passV2 ;
|
||||||
{-
|
{-
|
||||||
-- : VV -> VP -> VP ;
|
-- : VV -> VP -> VP ;
|
||||||
ComplVV vv vp = ;
|
ComplVV vv vp = ;
|
||||||
@@ -74,16 +74,13 @@ lin
|
|||||||
ReflVP vps = ;
|
ReflVP vps = ;
|
||||||
-}
|
-}
|
||||||
-- : Comp -> VP ;
|
-- : Comp -> VP ;
|
||||||
UseComp comp = UseCopula ** comp ** {
|
UseComp comp = UseCopula ** comp ;
|
||||||
isPred = True
|
|
||||||
} ;
|
|
||||||
|
|
||||||
-- : VP -> Adv -> VP ; -- sleep here
|
-- : VP -> Adv -> VP ; -- sleep here
|
||||||
AdvVP vp adv = insertAdv adv vp ; ---- TODO: how about combining adverbs?
|
AdvVP = insertAdv ;
|
||||||
|
|
||||||
|
|
||||||
-- : VPSlash -> Adv -> VPSlash ; -- use (it) here
|
-- : VPSlash -> Adv -> VPSlash ; -- use (it) here
|
||||||
AdvVPSlash vps adv = insertAdv adv vps ;
|
AdvVPSlash = insertAdv ;
|
||||||
|
|
||||||
{-
|
{-
|
||||||
-- : VP -> Adv -> VP ; -- sleep , even though ...
|
-- : VP -> Adv -> VP ; -- sleep , even though ...
|
||||||
@@ -117,18 +114,29 @@ lin
|
|||||||
-- : AP -> Comp ;
|
-- : AP -> Comp ;
|
||||||
CompAP ap = {
|
CompAP ap = {
|
||||||
comp = \\a => <[], ap.s ! AF (getNum a) Abs> ;
|
comp = \\a => <[], ap.s ! AF (getNum a) Abs> ;
|
||||||
|
pred = Copula ;
|
||||||
} ;
|
} ;
|
||||||
{-
|
|
||||||
-- : CN -> Comp ;
|
-- : CN -> Comp ;
|
||||||
CompCN cn = { } ;
|
CompCN cn = {
|
||||||
|
comp = \\a => <[], cn2str Sg Abs cn> ;
|
||||||
|
pred = NoCopula ;
|
||||||
|
} ;
|
||||||
|
|
||||||
-- NP -> Comp ;
|
-- NP -> Comp ;
|
||||||
CompNP np = { } ;
|
CompNP np = {
|
||||||
|
comp = \\a => <[], np.s ! Abs> ;
|
||||||
|
pred = NoCopula ;
|
||||||
|
} ;
|
||||||
|
|
||||||
-- : Adv -> Comp ;
|
-- : Adv -> Comp ;
|
||||||
CompAdv adv = { } ;
|
CompAdv adv = {
|
||||||
|
comp = \\a =>
|
||||||
|
<if_then_Str adv.np.isPron [] (adv.np.s ! Abs)
|
||||||
|
, adv.s ++ prepCombTable ! adv.np.a ! Single adv.c2> ;
|
||||||
|
pred = Copula ;
|
||||||
|
} ;
|
||||||
|
|
||||||
-}
|
|
||||||
-- : VP -- Copula alone;
|
-- : VP -- Copula alone;
|
||||||
UseCopula = useV copula ;
|
UseCopula = useV copula ;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user