(Som) Add simple y/n-questions

This commit is contained in:
Inari Listenmaa
2019-06-28 14:52:14 +02:00
parent ef13412a66
commit 890e29f628
6 changed files with 20 additions and 22 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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" }

View File

@@ -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 = ;

View File

@@ -697,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

View File

@@ -13,18 +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 predRaw : {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 { pred : {fin : Str ; inf : Str} = case vp.pred of {
NoCopula => {fin,inf = []} ; -- if NoCopula, no overt verb NoCopula => {fin,inf = []} ;
_ => predRaw _ => 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.pred,subj.a> of { case <isQ,p,vp.pred,subj.a> of {
<Pos,Copula|NoCopula,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
@@ -78,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 -> RCl -> RS ;
UseRCl t p cl = { s = t.s ++ p.s ++ cl.s ! 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 ;
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") -- An adverb can be added to the beginning of a sentence, either with comma ("externally")
-- or without: -- or without: