forked from GitHub/gf-rgl
(Som) Add simple y/n-questions
This commit is contained in:
@@ -16,29 +16,24 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
|
||||
Cl = ResSom.Clause ;
|
||||
ClSlash = ResSom.ClSlash ;
|
||||
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
|
||||
|
||||
-- Constructed in QuestionSom.
|
||||
|
||||
QCl = ResSom.Clause ;
|
||||
QCl = ResSom.QClause ;
|
||||
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"
|
||||
IQuant = ResSom.Quant ; -- interrogative quantifier e.g. "which"
|
||||
|
||||
|
||||
|
||||
|
||||
--2 Relative clauses and pronouns
|
||||
|
||||
-- Constructed in RelativeSom.
|
||||
|
||||
RCl = ResSom.RClause ;
|
||||
RP = { s : Str } ;
|
||||
|
||||
|
||||
RP = SS ;
|
||||
|
||||
--2 Verb phrases
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ lin bread_N = mkN "rooti" ; --masc/fem
|
||||
-- lin brown_A = mkA "" ;
|
||||
-- lin burn_V = mkV "" ;
|
||||
-- lin butter_N = mkN "" ;
|
||||
-- lin buy_V2 = mkV2 "" ;
|
||||
lin buy_V2 = mkV2 "iibsa" ;
|
||||
|
||||
----
|
||||
-- C
|
||||
|
||||
@@ -4,7 +4,7 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in {
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||
|
||||
UttS s = s ;
|
||||
-- UttQS qs = qs ;
|
||||
UttQS qs = qs ;
|
||||
|
||||
UttImpSg pol imp =
|
||||
let ma = case pol.p of { Pos => [] ; Neg => "ma" }
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
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
|
||||
-- with an interrogative.
|
||||
|
||||
lin
|
||||
-- : Cl -> QCl ;
|
||||
-- QuestCl cl = ;
|
||||
QuestCl cl = {s = cl.s ! True} ;
|
||||
|
||||
-- : IP -> VP -> QCl ;
|
||||
-- QuestVP ip vp = ;
|
||||
|
||||
@@ -697,7 +697,8 @@ oper
|
||||
} ;
|
||||
--------------------------------------------------------------------------------
|
||||
-- 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,
|
||||
ClSlash,
|
||||
Sentence : Type = SS ; ---- TODO
|
||||
|
||||
@@ -13,18 +13,19 @@ lin
|
||||
passive => complSlash (insertComp vps np) ;
|
||||
_ => complSlash vps } ;
|
||||
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 ;
|
||||
pred : {fin : Str ; inf : Str} = case vp.pred of {
|
||||
NoCopula => {fin,inf = []} ; -- if NoCopula, no overt verb
|
||||
NoCopula => {fin,inf = []} ;
|
||||
_ => predRaw
|
||||
} ;
|
||||
subjnoun : 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 ;
|
||||
stm : Str =
|
||||
case <p,vp.pred,subj.a> of {
|
||||
<Pos,Copula|NoCopula,Sg3 _|Impers> => "waa" ;
|
||||
case <isQ,p,vp.pred,subj.a> of {
|
||||
<True,_,_,_> => "ma" ;
|
||||
<_,Pos,Copula|NoCopula,Sg3 _|Impers> => "waa" ;
|
||||
-- _ => stmarker ! np.a ! b } -- marker+pronoun contract
|
||||
_ => case <np.isPron,p> of {
|
||||
<True,Pos> => "waa" ++ subjpron ; -- to force some string from NP to show in the tree
|
||||
@@ -78,14 +79,15 @@ lin
|
||||
|
||||
-}
|
||||
-- : 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 ;
|
||||
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")
|
||||
-- or without:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user