1
0
forked from GitHub/gf-rgl

(Som) Add UseCl, UseComp, CompAP, UttS

This commit is contained in:
Inari Listenmaa
2018-11-01 11:35:03 +01:00
parent 592a93005a
commit 8ce728f393
7 changed files with 84 additions and 63 deletions

View File

@@ -23,7 +23,7 @@ lin
-- PositAdAAdj a = { } ;
-- Subordinate clauses can function as adverbs.
--: Subj -> S -> Adv ;
-- : Subj -> S -> Adv ;
-- SubjS subj s = {} ;
-- Comparison adverbs also work as numeral adverbs.

View File

@@ -32,7 +32,6 @@ oper BaseS : S -> S -> ListS = notYet "BaseS" ;
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
oper CompAP : AP -> Comp = notYet "CompAP" ;
oper CompAdv : Adv -> Comp = notYet "CompAdv" ;
oper CompCN : CN -> Comp = notYet "CompCN" ;
oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ;
@@ -152,8 +151,6 @@ oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
oper Use3N3 : N3 -> N2 = notYet "Use3N3" ;
oper UseA2 : A2 -> AP = notYet "UseA2" ;
oper UseCl : Temp -> Pol -> Cl -> S = notYet "UseCl" ;
oper UseComp : Comp -> VP = notYet "UseComp" ;
oper UseComparA : A -> AP = notYet "UseComparA" ;
oper UseN2 : N2 -> CN = notYet "UseN2" ;
oper UsePN : PN -> NP = notYet "UsePN" ;
@@ -169,7 +166,6 @@ oper UttImpPol : Pol -> Imp -> Utt = notYet "UttImpPol" ;
oper UttImpSg : Pol -> Imp -> Utt = notYet "UttImpSg" ;
oper UttInterj : Interj -> Utt = notYet "UttInterj" ;
oper UttQS : QS -> Utt = notYet "UttQS" ;
oper UttS : S -> Utt = notYet "UttS" ;
oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ;
oper above_Prep : Prep = notYet "above_Prep" ;
oper active2passive : Cl -> Cl = notYet "active2passive" ;

View File

@@ -117,18 +117,15 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
OrdNumeral num = num ;
-- : A -> Ord ;
OrdSuperl a = { s = a.s ! AF Superl ; n = Sg } ; -- why force Sg?
OrdSuperl a = { } ; -- why force Sg?
-- One can combine a numeral and a superlative.
-- : Numeral -> A -> Ord ; -- third largest
OrdNumeralSuperl num a = num ** { s = num.s ++ a.s ! AF Superl } ; --TODO: is the word order correct?
OrdNumeralSuperl num a = num ** { } ;
-- : Quant
DefArt = { s = artDef ;
indep = False ;
pref = [] ;
isDef = True } ;
DefArt = { } ;
-- : Quant
IndefArt = { s = artDef ;
indep = False ;

View File

@@ -14,10 +14,10 @@ oper
gbd : pattern Str = #("g" | "b" | "d") ;
voiced : Str -> Str = \s -> case s of {
"k" => "g" ;
"t" => "d" ;
"p" => "b" ;
_ => s } ;
"k" => "g" ;
"t" => "d" ;
"p" => "b" ;
_ => s } ;
--------------------------------------------------------------------------------
-- Morphophonology
@@ -92,6 +92,7 @@ param
-- TODO: is this necessary?
param
CardOrd = NCard | NOrd ;
--------------------------------------------------------------------------------
-- Prepositions
@@ -124,13 +125,17 @@ oper
param
VForm =
VInf
| VPres Agreement Bool
| VPres Agreement Polarity
| VNegPast
| VPast Agreement
| VFut -- agreement comes from auxiliary
| VRel -- "som är/har/…" TODO is this used in other verbs?
| VImp Number ; -- TODO negation
oper
if_then_Pol : Polarity -> Str -> Str -> Str = \p,t,f ->
case p of {Pos => t ; Neg => f } ;
-- TODO:
-- tre aspekter (enkel, progressiv, habituell),
-- fem modus (indikativ, imperativ, konjunktiv, kontiditonalis, optativ)

View File

@@ -269,6 +269,9 @@ oper
Verb2 : Type = Verb ** {c2 : Preposition} ;
Verb3 : Type = Verb2 ** {c3 : Preposition} ;
-- Saeed page 79:
-- "… the reference form is the imperative singular form
-- since it corresponds to the form of the basic root."
mkVerb : (x1,x2 : Str) -> Verb = \ark,qaat ->
let stems : {p1 : Str ; p2 : Str} = case ark of {
a + r@#c + k@#c => <ark + "i", a + r + a + voiced k> ;
@@ -288,11 +291,11 @@ oper
_ => "n" } ;
in { s = table {
VPres (Sg1|Sg3 Masc) pol
=> qaat + if_then_Str pol "aa" "o" ;
=> qaat + if_then_Pol pol "aa" "o" ;
VPres (Sg2|Sg3 Fem) pol
=> arag + t + if_then_Str pol "aa" "o" ;
=> arag + t + if_then_Pol pol "aa" "o" ;
VPres (Pl1 _) pol
=> arag + n + if_then_Str pol "aa" "o" ;
=> arag + n + if_then_Pol pol "aa" "o" ;
VPres Pl2 pol => arag + t + "aan" ;
VPres Pl3 pol => qaat + "aan" ;
@@ -333,15 +336,15 @@ oper
copula : Verb = {
s = table {
VPres Sg1 pol => if_then_Str pol "ahay" "ihi" ;
VPres Sg2 pol => if_then_Str pol "tahay" "ihid" ;
VPres (Sg3 Masc) pol => if_then_Str pol "yahay" "aha" ;
VPres (Sg3 Fem) pol => if_then_Str pol "tahay" "aha" ;
VPres (Pl1 _) pol => if_then_Str pol "nahay" "ihin" ;
VPres Pl2 pol => if_then_Str pol "tihiin" "ihidin" ;
VPres Pl3 pol => if_then_Str pol "yihiin" "aha" ;
VPres Sg1 pol => if_then_Pol pol "ahay" "ihi" ;
VPres Sg2 pol => if_then_Pol pol "tahay" "ihid" ;
VPres (Sg3 Masc|Impers) pol => if_then_Pol pol "yahay" "aha" ;
VPres (Sg3 Fem) pol => if_then_Pol pol "tahay" "aha" ;
VPres (Pl1 _) pol => if_then_Pol pol "nahay" "ihin" ;
VPres Pl2 pol => if_then_Pol pol "tihiin" "ihidin" ;
VPres Pl3 pol => if_then_Pol pol "yihiin" "aha" ;
VPast (Sg1|Sg3 Masc)
VPast (Sg1|Sg3 Masc|Impers)
=> "ahaa" ;
VPast (Sg2|Sg3 Fem)
=> "ahayd" ;
@@ -410,17 +413,34 @@ oper
prepCombTable ! np.a ! combine vp.c2 noPrep ;
--------------------------------------------------------------------------------
-- Sentences etc.
Clause : Type = {s : Bool => Str} ; -- TODO tense + ant
Clause : Type = {s : Tense => Anteriority => Polarity => Str} ;
RClause,
ClSlash,
Sentence : Type = SS ; ---- TODO
stmarker : Agreement => Bool => Str = \\a,b =>
let stm = if_then_Str b "w" "m"
vf : Tense -> Anteriority -> Polarity -> Agreement -> Verb
-> {fin : Str ; inf : Str} = \t,ant,p,agr,vp ->
let pastV : Verb -> Str = \v ->
case p of { Neg => v.s ! VNegPast ;
Pos => v.s ! VPast agr } ;
presV : Verb -> Str = \v -> v.s ! VPres agr p ;
in case <t,ant> of {
<Pres,Simul> => {fin = presV vp ; inf = [] } ;
<Pres,Anter> => {fin = presV copula ; inf = vp.s ! VInf } ; ---- just guessing
<Past,Simul> => {fin = pastV vp ; inf = [] } ;
<Past,Anter> => {fin = pastV copula ; inf = vp.s ! VInf } ; ---- TODO: habitual aspect
<_Fut,Simul> => {fin = presV copula ; inf = vp.s ! VFut} ;
<_Fut,Anter> => {fin = pastV copula ; inf = vp.s ! VFut}
-- <Cond,Simul> => {fin = ? ; inf = ?} ; -- TODO conditional
-- <Cond,Anter> => {fin = ? ; inf = ?} -- TODO conditional
} ;
stmarker : Agreement => Polarity => Str = \\a,b =>
let stm = if_then_Pol b "w" "m"
in stm + subjpron ! a ;
stmarkerNoContr : Agreement => Bool => Str = \\a,b =>
let stm = if_then_Str b "waa" "ma"
stmarkerNoContr : Agreement => Polarity => Str = \\a,b =>
let stm = if_then_Pol b "waa" "ma"
in stm ++ subjpron ! a ;
subjpron : Agreement => Str = table {

View File

@@ -8,22 +8,27 @@ lin
--2 Clauses
-- : NP -> VP -> Cl
PredVP np vp = let compl = vp.comp ! np.a in {
s = \\b =>
if_then_Str np.isPron [] (np.s ! Nom)
++ compl.p1
++ case <b,vp.isPred,np.a> of { --sentence type marker + subj. pronoun
<True,True,Sg3 _> => "waa" ;
-- _ => stmarker ! np.a ! b } -- marker+pronoun contract
_ => case <np.isPron,b> of {
<True,True> => "waa" ++ np.s ! Nom ; -- to force some string from NP to show in the tree
<True,False> => "ma" ++ np.s ! Nom ;
<False> => stmarkerNoContr ! np.a ! b
}}
++ vp.adv.s
++ compl.p2 -- object pronoun for pronouns, empty for nouns
++ vp.s ! VPres np.a b -- the verb inflected
++ vp.adv.s2
PredVP np vp = {
s = \\t,a,p =>
let pred : {fin : Str ; inf : Str} = vf t a p np.a vp ;
subj : Str = if_then_Str np.isPron [] (np.s ! Nom) ;
obj : {p1,p2 : Str} = vp.comp ! np.a ;
stm : Str =
case <p,vp.isPred,np.a> of {
<Pos,True,Sg3 _> => "waa" ;
-- _ => stmarker ! np.a ! b } -- marker+pronoun contract
_ => case <np.isPron,p> of {
<True,Pos> => "waa" ++ np.s ! Nom ; -- to force some string from NP to show in the tree
<True,Neg> => "ma" ++ np.s ! Nom ;
<False> => stmarkerNoContr ! np.a ! p }} ;
in subj -- subject if it's a noun
++ obj.p1 -- object if it's a noun
++ stm -- sentence type marker + possible subj. pronoun
++ vp.adv.s ---- TODO: can it contract with obj. pronoun?
++ obj.p2 -- object if it's a pronoun
++ pred.fin -- the verb inflected
++ pred.inf -- potential participle
++ vp.adv.s2 ---- I have no idea /IL
} ;
{-
-- : SC -> VP -> Cl ; -- that she goes is good
@@ -63,10 +68,10 @@ lin
--2 Sentences
-}
-- : Temp -> Pol -> Cl -> S ;
UseCl temp pol cl = { s = cl.s ! temp.t ! temp.a ! pol.p ! Stat } ;
UseCl temp pol cl = { s = cl.s ! temp.t ! temp.a ! pol.p } ;
{-
-- : Temp -> Pol -> RCl -> RS ;
UseRCl temp pol cl = { s = cl.s ! temp.t ! temp.a ! pol.p } ;

View File

@@ -79,23 +79,23 @@ lin
-- : VPSlash -> VP ;
ReflVP vps = ;
-}
-- : Comp -> VP ;
UseComp comp =
insertComp comp.s (copulaVP comp.copula)
** {isPred = True} ;
UseComp comp = UseCopula ** comp ** {
isPred = True
} ;
{-
-- : V2 -> VP ; -- be loved
PassV2 v2 =
-- : VP -> Adv -> VP ; -- sleep here
AdvVP vp adv = ResSom.insertAdv adv vp ;
AdvVP vp adv = vp ** {adv = adv} ; ---- TODO: how about combining adverbs?
-- : VP -> Adv -> VP ; -- sleep , even though ...
ExtAdvVP vp adv = ResSom.insertAdv (postfixSS (SOFT_BIND ++ ",") adv) vp ;
ExtAdvVP vp adv = ;
-- : AdV -> VP -> VP ; -- always sleep
AdVVP adv vp = ResSom.insertAdv adv vp ;
AdVVP adv vp = vp ** {adv = adv} ;
-- : VPSlash -> Adv -> VPSlash ; -- use (it) here
AdvVPSlash vps adv = vps ** { adv = vps.adv ++ adv.s } ;
@@ -110,7 +110,7 @@ lin
-- x => x }} ;
{-
--2 Complements to copula
@@ -121,13 +121,11 @@ lin
-- I am [a house that sleeps here]
-- we are [houses that sleep here]
-- Complement : Type = { s : Agreement => {p1,p2 : Str}} ;
-- : AP -> Comp ;
CompAP ap = {
comp = \\a => <[], ap.s ! AF (getNum a) Abs> ;
} ;
{-}
-- : CN -> Comp ;
CompCN cn = { } ;