diff --git a/src/abstract/Extend.gf b/src/abstract/Extend.gf index b48daa442..5e5039d00 100644 --- a/src/abstract/Extend.gf +++ b/src/abstract/Extend.gf @@ -138,13 +138,22 @@ abstract Extend = Cat ** { -- proper structure of "it is AP to VP" PredAPVP : AP -> VP -> Cl ; -- it is good to walk - PredIAdvVP : IAdv -> VP -> QCl ; -- how 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) +-- 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. diff --git a/src/arabic/ExtendAra.gf b/src/arabic/ExtendAra.gf index 9aa92abc9..ec6437831 100644 --- a/src/arabic/ExtendAra.gf +++ b/src/arabic/ExtendAra.gf @@ -5,7 +5,8 @@ concrete ExtendAra of Extend = GenNP, ApposNP, ICompAP, DetNPMasc, DetNPFem, EmptyRelSlash, PredAPVP, ComplDirectVS, ComplDirectVQ, -- because of Utt - VPS, MkVPS, PredVPS, BaseVPS, ConsVPS, ConjVPS + VPS, MkVPS, PredVPS, BaseVPS, ConsVPS, ConjVPS, + EmbedSSlash ] with (Grammar=GrammarAra) ** open @@ -46,6 +47,9 @@ lin -- : ClSlash -> RCl -- he lives in EmptyRelSlash = RelSlash (IdRP ** {s = \\_ => []}) ; + -- : SSlash -> SC + EmbedSSlash = Grammar.EmbedS ; + lincat VPS = {s : PerGenNum => Str} ; -- finite VP's with tense and polarity [VPS] = {s1,s2 : PerGenNum => Str} ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 21ad52dd9..0ee3a32aa 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -42,7 +42,7 @@ concrete SentenceAra of Sentence = CatAra ** open -- SlashVS np vs sslash = TODO - EmbedS s = {s = "أَنْ" ++ s.s ! Verbal} ; + EmbedS s = {s = "مَا" ++ s.s ! Verbal} ; EmbedQS qs = {s = qs.s ! QIndir} ; EmbedVP vp = {s = uttVP VPPerf vp ! Masc} ; -- TODO: use VPGer once it's more stable diff --git a/src/common/ExtendFunctor.gf b/src/common/ExtendFunctor.gf index 8c7867d7e..311d712b7 100644 --- a/src/common/ExtendFunctor.gf +++ b/src/common/ExtendFunctor.gf @@ -64,6 +64,7 @@ lin FrontComplDirectVQ = variants {} ; -- NP -> VQ -> Utt -> Cl ; -- "where", she asked PredAPVP ap vp = ImpersCl (UseComp (CompAP (SentAP ap (EmbedVP vp)))) ; -- DEFAULT it is (good to walk) PredIAdvVP iadv vp = QuestIAdv iadv (GenericCl vp) ; -- DEFAULT how does one walk + EmbedSSlash = variants {} ; -- SSlash -> SC ; -- what we did (was fun) AdjAsCN = variants {} ; -- AP -> CN ; -- a green one ; en grön (Swe) AdjAsNP = variants {} ; -- AP -> NP ; -- green (is good) ReflRNP = variants {} ; -- VPSlash -> RNP -> VP ; -- love my family and myself diff --git a/src/english/ExtendEng.gf b/src/english/ExtendEng.gf index 935b737bb..3af375bf4 100644 --- a/src/english/ExtendEng.gf +++ b/src/english/ExtendEng.gf @@ -15,7 +15,7 @@ concrete ExtendEng of Extend = FocusAP, FocusAdV, FocusAdv, FocusObj, GenIP, GenModIP, GenModNP, GenNP, GenRP, GerundAdv, GerundCN, GerundNP, IAdvAdv, ICompAP, InOrderToVP, MkVPS, NominalizeVPSlashNP, PassAgentVPSlash, PassVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, PredVPS, PredVPSVV, PredetRNP, PrepCN, - PredIAdvVP, PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, StrandQuestSlash, StrandRelSlash, + EmbedSSlash, PredIAdvVP, PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, StrandQuestSlash, StrandRelSlash, UncontractedNeg, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, MkVPS2 ] with @@ -193,6 +193,8 @@ concrete ExtendEng of Extend = PredIAdvVP iadv vp = {s = \\t,a,p,q => iadv.s ++ infVP VVInf vp False Simul CPos (agrP3 Sg)} ; + EmbedSSlash s = {s = \\_ => "what" ++ s.s ++ s.c2} ; + NominalizeVPSlashNP vpslash np = let vp : ResEng.VP = insertObjPre (\\_ => vpslash.c2 ++ np.s ! NPAcc) vpslash ; a = AgP3Sg Neutr diff --git a/src/finnish/ExtendFin.gf b/src/finnish/ExtendFin.gf index eefeb0a11..0a6827ffd 100644 --- a/src/finnish/ExtendFin.gf +++ b/src/finnish/ExtendFin.gf @@ -5,7 +5,7 @@ concrete ExtendFin of Extend = VPI2,VPS2,MkVPS,MkVPS2,ConjVPS2,ComplVPS2, ConsVPS, BaseVPS, ListVPS, VPS, ConjVPS,PredVPS, MkVPI2,ConjVPI2,ComplVPI2,ComplVPIVV ,ExistCN, ExistMassCN, ICompAP, ByVP - ,CompoundN, GenNP, GenIP, AdvIsNP + ,CompoundN, GenNP, GenIP, AdvIsNP, EmbedSSlash ] with (Grammar = GrammarFin) ** @@ -149,4 +149,15 @@ lin ByVP vp = lin Adv {s = S.infVP vp.s.sc Pos (Ag Sg P3) vp Inf3Adess} ; ---- Agr ? AdvIsNP adv np = S.mkClause (\_ -> adv.s) np.a (UseComp (CompNP np)) ; + + -- : SSlash -> SC + EmbedSSlash ss = + let it_NP : NP = UsePron it_Pron ; + thatWhich : NP = it_NP ** { + s = \\nc => it_NP.s ! NPSep ++ case nc of { + NPCase c => mikaInt ! Sg ! c ; + NPAcc => mikaInt ! Sg ! Gen ; + NPSep => mikaInt ! Sg ! Nom } + } ; + in {s = appCompl True Pos ss.c2 thatWhich ++ ss.s} ; } diff --git a/src/persian/AdjectivePes.gf b/src/persian/AdjectivePes.gf index cad4b4a9a..ca7bed159 100644 --- a/src/persian/AdjectivePes.gf +++ b/src/persian/AdjectivePes.gf @@ -43,7 +43,8 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in { AdjOrd ord = { s = \\_ => ord.s ; adv = ord.s ; - isPre = ord.isPre + isPre = ord.isPre ; + afterPrefix = False ; } ; AdvAP ap adv = ap ** { diff --git a/src/persian/AdverbPes.gf b/src/persian/AdverbPes.gf index 026d2dd1b..3d6df3b6d 100644 --- a/src/persian/AdverbPes.gf +++ b/src/persian/AdverbPes.gf @@ -16,7 +16,12 @@ concrete AdverbPes of Adverb = CatPes ** open ResPes, Prelude in { AdAdv ada adv = { s = ada.s ++ adv.s} ; -- SubjS = cc2 ; - SubjS sub snt = {s = sub.s ++ conjThat ++ snt.s ! sub.compl} ; + SubjS sub snt = { + s = case sub.relpron of { + Ke => sub.s ++ conjThat ++ snt.s ! sub.compl ; + Ance => "آنچه" ++ snt.s ! sub.compl } + } ; + AdnCAdv cadv = {s = cadv.s ++ "از"} ; } diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index cfcce220c..87436ec83 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -12,7 +12,7 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in { ---- Sentence - Cl = ResPes.Clause ; + Cl = ResPes.Clause ; -- TODO: like romance does "no tiene ningún", i.e. negative quant/det/NP forces negation in Cl and S ClSlash = { subj : Str ; vp : ResPes.TAnt => Polarity => Order => Str ; @@ -71,10 +71,15 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in { Conj = {s1,s2 : Str ; n : Number} ; -----b Conj = {s : Str ; n : Number} ; -----b DConj = {s1,s2 : Str ; n : Number} ; - Subj = {s : Str ; compl : VVForm} ; -- subjunctive or indicative + Subj = { + s : Str ; + compl : VVForm ; -- subjunctive or indicative + relpron : RelPron -- choose between که and آنچه + } ; + VS = ResPes.Verb ** {compl : VVForm} ; -- subjunctive or indicative Prep = Compl ; ---- Open lexical classes, e.g. Lexicon - V, VS, VQ = ResPes.Verb ; + V, VQ = ResPes.Verb ; V2, VA, V2A, V2Q, V2S = ResPes.Verb ** {c2 : Compl} ; V3 = ResPes.Verb ** {c2, c3 : Compl} ; @@ -85,8 +90,8 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in { N = ResPes.Noun ; - N2 = ResPes.Noun ** {c2 : Str ; compl : Str}; -- when N3 is made to N2, need to retain compl - N3 = ResPes.Noun ** {c2 : Str ; c3 : Str} ; + N2 = ResPes.Noun ** {c2 : Compl ; compl : Str}; -- when N3 is made to N2, need to retain compl + N3 = ResPes.Noun ** {c2 : Compl ; c3 : Compl} ; PN = {s : Str ; animacy : Animacy} ; } diff --git a/src/persian/ConjunctionPes.gf b/src/persian/ConjunctionPes.gf index 1aa4a2e35..86cda5cd2 100644 --- a/src/persian/ConjunctionPes.gf +++ b/src/persian/ConjunctionPes.gf @@ -48,7 +48,7 @@ concrete ConjunctionPes of Conjunction = isCmpd : CmpdStatus; hasAdj : Bool ; compl : Number => Str} ; - [AP] = {s1,s2 : Mod => Str ; adv : Str ; isPre : Bool} ; + [AP] = {s1,s2 : Mod => Str ; adv : Str ; isPre,afterPrefix : Bool} ; [RS] = {s1,s2 : Agr => Str ; rp : RelPron => Str} ; oper diff --git a/src/persian/ExtendPes.gf b/src/persian/ExtendPes.gf index 91ccc9325..33892c7b5 100644 --- a/src/persian/ExtendPes.gf +++ b/src/persian/ExtendPes.gf @@ -3,7 +3,7 @@ concrete ExtendPes of Extend = CatPes ** ExtendFunctor - [ GenNP, ApposNP, ICompAP, AdvIsNP, InOrderToVP, ByVP - ,GerundNP,GerundCN,GerundAdv,EmbedPresPart + ,GerundNP,GerundCN,GerundAdv,EmbedPresPart,EmbedSSlash ] with (Grammar=GrammarPes) ** open Prelude, ResPes in { @@ -33,6 +33,9 @@ lin -- : VP -> SC ; EmbedPresPart vp = lin SC {s = showVPH Inf defaultAgr vp} ; + -- : SSlash -> SC + EmbedSSlash ss = {s = conjThat ++ ss.s ! Indic ++ ss.c2.s} ; + -- : Adv -> NP -> Cl -- here is the car / here are the cars AdvIsNP adv np = mkClause (indeclNP adv.s ** {a = np.a}) (UseComp (CompNP np)) ; diff --git a/src/persian/LexiconPes.gf b/src/persian/LexiconPes.gf index e5cc52626..c9e6cff1c 100644 --- a/src/persian/LexiconPes.gf +++ b/src/persian/LexiconPes.gf @@ -65,7 +65,7 @@ concrete LexiconPes of Lexicon = CatPes ** cow_N = mkN01 "گاو" animate; die_V = mkV "مردن" "میر" ; dirty_A = mkA "کثیف" ; - distance_N3 = (mkN "فاصله" "فواصل" inanimate ) ** {c2="از" ; c3 = "تا"}; + distance_N3 = mkN3 (mkN "فاصله" "فواصل" inanimate ) "از" "تا" ; doctor_N = mkN01 "دکتر" animate; -- has variant "پزشک", but only a doctor in medicine dog_N = mkN01 "سگ" animate; door_N = mkN01 "در" inanimate; @@ -76,7 +76,7 @@ concrete LexiconPes of Lexicon = CatPes ** enemy_N = mkN02 "دشمن" animate; factory_N = mkN01 "کارخانه" inanimate; father_N2 = mkN2 (mkN02 "پدر" animate) []; - fear_VS = mkV_1 "ترسیدن"; + fear_VS = mkVS (mkV_1 "ترسیدن") ; find_V2 = mkV2 (compoundV "پیدا" doVerb) "را"; fish_N = mkN01 "ماهی" animate; floor_N = mkN01 "زمین" inanimate; -- Note: floor in persian can have 3 different translations @@ -97,7 +97,7 @@ concrete LexiconPes of Lexicon = CatPes ** hat_N = mkN01 "کلاه" inanimate; hear_V2 = mkV2 (mkV "شنیدن" "شنو") "را" ; hill_N = mkN01 "تپه" inanimate; - hope_VS = compoundV "امیدوار" beVerb; + hope_VS = mkVS (compoundV "امیدوار" beVerb) ; horse_N = mkN01 "اسب" animate; hot_A = mkA "داغ" ["داغ داغ"] ; house_N = mkN01 "خانه" inanimate; @@ -106,7 +106,7 @@ concrete LexiconPes of Lexicon = CatPes ** iron_N = mkN01 "آهن" inanimate; king_N = mkN "پادشاه" "پادشاهان" animate; know_V2 = mkV2 (mkV "شناختن" "شناس") "را"; - know_VS = (mkV_1 "دانستن") ; -- danestan -> dan ; needs explicit mkV_1 + know_VS = mkVS (mkV_1 "دانستن") ; -- danestan -> dan ; needs explicit mkV_1 know_VQ = (mkV_1 "دانستن") ; lake_N = mkN01 "دریاچه" inanimate; lamp_N = mkN01 "چراغ" inanimate; -- also "لامپ", but they have different usage @@ -157,7 +157,7 @@ concrete LexiconPes of Lexicon = CatPes ** roof_N = mkN01 "بام" inanimate; -- has variant "سقف" rubber_N = mkN01 "پاککن" inanimate; -- also "لاستیک" run_V = mkV_1 "دویدن" ; - say_VS = mkV "گفتن" "گوی" ; + say_VS = mkVS (mkV "گفتن" "گوی") ; school_N = mkN "مدرسه" "مدارس" inanimate; science_N = mkN "علم" "علوم" inanimate; -- also "دانش" sea_N = mkN01 "دریا" inanimate; @@ -215,7 +215,7 @@ concrete LexiconPes of Lexicon = CatPes ** woman_N = mkN02 "زن" animate; wonder_VQ = compoundV "متعجب" beVerb ; wood_N = mkN01 "چوب" inanimate; - write_V2 = mkV2 (mkV "نوشتن" "نویس") "را" ; + write_V2 = mkV2 (mkV "نوشتن" "نویس") ; -- would need ra with a definite object, but better rule of thumb to go without ra /NM yellow_A = mkA "زرد" ; young_A = mkA "جوان""جوانانه" ; do_V2 = mkV2 (compoundV "انجام" giveVerb) "را"; diff --git a/src/persian/MorphoPes.gf b/src/persian/MorphoPes.gf index 24b4dd896..78d075395 100644 --- a/src/persian/MorphoPes.gf +++ b/src/persian/MorphoPes.gf @@ -25,6 +25,10 @@ oper -- fatha : Str = "َ" ; kasre,fatha : Str = [] ; + -- for appComp + -- runtimeKasre : Str -> Str = \s -> glue s kasre ; + runtimeKasre : Str -> Str = \s -> s ; + ---- Nouns param @@ -150,7 +154,8 @@ oper Adjective : Type = { s : Mod => Str ; adv : Str ; - isPre : Bool + isPre : Bool ; -- as attributive + afterPrefix : Bool ; -- as predicative, does it go between the prefix and the light verb } ; mkAdj : Str -> Str -> Adjective = \adj,adv -> { @@ -159,7 +164,7 @@ oper Clitic => mkEnclic adj ; Poss => mkPossStem adj } ; - adv = adv ; isPre = False + adv = adv ; isPre = False ; afterPrefix = True ; }; ------------------------------------------------------------------ @@ -315,7 +320,8 @@ oper haveVerb : Verb = haveRegV ** {s = table { ImpPrefix _ => [] ; - VAor Neg agr => imperfectSuffix agr (addN "دار") ; + VAor Neg agr => imperfectSuffixD agr (addN "دار") ; + VSubj pol agr => haveRegV.s ! VPerf pol agr ; vf => haveRegV.s ! vf } } where { haveRegV = mkVerb "داشتن" "دار" } ; diff --git a/src/persian/NounPes.gf b/src/persian/NounPes.gf index 428ab04ce..9a222dcfa 100644 --- a/src/persian/NounPes.gf +++ b/src/persian/NounPes.gf @@ -119,14 +119,14 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { } ; ComplN2 n2 np = n2 ** { - s = \\n,m => n2.s ! n ! Ezafe ; - compl = \\_ => n2.compl ++ n2.c2 ++ np2str np ; + s = \\n,m => n2.s ! n ! n2.c2.mod ; + compl = \\_ => n2.compl ++ n2.c2.s ++ np2str np ; hasAdj = False }; ComplN3 n3 np = n3 ** { - s = \\n,m => n3.s ! n ! Ezafe ; - compl = n3.c2 ++ np2str np ; + s = \\n,m => n3.s ! n ! n3.c2.mod ; + compl = n3.c2.s ++ np2str np ; c = n3.c3; } ; diff --git a/src/persian/NumeralPes.gf b/src/persian/NumeralPes.gf index 5051074d9..3e1f767b3 100644 --- a/src/persian/NumeralPes.gf +++ b/src/persian/NumeralPes.gf @@ -72,7 +72,7 @@ lin pot3plus n m = { } ; -} D_0 = mkDig "0" ; - D_1 = mk3Dig "1" "" Pl; + D_1 = mk3Dig "1" "" Sg ; D_2 = mk2Dig "2" ""; D_3 = mk2Dig "3" "سوم" ; D_4 = mkDig "4" ; diff --git a/src/persian/ParadigmsPes.gf b/src/persian/ParadigmsPes.gf index e2d927a3b..c65e8f96e 100644 --- a/src/persian/ParadigmsPes.gf +++ b/src/persian/ParadigmsPes.gf @@ -42,11 +42,13 @@ oper } ; mkN2 : overload { - mkN2 : (key : N) -> (to : Str) -> N2 -- Takes a noun and a complementiser, returns a N2. + mkN2 : (key : N) -> (to : Str) -> N2 ; -- Takes a noun and a complementiser as a string, returns a N2. + mkN2 : (key : N) -> (to : Prep) -> N2 -- Takes a noun and a complementiser as a Prep, returns a N2. } ; mkN3 : overload { - mkN3 : (distance : N) -> (from,to : Str) -> N3 -- Takes a noun and two complementisers, returns a N3. + mkN3 : (distance : N) -> (from,to : Str) -> N3 ; -- Takes a noun and two complementisers as strings, returns a N3. + mkN3 : (distance : N) -> (from,to : Prep) -> N3 -- Takes a noun and two complementisers as Preps, returns a N3. } ; -- Compound Nouns @@ -88,6 +90,7 @@ oper mkA : Str -> A ; -- Regular adjective, same form for adjective and adverb. mkA : (adj,adv : Str) -> A -- Different forms for adjective and adverb. } ; + prefixA : A -> A ; -- Adjective that comes before the noun mkA2 : (married,to : Str) -> A2 -- Takes string and complementiser, returns A2. = \a,c -> lin A2 (mkAdj a a ** {c2 = c}) ; @@ -123,7 +126,7 @@ oper mkV3 = overload { mkV3 : Str -> V3 -- Predictable V3, را for direct object, no prepositions. - = \s -> lin V3 (regV s ** {c2 = prepOrRa "را" ; c3 = prepOrRa []}) ; + = \s -> lin V3 (regV s ** {c2 = prepOrRa "را" ; c3 = noPrep}) ; mkV3 : V -> (dir,indir : Str) -> V3 -- Takes a verb and two prepositions or را as strings (can be empty). = \v,p,q -> lin V3 (v ** {c2 = prepOrRa p ; c3 = prepOrRa q}) ; mkV3 : V -> (dir,indir : Prep) -> V3 -- Takes a verb and two prepositions @@ -139,18 +142,18 @@ oper mkVA = overload { mkVA : Str -> VA -- predictable verb with adjective complement - = \s -> lin VA (regV s ** {c2 = prepOrRa []}) ; + = \s -> lin VA (regV s ** {c2 = noPrep}) ; mkVA : V -> VA -- VA out of a verb - = \v -> lin VA (v ** {c2 = prepOrRa []}) ; + = \v -> lin VA (v ** {c2 = noPrep}) ; mkVA : V -> Prep -> VA -- VA out of a verb and preposition = \v,p -> lin VA (v ** {c2 = p}) ; } ; mkVS = overload { mkVS : Str -> VS -- predictable verb with sentence complement - = \s -> lin VS (regV s) ; + = \s -> lin VS (regV s ** {compl=subjunctive}) ; mkVS : V -> VS -- VS out of a verb - = \v -> lin VS v + = \v -> lin VS (v ** {compl=subjunctive}) } ; mkVV = overload { @@ -185,7 +188,7 @@ oper mkPrep = overload { mkPrep : Str -> Prep -- Takes a string, returns a preposition. - = \str -> lin Prep {s = str ; ra = [] ; mod = Bare} ; + = \str -> lin Prep (prepOrRa str) ; mkPrep : Str -> Mod -> Prep -- Takes a string and Mod (so far only option is ezafe), returns a preposition. = \str,m -> lin Prep {s = str ; ra = [] ; mod=m} } ; @@ -213,9 +216,9 @@ oper mkSubj = overload { mkSubj : Str -> Subj -- Takes its verbal complement in indicative. - = \s -> lin Subj {s=s ; compl=indicative} ; + = \s -> mkSubj' s ; mkSubj : VVForm -> Str -> Subj -- Specify whether it takes complement in subjunctive or indicative. - = \vvf,s -> lin Subj {s=s ; compl=vvf} + = \vvf,s -> mkSubj' s ** {compl=vvf} } ; mkInterj : Str -> Interj @@ -245,6 +248,13 @@ oper Mod = ResPes.Mod ; ezafe = ResPes.Ezafe ; + + mkSubj' : Str -> Subj ; + mkSubj' s = lin Subj (case s of { + "آن" => {s = [] ; relpron = Ance ; compl = indicative} ; + _ => {s = s ; relpron = Ke ; compl = indicative} + }) ; + -- Removed mkV_1, mkV_2, mkN01 and mkN02 from public API, still available for -- any applications that open ParadigmsPes. /IL 2019-02-08 mkV_1 : Str -> V @@ -303,6 +313,8 @@ oper = \a,c -> lin A2 (mkAdj a a ** {c2 = c}) } ; + prefixA a = a ** {isPre=True}; + preA : (adj,adv : Str) -> A = \adj,adv -> lin A ((mkAdj adj adv) ** {isPre=True}) ; @@ -357,25 +369,29 @@ oper "را" => {s = [] ; ra = "را" ; mod=Bare} ; prep => {s = prep ; ra = []; mod=Bare} } ; + noPrep = prepOrRa [] ; + ezafePrep = {s = [] ; ra = [] ; mod=Ezafe} ; mkPost : Str -> Prep = \s -> lin Prep {s=[] ; ra=s ; mod=Bare} ; mkN2 = overload { mkN2 : Str -> N2 -- Predictable N2 without complement - = \s -> lin N2 (mkN01 s inanimate ** {c2,compl = []}) ; + = \s -> lin N2 (mkN01 s inanimate ** {c2 = ezafePrep ; compl = []}) ; mkN2 : N -> N2 -- N2 from without complement - = \n -> lin N2 (n ** {c2,compl = []}) ; + = \n -> lin N2 (n ** {c2 = ezafePrep ; compl = []}) ; mkN2 : N -> Str -> N2 - = \n,c -> lin N2 (n ** {c2 = c ; compl = []}) ; + = \n,c -> lin N2 (n ** {c2 = prepOrRa c ; compl = []}) ; mkN2 : N -> Prep -> Str -> N2 -- hidden from puclic API - = \n,p,c -> lin N2 (n ** {c2 = p.s; compl = []}) + = \n,p,c -> lin N2 (n ** {c2 = p; compl = []}) } ; mkN3 = overload { mkN3 : N -> Str -> Str -> N3 + = \n,p,q -> lin N3 (n ** {c2 = prepOrRa p ; c3 = prepOrRa q}) ; + mkN3 : N -> Prep -> Prep -> N3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; mkN3 : N -> Prep -> Str -> Str -> N3 -- hidden from public API - = \n,p,q,r -> lin N3 (n ** {c2 = p.s ; c3 = q ; c4 = r}) -- there is no c4 + = \n,p,q,r -> lin N3 (n ** {c2 = p ; c3 = prepOrRa q ; c4 = r}) -- there is no c4 } ; diff --git a/src/persian/ResPes.gf b/src/persian/ResPes.gf index 22b3bbc1c..cc773a539 100644 --- a/src/persian/ResPes.gf +++ b/src/persian/ResPes.gf @@ -67,16 +67,23 @@ resource ResPes = MorphoPes ** open Prelude,Predef in { ----------------------- param VVType = NoVV | FullVV | DefVV ; - VVForm = Indic | Subj ; - VVTense = VVPres | VVPerf | VVPast ; -- VVPast Anteriority ??? + VVForm = Indic | Subj ; ---| SubjPast ; -- TODO extend this to VV, VS and Subj + VVTense = VVPres | VVPast VVForm ; TAnt = TA Tense Anteriority ; oper - -- TODO: all forms - ta2vvt : TAnt -> VVTense = \ta -> case ta of { - TA Pres Anter => VVPerf ; - TA Past _ => VVPast ; + -- VVPast Subj is another possibility, used in constructions such as + -- قاتل نمی توانسته آنجا بوده باشد، چون او آن زمان در پاریس بوده + -- The form is created in complVV, but not currently used in other functions. /IL + ta2vvt : TAnt -> VVType -> VVTense = \ta,vvtype -> case ta of { + TA Pres Anter | + TA Past _ => VVPast Indic ; + TA Cond Simul => VVPres ; + TA Cond Anter => + case vvtype of { + DefVV => VVPast Indic ; + _ => VVPres } ; _ => VVPres } ; VV : Type = Verb ** { @@ -95,20 +102,18 @@ oper } ; showVPH = overload { - showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' VVPres ; - showVPH : VVTense -> VerbForm -> Agr -> VPH -> Str = showVPH' + showVPH : VerbForm -> Agr -> VPH -> Str = showVPH' False VVPres ; + showVPH : VVTense -> VerbForm -> Agr -> VPH -> Str = showVPH' False } ; - showVPH' : VVTense -> VerbForm -> Agr -> VPH -> Str = - \ant,vf,agr,vp -> vp.ad ++ vp.comp ! agr ++ vp.obj - ++ vp.prefix ++ vp.s ! vf - ++ vp.vComp ! agr ! ant ++ vp.embComp ; - - -- A hack: we reuse the obj field for the VP complement in - -- SlashV2V and this is needed to get the right word order for complVV. - showVPHvv : VerbForm -> Agr -> VPH -> Str = \vf,agr,vp -> - vp.comp ! agr ++ vp.prefix ++ vp.s ! vf -- vp.ad is missing on purpose! we add it in insertVV. - ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp ; + showVPH' : Bool -> VVTense -> VerbForm -> Agr -> VPH -> Str = + \showImpPref,ant,vf,agr,vp -> + let impPref = case showImpPref of { + True => vp.s ! ImpPrefix Pos ; + False => [] } + in vp.ad ++ vp.comp ! agr ++ vp.obj + ++ vp.prefix ++ impPref ++ vp.s ! vf + ++ vp.vComp ! agr ! ant ++ vp.embComp ; Compl : Type = {s : Str ; ra : Str ; mod : Mod} ; @@ -131,18 +136,22 @@ oper predVc : (Verb ** {c2 : Compl}) -> VPHSlash = \verb -> predV verb ** vs verb.c2 ; - passV : Verb -> VPH = \v -> predV v ** { + passV : Verb -> VPH = \v -> passVP (predV v) ; + + passVP : VPH -> VPH = \vp -> vp ** { s = becomeVerb.s ; - prefix = case v.passive of { - Add => v.s ! PerfStem ++ v.prefix ; - Replace => v.prefix + prefix = case vp.passive of { + Add => vp.s ! PerfStem ++ vp.prefix ; + Replace => vp.prefix } ; } ; -- --------------------- -- VP complementation --------------------- appComp : Compl -> (Mod=>Str) -> Str = \c2,obj -> - c2.s ++ obj ! c2.mod ++ c2.ra ; + case c2.mod of { + Ezafe => runtimeKasre c2.s ++ obj ! Bare ++ c2.ra ; + _ => c2.s ++ obj ! c2.mod ++ c2.ra } ; insertComp : (Agr => Str) -> VPH -> VPH = \obj,vp -> vp ** { comp = \\a => vp.comp ! a ++ obj ! a @@ -159,7 +168,6 @@ oper insertVV : VV -> VPH -> VPH = \vv,vp -> predV vv ** { vComp = \\a,t => vp.vComp ! a ! t ++ complVV vv vp ! a ! t ; vvtype = case vv.isDef of {True => DefVV ; _ => FullVV} ; - ad = vp.ad -- because complVV doesn't include ad! for word order. } ; embComp : Str -> VPH -> VPH = \str,vp -> vp ** { @@ -181,15 +189,15 @@ oper \\agr,ant => if_then_Str vv.isAux conjThat [] ++ case of { -- Auxiliaries with defective inflection: complement inflects in tense - => showVPHvv (VPast Pos agr) agr vp ; --- => showVPH PerfStem agr vp ++ pluperfAux Pos agr ; -- TODO do we need this? - => showVPHvv PerfStem agr vp ++ subjAux Pos agr ; + => showVPH' True VVPres (VPast Pos agr) agr vp ; + => showVPH (VPast Pos agr) agr vp ; + => showVPH PerfStem agr vp ++ subjAux Pos agr ; -- Auxiliaries that take indicative (full or defective inflection) - => showVPHvv (VAor Pos agr) agr vp ; + => showVPH (VAor Pos agr) agr vp ; -- Default: complement in subjunctive - _ => showVPHvv (VSubj Pos agr) agr vp ---- TODO more forms ? + _ => showVPH (VSubj Pos agr) agr vp } ; insertAdV : Str -> VPH -> VPH = \ad,vp -> vp ** { @@ -205,16 +213,15 @@ oper SlClause : Type = {quest : Order => Str ; subj : Str ; vp : TAnt => Polarity => Order => Str} ; ---- AR 18/9/2017 intermediate SClause to preserve SOV in e.g. QuestionPes.QuestSlash - -- TODO: check the VV forms with defective verbs clTable : VPH -> (Agr => TAnt => Polarity => Str) = \vp -> \\agr,vt,pol => vp.prefix ++ case vt of { TA Pres Simul => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; -- for reg. verbs, VAor pol is invariant and negation comes in ImpPrefix. TA Pres Anter => vp.s ! VPerf pol agr ; - TA Past Simul => vp.s ! VPast pol agr ; - TA Past Anter => - case vp.vvtype of { - DefVV => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; - _ => vp.s ! PerfStem ++ pluperfAux pol agr } ; + TA Past Simul => vp.s ! VPast pol agr ; -- Past Simul: simple past + TA Past Anter | TA Cond _ => -- Past Anter & Cond _: continuous past + case vp.vvtype of { + DefVV => vp.s ! VPast pol agr ; + _ => vp.s ! ImpPrefix pol ++ vp.s ! VPast Pos agr } ; TA Fut Simul => case vp.vvtype of { DefVV => vp.s ! ImpPrefix pol ++ vp.s ! VAor pol agr ; @@ -223,13 +230,8 @@ oper TA Fut Anter => case vp.vvtype of { DefVV => vp.s ! VPerf pol agr ; - _ => "خواسته" ++ pluperfAux pol agr ++ vp.s ! PastStem - } ; -- verb form need to be confirmed - TA Cond Simul => vp.s ! VSubj pol agr ; - TA Cond Anter => - case vp.vvtype of { - DefVV => vp.s ! VSubj pol agr ; - _ => vp.s ! PerfStem ++ subjAux pol agr } -- verb form to be confirmed + _ => futAux pol agr ++ vp.s ! PastStem + } } ; mkClause : NP -> VPH -> Clause = \np,vp -> @@ -243,7 +245,7 @@ oper subj = np2str np ; vp = \\ta,p,ord => let vps = clTable vp ! np.a ! ta ! p ; - vvt = ta2vvt ta ; + vvt = ta2vvt ta vp.vvtype ; in case vp.vvtype of { DefVV => vps ++ vp.ad ++ vp.comp ! np.a ++ vp.obj @@ -257,9 +259,8 @@ oper s = \\ta,p,ord => let vps = clTable vp ! agr ! ta ! p ; quest = case ord of { ODir => [] ; OQuest => "آیا" } ; - vvt = ta2vvt ta ; + vvt = ta2vvt ta vp.vvtype ; in quest ++ subj ++ vp.ad ++ vp.comp ! agr ++ vp.obj --- in quest ++ vp.ad ++ subj ++ vp.comp ! agr ++ vp.obj -- TODO check which word order is better /IL ++ vps ++ vp.vComp ! agr ! vvt ++ vp.embComp }; diff --git a/src/persian/StructuralPes.gf b/src/persian/StructuralPes.gf index 6ecc2817f..e4d0c1fd9 100644 --- a/src/persian/StructuralPes.gf +++ b/src/persian/StructuralPes.gf @@ -26,7 +26,7 @@ concrete StructuralPes of Structural = CatPes ** either7or_DConj = sd2 "یا" "یا" ** {n = Sg} ; -- everybody_NP = R.indeclNP "هر کwی"; every_Det = mkDet "هر" Sg ; --- everything_NP = R.indeclNP ["هر XE"])); + everything_NP = DetCN (mkDet "همه" Sg) (UseN (mkN "چیز")) ; everywhere_Adv = ss ["هر جا"] ; few_Det = mkDet ["تعداد کمی"] Pl True; -- check for_Prep = mkPrep "برای" Ezafe ; diff --git a/src/persian/SymbolPes.gf b/src/persian/SymbolPes.gf index 59f02f6c7..26298aedc 100644 --- a/src/persian/SymbolPes.gf +++ b/src/persian/SymbolPes.gf @@ -24,8 +24,8 @@ concrete SymbolPes of Symbol = CatPes ** open Prelude, ResPes in { } ; SymbS sy = {s = \\_ => sy.s} ; - SymbNum sy = { s = sy.s ; n = Pl } ; - SymbOrd sy = { s = sy.s ++ "wN" ; n = Pl; isNum,isPre=False} ; + SymbNum sy = {s = sy.s ; n = Pl} ; + SymbOrd sy = {s = sy.s ; n = Sg ; isNum,isPre=False} ; lincat diff --git a/src/persian/VerbPes.gf b/src/persian/VerbPes.gf index cff7d80d3..50a037149 100644 --- a/src/persian/VerbPes.gf +++ b/src/persian/VerbPes.gf @@ -13,9 +13,13 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in { ComplSlash = complSlash ; ComplVV = insertVV ; - ComplVS v s = embComp (conjThat ++ s.s ! Indic) (predV v) ; + ComplVS v s = embComp (conjThat ++ s.s ! v.compl) (predV v) ; ComplVQ v q = embComp (conjThat ++ q.s) (predV v) ; - ComplVA v ap = insertObj (appComp v.c2 ap.s) (predV v) ; -- check form of adjective + ComplVA v ap = let adjStr = appComp v.c2 ap.s in + case ap.afterPrefix of { + True => predV (v ** {prefix = v.prefix ++ adjStr}) ; + False => insertObj adjStr (predV v) -- check form of adjective + } ; SlashVV vv vps = vps ** ComplVV vv vps ; SlashV2S v s = predVc v ** embComp (conjThat ++ s.s ! Indic) (predV v) ; diff --git a/src/portuguese/DiffPor.gf b/src/portuguese/DiffPor.gf index e7463c61c..096dd78a1 100644 --- a/src/portuguese/DiffPor.gf +++ b/src/portuguese/DiffPor.gf @@ -238,7 +238,7 @@ instance DiffPor of DiffRomance - [iAdvQuestionInv,chooseTA,otherInv,partAgr,sta => ; --# notpresent => ; --# notpresent => ; --# notpresent - => ; --# notpresent + => ; --# notpresent => ; --# notpresent => } ; diff --git a/src/portuguese/ExtendPor.gf b/src/portuguese/ExtendPor.gf index f831bbbc8..d7081b36e 100644 --- a/src/portuguese/ExtendPor.gf +++ b/src/portuguese/ExtendPor.gf @@ -8,6 +8,7 @@ concrete ExtendPor of Extend = CatPor ** ExtendRomanceFunctor - GenRP, ICompAP, InOrderToVP, + EmbedSSlash, WithoutVP, iFem_Pron, theyFem_Pron, @@ -60,6 +61,9 @@ concrete ExtendPor of Extend = CatPor ** ExtendRomanceFunctor - exist_V : V ; exist_V = mkV "existir" ; + lin + EmbedSSlash s = {s = \\_ => "o que" ++ s.s ! {g = Masc ; n = Sg} ! Indic} ; + lin CompoundN noun noun2 = { -- order is different because that's needed for correct translation from english s = \\n => noun2.s ! n diff --git a/src/romance/ExtendRomanceFunctor.gf b/src/romance/ExtendRomanceFunctor.gf index ef2b2f6eb..deb5d0091 100644 --- a/src/romance/ExtendRomanceFunctor.gf +++ b/src/romance/ExtendRomanceFunctor.gf @@ -223,7 +223,15 @@ incomplete concrete ExtendRomanceFunctor of Extend = lin DetNPMasc = DetNP ; - DetNPFem = DetNP ; + DetNPFem det = + let + g = Fem ; + n = det.n + in heavyNPpol det.isNeg { + s = det.sp ! g ; + a = agrP3 g n ; + hasClit = False + } ; lin iFem_Pron = i_Pron ; -- DEFAULT I (masc) diff --git a/src/spanish/DiffSpa.gf b/src/spanish/DiffSpa.gf index af4632b23..655716a48 100644 --- a/src/spanish/DiffSpa.gf +++ b/src/spanish/DiffSpa.gf @@ -158,8 +158,8 @@ instance DiffSpa of DiffRomance - [iAdvQuestionInv,otherInv,partAgr,stare_V,vpAg relPron : Bool => AAgr => Case => Str = \\b,a,c => case c of { Nom | Acc => "que" ; - CPrep P_a => "cuyo" ; - _ => prepCase c ++ "cuyo" + CPrep P_de => "cuyo" ; + _ => prepCase c ++ "que" } ; pronSuch : AAgr => Str = aagrForms "tál" "tál" "tales" "tales" ; diff --git a/src/spanish/ExtendSpa.gf b/src/spanish/ExtendSpa.gf index 933446faa..d6f2528e3 100644 --- a/src/spanish/ExtendSpa.gf +++ b/src/spanish/ExtendSpa.gf @@ -5,6 +5,7 @@ concrete ExtendSpa of Extend = CatSpa ** ExtendRomanceFunctor - CompoundAP, CompoundN, ExistsNP, + EmbedSSlash, GenRP, GenRP, IAdvAdv, @@ -61,6 +62,8 @@ concrete ExtendSpa of Extend = CatSpa ** ExtendRomanceFunctor - s = "qué tan" ++ adv.s } ; + EmbedSSlash s = {s = \\_ => "lo que" ++ s.s ! {g=Masc ; n=Sg} ! Indic} ; + ExistsNP np = mkClause [] True False np.a (insertComplement (\\_ => (np.s ! Nom).ton) diff --git a/src/swedish/ExtendSwe.gf b/src/swedish/ExtendSwe.gf index 106b2235d..63b3fa6af 100644 --- a/src/swedish/ExtendSwe.gf +++ b/src/swedish/ExtendSwe.gf @@ -8,7 +8,7 @@ concrete ExtendSwe of Extend = CatSwe ** PassVPSlash, PassAgentVPSlash, UttVPShort, ByVP, InOrderToVP, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, - ICompAP,ProDrop, + ICompAP,ProDrop,EmbedSSlash, AdAdV, PositAdVAdj, GerundCN, GerundNP, GerundAdv, PresPartAP, PastPartAP, PastPartAgentAP, RNP, RNPList, ReflRNP, ReflPron, ReflPoss, PredetRNP, ConjRNP, Base_rr_RNP, Base_nr_RNP, Base_rn_RNP, Cons_rr_RNP, Cons_nr_RNP, @@ -230,4 +230,6 @@ concrete ExtendSwe of Extend = CatSwe ** } ; AdvIsNP adv np = PredVP {s = \\_ => adv.s ; a = np.a ; isPron = False} (UseComp (CompNP np)) ; + + EmbedSSlash ss = {s = "det" ++ ss.s ! Main ++ ss.c2.s ++ ss.n3 ! agrUSgP3} ; } diff --git a/treebanks/ud-rgl-trees.txt b/treebanks/ud-rgl-trees.txt index de29d12f8..faf303bc0 100644 --- a/treebanks/ud-rgl-trees.txt +++ b/treebanks/ud-rgl-trees.txt @@ -33,7 +33,7 @@ PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (ImpersCl (UseComp (CompAd PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePN john_PN) (ComplVA become_VA (PositA clever_A))))) NoVoc PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePN john_PN) (ProgrVP (UseV sleep_V))))) NoVoc PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (ExistNPAdv (DetCN (DetQuant IndefArt NumSg) (UseN cow_N)) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN forest_N)))))) NoVoc -PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredSCVP (EmbedQS (UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whatSg_IP (SlashVP (UsePron she_Pron) (SlashV2a do_V2))))) (UseComp (CompAP (PositA important_A)))))) NoVoc +PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredSCVP (EmbedSSlash (UseSlash (TTAnt TPast ASimul) PPos (SlashVP (UsePron she_Pron) (SlashV2a do_V2)))) (UseComp (CompAP (PositA important_A)))))) NoVoc PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredSCVP (EmbedS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron she_Pron) (UseV sleep_V)))) (AdvVP (PassV2 see_V2) (PrepNP by8agent_Prep everything_NP))))) NoVoc PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN man_N)) (UseComp (CompAdv here_Adv))))) NoVoc PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN book_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a like_V2))))) NoVoc