1
0
forked from GitHub/gf-rgl

(Som) Cleanup and renaming functions

This commit is contained in:
Inari Listenmaa
2019-09-06 15:32:48 +02:00
parent 8ac75e8550
commit df11d86ffb

View File

@@ -882,14 +882,14 @@ oper
let hasSubjPron : Bool = False ; let hasSubjPron : Bool = False ;
hasSTM : Bool = False ; hasSTM : Bool = False ;
isRel : Bool = True ; isRel : Bool = True ;
in wordOrder Subord isRel hasSubjPron hasSTM ; in mkClause Subord isRel hasSubjPron hasSTM ;
-- No subject pronoun, no STM, but use verb forms from Statement -- No subject pronoun, no STM, but use verb forms from Statement
cl2rclNom : ClSlash -> Clause = \cls -> cl2rclNom : ClSlash -> Clause = \cls ->
let hasSubjPron : Bool = False ; let hasSubjPron : Bool = False ;
hasSTM : Bool = False ; hasSTM : Bool = False ;
isRel : Bool = True ; isRel : Bool = True ;
in wordOrder Statement isRel hasSubjPron hasSTM cls ; in mkClause Statement isRel hasSubjPron hasSTM cls ;
-- RelSlash: subject pronoun is included if it's not 3rd person -- RelSlash: subject pronoun is included if it's not 3rd person
-- TODO check this rule with more example sentences -- TODO check this rule with more example sentences
@@ -897,14 +897,14 @@ oper
let hasSubjPron : Bool = True ; let hasSubjPron : Bool = True ;
hasSTM : Bool = False ; hasSTM : Bool = False ;
isRel : Bool = True ; isRel : Bool = True ;
in wordOrder Subord isRel hasSubjPron hasSTM ; in mkClause Subord isRel hasSubjPron hasSTM ;
-- Question clauses: subject pronoun not included, STM is -- Question clauses: subject pronoun not included, STM is
cl2qcl : ClSlash -> Clause = cl2qcl : ClSlash -> Clause =
let hasSubjPron : Bool = False ; let hasSubjPron : Bool = False ;
hasSTM : Bool = True ; hasSTM : Bool = True ;
isRel : Bool = False ; isRel : Bool = False ;
in wordOrder Question isRel hasSubjPron hasSTM ; in mkClause Question isRel hasSubjPron hasSTM ;
-- Sentence: include subject pronoun and STM. -- Sentence: include subject pronoun and STM.
-- When subordinate, include "in". -- When subordinate, include "in".
@@ -916,12 +916,12 @@ oper
cl : ClSlash = case isSubord of { -- add "in" to the clause if used as subordinate cl : ClSlash = case isSubord of { -- add "in" to the clause if used as subordinate
True => cls ** {vComp = cls.vComp ** {subjunc = "in"}} ; True => cls ** {vComp = cls.vComp ** {subjunc = "in"}} ;
False => cls } ; False => cls } ;
sent = wordOrder cltyp False True True cl sent = mkClause cltyp False True True cl
in sent.s ! t ! a ! p in sent.s ! t ! a ! p
} ; } ;
wordOrder : ClType -> (rel,sp,stm : Bool) -> ClSlash -> Clause = \cltyp,isRel,hasSubjPron,hasSTM,incomplCl -> { mkClause : ClType -> (rel,sp,stm : Bool) -> ClSlash -> Clause = \cltyp,isRel,hasSubjPron,hasSTM,incomplCl -> {
s = \\t,a,p => s = \\t,a,p =>
let -- Put all arguments in their right place let -- Put all arguments in their right place
cl : ClSlash = complCl incomplCl ; cl : ClSlash = complCl incomplCl ;
@@ -1044,16 +1044,6 @@ oper
-- linrefs -- linrefs
oper oper
linVP : VForm -> ClType -> VerbPhrase -> Str = \vf,cltyp,vp ->
let pred = vp.s ! vf ;
vp' = complSlash vp ;
stm = case <cltyp,isNeg vf> of {
<Subord,True> => {p1 = "aan" ; p2 = []} ;
_ => {p1,p2 = []}
} ;
wo = wordOrderOld (Sg3 Masc) [] stm (vp'.comp ! pagr2agr vp.obj2.a) pred vp' cltyp ;
in wo.beforeSTM ++ wo.stm ++ wo.afterSTM ;
linCN : CNoun -> Str = \cn -> cn.s ! Indef Sg ++ cn.mod ! Indefinite ! Sg ! Abs ; linCN : CNoun -> Str = \cn -> cn.s ! Indef Sg ++ cn.mod ! Indefinite ! Sg ! Abs ;
linAdv : Adverb -> Str = \adv -> linAdv : Adverb -> Str = \adv ->
adv.berri adv.berri
@@ -1062,24 +1052,25 @@ oper
++ adv.dhex ++ adv.dhex
++ adv.np.s ++ adv.np.s
++ adv.miscAdv ; ++ adv.miscAdv ;
linBaseCl : BaseCl -> Str = \b -> b.beforeSTM ++ b.stm ++ b.afterSTM ;
-- TODO: deprecate eventually linVP : VForm -> ClType -> VerbPhrase -> Str = \vf,cltyp,vp ->
BaseCl : Type = {beforeSTM, stm, afterSTM : Str} ; -- adverbs, subjects, all that comes before sentence type marker. Eventual Subj attaches to the part after STM. let pred = vp.s ! vf ;
vp' = complSlash vp ;
neg = case <cltyp,isNeg vf> of {
<Subord,True> => "aan" ;
_ => []
} ;
in wordOrder cltyp neg pred (vp'.comp ! pagr2agr vp.obj2.a) vp' ;
wordOrderOld : Agreement -> (sn : Str) -> (stm,obj : {p1,p2 : Str}) -> Str -> VerbPhrase -> ClType -> BaseCl = wordOrder : ClType -> (neg,pred : Str) -> (obj : {p1,p2 : Str}) -> VerbPhrase -> Str =
\agr,subjnoun,stm,obj,pred,vp,cltyp -> { \cltyp,neg,pred,obj,vp ->
beforeSTM = vp.berri -- AdV vp.berri -- AdV
++ subjnoun -- subject if it's a noun
++ case cltyp of { ++ case cltyp of {
Subord => [] ; Subord => [] ;
_ => obj.p1 } ; -- noun object if it's a statement _ => obj.p1 } -- noun object if it's a statement
++ neg
stm = stm.p1 ; -- sentence type marker; empty if subordinate and positive ++ vp.vComp.subjunc -- "waa in" construction
afterSTM = vp.vComp.subjunc -- "waa in" construction
++ stm.p2 -- possible subj. pronoun
++ case cltyp of { ++ case cltyp of {
Subord => obj.p1 ; -- noun object if it's subordinate clause Subord => obj.p1 ; -- noun object if it's subordinate clause
_ => [] } _ => [] }
@@ -1089,7 +1080,7 @@ oper
++ vp.secObj -- "second object" ++ vp.secObj -- "second object"
++ vp.vComp.inf -- VV complement, if it's infinitive ++ vp.vComp.inf -- VV complement, if it's infinitive
++ pred -- the verb inflected ++ pred -- the verb inflected
++ vp.vComp.subcl ! agr -- VV complement, if it's subordinate clause ++ vp.vComp.subcl ! Sg3 Masc -- VV complement, if it's subordinate clause
++ vp.miscAdv } ; ---- NB. Only used if there are several adverbs, or for "waa in" construction. ++ vp.miscAdv ; ---- NB. Only used if there are several adverbs, or for "waa in" construction.
} }