From 5871f9c1651e1eda6aec3cd22221e9f9a7dc236b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 3 Oct 2019 17:56:44 +0200 Subject: [PATCH 1/4] (Som) Implement GenModNP + restructure ComplN2 to better reuse code --- src/somali/ExtendSom.gf | 4 ++++ src/somali/NounSom.gf | 34 +++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/somali/ExtendSom.gf b/src/somali/ExtendSom.gf index 5d62124b6..fdef37935 100644 --- a/src/somali/ExtendSom.gf +++ b/src/somali/ExtendSom.gf @@ -6,6 +6,10 @@ concrete ExtendSom of Extend = CatSom ** open Prelude, ResSom in { lin + + -- : Num -> NP -> CN -> NP ; -- this man's car(s) + GenModNP num np cn = DetCN (DetQuant IndefArt num) (genModCN cn np) ; + -- : NP -> SSlash -> Utt ; -- her I love -- Saeed p. 189- FocusObj np sslash = -- FIXME: preposition disappears in negative sentences let ss = sslash.s ! False ; diff --git a/src/somali/NounSom.gf b/src/somali/NounSom.gf index e41754d1f..5432a8b49 100644 --- a/src/somali/NounSom.gf +++ b/src/somali/NounSom.gf @@ -226,21 +226,7 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { UseN,UseN2 = ResSom.useN ; -- : N2 -> NP -> CN ; -- Sahra hooyadeed - ComplN2 n2 np = let cn = useN n2 in cn ** {s = \\nf => - let num = case nf of { - Def n => n ; - Indef n => n ; - _ => Sg } ; - art = gda2da cn.gda ! num ; - qnt = PossPron (pronTable ! np.a) ; - det = case cn.shortPoss of { - True => qnt.shortPoss ! art ; - _ => qnt.s ! sg n2.gda ! Abs } ; - noun = case np.isPron of { - True => (pronTable ! np.a).sp ! Abs ; -- long subject pronoun - False => np.s ! Abs } - in noun ++ cn.s ! Def num ++ BIND ++ det ; - isPoss = True} ; + ComplN2 n2 np = genModCN (useN n2) np ; {- -- : N3 -> NP -> N2 ; -- distance from this city (to Paris) @@ -346,4 +332,22 @@ oper => "ee" ; _ => [] } ; + + genModCN : CN -> NP -> CN = \cn,np -> cn ** { + s = \\nf => + let num = case nf of { + Def n => n ; + Indef n => n ; + _ => Sg } ; + art = gda2da cn.gda ! num ; + qnt = PossPron (pronTable ! np.a) ; + det = case cn.shortPoss of { + True => qnt.shortPoss ! art ; + _ => qnt.s ! sg cn.gda ! Abs } ; + noun = case np.isPron of { + True => (pronTable ! np.a).sp ! Abs ; -- long subject pronoun + False => np.s ! Abs } + in noun ++ cn.s ! Def num ++ BIND ++ det ; + isPoss = True} ; + } From c2e0c709a764cf1bd10425943a80210dcb435c12 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 3 Oct 2019 17:59:00 +0200 Subject: [PATCH 2/4] (Som) Update FocusObj and UseSlash to new type of SSlash --- src/somali/ExtendSom.gf | 6 +----- src/somali/SentenceSom.gf | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/somali/ExtendSom.gf b/src/somali/ExtendSom.gf index fdef37935..dd8266f77 100644 --- a/src/somali/ExtendSom.gf +++ b/src/somali/ExtendSom.gf @@ -11,11 +11,7 @@ lin GenModNP num np cn = DetCN (DetQuant IndefArt num) (genModCN cn np) ; -- : NP -> SSlash -> Utt ; -- her I love -- Saeed p. 189- - FocusObj np sslash = -- FIXME: preposition disappears in negative sentences - let ss = sslash.s ! False ; - ssSub = sslash.s ! True ; -- the negative particle is the same as subordinate, but verb forms come from main clause - obj = objpron np ! Abs ; - in {s = ssSub.beforeSTM ++ "waxa" ++ ssSub.stm ++ ss.afterSTM ++ obj} ; + FocusObj np sslash = {s = sslash.s ! False ++ objpron np ! Abs} ; -- FocusAdv : Adv -> S -> Utt ; -- today I will sleep -- FocusAdV : AdV -> S -> Utt ; -- never will I sleep diff --git a/src/somali/SentenceSom.gf b/src/somali/SentenceSom.gf index 27167f21f..3460e003f 100644 --- a/src/somali/SentenceSom.gf +++ b/src/somali/SentenceSom.gf @@ -28,7 +28,11 @@ lin -} -- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen UseSlash t p cls = { - s = \\isSubord => let cl = cl2sentence isSubord cls in + s = \\isSubord => + let cls' : ClSlash = cls ** { + stm = modSTM "waxa" "waxa aan" cls.stm -- Saeed p. 195 + } ; + cl : Clause = cl2sentence isSubord cls' in t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p } ; From 6a1ebffcee5d8d43cecd84a8c5b0af21331c1e37 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 3 Oct 2019 18:01:26 +0200 Subject: [PATCH 3/4] (Som) Implement remaining funs needed for ExtendSom + use ExtendFunctor --- src/somali/AdjectiveSom.gf | 4 +++- src/somali/ExtendSom.gf | 6 +++--- src/somali/IdiomSom.gf | 17 ++++++++--------- src/somali/SentenceSom.gf | 8 +++----- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/somali/AdjectiveSom.gf b/src/somali/AdjectiveSom.gf index 19b4e6fd3..a971d7292 100644 --- a/src/somali/AdjectiveSom.gf +++ b/src/somali/AdjectiveSom.gf @@ -48,7 +48,9 @@ concrete AdjectiveSom of Adjective = CatSom ** open ResSom, Prelude in { -- phrases, although the semantics is only clear for some adjectives. -- : AP -> SC -> AP ; -- good that she is here - -- SentAP ap sc = ap ** { } ; + SentAP ap sc = ap ** { + s = \\af => ap.s ! af ++ sc.s -- TODO check + } ; -- An adjectival phrase can be modified by an *adadjective*, such as "very". diff --git a/src/somali/ExtendSom.gf b/src/somali/ExtendSom.gf index dd8266f77..d16c7b3a7 100644 --- a/src/somali/ExtendSom.gf +++ b/src/somali/ExtendSom.gf @@ -1,9 +1,9 @@ --# -path=.:../common:../abstract concrete ExtendSom of Extend = CatSom - -- ** ExtendFunctor -- Add this back when all relevant functions are implemented - -- with (Grammar=GrammarSom) - ** open Prelude, ResSom in { + ** ExtendFunctor - [GenModNP, FocusObj, ComplDirectVS, ComplDirectVQ] + with (Grammar=GrammarSom) + ** open Prelude, ResSom, NounSom in { lin diff --git a/src/somali/IdiomSom.gf b/src/somali/IdiomSom.gf index 01f7948fe..fdd132a55 100644 --- a/src/somali/IdiomSom.gf +++ b/src/somali/IdiomSom.gf @@ -1,27 +1,26 @@ --1 Idiom: Idiomatic Expressions -concrete IdiomSom of Idiom = CatSom ** open Prelude, ResSom, VerbSom in { +concrete IdiomSom of Idiom = CatSom ** open Prelude, ResSom, VerbSom, NounSom, StructuralSom in { -- This module defines constructions that are formed in fixed ways, -- often different even in closely related languages. lin - -- : VP -> Cl ; -- it is hot - --ImpersCl = ; - - -- : VP -> Cl ; -- one sleeps - GenericCl vp = predVP impersNP (passVP vp) ; + -- ImpersCl : VP -> Cl ; -- it is hot + -- GenericCl : VP -> Cl ; -- one sleeps + ImpersCl, + GenericCl = \vp -> predVP impersNP (passVP vp) ; {- CleftNP : NP -> RS -> Cl ; -- it is I who did it CleftAdv : Adv -> S -> Cl ; -- it is here she slept -} -- : NP -> Cl ; -- there is a house - -- ExistNP np = - -- let vp = UseComp (CompNP np) - -- in ; + ExistNP np = + let vp = UseComp (CompNP np) + in predVP impersNP vp ; {- ExistIP : IP -> QCl ; -- which houses are there diff --git a/src/somali/SentenceSom.gf b/src/somali/SentenceSom.gf index 3460e003f..4c044bb29 100644 --- a/src/somali/SentenceSom.gf +++ b/src/somali/SentenceSom.gf @@ -42,19 +42,17 @@ lin --2 Embedded sentences -{- -- : S -> SC ; - EmbedS s = { } ; + EmbedS s = {s = s.s ! True} ; -- choose subordinate -- : QS -> SC ; - EmbedQS qs = { } ; + -- EmbedQS qs = { } ; -- : VP -> SC ; - EmbedVP vp = { s = linVP vp } ; + EmbedVP vp = {s = infVP vp} ; --2 Sentences --} -- : Temp -> Pol -> Cl -> S ; UseCl t p cls = { s = \\isSubord => let cl = cl2sentence isSubord cls in From 0ef64ed77a031d3523bcfd1be2d7bd8829e35425 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 3 Oct 2019 18:01:43 +0200 Subject: [PATCH 4/4] (Som) Remove implemented funs from MissingSom --- src/somali/MissingSom.gf | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/src/somali/MissingSom.gf b/src/somali/MissingSom.gf index 6d3ad2ee8..f99d8d6b6 100644 --- a/src/somali/MissingSom.gf +++ b/src/somali/MissingSom.gf @@ -21,43 +21,28 @@ oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ; oper ApposCN : CN -> NP -> CN = notYet "ApposCN" ; oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ; oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ; -oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ; oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ; oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ; -oper BaseNP : NP -> NP -> ListNP = notYet "BaseNP" ; -oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ; oper BaseS : S -> S -> ListS = notYet "BaseS" ; oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ; oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ; oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ; -oper CompAdv : Adv -> Comp = notYet "CompAdv" ; -oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ; -oper CompIP : IP -> IComp = notYet "CompIP" ; -oper ComparA : A -> NP -> AP = notYet "ComparA" ; oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ; oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ; oper ComplA2 : A2 -> NP -> AP = notYet "ComplA2" ; oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ; oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ; -oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ; oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ; -oper ComplVS : VS -> S -> VP = notYet "ComplVS" ; oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ; 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" ; -oper ConjNP : Conj -> ListNP -> NP = notYet "ConjNP" ; -oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ; oper ConjS : Conj -> ListS -> S = notYet "ConjS" ; oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ; oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ; -oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ; oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ; oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ; -oper ConsNP : NP -> ListNP -> ListNP = notYet "ConsNP" ; -oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ; oper ConsS : S -> ListS -> ListS = notYet "ConsS" ; oper CountNP : Det -> NP -> NP = notYet "CountNP" ; oper DefArt : Quant = notYet "DefArt" ; @@ -68,23 +53,16 @@ oper DetNP : Det -> NP = notYet "DetNP" ; oper DetQuant : Quant -> Num -> Det = notYet "DetQuant" ; 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 ExistIP : IP -> QCl = notYet "ExistIP" ; oper ExistIPAdv : IP -> Adv -> QCl = notYet "ExistIPAdv" ; -oper ExistNP : NP -> Cl = notYet "ExistNP" ; oper ExistNPAdv : NP -> Adv -> Cl = notYet "ExistNPAdv" ; oper ExtAdvS : Adv -> S -> S = notYet "ExtAdvS" ; oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ; oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ; -oper GenericCl : VP -> Cl = notYet "GenericCl" ; oper IdRP : RP = notYet "IdRP" ; oper IdetIP : IDet -> IP = notYet "IdetIP" ; -oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ; oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ; oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; -oper ImpVP : VP -> Imp = notYet "ImpVP" ; -oper ImpersCl : VP -> Cl = notYet "ImpersCl" ; oper NumCard : Card -> Num = notYet "NumCard" ; oper NumDigits : Digits -> Card = notYet "NumDigits" ; oper NumNumeral : Numeral -> Card = notYet "NumNumeral" ; @@ -102,21 +80,10 @@ oper PossPron : Pron -> Quant = notYet "PossPron" ; oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ; oper PredetNP : Predet -> NP -> NP = notYet "PredetNP" ; oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ; -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 QuestQVP : IP -> QVP -> QCl = notYet "QuestQVP" ; -oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ; -oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ; oper ReflA2 : A2 -> AP = notYet "ReflA2" ; -oper RelCN : CN -> RS -> CN = notYet "RelCN" ; oper RelCl : Cl -> RCl = notYet "RelCl" ; -oper RelNP : NP -> RS -> NP = notYet "RelNP" ; oper RelS : S -> RS -> S = notYet "RelS" ; -oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ; -oper RelVP : RP -> VP -> RCl = notYet "RelVP" ; -oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ; oper SelfAdVVP : VP -> VP = notYet "SelfAdVVP" ; oper SelfAdvVP : VP -> VP = notYet "SelfAdvVP" ; oper SelfNP : NP -> NP = notYet "SelfNP" ; @@ -125,10 +92,8 @@ oper SentCN : CN -> SC -> CN = notYet "SentCN" ; oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ; oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ; oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ; -oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ; oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ; oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ; -oper SlashVP : NP -> VPSlash -> ClSlash = notYet "SlashVP" ; oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ; oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ; oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;