1
0
forked from GitHub/gf-rgl

Merge pull request #297 from daherb/master

Updated Latin RG
This commit is contained in:
Inari Listenmaa
2019-12-03 19:48:42 +01:00
committed by GitHub
22 changed files with 48374 additions and 47931 deletions

View File

@@ -8,12 +8,12 @@ concrete AdjectiveLat of Adjective = CatLat ** open ResLat, Prelude in {
-- ComparA : A -> NP -> AP ; -- warmer than I -- ComparA : A -> NP -> AP ; -- warmer than I
ComparA a np = { ComparA a np = {
s = \\ag => a.s ! Compar ! ag ++ "quam" ++ (combineNounPhrase np) ! PronNonDrop ! Nom ; s = \\ag => a.s ! Compar ! ag ++ "quam" ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom ;
} ; } ;
-- ComplA2 : A2 -> NP -> AP ; -- married to her -- ComplA2 : A2 -> NP -> AP ; -- married to her
ComplA2 a np = { ComplA2 a np = {
s = \\ag => a.s ! Posit ! ag ++ a.c.s ++ (combineNounPhrase np) ! PronNonDrop ! a.c.c ; s = \\ag => a.s ! Posit ! ag ++ a.c.s ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! a.c.c ;
} ; } ;
-- ReflA2 : A2 -> AP -- married to myself -- ReflA2 : A2 -> AP -- married to myself
@@ -31,7 +31,7 @@ concrete AdjectiveLat of Adjective = CatLat ** open ResLat, Prelude in {
-- CAdvAP : CAdv -> AP -> NP -> AP ; -- as cool as John -- CAdvAP : CAdv -> AP -> NP -> AP ; -- as cool as John
CAdvAP cadv ap np = CAdvAP cadv ap np =
{ s = \\ag => cadv.s ++ ap.s ! ag ++ cadv.p ++ (combineNounPhrase np) ! PronNonDrop ! Nom } ; { s = \\ag => cadv.s ++ ap.s ! ag ++ cadv.p ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom } ;
-- The superlative use is covered in $Ord$. -- The superlative use is covered in $Ord$.

View File

@@ -8,16 +8,16 @@ concrete AdverbLat of Adverb = CatLat ** open ResLat, Prelude, ParadigmsLat in
-- PrepNP : Prep -> NP -> Adv ; -- in the house -- PrepNP : Prep -> NP -> Adv ; -- in the house
PrepNP prep np = PrepNP prep np =
mkAdv (prep.s ++ np.adv ++ (combineNounPhrase np) ! PronNonDrop ! prep.c ) ; mkAdv (prep.s ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! prep.c ) ;
-- ComparAdvAdj : CAdv -> A -> NP -> Adv ; -- more warmly than John -- ComparAdvAdj : CAdv -> A -> NP -> Adv ; -- more warmly than John
ComparAdvAdj cadv a np = ComparAdvAdj cadv a np =
mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ (combineNounPhrase np) ! PronNonDrop ! Nom) ; mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom) ;
-- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs -- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
ComparAdvAdjS cadv a s = ComparAdvAdjS cadv a s =
mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ combineSentence s ! SPreS ! PreV ! CPreV ! SOV ) ; mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ defaultSentence s ! SOV ) ;
-- AdAdv : AdA -> Adv -> Adv ; -- very quickly -- AdAdv : AdA -> Adv -> Adv ; -- very quickly
AdAdv ada adv = mkAdv (ada.s ++ (adv.s ! Posit) ) ; AdAdv ada adv = mkAdv (ada.s ++ (adv.s ! Posit) ) ;
@@ -29,7 +29,7 @@ concrete AdverbLat of Adverb = CatLat ** open ResLat, Prelude, ParadigmsLat in
-- Subordinate clauses can function as adverbs. -- Subordinate clauses can function as adverbs.
-- SubjS : Subj -> S -> Adv ; -- when she sleeps -- SubjS : Subj -> S -> Adv ; -- when she sleeps
SubjS subj s = mkAdv (subj.s ++ combineSentence s ! SPreS ! PreV ! CPreV ! SOV ) ; SubjS subj s = mkAdv (subj.s ++ defaultSentence s ! SOV ) ;
-- AdnCAdv : CAdv -> AdN ; -- less (than five) -- AdnCAdv : CAdv -> AdN ; -- less (than five)
AdnCAdv cadv = {s = cadv.s ++ cadv.p} ; AdnCAdv cadv = {s = cadv.s ++ cadv.p} ;

View File

@@ -8,6 +8,7 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in {
-- --
S = Sentence ; S = Sentence ;
QS = {s : QForm => Str} ; QS = {s : QForm => Str} ;
RS = { s : Gender => Number => Str } ; -- Sentence ;
-- RS = {s : Agr => Str ; c : Case} ; -- c for it clefts -- RS = {s : Agr => Str ; c : Case} ; -- c for it clefts
-- SSlash = {s : Str ; c2 : Str} ; -- SSlash = {s : Str ; c2 : Str} ;
-- --
@@ -28,11 +29,11 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in {
-- --
---- Relative ---- Relative
-- --
-- RCl = { RCl = { s : Gender => Number => Clause };
-- s : ResLat.Tense => Anteriority => CPolarity => Agr => Str ; -- s : ResLat.Tense => Anteriority => CPolarity => Agr => Str ;
-- c : Case -- c : Case
-- } ; -- } ;
-- RP = {s : RCase => Str ; a : RAgr} ; RP = {s : Agr => Str } ;
-- --
---- Verb ---- Verb
-- --
@@ -87,9 +88,9 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in {
A2 = Adjective ** { c : Prep} ; A2 = Adjective ** { c : Prep} ;
linref linref
NP = \np -> combineNounPhrase np ! PronNonDrop ! Nom ; NP = \np -> combineNounPhrase np ! PronNonDrop ! APreN ! DPostN ! Nom ;
VP = \vp -> vp.adv ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ; VP = \vp -> vp.adv ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ;
S = \s -> combineSentence s ! SPreO ! PreO ! CPreV ! SOV ; S = \s -> defaultSentence s ! SOV ;
V, VS, VQ, VA, VV = \v -> v.act ! (VAct VSim (VPres VInd) Sg P1) ; V, VS, VQ, VA, VV = \v -> v.act ! (VAct VSim (VPres VInd) Sg P1) ;
V2, V2A, V2Q, V2S = \v -> v.act ! (VAct VSim (VPres VInd) Sg P1) ; V2, V2A, V2Q, V2S = \v -> v.act ! (VAct VSim (VPres VInd) Sg P1) ;
Pron = \p -> p.pers.s ! PronNonDrop ! PronNonRefl ! Nom ; Pron = \p -> p.pers.s ! PronNonDrop ! PronNonRefl ! Nom ;

View File

@@ -11,14 +11,16 @@ concrete ConjunctionLat of Conjunction =
ConjS conj ss = { ConjS conj ss = {
-- s = \\apos => coord conj.c { init = (ss.s ! conj.c).init ! SPreS ! apos ! CPreV ! SOV ; -- s = \\apos => coord conj.c { init = (ss.s ! conj.c).init ! SPreS ! apos ! CPreV ! SOV ;
-- last = (ss.s ! conj.c).last ! SPreS ! apos ! CPreV ! SOV} ; -- last = (ss.s ! conj.c).last ! SPreS ! apos ! CPreV ! SOV} ;
s = \\apos => conj.s1 ++ (ss.s ! conj.c).init ! SPreS ! apos ! CPreV ! SOV ++ conj.s2 ++ s = \\apos => conj.s1 ++ (ss.s ! conj.c).init ! SAPreS ! apos ! DPreN ! VReg ! CPreV ! SOV ++ conj.s2 ++
(ss.s ! conj.c).last ! SPreS ! apos ! CPreV ! SOV ++ conj.s3 ; (ss.s ! conj.c).last ! SAPreS ! apos ! DPreN ! VReg ! CPreV ! SOV ++ conj.s3 ;
o = \\_ => [] ; o = \\_ => [] ;
v = \\_,_ => [] ; v = \\_ => [] ;
neg = \\_ => [] ; neg = \\_ => [] ;
compl = [] ;
p = ss.p ; p = ss.p ;
sadv = [] ; sadv = [] ;
t = ss.t t = ss.t ;
det = { s, sp = \\_ => [] } ;
} ; } ;
-- ConjAdv : Conj -> ListAdv -> Adv ; -- here or there -- ConjAdv : Conj -> ListAdv -> Adv ; -- here or there
@@ -34,14 +36,13 @@ concrete ConjunctionLat of Conjunction =
-- } ; -- } ;
-- c => (conjunctDistrTable Case conj (nps.l ! Et)).s -- c => (conjunctDistrTable Case conj (nps.l ! Et)).s
-- } ; -- } ;
s = \\pd,ca => conj.s1 ++ (nps.s ! conj.c).init ! pd ! ca ++ conj.s2 ++ (nps.s ! conj.c).last ! pd ! ca ++ conj.s3 ; s = \\pd,ca => conj.s1 ++ (nps.s ! conj.c).init ! pd ! APreN ! DPreN ! ca ++ conj.s2 ++ (nps.s ! conj.c).last ! pd ! APreN ! DPreN ! ca ++ conj.s3;
n = case conj.c of { Et => Pl ; _ => nps.n } ; n = case conj.c of { Et => Pl ; _ => nps.n } ;
g = nps.g ; g = nps.g ;
p = nps.p ; p = nps.p ;
adv = nps.adv ; adv = "" ;
preap = nps.preap ; preap , postap = { s = \\_ => "" };
postap = nps.postap ; det = { s , sp = \\_ => ""} ;
det = nps.det
} ; } ;
-- ConjAP : Conj -> ListAP -> AP ; -- ConjAP : Conj -> ListAP -> AP ;
@@ -61,8 +62,12 @@ concrete ConjunctionLat of Conjunction =
-- isPre = ss.isPre -- isPre = ss.isPre
-- } ; -- } ;
---} ---}
-- --
---- These fun's are generated from the list cat's.
-- ConjRS : Conj -> ListRS -> RS
ConjRS conj rss = { s = \\g,n => conj.s1 ++ (rss.s ! conj.c).init ! g ! n ++ conj.s2 ++ (rss.s ! conj.c).last ! g ! n++ conj.s3 };
---- These fun's are generated from the list cat's.
-- --
-- BaseS : S -> S -> ListS -- BaseS : S -> S -> ListS
@@ -77,7 +82,7 @@ concrete ConjunctionLat of Conjunction =
-- ConsS x xs = { l = \\_ => consrSS bindComma (ss (x.s ! PreS)) (xs.l ! Comma) }; -- ConsS x xs = { l = \\_ => consrSS bindComma (ss (x.s ! PreS)) (xs.l ! Comma) };
ConsS s ss = { ConsS s ss = {
s = \\co => s = \\co =>
{ init = \\s,a,c,o => coord co { init = (ss.s ! co).init ! s ! a ! c ! o ; last = (ss.s ! co).last ! s ! a ! c ! o } ; { init = \\s,a,d,v,c,o => coord co { init = (ss.s ! co).init ! s ! a ! d ! v ! c ! o ; last = (ss.s ! co).last ! s ! a ! d ! v ! c ! o } ;
last = combineSentence s } ; last = combineSentence s } ;
p = s.p ; p = s.p ;
t = s.t t = s.t
@@ -99,29 +104,21 @@ concrete ConjunctionLat of Conjunction =
-- -- BaseNP : NP -> NP -> ListNP ; -- John, Mary -- -- BaseNP : NP -> NP -> ListNP ; -- John, Mary
BaseNP x y = { BaseNP x y = {
-- s = \\c => twoTable Case x y ; -- s = \\c => twoTable Case x y ;
s = \\c => { init = x.s ; last = y.s } ; s = \\c => { init = combineNounPhrase x ; last = combineNounPhrase y } ;
g = Masc ; -- Just guessing (but maybe sexist bullshit) g = Neutr ; -- Trying to avoid trouble by choosing a gender
n = matchNumber x.n y.n ; n = matchNumber x.n y.n ;
p = P3 ; p = P3 ;
adv = x.adv ++ y.adv ;
preap = lin AP { s = \\a => x.preap.s ! a ++ y.preap.s ! a } ;
postap = lin AP { s = \\a => x.postap.s ! a ++ y.postap.s ! a } ;
isBase = True ; isBase = True ;
det = lin Det { s = \\g,c => x.det.s ! g ! c ++ y.det.s ! g ! c ; sp = \\g,c => x.det.sp ! g ! c ++ y.det.sp ! g ! c ; n = matchNumber x.det.n y.det.n } ;
} ; } ;
-- -- ConsNP : NP -> ListNP -> ListNP ; -- John, Mary, Bill -- -- ConsNP : NP -> ListNP -> ListNP ; -- John, Mary, Bill
ConsNP x xs = { ConsNP x xs = {
-- s = \\_ => consrTable Case bindComma x ( xs.s ! Comma ); -- s = \\_ => consrTable Case bindComma x ( xs.s ! Comma );
s = \\co => { init = \\pd,ca => coord co { init = (xs.s ! co).init ! pd ! ca ; last = (xs.s ! co).last ! pd ! ca} ; last = x.s } ; s = \\co => { init = \\pd,ap,dp,ca => coord co { init = (xs.s ! co).init ! pd ! ap ! dp ! ca ; last = (xs.s ! co).last ! pd ! ap ! dp ! ca} ; last = combineNounPhrase x } ;
n = matchNumber x.n xs.n ; n = matchNumber x.n xs.n ;
g = xs.g ; g = xs.g ;
p = xs.p ; p = xs.p ;
adv = x.adv ++ xs.adv ;
preap = lin AP { s = \\a => x.preap.s ! a ++ xs.preap.s ! a } ;
postap = lin AP { s = \\a => x.postap.s ! a ++ xs.postap.s ! a } ;
isBase = False ; isBase = False ;
det = lin Det { s = \\g,c => x.det.s ! g ! c ++ xs.det.s ! g ! c ; sp = \\g,c => x.det.sp ! g ! c ++ xs.det.sp ! g ! c ; n = matchNumber x.det.n xs.det.n } ; -- try to combine the determiners, probably not what we want
} ; } ;
-- -- BaseAP : AP -> AP -> ListAP -- -- BaseAP : AP -> AP -> ListAP
@@ -130,13 +127,21 @@ concrete ConjunctionLat of Conjunction =
-- -- ConsAP : AP -> ListAP -> ListAP -- -- ConsAP : AP -> ListAP -> ListAP
-- ConsAP x xs = -- ConsAP x xs =
-- { l = \\_ => consrTable Agr and_Conj.s2 x (xs.l ! Comma ) } ; -- { l = \\_ => consrTable Agr and_Conj.s2 x (xs.l ! Comma ) } ;
-- BaseRS : RS -> RS -> ListRS ;
BaseRS rs1 rs2 = { s = \\co => { init = rs1.s ; last = rs2.s }} ;
-- ConsRS : RS -> List RS -> ListRS ;
ConsRS rs rss = { s = \\co => { init = rs.s ; last = \\g,n => coord co { init = (rss.s ! co).init ! g ! n ; last = (rss.s ! co).last ! g ! n } } } ;
-- --
lincat lincat
[S] = { s : Coordinator => {init,last : SAdvPos => AdvPos => ComplPos => Order => Str} ; p : Pol ; t : Tense } ; -- TO FIX [S] = { s : Coordinator => {init,last : SAdvPos => AdvPos => DetPos => VPos => ComplPos => Order => Str} ; p : Pol ; t : Tense } ; -- TO FIX
[Adv] = { s: Coordinator => {init,last : Str}} ; [Adv] = { s: Coordinator => {init,last : Str}} ;
[NP] = { s : Coordinator => {init,last : PronDropForm => Case => Str} ; g : Gender ; n : Number ; p : Person ; adv : Str ; preap : AP ; postap : AP ; isBase : Bool ; det : Det } ; [NP] = { s : Coordinator => {init,last : PronDropForm => AdvPos => DetPos => Case => Str} ; g : Gender ; n : Number ; p : Person ; isBase : Bool } ;
[AP] = {s : Coordinator => {init,last : Agr => Str } } ; [AP] = {s : Coordinator => {init,last : Agr => Str } } ;
[RS] = { s : Coordinator => { init, last : Gender => Number => Str }} ;
oper oper
-- Generates a new number value given two number values. -- Generates a new number value given two number values.
-- Pl if any of the two is Pl -- Pl if any of the two is Pl

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,262 @@
concrete ExtendLat of Extend = CatLat ** ExtendFunctor-[VPS,ComplDirectVQ,ComplDirectVS,CompIQuant,EmptyRelSlash,ExistsNP,ExistCN,ExistMassCN,ExistPluralCN,GenModNP,PredAPVP,PredIAdvVP,SlashBareV2S,StrandQuestSlash,StrandRelSlash] with (Grammar=GrammarLat) ** open MissingLat in { --1 Extensions of core RGL syntax (the Grammar module)
lincat
VPS = Comp ; -- This module defines syntax rules that are not yet implemented in all
-- languages, and perhaps never implementable either. But all rules are given
-- a default implementation in common/ExtendFunctor.gf so that they can be included
-- in the library API. The default implementations are meant to be overridden in each
-- xxxxx/ExtendXxx.gf when the work proceeds.
--
-- This module is aimed to replace the original Extra.gf, which is kept alive just
-- for backwardcommon compatibility. It will also replace translator/Extensions.gf
-- and thus eliminate the often duplicated work in those two modules.
--
-- (c) Aarne Ranta 2017-08-20 under LGPL and BSD
concrete ExtendLat of Extend = CatLat ** open ResLat in {
lin lin
-- ComplDirectVS : VS -> Utt -> VP ; -- say: "today" -- GenNP : NP -> Quant ; -- this man's
ComplDirectVS vs utt = AdvVP (UseV <lin V vs : V>) (lin Adv {s = \\_ => ":" ++ quoted utt.s}) ; -- DEFAULT complement added as Adv in quotes GenNP np = { s = \\_ => combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Gen ; sp = \\_ => ""} ;
-- ComplDirectVQ : VQ -> Utt -> VP ; -- ask: "when" -- GenIP : IP -> IQuant ; -- whose
ComplDirectVQ vq utt = AdvVP (UseV <lin V vq : V>) (lin Adv {s = \\_ => ":" ++ quoted utt.s}) ; -- DEFAULT complement added as Adv in quotes -- GenRP : Num -> CN -> RP ; -- whose car
} ;
-- -- In case the first two are not available, the following applications should in any case be.
-- GenModNP : Num -> NP -> CN -> NP ; -- this man's car(s)
-- GenModIP : Num -> IP -> CN -> IP ; -- whose car(s)
-- CompBareCN : CN -> Comp ; -- (is) teacher
-- StrandQuestSlash : IP -> ClSlash -> QCl ; -- whom does John live with
-- StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives in
-- EmptyRelSlash : ClSlash -> RCl ; -- he lives in
-- -- $VP$ conjunction, separate categories for finite and infinitive forms (VPS and VPI, respectively)
-- -- covering both in the same category leads to spurious VPI parses because VPS depends on many more tenses
-- cat
-- VPS ; -- finite VP's with tense and polarity
-- [VPS] {2} ;
-- VPI ;
-- [VPI] {2} ; -- infinitive VP's (TODO: with anteriority and polarity)
-- fun
-- MkVPS : Temp -> Pol -> VP -> VPS ; -- hasn't slept
-- ConjVPS : Conj -> [VPS] -> VPS ; -- has walked and won't sleep
-- PredVPS : NP -> VPS -> S ; -- she [has walked and won't sleep]
-- MkVPI : VP -> VPI ; -- to sleep (TODO: Ant and Pol)
-- ConjVPI : Conj -> [VPI] -> VPI ; -- to sleep and to walk
-- ComplVPIVV : VV -> VPI -> VP ; -- must sleep and walk
-- -- the same for VPSlash, taking a complement with shared V2 verbs
-- cat
-- VPS2 ; -- have loved (binary version of VPS)
-- [VPS2] {2} ; -- has loved, hates"
-- VPI2 ; -- to love (binary version of VPI)
-- [VPI2] {2} ; -- to love, to hate
-- fun
-- MkVPS2 : Temp -> Pol -> VPSlash -> VPS2 ; -- has loved
-- ConjVPS2 : Conj -> [VPS2] -> VPS2 ; -- has loved and now hates
-- ComplVPS2 : VPS2 -> NP -> VPS ; -- has loved and now hates that person
-- MkVPI2 : VPSlash -> VPI2 ; -- to love
-- ConjVPI2 : Conj -> [VPI2] -> VPI2 ; -- to love and hate
-- ComplVPI2 : VPI2 -> NP -> VPI ; -- to love and hate that person
-- fun
-- ProDrop : Pron -> Pron ; -- unstressed subject pronoun becomes empty: "am tired"
-- ICompAP : AP -> IComp ; -- "how old"
-- IAdvAdv : Adv -> IAdv ; -- "how often"
-- CompIQuant : IQuant -> IComp ; -- which (is it) [agreement to NP]
-- PrepCN : Prep -> CN -> Adv ; -- by accident [Prep + CN without article]
-- -- fronted/focal constructions, only for main clauses
-- fun
-- FocusObj : NP -> SSlash -> Utt ; -- her I love
-- FocusAdv : Adv -> S -> Utt ; -- today I will sleep
-- FocusAdV : AdV -> S -> Utt ; -- never will I sleep
-- FocusAP : AP -> NP -> Utt ; -- green was the tree
-- -- participle constructions
-- PresPartAP : VP -> AP ; -- (the man) looking at Mary
-- EmbedPresPart : VP -> SC ; -- looking at Mary (is fun)
-- PastPartAP : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space
PastPartAP vp = { s = \\ag => vp.part ! VPassPerf ! ag ++ vp.adv ++ vp.c.s} ; -- TODO
-- PastPartAgentAP : VPSlash -> NP -> AP ; -- (opportunity) lost by the company
-- -- this is a generalization of Verb.PassV2 and should replace it in the future.
-- PassVPSlash : VPSlash -> VP ; -- be forced to sleep
PassVPSlash vp = vp ** {
s = \\a => case a of { VAct _ t n p => vp.pass ! VPass t n p } ;
} ;
-- -- the form with an agent may result in a different linearization
-- -- from an adverbial modification by an agent phrase.
-- PassAgentVPSlash : VPSlash -> NP -> VP ; -- be begged by her to go
-- -- publishing of the document
-- NominalizeVPSlashNP : VPSlash -> NP -> NP ;
-- -- counterpart to ProgrVP, for VPSlash
-- ProgrVPSlash : VPSlash -> VPSlash;
-- -- existential for mathematics
-- ExistsNP : NP -> Cl ; -- there exists a number / there exist numbers
-- -- existentials with a/no variation
-- ExistCN : CN -> Cl ; -- there is a car / there is no car
-- ExistMassCN : CN -> Cl ; -- there is beer / there is no beer
-- ExistPluralCN : CN -> Cl ; -- there are trees / there are no trees
-- -- generalisation of existential, with adverb as a parameter
-- AdvIsNP : Adv -> NP -> Cl ; -- here is the tree / here are the trees
-- AdvIsNPAP : Adv -> NP -> AP -> Cl ; -- here are the instructions documented
-- -- infinitive for purpose AR 21/8/2013
-- PurposeVP : VP -> Adv ; -- to become happy
-- -- object S without "that"
-- ComplBareVS : VS -> S -> VP ; -- say she runs
-- SlashBareV2S : V2S -> S -> VPSlash ; -- answer (to him) it is good
-- ComplDirectVS : VS -> Utt -> VP ; -- say: "today"
-- ComplDirectVQ : VQ -> Utt -> VP ; -- ask: "when"
-- -- front the extraposed part
-- FrontComplDirectVS : NP -> VS -> Utt -> Cl ; -- "I am here", she said
-- FrontComplDirectVQ : NP -> VQ -> Utt -> Cl ; -- "where", she asked
-- -- proper structure of "it is AP to VP"
-- PredAPVP : AP -> VP -> Cl ; -- it is good to walk
-- -- to use an AP as CN or NP without CN
-- AdjAsCN : AP -> CN ; -- a green one ; en grön (Swe)
-- AdjAsNP : AP -> NP ; -- green (is good)
AdjAsNP ap = {
s = \\_,c => ap.s ! (Ag Neutr Sg c) ;
adv = "" ;
det = { s, sp = \\_ => "" } ;
g = Neutr ;
n = Sg ;
p = P3 ;
postap = { s = \\_ => "" } ;
preap = { s = \\_ => "" } ;
} ;
-- -- infinitive complement for IAdv
-- PredIAdvVP : IAdv -> VP -> QCl ; -- how to walk?
-- -- alternative to EmbedQS. For English, EmbedQS happens to work,
-- -- because "what" introduces question and relative. The default linearization
-- -- could be e.g. "the thing we did (was fun)".
-- EmbedSSlash : SSlash -> SC ; -- what we did (was fun)
-- -- reflexive noun phrases: a generalization of Verb.ReflVP, which covers just reflexive pronouns
-- -- This is necessary in languages like Swedish, which have special reflexive possessives.
-- -- However, it is also needed in application grammars that want to treat "brush one's teeth" as a one-place predicate.
-- cat
-- RNP ; -- reflexive noun phrase, e.g. "my family and myself"
-- RNPList ; -- list of reflexives to be coordinated, e.g. "my family, myself, everyone"
-- -- Notice that it is enough for one NP in RNPList to be RNP.
-- fun
-- ReflRNP : VPSlash -> RNP -> VP ; -- love my family and myself
-- ReflPron : RNP ; -- myself
-- ReflPoss : Num -> CN -> RNP ; -- my car(s)
-- PredetRNP : Predet -> RNP -> RNP ; -- all my brothers
-- ConjRNP : Conj -> RNPList -> RNP ; -- my family, John and myself
-- Base_rr_RNP : RNP -> RNP -> RNPList ; -- my family, myself
-- Base_nr_RNP : NP -> RNP -> RNPList ; -- John, myself
-- Base_rn_RNP : RNP -> NP -> RNPList ; -- myself, John
-- Cons_rr_RNP : RNP -> RNPList -> RNPList ; -- my family, myself, John
-- Cons_nr_RNP : NP -> RNPList -> RNPList ; -- John, my family, myself
-- ---- Cons_rn_RNP : RNP -> ListNP -> RNPList ; -- myself, John, Mary
-- --- from Extensions
-- ComplGenVV : VV -> Ant -> Pol -> VP -> VP ; -- want not to have slept
-- ---- SlashV2V : V2V -> Ant -> Pol -> VPS -> VPSlash ; -- force (her) not to have slept
-- CompoundN : N -> N -> N ; -- control system / controls system / control-system
-- CompoundAP : N -> A -> AP ; -- language independent / language-independent
-- GerundCN : VP -> CN ; -- publishing of the document (can get a determiner)
-- GerundNP : VP -> NP ; -- publishing the document (by nature definite)
-- GerundAdv : VP -> Adv ; -- publishing the document (prepositionless adverb)
-- WithoutVP : VP -> Adv ; -- without publishing the document
-- ByVP : VP -> Adv ; -- by publishing the document
-- InOrderToVP : VP -> Adv ; -- (in order) to publish the document
-- ApposNP : NP -> NP -> NP ; -- Mr Macron, the president of France,
-- AdAdV : AdA -> AdV -> AdV ; -- almost always
-- UttAdV : AdV -> Utt ; -- always(!)
-- PositAdVAdj : A -> AdV ; -- (that she) positively (sleeps)
-- CompS : S -> Comp ; -- (the fact is) that she sleeps
-- CompQS : QS -> Comp ; -- (the question is) who sleeps
-- CompVP : Ant -> Pol -> VP -> Comp ; -- (she is) to go
-- -- very language-specific things
-- -- Eng
-- UncontractedNeg : Pol ; -- do not, etc, as opposed to don't
-- UttVPShort : VP -> Utt ; -- have fun, as opposed to "to have fun"
-- ComplSlashPartLast : VPSlash -> NP -> VP ; -- set it apart, as opposed to "set apart it"
-- -- Romance
-- DetNPMasc : Det -> NP ;
-- DetNPFem : Det -> NP ;
-- UseComp_estar : Comp -> VP ; -- (Cat, Spa, Por) "está cheio" instead of "é cheio"
-- SubjRelNP : NP -> RS -> NP ; -- Force RS in subjunctive: lo que les *resulte* mejor
-- iFem_Pron : Pron ; -- I (Fem)
-- youFem_Pron : Pron ; -- you (Fem)
-- weFem_Pron : Pron ; -- we (Fem)
-- youPlFem_Pron : Pron ; -- you plural (Fem)
-- theyFem_Pron : Pron ; -- they (Fem)
-- youPolFem_Pron : Pron ; -- you polite (Fem)
-- youPolPl_Pron : Pron ; -- you polite plural (Masc)
-- youPolPlFem_Pron : Pron ; -- you polite plural (Fem)
-- -- German
-- UttAccNP : NP -> Utt ; -- him (accusative)
-- UttDatNP : NP -> Utt ; -- him (dative)
-- UttAccIP : IP -> Utt ; -- whom (accusative)
-- UttDatIP : IP -> Utt ; -- whom (dative)
}

View File

@@ -1,9 +1,10 @@
concrete ExtraLat of ExtraLatAbs = concrete ExtraLat of ExtraLatAbs =
CatLat, ConjunctionLat ** CatLat, ConjunctionLat **
open ResLat, ParadigmsLat, Coordination, Prelude in { open ResLat, ParadigmsLat, RelativeLat, NounLat, Prelude in {
lincat CS = Str ; lincat CS = SAdvPos => AdvPos => DetPos => VPos => ComplPos => Order => Str ;
TestRS = { s : Gender => Number => SAdvPos => AdvPos => DetPos => VPos => ComplPos => Order => Str } ;
lin lin
useS s = combineSentence s ! SPreO ! PreO ! CPreV ! SOV ; useS s = combineSentence s ;
-- PastPartAP : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space -- PastPartAP : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space
-- PastPartAP vp = { s = vp.part ! VPassPerf } ; -- PastPartAP vp = { s = vp.part ! VPassPerf } ;
@@ -50,4 +51,83 @@ concrete ExtraLat of ExtraLatAbs =
Abl_Prep = mkPrep "" Abl ; Abl_Prep = mkPrep "" Abl ;
inAbl_Prep = mkPrep "in" Abl ; inAbl_Prep = mkPrep "in" Abl ;
onAbl_Prep = mkPrep "in" Abl ; -- L... onAbl_Prep = mkPrep "in" Abl ; -- L...
-- UttS_SVO : S -> Utt
UttS_SVO s = { s = defaultSentence s ! SVO };
-- UttS_VInS : S -> Utt
UttS_VInS s = { s = combineSentence s ! SAPreS ! APreV ! DPostN ! VInS ! CPostV ! SVO } ;
TestRCl t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ;
} ;
-- UseRCl_OSV : Temp -> Pol -> RCl -> RS ;
UseRCl_OSV t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SAPreO ! APreV ! DPreN ! VReg ! CPostV ! OSV ;
} ;
-- UseRCl_OVS : Temp -> Pol -> RCl -> RS ;
UseRCl_OVS t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SAPreO ! APreV ! DPreN ! VReg ! CPostV ! OVS ; -- SAPreO APreV DPreN VReg CPostV OVS
} ;
-- UseRCl_SOV : Temp -> Pol -> RCl -> RS ;
UseRCl_SOV t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SAPreS ! APreV ! DPreN ! VReg ! CPostV ! SOV ;
} ;
-- UseRCl_SVO : Temp -> Pol -> RCl -> RS ;
UseRCl_SVO t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SAPreS ! APreV ! DPreN ! VReg ! CPostV ! SVO ;
} ;
-- PrepNP_DPostN : Prep -> NP -> Adv ; -- in the house
PrepNP_DPostN prep np =
mkAdv (prep.s ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPostN ! prep.c ) ;
-- ApposCN_DPostN : CN -> NP -> CN
ApposCN_DPostN cn np =
cn **
{
s = \\n,c => cn.s ! n ! c ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPostN ! c ;
} ; -- massable = cn.massable } ;
-- CompNP_DPostN : NP -> Comp ; -- (be) the man
CompNP np = {s = \\_ =>
(combineNounPhrase np) ! PronNonDrop ! DPostN ! Nom
} ;
-- DetNP_Fem : Det -> NP ; -- these five
DetNP_Fem det = {
s = \\_ => det.s ! Fem ;
g = Fem ;
n = det.n ;
p = P3 ;
adv = "" ;
preap, postap = { s = \\_ => "" } ;
det = { s,sp = \\_ => "" ; n = det.n } ;
} ;
-- AdjAsNP_Fem : AP -> NP ; -- green (is good)
AdjAsNP_Fem ap = {
s = \\_,c => ap.s ! (Ag Fem Sg c) ;
adv = "" ;
det = { s, sp = \\_ => "" } ;
g = Fem ;
n = Sg ;
p = P3 ;
postap = { s = \\_ => "" } ;
preap = { s = \\_ => "" } ;
} ;
-- PredVP_VP_Ellipsis : NP -> VP -> Cl
PredVP_VP_Ellipsis np =
mkClause np emptyVP ;
-- SlashVP_VP_Ellipsis : NP -> VPSlash -> ClSlash ; -- (whom) he sees
SlashVP_VP_Ellipsis np =
mkClause np emptyVP ;
-- FunRP_RP_Ellipsis : Prep -> NP -> RP ;
FunRP_RP_Ellipsis p np = FunRP p np (lin RP { s = \\_ => "" }) ;
RelNP_NP_Ellipsis rs = RelNP emptyNP rs ;
comma_Conj = mkConj "" "," "" Pl Comma ;
} }

View File

@@ -1,7 +1,8 @@
abstract ExtraLatAbs = abstract ExtraLatAbs =
Extra, Conjunction Conjunction
** { ** {
cat CS ; cat CS ;
TestRS ;
fun fun
useS : S -> CS ; useS : S -> CS ;
-- do not drop pronouns -- do not drop pronouns
@@ -29,4 +30,27 @@ abstract ExtraLatAbs =
-- Preposition with alternate case -- Preposition with alternate case
inAbl_Prep : Prep ; inAbl_Prep : Prep ;
onAbl_Prep : Prep ; onAbl_Prep : Prep ;
-- Add other word orders
UttS_SVO : S -> Utt ;
UttS_VInS : S -> Utt ;
TestRCl : Temp -> Pol -> RCl -> TestRS ;
UseRCl_OSV : Temp -> Pol -> RCl -> RS ;
UseRCl_OVS : Temp -> Pol -> RCl -> RS ;
UseRCl_SOV : Temp -> Pol -> RCl -> RS ;
UseRCl_SVO : Temp -> Pol -> RCl -> RS ;
PrepNP_DPostN : Prep -> NP -> Adv ;
ApposCN_DPostN : CN -> NP -> CN ;
-- More genders
DetNP_Fem : Det -> NP ;
AdjAsNP_Fem : AP -> NP ;
-- Ellipsis
PredVP_VP_Ellipsis : NP -> Cl ;
SlashVP_VP_Ellipsis : NP -> ClSlash ;
FunRP_RP_Ellipsis : Prep -> NP -> RP ;
RelNP_NP_Ellipsis : RS -> NP ;
comma_Conj : Conj ;
} }

View File

@@ -8,7 +8,7 @@ concrete GrammarLat of Grammar =
NumeralLat, NumeralLat,
SentenceLat, SentenceLat,
QuestionLat, QuestionLat,
-- RelativeLat, RelativeLat,
ConjunctionLat, ConjunctionLat,
PhraseLat, PhraseLat,
TextX-[Adv], TextX-[Adv],

View File

@@ -2,142 +2,78 @@ resource MissingLat = open GrammarLat, Prelude in {
-- temporary definitions to enable the compilation of RGL API -- temporary definitions to enable the compilation of RGL API
oper AdNum : AdN -> Card -> Card = notYet "AdNum" ; oper AdNum : AdN -> Card -> Card = notYet "AdNum" ;
oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ;
oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ;
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ; oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ; oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ; oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ;
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ; oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ; oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ;
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ; oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ;
oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ;
oper BaseDAP : DAP -> DAP -> ListDAP = notYet "BaseDAP" ;
oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ; oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ; oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
oper CompIP : IP -> IComp = notYet "CompIP" ; oper CompIP : IP -> IComp = notYet "CompIP" ;
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ; oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ; oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ; oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ;
oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ; oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ;
oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ; oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ;
oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ;
oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ;
-- Error: No type found for ConjNPque
oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ; oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ;
oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ; oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ;
oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ;
oper ConsDAP : DAP -> ListDAP -> ListDAP = notYet "ConsDAP" ;
oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ;
oper DetDAP : Det -> DAP = notYet "DetDAP" ;
oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ; oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ;
oper EmbedQS : QS -> SC = notYet "EmbedQS" ; oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
oper EmbedS : S -> SC = notYet "EmbedS" ; oper EmbedS : S -> SC = notYet "EmbedS" ;
oper EmbedVP : VP -> SC = notYet "EmbedVP" ; oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
oper ExistIP : IP -> QCl = notYet "ExistIP" ; oper ExistIP : IP -> QCl = notYet "ExistIP" ;
oper ExistNP : NP -> Cl = notYet "ExistNP" ; oper ExistNP : NP -> Cl = notYet "ExistNP" ;
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ; oper ExtAdvS : Adv -> S -> S = notYet "ExtAdvS" ;
oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ;
oper GenericCl : VP -> Cl = notYet "GenericCl" ; oper GenericCl : VP -> Cl = notYet "GenericCl" ;
oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ; oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ;
oper IdetIP : IDet -> IP = notYet "IdetIP" ; oper IdetIP : IDet -> IP = notYet "IdetIP" ;
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ; oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
oper IdRP : RP = notYet "IdRP" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
oper ImpVP : VP -> Imp = notYet "ImpVP" ; oper ImpVP : VP -> Imp = notYet "ImpVP" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper NumDigits : Digits -> Card = notYet "NumDigits" ; oper NumDigits : Digits -> Card = notYet "NumDigits" ;
oper NumNumeral : Numeral -> Card = notYet "NumNumeral" ;
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ; oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ; oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ;
oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ; oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ;
oper PossPron : Pron -> Quant = notYet "PossPron" ;
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ; oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
oper PartNP : CN -> NP -> CN = notYet "PartNP" ;
oper PossNP : CN -> NP -> CN = notYet "PossNP" ;
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ; oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ; oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
oper ProgrVP : VP -> VP = notYet "ProgrVP" ; oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
oper QuestCl : Cl -> QCl = notYet "QuestCl" ;
oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ;
oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ;
oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper RelCl : Cl -> RCl = notYet "RelCl" ;
oper RelCN : CN -> RS -> CN = notYet "RelCN" ;
oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ;
oper RelVP : RP -> VP -> RCl = notYet "RelVP" ;
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ;
oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ;
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ;
oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ;
oper AdNum : AdN -> Card -> Card = notYet "AdNum" ;
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ;
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ;
oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ;
oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ;
oper BaseDAP : DAP -> DAP -> ListDAP = notYet "BaseDAP" ;
oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ;
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ;
oper CompIP : IP -> IComp = notYet "CompIP" ;
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ;
oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ;
oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ;
oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ;
oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ;
oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ;
oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ;
oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ;
oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ;
oper ConsDAP : DAP -> ListDAP -> ListDAP = notYet "ConsDAP" ;
oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ;
oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ;
oper CountNP : Det -> NP -> NP = notYet "CountNP" ;
oper DetDAP : Det -> DAP = notYet "DetDAP" ;
oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ;
oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
oper EmbedS : S -> SC = notYet "EmbedS" ;
oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
oper ExtAdvS : Adv -> S -> S = notYet "ExtAdvS" ;
oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ;
oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ;
oper IdetIP : IDet -> IP = notYet "IdetIP" ;
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
oper ImpVP : VP -> Imp = notYet "ImpVP" ;
oper NumDigits : Digits -> Card = notYet "NumDigits" ;
oper NumNumeral : Numeral -> Card = notYet "NumNumeral" ;
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ;
oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ;
oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ;
oper PartNP : CN -> NP -> CN = notYet "PartNP" ;
oper PossNP : CN -> NP -> CN = notYet "PossNP" ;
oper PossPron : Pron -> Quant = notYet "PossPron" ;
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
oper QuestCl : Cl -> QCl = notYet "QuestCl" ;
oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ;
oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ;
oper QuestQVP : IP -> QVP -> QCl = notYet "QuestQVP" ; oper QuestQVP : IP -> QVP -> QCl = notYet "QuestQVP" ;
oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ; oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ; oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper RelCN : CN -> RS -> CN = notYet "RelCN" ; oper RelCN : CN -> RS -> CN = notYet "RelCN" ;
oper RelCl : Cl -> RCl = notYet "RelCl" ;
oper RelS : S -> RS -> S = notYet "RelS" ; oper RelS : S -> RS -> S = notYet "RelS" ;
oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ;
oper SentCN : CN -> SC -> CN = notYet "SentCN" ; oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ; oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ; oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ; oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ; oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ; oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ;
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ; oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
oper Use3N3 : N3 -> N2 = notYet "Use3N3" ; oper Use3N3 : N3 -> N2 = notYet "Use3N3" ;
oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ; -- Error: No type found for UsePronNonDrop
oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ;
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ; oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ; oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ;

View File

@@ -11,7 +11,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
adv = cn.adv ; adv = cn.adv ;
preap = cn.preap ; preap = cn.preap ;
postap = cn.postap ; postap = cn.postap ;
det = det det = { s = det.s ! cn.g ; sp = det.sp ! cn.g } ;
} ; } ;
-- UsePN : PN -> NP ; -- John -- UsePN : PN -> NP ; -- John
@@ -22,7 +22,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
p = P3 ; p = P3 ;
adv = "" ; adv = "" ;
preap, postap = { s = \\_ => "" } ; preap, postap = { s = \\_ => "" } ;
det = { s,sp = \\_,_ => "" ; n = Sg } det = { s,sp = \\_ => "" ; n = Sg }
} ; } ;
-- UsePron : Pron -> NP ; -- he -- UsePron : Pron -> NP ; -- he
@@ -33,13 +33,13 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
s = \\pd,c => p.pers.s ! pd ! PronNonRefl ! c; s = \\pd,c => p.pers.s ! pd ! PronNonRefl ! c;
adv = "" ; adv = "" ;
preap, postap = { s = \\_ => "" } ; preap, postap = { s = \\_ => "" } ;
det = { s,sp = \\_,_ => "" ; n = p.pers.n } ; det = { s,sp = \\_ => "" ; n = p.pers.n } ;
} ; } ;
-- PredetNP : Predet -> NP -> NP ; -- only the man -- PredetNP : Predet -> NP -> NP ; -- only the man
PredetNP predet np = PredetNP predet np =
np ** { np ** {
det = np.det ** { s = \\g,c => predet.s ++ np.det.s ! g ! c } det = { s = \\c => predet.s ++ np.det.s ! c ; sp = np.det.sp }
} ; } ;
-- PPartNP : NP -> V2 -> NP ; -- the man seen -- PPartNP : NP -> V2 -> NP ; -- the man seen
@@ -64,7 +64,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
ExtAdvNP = AdvNP ; ExtAdvNP = AdvNP ;
-- RelNP : NP -> RS -> NP ; -- Paris, which is here -- RelNP : NP -> RS -> NP ; -- Paris, which is here
RelNP np rs = np ** { adv = rs.s ++ np.adv } ; RelNP np rs = np ** { adv = bindComma ++ rs.s ! np.g ! np.n ++ np.adv } ;
-- DetNP : Det -> NP ; -- these five -- DetNP : Det -> NP ; -- these five
DetNP det = { DetNP det = {
@@ -74,7 +74,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
p = P3 ; p = P3 ;
adv = "" ; adv = "" ;
preap, postap = { s = \\_ => "" } ; preap, postap = { s = \\_ => "" } ;
det = { s,sp = \\_,_ => "" ; n = det.n } ; det = { s,sp = \\_ => "" ; n = det.n } ;
} ; } ;
-- --
-- DetQuantOrd quant num ord = { -- DetQuantOrd quant num ord = {
@@ -85,13 +85,13 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- --
DetQuant quant num = { DetQuant quant num = {
s = \\g,c => quant.s ! Ag g num.n c ++ num.s ! g ! c ; s = \\g,c => quant.s ! Ag g num.n c ++ num.s ! g ! c ;
sp = \\g,c => quant.sp ! Ag g num.n c ++ num.s ! g ! c ; sp = \\g,c => quant.sp ! Ag g num.n c ;
n = num.n n = num.n
} ; } ;
-- PossPron p = { PossPron p = { s = \\a => p.poss.s ! PronNonRefl ! a ; sp = \\_ => "" } ;
-- s = \\_,_ => p.s ! Gen ; -- s = \\_,_ => p.s ! Gen ;
-- sp = \\_,_ => p.sp -- sp = \\_,_ => p.sp
-- } ; -- } ;
@@ -105,8 +105,10 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- OrdDigits n = {s = n.s ! NOrd} ; -- OrdDigits n = {s = n.s ! NOrd} ;
-- --
lin lin
-- NumNumeral numeral = numeral.s ; -- NumNumeral : Numeral -> Card ; -- fifty-one
-- OrdNumeral numeral = numeral.ord ; NumNumeral numeral = { s = numeral.s ; n = numeral.n } ;
-- OrdNumeral : Numeral -> Ord ; -- fifty-first
OrdNumeral numeral = { s = numeral.ord } ;
-- --
-- AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ; -- AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ;
-- --
@@ -128,7 +130,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- s = case cn.massable of { True => cn.s ! Sg ; False => \\_ => nonExist } ; -- s = case cn.massable of { True => cn.s ! Sg ; False => \\_ => nonExist } ;
n = Sg ; n = Sg ;
p = P3 ; p = P3 ;
det = { s,sp = \\_,_ => "" ; n = Sg } ; det = { s,sp = \\_ => "" ; n = Sg } ;
}; };
UseN n = -- N -> CN UseN n = -- N -> CN
@@ -175,6 +177,11 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
ApposCN cn np = ApposCN cn np =
cn ** cn **
{ {
s = \\n,c => cn.s ! n ! c ++ (combineNounPhrase np) ! PronNonDrop ! c ; s = \\n,c => cn.s ! n ! c ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! c ;
} ; -- massable = cn.massable } ; } ; -- massable = cn.massable } ;
}
-- CountNP : Det -> NP -> NP ; -- three of them, some of the boys
CountNP det np = np ** {
det = { s = \\c => det.s ! np.g ! c ++ np.det.s ! c ; sp = \\c => det.sp ! np.g ! c ++ np.det.sp ! c } ;
};
}

View File

@@ -18,111 +18,136 @@ concrete NumeralLat of Numeral = CatLat, ParamX[Number] ** open ParadigmsLat, Pr
n9 = lin Digit ( mkDigit "novem" "undeviginti" "nonaginta" "nongenti" "nonus" "centum" No9 ) ; n9 = lin Digit ( mkDigit "novem" "undeviginti" "nonaginta" "nongenti" "nonus" "centum" No9 ) ;
-- 1 -- 1
pot01 = { s = n1.s ! one ; d = n1.s ; n = singular ; below8 = n1.below8 } ; pot01 = {
s = n1.s ! one ;
d = { num, ord = n1.s } ;
n = singular ;
below8 = n1.below8 ;
ord = n1.ord ! one
} ;
-- d * 1 -- d * 1
pot0 d = { pot0 d = {
s = d.s ! one ; s = d.s ! one ;
d = table { d = { num,ord = table {
thousand => \\g,c => d.s ! one ! g ! c ++ d.s ! thousand ! g ! c ; thousand => \\g,c => d.s ! one ! g ! c ++ d.s ! thousand ! g ! c ;
u => \\g,c => d.s ! u ! g ! c u => \\g,c => d.s ! u ! g ! c
} ; }
};
n = plural ; n = plural ;
below8 = d.below8 below8 = d.below8 ;
ord = d.ord ! one ;
} ; } ;
-- 10 -- 10
pot110 = { pot110 = {
s = n1.s ! ten ; s = n1.s ! ten ;
d = table { d = { num, ord = table {
thousand => \\g,c => n1.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ; thousand => \\g,c => n1.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n1.s ! u ! g ! c u => \\g,c => n1.s ! u ! g ! c
} ; }
};
n = singular ; n = singular ;
below8 = Yes below8 = Yes ;
ord = n1.ord ! ten
} ; } ;
-- 11 -- 11
pot111 = pot1to19 n1 ; pot111 = pot1to19 n1 ;
-- 10 + d -- 10 + d
pot1to19 d = { pot1to19 d = {
s = d.s ! eleven ; s = d.s ! eleven ;
d = table { d = { num, ord = table {
thousand => \\g,c => d.s ! eleven ! g ! c ++ n1.s ! thousand ! g ! c ; thousand => \\g,c => d.s ! eleven ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => d.s ! u ! g ! c u => \\g,c => d.s ! u ! g ! c
} ; }
};
n = plural ; n = plural ;
below8 = Ign below8 = Ign ;
ord = n1.ord ! eleven
} ; } ;
-- coercion of 1..9 -- coercion of 1..9
pot0as1 n = n ; pot0as1 n = n ;
-- d * 10 -- d * 10
pot1 d = { pot1 d = {
s = d.s ! ten ; s = d.s ! ten ;
d = table { d = { num, ord = table {
thousand => \\g,c => d.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ; thousand => \\g,c => d.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => d.s ! u ! g ! c u => \\g,c => d.s ! u ! g ! c
} ; }
};
n = plural ; n = plural ;
below8 = Yes below8 = Yes ;
ord = d.ord ! ten
} ; } ;
-- d * 10 + n -- d * 10 + n
pot1plus d n = pot1plus d n =
let let
newS : Gender => Case => Str = \\g,c => case n.below8 of { newS : Gender => Case => Str = \\g,c => case n.below8 of {
No8 => "duo" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ d.tenNext ; No8 => "duo" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ d.tenNext ;
No9 => "un" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ d.tenNext ; No9 => "un" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ d.tenNext ;
_ => d.s ! ten ! g ! c ++ n.s ! g ! c _ => d.s ! ten ! g ! c ++ n.s ! g ! c
} in } in
{ {
s = newS ; s = newS ;
d = table { d = { num, ord = table {
thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ; thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n.d ! u ! g ! c u => \\g,c => n.d.num ! u ! g ! c
} ; }
};
below8 = Ign ; below8 = Ign ;
n = plural n = plural ;
ord = \\_,_,_ => nonExist -- TODO
} ; } ;
-- coercion of 1..99 -- coercion of 1..99
pot1as2 n = n ; pot1as2 n = n ;
-- m * 100 -- m * 100
pot2 n = { pot2 n = {
s = n.d ! hundred ; s = n.d.num ! hundred ;
d = table { d = { num, ord = table {
thousand => \\g,c => n.d ! hundred ! g ! c ++ n1.s ! thousand ! g ! c ; thousand => \\g,c => n.d.num ! hundred ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n.d ! u ! g ! c u => \\g,c => n.d.num ! u ! g ! c
} ; }
};
n = plural ; n = plural ;
below8 = Yes} ; below8 = Yes ;
ord = \\_,_,_ => nonExist -- TODO
} ;
-- d * 100 + n -- d * 100 + n
pot2plus d n = pot2plus d n =
let let
newS : Gender => Case => Str = \\g,c => d.d ! hundred ! g ! c ++ "et" ++ n.s ! g ! c newS : Gender => Case => Str = \\g,c => d.d.num ! hundred ! g ! c ++ "et" ++ n.s ! g ! c
in in
{ {
s = newS ; s = newS ;
d = table { d = { num, ord = table {
thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ; thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n.d ! u ! g ! c u => \\g,c => n.d.num ! u ! g ! c
} ; }
};
below8 = Ign ; below8 = Ign ;
n = plural n = plural;
ord = \\_,_,_ => nonExist -- TODO
} ; } ;
-- coercion of 1..999 -- coercion of 1..999
pot2as3 n = n ; pot2as3 n = n ;
-- m * 1000 -- m * 1000
pot3 n = { pot3 n = {
s = \\g,c => n.s ! g ! c ++ n.d ! thousand ! g ! c ; s = \\g,c => n.s ! g ! c ++ n.d.num ! thousand ! g ! c ;
d = table { thousand => \\g,c => n.s ! g ! c ++ n.d ! thousand ! g ! c ; d = { num,ord = table {
u => \\g,c => n.d ! u ! g ! c thousand => \\g,c => n.s ! g ! c ++ n.d.num ! thousand ! g ! c ;
u => \\g,c => n.d.num ! u ! g ! c
}
} ; } ;
below8 = Ign ; below8 = Ign ;
n = plural n = plural ;
ord = \\_,_,_ => nonExist -- TODO
} ; } ;
-- d * 1000 + n -- d * 1000 + n
pot3plus d n = { pot3plus d n = {
s = \\g,c => d.d ! thousand ! g ! c ++ "et" ++ n.s ! g ! c ; s = \\g,c => d.d.num ! thousand ! g ! c ++ "et" ++ n.s ! g ! c ;
d = n.d ; d = n.d ; -- ???
below8 = Ign ; below8 = Ign ;
n = plural n = plural ;
ord = \\_,_,_ => nonExist -- TODO
} ; } ;
oper oper
@@ -146,14 +171,15 @@ concrete NumeralLat of Numeral = CatLat, ParamX[Number] ** open ParadigmsLat, Pr
hundred_thousand => \\_,_ => nonExist hundred_thousand => \\_,_ => nonExist
} ; } ;
-- n = case ones of { "unus" => singular ; _ => plural } ; -- n = case ones of { "unus" => singular ; _ => plural } ;
-- ord = ord =
-- \\_,_ => [] ; table { one => ordFlex ord1 ;
-- -- table { one => (mkA ord1).s ! Posit; eleven => \\_,_,_ => nonExist ;
-- -- ten => (mkA ord10).s ! Posit ; ten => ordFlex ord10 ;
-- -- hundred => (mkA ord100).s ! Posit ; hundred => ordFlex ord100 ;
-- -- thousand => \\_,_ => nonExist ; thousand => \\_,_,_ => nonExist ;
-- -- ten_thousand => \\_ => nonExist ; ten_thousand => \\_,_,_ => nonExist ;
-- -- hundred_thousand => \\_ => nonExist } ; hundred_thousand => \\_,_,_ => nonExist
} ;
tenNext = tenNext ; tenNext = tenNext ;
below8 = b8 below8 = b8
} ; } ;

View File

@@ -3,7 +3,7 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat 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 -> Utt -- UttS : S -> Utt
UttS s = { s = combineSentence s ! SPreS ! PreS ! CPreV ! SOV }; UttS s = { s = defaultSentence s ! SOV };
-- UttQS : QS -> Utt -- UttQS : QS -> Utt
UttQS qs = {s = qs.s ! QDir } ; UttQS qs = {s = qs.s ! QDir } ;
@@ -18,7 +18,7 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat in {
-- UttIAdv : IAdv -> Utt -- UttIAdv : IAdv -> Utt
UttIAdv iadv = iadv ; UttIAdv iadv = iadv ;
-- UttNP : NP -> Utt -- UttNP : NP -> Utt
UttNP np = {s = np.adv ++ (combineNounPhrase np) ! PronNonDrop ! Nom} ; UttNP np = {s = np.adv ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom} ;
-- UttVP : VP -> Utt -- UttVP : VP -> Utt
UttVP vp = ss (vp.inf ! VInfActPres) ; UttVP vp = ss (vp.inf ! VInfActPres) ;
@@ -36,6 +36,6 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat in {
PConjConj conj = {s = conj.s2} ; --- PConjConj conj = {s = conj.s2} ; ---
-- --
NoVoc = {s = []} ; NoVoc = {s = []} ;
VocNP np = {s = "," ++ (combineNounPhrase np) ! PronNonDrop ! ResLat.Voc} ; ---- what is the compiler error here? AR 1/2/2014 -- answer: clash with the type name Voc 3/2 VocNP np = {s = bindComma ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! ResLat.Voc} ; ---- what is the compiler error here? AR 1/2/2014 -- answer: clash with the type name Voc 3/2
-- --
} }

View File

@@ -5,7 +5,7 @@ concrete QuestionLat of Question = CatLat ** open ResLat, IrregLat, Prelude in {
lin lin
-- QuestCl : Cl -> QCl ; -- does John walk -- QuestCl : Cl -> QCl ; -- does John walk
QuestCl cl = cl ** { QuestCl cl = cl ** {
v = \\t,a,_,ap,cp => cl.v ! t ! a ! VQTrue ! ap ! cp ; v = \\t,a,_,ap => cl.v ! t ! a ! VQTrue ! ap ;
q = "" q = ""
} ; } ;
@@ -17,7 +17,9 @@ concrete QuestionLat of Question = CatLat ** open ResLat, IrregLat, Prelude in {
neg = \\_,_ => "" ; neg = \\_,_ => "" ;
o = \\_ => vp.obj ; o = \\_ => vp.obj ;
q = ip.s ! Nom ; q = ip.s ! Nom ;
v = \\t,a,_,ap,cp => vp.s ! VAct (anteriorityToVAnter a) (tenseToVTense t) ip.n P3 ! VQFalse v = \\t,a,_,ap => vp.s ! VAct (anteriorityToVAnter a) (tenseToVTense t) ip.n P3 ! VQFalse ;
compl = vp.compl ! Ag Masc ip.n Nom ; -- default gender masculine
det = { s, sp = \\_ => [] ; n = ip.n } ;
} ; } ;
-- let qcl = mkQuestion { s = ip.s ! Nom } ( mkClause emptyNP vp ) -- let qcl = mkQuestion { s = ip.s ! Nom } ( mkClause emptyNP vp )
-- in {s = \\t,a,b,qd => qcl.s ! t ! a ! b ! qd} ; -- in {s = \\t,a,b,qd => qcl.s ! t ! a ! b ! qd} ;
@@ -37,9 +39,11 @@ concrete QuestionLat of Question = CatLat ** open ResLat, IrregLat, Prelude in {
s = \\_ => "" ; s = \\_ => "" ;
adv = "" ; adv = "" ;
neg = \\_,_ => "" ; neg = \\_,_ => "" ;
o = \\_ => combineNounPhrase np ! PronNonDrop ! Nom ; -- Should probably not go into the object field o = \\_ => combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Nom ; -- Should probably not go into the object field
q = icomp.s ; q = icomp.s ;
v = \\t,a,_,ap,cp => esseAux.act ! VAct (anteriorityToVAnter a) (tenseToVTense t) np.n P3 ; v = \\t,a,_,ap => esseAux.act ! VAct (anteriorityToVAnter a) (tenseToVTense t) np.n P3 ;
det = { s , sp = \\_=> [] ; n = Sg } ; -- default number singilar
compl = "" ;
} ; } ;
-- --
-- --

View File

@@ -2,14 +2,14 @@ concrete RelativeLat of Relative = CatLat ** open ResLat in {
-- --
-- flags optimize=all_subs ; -- flags optimize=all_subs ;
-- --
-- lin lin
-- --
-- RelCl cl = { -- RelCl cl = {
-- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir ; -- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir ;
-- c = Nom -- c = Nom
-- } ; -- } ;
-- --
-- RelVP rp vp = { RelVP rp vp = { s = \\g,n => mkClause (emptyNP ** { s = \\_,c => rp.s ! (Ag g n c) ; g = g ; n = n } ) vp };
-- s = \\t,ant,b,ag => -- s = \\t,ant,b,ag =>
-- let -- let
-- agr = case rp.a of { -- agr = case rp.a of {
@@ -25,19 +25,43 @@ concrete RelativeLat of Relative = CatLat ** open ResLat in {
---- Pied piping: "at which we are looking". Stranding and empty ---- Pied piping: "at which we are looking". Stranding and empty
---- relative are defined in $ExtraLat.gf$ ("that we are looking at", ---- relative are defined in $ExtraLat.gf$ ("that we are looking at",
---- "we are looking at"). ---- "we are looking at").
-- --
-- RelSlash rp slash = { -- RelSlash : RP -> ClSlash -> RCl ;
RelSlash rp slash = { s = \\g,n => slash ** { adv = rp.s ! Ag g n Gen } } ; -- abuse adverbs again
-- s = \\t,a,p,agr => -- s = \\t,a,p,agr =>
-- slash.c2 ++ rp.s ! RPrep (fromAgr agr).g ++ slash.s ! t ! a ! p ! ODir ; -- slash.c2 ++ rp.s ! RPrep (fromAgr agr).g ++ slash.s ! t ! a ! p ! ODir ;
-- c = Acc -- c = Acc
-- } ;
-- --
-- FunRP p np rp = { FunRP p np rp = {
-- s = \\c => (combineNounPhrase np) ! PronNonDrop ! Acc ++ p.s ++ rp.s ! RPrep (fromAgr np.a).g ; s = \\a => case a of { Ag g n c => rp.s ! a ++ p.s ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Acc };
-- a = RAg np.a -- s = \\c => (combineNounPhrase np) ! PronNonDrop ! Acc ++ p.s ++ rp.s ! RPrep (fromAgr np.a).g ;
-- } ; -- a = RAg np.a
} ;
-- --
-- IdRP = IdRP = {
s = table {
Ag Masc Sg (Nom | Voc) => "qui" ;
Ag Fem Sg (Nom | Voc) => "quae" ;
Ag Neutr Sg (Nom | Voc) => "quod" ;
Ag _ Sg Gen => "cuius" ;
Ag _ Sg Dat => "cui" ;
Ag Masc Sg Acc => "quem" ;
Ag Fem Sg Acc => "quam" ;
Ag Neutr Sg Acc => "quod" ;
Ag (Masc | Neutr) Sg Abl => "quo" ;
Ag Fem Sg Abl => "qua" ;
Ag Masc Pl (Nom | Voc) => "qui" ;
Ag (Fem | Neutr) Pl (Nom | Voc) => "quae" ;
Ag (Masc | Neutr) Pl Gen => "quorum" ;
Ag Fem Pl Gen => "quarum" ;
Ag _ Pl Dat => "quibus" ;
Ag Masc Pl Acc => "quos" ;
Ag Fem Pl Acc => "quas" ;
Ag Neutr Pl Acc => "quae" ;
Ag _ Pl Abl => "cui"
}
}
;
-- let varr : Str -> Str = \x -> variants {x ; "that"} --- for bwc -- let varr : Str -> Str = \x -> variants {x ; "that"} --- for bwc
-- in { -- in {
-- s = table { -- s = table {

View File

@@ -22,13 +22,22 @@ param
adv : Str ; adv : Str ;
preap : {s : Agr => Str } ; preap : {s : Agr => Str } ;
postap : {s : Agr => Str } ; postap : {s : Agr => Str } ;
det : Determiner det : { s, sp : Case => Str } ;
} ; } ;
param param
-- Parameters to determine word order
-- top level order, e.g. subject verb object
Order = SVO | VSO | VOS | OSV | OVS | SOV ; Order = SVO | VSO | VOS | OSV | OVS | SOV ;
AdvPos = PreS | PreV | PreO | PreNeg | InV | InS ; -- | InO -- determiner position in a noun phrase, e.g. before or after noun
DetPos = DPreN | DPostN ;
-- verb position, eithe regular or interleaved in the subject
VPos = VReg | VInS ;
-- (verb-modifying) adverb position
AdvPos = APreS | APreV | APreO | APreNeg | AInV | AInS | APreN | APostN ; -- | InO
-- verb complement position in relation to verb
ComplPos = CPreV | CPostV ; ComplPos = CPreV | CPostV ;
SAdvPos = SPreS | SPreV | SPreO | SPreNeg ; -- sentence adverb position
SAdvPos = SAPreS | SAPreV | SAPreO | SAPreNeg ;
param param
Agr = Ag Gender Number Case ; -- Agreement for NP et al. Agr = Ag Gender Number Case ; -- Agreement for NP et al.
oper oper
@@ -141,15 +150,20 @@ param
p = P3; p = P3;
adv = "" ; adv = "" ;
preap, postap = { s = \\_ => "" } ; preap, postap = { s = \\_ => "" } ;
det = { s = \\_,_ => "" ; sp = \\_,_ => "" ; n = n} ; det = { s,sp = \\_ => "" ; n = n} ;
} ; } ;
dummyNP : Str -> NounPhrase = \s -> regNP s s s s s s Masc Sg ; dummyNP : Str -> NounPhrase = \s -> regNP s s s s s s Masc Sg ;
emptyNP : NounPhrase = { s = \\_,_ => ""; g = Masc; n = Sg; p = P1 ; adv = "" ; preap, postap = { s = \\_ => "" } ; det = { s = \\_,_ => "" ; sp = \\_,_ => "" ; n = Sg } ;}; emptyNP : NounPhrase = { s = \\_,_ => ""; g = Masc; n = Sg; p = P3 ; adv = "" ; preap, postap = { s = \\_ => "" } ; det = { s , sp = \\_ => "" ; n = Sg } ;};
combineNounPhrase : NounPhrase -> PronDropForm => Case => Str = \np -> combineNounPhrase : NounPhrase -> PronDropForm => AdvPos => DetPos => Case => Str = \np ->
\\pd,c => np.det.s ! np.g ! c ++ np.adv ++ np.preap.s ! (Ag np.g np.n c) ++ np.s ! pd ! c ++ np.postap.s ! (Ag np.g np.n c) ++ np.det.sp ! np.g ! c ; let detpren : DetPos -> { s , sp : Case => Str} = \dp -> case dp of { DPreN => np.det ; _ => { s, sp = \\_ => [] } } ;
detpostn : DetPos -> { s , sp : Case => Str} = \dp -> case dp of { DPostN => np.det ; _ => { s, sp = \\_ => [] } } ;
apren : AdvPos -> Str = \ap -> case ap of { APreN => np.adv ; _ => [] } ;
apostn : AdvPos -> Str = \ap -> case ap of { APostN => np.adv ; _ => [] } ;
in
\\pd,ap,dp,c => apren ap ++ (detpren dp).s ! c ++ np.preap.s ! (Ag np.g np.n c) ++ np.s ! pd ! c ++ np.postap.s ! (Ag np.g np.n c) ++ (detpren dp).sp ! c ++ (detpostn dp).s ! c ++ apostn ap ;
-- also used for adjectives and so on -- also used for adjectives and so on
-- adjectives -- adjectives
@@ -264,7 +278,8 @@ param
oper oper
VerbPhrase : Type = { VerbPhrase : Type = {
s : VActForm => VQForm => Str ; s : VActForm => VQForm => Str ;
part : VPartForm =>Agr => Str ; pass : VPassForm => VQForm => Str ;
part : VPartForm => Agr => Str ;
inf : VInfForm => Str ; inf : VInfForm => Str ;
imp : VImpForm => Str ; imp : VImpForm => Str ;
obj : Str ; obj : Str ;
@@ -274,6 +289,17 @@ param
ObjectVerbPhrase : Type = VerbPhrase ** {c : Preposition} ; ObjectVerbPhrase : Type = VerbPhrase ** {c : Preposition} ;
emptyVP : VerbPhrase = {
s = \\_,_ => "" ;
pass = \\_,_ => "" ;
part = \\_,_ => "" ;
inf = \\_ => "" ;
imp = \\_ => "" ;
obj = "";
compl = \\_ => "" ;
adv = ""
} ;
Verb : Type = { Verb : Type = {
act : VActForm => Str ; act : VActForm => Str ;
pass : VPassForm => Str ; pass : VPassForm => Str ;
@@ -351,6 +377,7 @@ param
VAct VSim (VPres VInd) Sg P1 => -- Present Indicative VAct VSim (VPres VInd) Sg P1 => -- Present Indicative
( case pres_ind_base of { ( case pres_ind_base of {
_ + "a" => ( init pres_ind_base ) ; _ + "a" => ( init pres_ind_base ) ;
-- | _ + "ui" => ( init pres_ind_base ) ;
_ => pres_ind_base _ => pres_ind_base
} }
) + "o" ; --actPresEnding Sg P1 ; ) + "o" ; --actPresEnding Sg P1 ;
@@ -1235,6 +1262,7 @@ oper
predV : Verb -> VerbPhrase = \v -> { predV : Verb -> VerbPhrase = \v -> {
s = \\a,q => v.act ! a ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" }; s = \\a,q => v.act ! a ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
pass = \\p,q => v.pass ! p ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
part = v.part; part = v.part;
imp = v.imp ; imp = v.imp ;
inf = v.inf ; inf = v.inf ;
@@ -1253,20 +1281,22 @@ oper
insertObj : NounPhrase -> Preposition -> VerbPhrase -> VerbPhrase = \np,prep,vp -> { insertObj : NounPhrase -> Preposition -> VerbPhrase -> VerbPhrase = \np,prep,vp -> {
s = vp.s ; s = vp.s ;
pass = vp.pass ;
part = vp.part ; part = vp.part ;
imp = vp.imp ; imp = vp.imp ;
inf = vp.inf ; inf = vp.inf ;
obj = np.det.s ! np.g ! prep.c ++ np.preap.s ! (Ag np.g np.n prep.c) ++ (appPrep prep (np.s ! PronNonDrop)) ++ np.postap.s ! (Ag np.g np.n prep.c) ++ np.det.sp ! np.g ! prep.c ++ vp.obj ; obj = np.det.s ! prep.c ++ np.preap.s ! (Ag np.g np.n prep.c) ++ (appPrep prep (np.s ! PronNonDrop)) ++ np.postap.s ! (Ag np.g np.n prep.c) ++ np.det.sp ! prep.c ++ vp.obj ;
compl = vp.compl ; compl = vp.compl ;
adv = vp.adv ++ np.adv adv = vp.adv ++ np.adv
} ; } ;
insertObjc: NounPhrase -> VPSlash -> VPSlash = \np,vp -> { insertObjc: NounPhrase -> VPSlash -> VPSlash = \np,vp -> {
s = vp.s ; s = vp.s ;
pass = vp.pass ;
part = vp.part ; part = vp.part ;
imp = vp.imp ; imp = vp.imp ;
inf = vp.inf ; inf = vp.inf ;
obj = np.det.s ! np.g ! vp.c.c ++ np.preap.s ! (Ag np.g np.n vp.c.c) ++ (appPrep vp.c (np.s ! PronNonDrop)) ++ np.postap.s ! (Ag np.g np.n vp.c.c) ++ np.det.sp ! np.g ! vp.c.c ++ vp.obj ; obj = np.det.s ! vp.c.c ++ np.preap.s ! (Ag np.g np.n vp.c.c) ++ (appPrep vp.c (np.s ! PronNonDrop)) ++ np.postap.s ! (Ag np.g np.n vp.c.c) ++ np.det.sp ! vp.c.c ++ vp.obj ;
compl = vp.compl ; compl = vp.compl ;
c = vp.c ; c = vp.c ;
adv = vp.adv ++ np.adv adv = vp.adv ++ np.adv
@@ -1274,6 +1304,7 @@ oper
insertAdj : (Agr => Str) -> VerbPhrase -> VerbPhrase = \adj,vp -> { insertAdj : (Agr => Str) -> VerbPhrase -> VerbPhrase = \adj,vp -> {
s = vp.s ; s = vp.s ;
pass = vp.pass ;
part = vp.part ; part = vp.part ;
imp = vp.imp ; imp = vp.imp ;
inf = vp.inf ; inf = vp.inf ;
@@ -1284,6 +1315,7 @@ oper
insertAdv : Adverb -> VerbPhrase -> VerbPhrase = \a,vp -> { insertAdv : Adverb -> VerbPhrase -> VerbPhrase = \a,vp -> {
s = vp.s ; s = vp.s ;
pass = vp.pass ;
part = vp.part ; part = vp.part ;
imp = vp.imp ; imp = vp.imp ;
inf = vp.inf ; inf = vp.inf ;
@@ -1296,13 +1328,22 @@ oper
Sentence = Sentence =
{ {
s,o,neg : AdvPos => Str ; -- Subject, verbphrase, object and negation particle plus potential adverb s,o,neg : AdvPos => Str ; -- Subject, verbphrase, object and negation particle plus potential adverb
v : AdvPos => ComplPos => Str ; v : AdvPos => Str ;
t : C.Tense ; -- tense marker t : C.Tense ; -- tense marker
p : C.Pol ; -- polarity marker p : C.Pol ; -- polarity marker
sadv : Str -- sentence adverb¡ sadv : Str ; -- sentence adverb¡
det : { s , sp : Case => Str } ;
compl : Str -- verb complement
} ; } ;
Clause = {s,o : AdvPos => Str ; v : Tense => Anteriority => VQForm => AdvPos => ComplPos => Str ; neg : Polarity => AdvPos => Str ; adv : Str } ; Clause =
{s : AdvPos => Str ;
o : AdvPos => Str ;
v : Tense => Anteriority => VQForm => AdvPos => Str ;
det : { s , sp : Case => Str } ;
compl : Str ;
neg : Polarity => AdvPos => Str ;
adv : Str } ;
QClause = {s : C.Tense => Anteriority => C.Pol => QForm => Str} ; QClause = {s : C.Tense => Anteriority => C.Pol => QForm => Str} ;
mkClause : NounPhrase -> VerbPhrase -> Clause = \np,vp -> mkClause : NounPhrase -> VerbPhrase -> Clause = \np,vp ->
@@ -1313,39 +1354,35 @@ oper
compl = vp.compl ! Ag np.g np.n Nom ; compl = vp.compl ! Ag np.g np.n Nom ;
-- helper functions to either place the adverb in the designated position -- helper functions to either place the adverb in the designated position
-- or an empty string instead -- or an empty string instead
pres : AdvPos -> Str = \ap -> case ap of { PreS => adv ; _ => [] } ; pres : AdvPos -> Str = \ap -> case ap of { APreS => adv ; _ => [] } ;
prev : AdvPos -> Str = \ap -> case ap of { PreV => adv ; _ => [] } ; prev : AdvPos -> Str = \ap -> case ap of { APreV => adv ; _ => [] } ;
preo : AdvPos -> Str = \ap -> case ap of { PreO => adv ; _ => [] } ; preo : AdvPos -> Str = \ap -> case ap of { APreO => adv ; _ => [] } ;
preneg : AdvPos -> Str = \ap -> case ap of { PreNeg => adv ; _ => [] } ; preneg : AdvPos -> Str = \ap -> case ap of { APreNeg => adv ; _ => [] } ;
ins : AdvPos -> Str = \ap -> case ap of { InS => adv ; _ => [] } ; ins : AdvPos -> Str = \ap -> case ap of { AInS => adv ; _ => [] } ;
inv : AdvPos -> Str = \ap -> case ap of { InV => adv ; _ => [] } ; inv : AdvPos -> Str = \ap -> case ap of { AInV => adv ; _ => [] } ;
cprev : ComplPos -> Str = \cp -> case cp of { CPreV => compl ; _ => [] } ;
cpostv : ComplPos -> Str = \cp -> case cp of { CPostV => compl ; _ => [] }
in in
{ {
-- subject part of the clause: -- subject part of the clause:
-- advpos is the adverb position in the clause -- advpos is the adverb position in the clause
s = \\advpos => s = \\advpos =>
pres advpos ++ -- adverbs can be placed in the beginning of the clause pres advpos ++ -- adverbs can be placed in the beginning of the clause
np.det.s ! np.g ! Nom ++ -- the determiner, if any
np.preap.s ! (Ag np.g np.n Nom) ++ -- adjectives which come before the subject noun, agreeing with it np.preap.s ! (Ag np.g np.n Nom) ++ -- adjectives which come before the subject noun, agreeing with it
ins advpos ++ -- adverbs can be placed within the subject noun phrase ins advpos ++ -- adverbs can be placed within the subject noun phrase
np.s ! PronDrop ! Nom ++ -- the noun of the subject noun phrase in nominative np.s ! PronDrop ! Nom ++ -- the noun of the subject noun phrase in nominative
np.postap .s ! (Ag np.g np.n Nom) ++ -- adjectives which come after the subject noun, agreeing with it np.postap .s ! (Ag np.g np.n Nom) ; -- adjectives which come after the subject noun, agreeing with it
np.det.sp ! np.g ! Nom ; -- second part of split determiners
-- verb part of the clause: -- verb part of the clause:
-- tense and anter(ority) for the verb tense -- tense and anter(ority) for the verb tense
-- vqf is the VQForm parameter which defines if the ordinary verbform or the quistion form with suffix "-ne" will be used -- vqf is the VQForm parameter which defines if the ordinary verbform or the quistion form with suffix "-ne" will be used
-- advposis the adverb position in the clause -- advposis the adverb position in the clause
-- comppos is the position of the verb complement -- comppos is the position of the verb complement
v = \\tense,anter,vqf,advpos,complpos => v = \\tense,anter,vqf,advpos =>
prev advpos ++ -- adverbs can be placed in the before the verb phrase prev advpos ++ -- adverbs can be placed in the before the verb phrase
cprev complpos ++ -- verb phrase complement, e.g. predicative expression, agreeing with the subject, can go before the verb
inv advpos ++ -- adverbs can be placed within the verb phrase inv advpos ++ -- adverbs can be placed within the verb phrase
-- verb form with conversion between different forms of tense and aspect -- verb form with conversion between different forms of tense and aspect
vp.s ! VAct ( anteriorityToVAnter anter ) ( tenseToVTense tense ) np.n np.p ! vqf ++ vp.s ! VAct ( anteriorityToVAnter anter ) ( tenseToVTense tense ) np.n np.p ! vqf ; -- ++
cpostv complpos ; -- complement can also go after the verb det = np.det ;
-- verb complement
compl = compl ;
-- object part of the clause -- object part of the clause
o = \\advpos => preo advpos ++ vp.obj ; o = \\advpos => preo advpos ++ vp.obj ;
-- optional negation particle, adverbs can be placed before the negation -- optional negation particle, adverbs can be placed before the negation
@@ -1354,41 +1391,79 @@ oper
} ; } ;
combineClause : Clause -> C.Tense -> Anteriority -> C.Pol -> VQForm -> Sentence = \cl,tense,anter,pol,vqf -> combineClause : Clause -> C.Tense -> Anteriority -> C.Pol -> VQForm -> Sentence = \cl,tense,anter,pol,vqf ->
{ s = cl.s ; cl **
o = cl.o ; {
v = cl.v ! tense.t ! anter ! vqf ; v = \\advpos => cl.v ! tense.t ! anter ! vqf ! advpos ;
neg = cl.neg ! pol.p ; neg = cl.neg ! pol.p ;
sadv = "" ; sadv = cl.adv ;
t = tense ; t = tense ;
p = pol p = pol ;
} ; } ;
combineSentence : Sentence -> ( SAdvPos => AdvPos => ComplPos => Order => Str ) = \s -> combineSentence : Sentence -> ( SAdvPos => AdvPos => DetPos => VPos => ComplPos => Order => Str ) = \s ->
let let
pres : SAdvPos -> Str = \ap -> case ap of { SPreS => s.sadv ; _ => [] } ; advpres : SAdvPos -> Str = \ap -> case ap of { SAPreS => s.sadv ; _ => [] } ;
prev : SAdvPos -> Str = \ap -> case ap of { SPreV => s.sadv ; _ => [] } ; advprev : SAdvPos -> Str = \ap -> case ap of { SAPreV => s.sadv ; _ => [] } ;
preo : SAdvPos -> Str = \ap -> case ap of { SPreO => s.sadv ; _ => [] } ; advpreo : SAdvPos -> Str = \ap -> case ap of { SAPreO => s.sadv ; _ => [] } ;
preneg : SAdvPos -> Str = \ap -> case ap of { SPreNeg => s.sadv ; _ => [] } advpreneg : SAdvPos -> Str = \ap -> case ap of { SAPreNeg => s.sadv ; _ => [] } ;
detpren : DetPos -> { s, sp : Case => Str } = \dp -> case dp of { DPreN => s.det; _ => { s,sp = \\_ => [] } } ;
detpostn : DetPos -> { s, sp : Case => Str } = \dp -> case dp of { DPostN => s.det ; _ => { s , sp = \\_ => [] } } ;
verbins : VPos -> ResLat.AdvPos => Str = \vp -> case vp of { VInS => s.v ; _ => \\_ => [] } ;
verbreg : VPos -> ResLat.AdvPos => Str = \vp -> case vp of { VReg => s.v ; _ => \\_ => [] } ;
complprev : ComplPos -> Str = \cp -> case cp of { CPreV => s.compl ; _ => [] } ;
complpostv : ComplPos -> Str = \cp -> case cp of { CPostV => s.compl ; _ => [] }
in in
-- sap is the position of the sentence adverbial -- sadvpos is the position of the sentence adverbial
-- ap is the position of the adverb -- advpos is the position of the adverb
-- cp is the position of the verb complement -- detpos is the position of the determiner (relative to the noun)
\\sap,ap,cp,order => case order of { -- vpos is the position of the main verb (either regular or interleaved)
SVO => s.t.s ++ s.p.s ++ pres sap ++ s.s ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ preo sap ++ s.o ! ap; -- complosp is the position of the verb complement
VSO => s.t.s ++ s.p.s ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ pres sap ++ s.s ! ap ++ preo sap ++ s.o ! ap; \\sadvpos,advpos,detpos,verbpos,complpos,order => case order of {
VOS => s.t.s ++ s.p.s ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ preo sap ++ s.o ! ap ++ pres sap ++ s.s ! ap ; SVO =>
OSV => s.t.s ++ s.p.s ++ preo sap ++ s.o ! ap ++ pres sap ++ s.s ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp; s.t.s ++ s.p.s ++
OVS => s.t.s ++ s.p.s ++ preo sap ++ s.o ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ pres sap ++ s.s ! ap ; advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ++
SOV => s.t.s ++ s.p.s ++ pres sap ++ s.s ! ap ++ preo sap ++ s.o ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
advpreo sadvpos ++ s.o ! advpos;
VSO =>
s.t.s ++ s.p.s ++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ++
advpreo sadvpos ++ s.o ! advpos;
VOS =>
s.t.s ++ s.p.s ++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
advpreo sadvpos ++ s.o ! advpos ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ;
OSV =>
s.t.s ++ s.p.s ++
advpreo sadvpos ++ s.o ! advpos ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ;
OVS =>
s.t.s ++ s.p.s ++
advpreo sadvpos ++ s.o ! advpos ++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ;
SOV =>
s.t.s ++ s.p.s ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ++
advpreo sadvpos ++ s.o ! advpos ++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos)
} ; } ;
defaultSentence : Sentence -> Order => Str = \s -> combineSentence s ! SAPreS ! APreV ! DPreN ! VReg ! CPreV ;
-- questions -- questions
mkQuestion : SS -> Clause -> QClause = \ss,cl -> { mkQuestion : SS -> Clause -> QClause = \ss,cl -> {
s = \\tense,anter,pol,form => case form of { s = \\tense,anter,pol,form => case form of {
QDir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SPreS ! PreS ! CPreV ! OVS ; QDir => ss.s ++ (defaultSentence (combineClause cl tense anter pol VQFalse)) ! OVS ;
QIndir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SPreO ! PreO ! CPreV ! OSV QIndir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SAPreO ! APreO ! DPreN ! VReg ! CPreV ! OSV
} }
}; };
@@ -1472,8 +1547,8 @@ oper
Below8 = Yes | No8 | No9 | Ign ; Below8 = Yes | No8 | No9 | Ign ;
oper oper
-- Numerals are by default cardinal numbers but have a field for ordinal numbers -- Numerals are by default cardinal numbers but have a field for ordinal numbers
TDigit : Type = { s : Unit => Gender => Case => Str ; tenNext : Str ; below8 : Below8 } ; -- ord : Unit => Agr => Str } ; TDigit : Type = { s : Unit => Gender => Case => Str ; tenNext : Str ; below8 : Below8 ; ord : Unit => Gender => Number => Case => Str } ;
TNumeral : Type = { s : Gender => Case => Str ; d : Unit => Gender => Case => Str ; n : Number ; below8 : Below8 } ; -- ord : Unit => Agr => Str } ; TNumeral : Type = { s : Gender => Case => Str ; d : { num, ord : Unit => Gender => Case => Str } ; n : Number ; below8 : Below8 ; ord : Gender => Number => Case => Str } ;
-- Inflection for cardinal numbers -- Inflection for cardinal numbers
cardFlex : Str -> Gender => Case => Str = cardFlex : Str -> Gender => Case => Str =
@@ -1496,21 +1571,21 @@ oper
} ; } ;
_ => \\_,_ => c _ => \\_,_ => c
} ; } ;
-- ordFlex : Gender => Number => Case => Str = ordFlex : Str -> Gender => Number => Case => Str =
-- case o of { \o -> case o of {
-- stem + "us" => table { stem + "us" => table {
-- Masc => table Number [ table Case [ stem + "us" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "e" ] ; Masc => table Number [ table Case [ stem + "us" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "e" ] ;
-- table Case [ stem + "i" ; stem + "os" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "i" ] ; table Case [ stem + "i" ; stem + "os" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "i" ] ;
-- ]; ];
-- Fem => table Number [ table Case [ stem + "a" ; stem + "am" ; stem + "ae" ; stem + "ae" ; stem + "a" ; stem + "a" ] ; Fem => table Number [ table Case [ stem + "a" ; stem + "am" ; stem + "ae" ; stem + "ae" ; stem + "a" ; stem + "a" ] ;
-- table Case [ stem + "ae" ; stem + "as" ; stem + "arum" ; stem + "is" ; stem + "is" ; stem + "ae" ] ; table Case [ stem + "ae" ; stem + "as" ; stem + "arum" ; stem + "is" ; stem + "is" ; stem + "ae" ] ;
-- ] ; ] ;
-- Neutr => table Number [ table Case [ stem + "um" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "um" ] ; Neutr => table Number [ table Case [ stem + "um" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "um" ] ;
-- table Case [ stem + "a" ; stem + "a" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "a" ] ; table Case [ stem + "a" ; stem + "a" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "a" ] ;
-- ] ]
-- } ; } ;
-- _ => error "unsupported ordinal form" _ => error "unsupported ordinal form"
-- } } ;
-- in -- in
-- { s = cardFlex ; n = case c of { "unus" => Sg ; _ => Pl } ; ord = ordFlex } ; -- { s = cardFlex ; n = case c of { "unus" => Sg ; _ => Pl } ; ord = ordFlex } ;

View File

@@ -52,29 +52,31 @@ concrete SentenceLat of Sentence = CatLat ** open Prelude, ResLat in {
{ {
s = let qs = combineClause cl t t.a p VQTrue in s = let qs = combineClause cl t t.a p VQTrue in
\\q => case q of { \\q => case q of {
QDir => cl.q ++ combineSentence qs ! SPreS ! PreV ! CPostV ! SVO ; -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV ++ cl.o ! PreV ; QDir => cl.q ++ defaultSentence qs ! SVO ; -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV ++ cl.o ! PreV ;
QIndir => cl.q ++ combineSentence qs ! SPreS ! PreV ! CPostV ! SOV -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.o ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV QIndir => cl.q ++ defaultSentence qs ! SOV -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.o ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV
} }
} ; } ;
-- UseRCl : Temp -> Pol -> RCl -> RS ;
-- UseRCl t p cl = { UseRCl t p cl = {
s = \\g,n => defaultSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SOV ;
-- s = \\r => t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! r ; -- s = \\r => t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! r ;
-- c = cl.c -- c = cl.c
-- } ; } ;
-- UseSlash t p cl = { -- UseSlash t p cl = {
-- s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! ODir ; -- s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! ODir ;
-- c2 = cl.c2 -- c2 = cl.c2
-- } ; -- } ;
-- --
-- AdvS : Adv -> S -> S -- AdvS : Adv -> S -> S
AdvS adv s = { s = s.s ; o = s.o ; v = s.v ; neg = s.neg ; t = s.t ; p = s.p ; sadv = adv.s ! Posit ++ s.sadv } ; AdvS adv s = -- { s = s.s ; o = s.o ; v = s.v ; neg = s.neg ; t = s.t ; p = s.p ; sadv = adv.s ! Posit ++ s.sadv } ;
s ** { sadv = adv.s ! Posit ++ s.sadv } ;
-- This covers subjunctive clauses, but they can also be added to the end. -- This covers subjunctive clauses, but they can also be added to the end.
-- SSubjS : S -> Subj -> S -> S ; -- I go home if she comes -- SSubjS : S -> Subj -> S -> S ; -- I go home if she comes
-- TO FIX -- TO FIX
-- SSubjS s1 subj s2 = { s = \\_ => subj.s ++ s2.s ! PreS ++ s1.s ! PreS ; sadv = lin Adv (mkAdverb []) } ; -- SSubjS s1 subj s2 = { s = \\_ => subj.s ++ s2.s ! PreS ++ s1.s ! PreS ; sadv = lin Adv (mkAdverb []) } ;
-- RelS s r = {s = s.s ++ "," ++ r.s ! agrP3 Sg} ; -- RelS s r = {s = s.s ! APreV ++ "," ++ r.s } ;
-- --
-- oper -- oper
-- ctr = contrNeg True ; -- contracted negations -- ctr = contrNeg True ; -- contracted negations

View File

@@ -2,51 +2,58 @@
concrete SymbolLat of Symbol = CatLat ** open Prelude, ResLat, ParadigmsLat, TenseX in { concrete SymbolLat of Symbol = CatLat ** open Prelude, ResLat, ParadigmsLat, TenseX in {
lin lin
SymbPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c -- SymbPN : Symb -> PN ;
IntPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c SymbPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c
FloatPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c -- IntPN : Int -> PN ;
NumPN i = {s = \\c => i.s ! Neutr ! c; g = Neutr ; n = Pl } ; --- c IntPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c
CNIntNP cn i = { -- FloatPN : Float -> PN ;
s = \\_,c => (cn.s ! Sg ! Nom ++ i.s) ; FloatPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c
g = cn.g ; -- NumPN : Num -> PN ;
n = Sg ; NumPN i = {s = \\c => i.s ! Neutr ! c; g = Neutr ; n = Pl } ; --- c
adv = [] ; -- CNIntNP : CN -> Int -> NP ;
det = { s = \\_,_ => [] ; n = Sg ; sp = \\_,_ => [] } ; CNIntNP cn i = {
p = P3 ; s = \\_,c => (cn.s ! Sg ! Nom ++ i.s) ;
postap = { s = \\_ => [] } ; g = cn.g ;
preap = { s = \\_ => [] } ; n = Sg ;
} ; adv = [] ;
CNSymbNP det cn xs = { det = { s , sp = \\_ => [] ; n = Sg } ;
s = \\_,c => (cn.s ! Sg ! Nom ++ xs.s ) ; p = P3 ;
g = cn.g ; preap , postap = { s = \\_ => [] } ;
n = det.n ; } ;
adv = [] ; --CNSymbNP : CN -> Symb -> NP ;
det = det ; CNSymbNP det cn xs = {
p = P3 ; s = \\_,c => (cn.s ! Sg ! Nom ++ xs.s ) ;
postap = { s = \\_ => [] } ; g = cn.g ;
preap = { s = \\_ => [] } ; n = det.n ;
} ; adv = [] ;
det = { s = det.s ! cn.g ; sp = det.sp ! cn.g } ;
p = P3 ;
preap , postap = { s = \\_ => [] } ;
} ;
-- s = \\c => det.s ++ cn.s ! det.n ! c ++ xs.s ; -- s = \\c => det.s ++ cn.s ! det.n ! c ++ xs.s ;
-- a = agrgP3 det.n cn.g -- a = agrgP3 det.n cn.g
-- } ; -- } ;
-- } ; -- } ;
CNNumNP cn i = {
s = \\_,c => (cn.s ! Sg ! Nom ++ i.s ! cn.g ! Nom ) ; -- CNNumNP : CN -> Num -> NP ;
g = cn.g ; CNNumNP cn i = {
n = Sg ; s = \\_,c => (cn.s ! Sg ! Nom ++ i.s ! cn.g ! Nom ) ;
adv = [] ; g = cn.g ;
det = { s = \\_,_ => [] ; n = Sg ; sp = \\_,_ => [] } ; n = Sg ;
p = P3 ; adv = [] ;
postap = { s = \\_ => [] } ; det = { s , sp = \\_ => [] ; n = Sg };
preap = { s = \\_ => [] } ; p = P3 ;
} ; preap , postap = { s = \\_ => [] } ;
} ;
-- --
-- SymbS : Symb -> S ;
SymbS sy = { s = \\_ => sy.s ; o , neg = \\_ => "" ; p = PPos ; sadv = "" ; t = TPres ; v = \\_ => "" ; compl = "" ; det = { s , sp = \\_ => [] ; n = Sg } } ;
SymbS sy = { s = \\_ => sy.s ; neg = \\_ => "" ; o = \\_ => "" ; p = PPos ; sadv = "" ; t = TPres ; v = \\_,_ => "" } ; -- SymbNum : Symb -> Num
-- SymbNum sy = {s = \\_,_ => sy.s ; n = Pl } ;
SymbNum sy = {s = \\_,_ => sy.s ; n = Pl } ; -- SymbOrd : Symb -> Ord
SymbOrd sy = { s = \\g,n,c => sy.s } ; -- does not inflect properly SymbOrd sy = { s = \\g,n,c => sy.s } ; -- does not inflect properly
lincat lincat
Symb, [Symb] = SS ; Symb, [Symb] = SS ;

View File

@@ -19,15 +19,17 @@ concrete VerbLat of Verb = CatLat ** open (S=StructuralLat),ResLat,IrregLat,Extr
-- ComplVS : VS -> S -> VP ; -- say that she runs -- ComplVS : VS -> S -> VP ; -- say that she runs
ComplVS vs s = -- insertObj ( dummyNP (S.that_Subj.s ++ s.s ! PreS)) Nom_Prep (predV v) ; ComplVS vs s = -- insertObj ( dummyNP (S.that_Subj.s ++ s.s ! PreS)) Nom_Prep (predV v) ;
vs ** { vs ** {
s = \\af,qf => vs.act ! af ; s = \\a,q => vs.act ! a ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
compl = \\ag => combineSentence s ! SPreS ! PreV ! CPostV ! SOV ; -- s.s ! QIndir ; pass = \\p,q => vs.pass ! p ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
compl = \\ag => defaultSentence s ! SOV ; -- s.s ! QIndir ;
adv = [] ; adv = [] ;
obj = [] obj = []
} ; } ;
-- ComplVQ : VQ -> QS -> VP ; -- wonder who runs -- ComplVQ : VQ -> QS -> VP ; -- wonder who runs
ComplVQ vq qs = -- insertObj (dummyNP (q.s ! QIndir)) Nom_Prep (predV v) ; ComplVQ vq qs = -- insertObj (dummyNP (q.s ! QIndir)) Nom_Prep (predV v) ;
vq ** { vq ** {
s = \\af,qf => vq.act ! af ; s = \\a,q => vq.act ! a ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
pass = \\p,q => vq.pass ! p ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
compl = \\ag => qs.s ! QIndir ; compl = \\ag => qs.s ! QIndir ;
adv = [] ; adv = [] ;
obj = [] obj = []
@@ -115,7 +117,7 @@ concrete VerbLat of Verb = CatLat ** open (S=StructuralLat),ResLat,IrregLat,Extr
-- CompNP : NP -> Comp ; -- (be) the man -- CompNP : NP -> Comp ; -- (be) the man
CompNP np = {s = \\_ => CompNP np = {s = \\_ =>
(combineNounPhrase np) ! PronNonDrop ! Nom (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom ;
} ; } ;
-- CompAdv : Adv -> Comp ; -- (be) here -- CompAdv : Adv -> Comp ; -- (be) here

View File

@@ -1,10 +1,11 @@
import PGF import PGF
import System.Environment import System.Environment
import Data.List
import Data.Maybe
main = main =
do do
args <- getArgs -- first one should be pgf file and second one should be the file containing the errors/warnings about missing things args <- getArgs -- first one should be pgf file and second one should be the file containing the errors/warnings about missing things
pgf <- PGF.readPGF (args !! 0) -- "tmp/Lang.pgf" pgf <- PGF.readPGF (args !! 0) -- "tmp/Lang.pgf"
ms <- readFile (args !! 1) {- "tmp/MissingLat.tmp" -} >>= return . map (last . words) . lines ms <- readFile (args !! 1) {- "tmp/MissingLat.tmp" -} >>= return . nub . sort . map (last . words) . lines
let ts = [PGF.showType [] t | m <- ms, Just t <- [PGF.functionType pgf (PGF.mkCId m)]] let ts = [maybe ("-- Error: No type found for " ++ m) (\t -> "oper " ++ m ++ " : " ++ PGF.showType [] t ++ " = notYet \"" ++ m ++ "\" ;") $ PGF.functionType pgf (PGF.mkCId m) | m <- ms ]
putStrLn $ unlines ["oper " ++ f ++ " : " ++ t ++ " = notYet \"" ++ f ++ "\" ;" | (f,t) <- zip ms ts] putStrLn $ unlines ts -- ["oper " ++ f ++ " : " ++ t ++ " = notYet \"" ++ f ++ "\" ;" | (f,t) <- zip ms ts]

View File

@@ -2,6 +2,7 @@
echo "Create tmp dir" echo "Create tmp dir"
mkdir tmp/ mkdir tmp/
echo "Remove old file" echo "Remove old file"
rm -Rfv tmp/*
echo "resource MissingLat = {} " > MissingLat.gf echo "resource MissingLat = {} " > MissingLat.gf
echo "Look for missing functions" echo "Look for missing functions"
# gf -src -i .. -batch TryLat.gf 2>&1 | grep "Warning: no linearization of" | sort -u > tmp/MissingLat.tmp # gf -src -i .. -batch TryLat.gf 2>&1 | grep "Warning: no linearization of" | sort -u > tmp/MissingLat.tmp