diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..251055ec7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: Check that the RGL can successfully build + +on: + - push + - pull_request + +jobs: + build: + runs-on: ubuntu-20.04 + env: + GF_VERSION: 3.11 + DEST: gf-rgl + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Download GF + uses: dsaltares/fetch-gh-release-asset@1.1.1 + with: + repo: 'GrammaticalFramework/gf-core' + version: 'tags/${{ env.GF_VERSION }}' + file: 'gf-${{ env.GF_VERSION }}-ubuntu-20.04.deb' + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install GF + run: | + sudo dpkg -i gf-${GF_VERSION}-ubuntu-20.04.deb + + - name: Build RGL + run: | + mkdir -p ${DEST} + bash Setup.sh --dest=${DEST} --gf=gf --verbose diff --git a/languages.csv b/languages.csv index 76cae9625..ac2d7cafa 100644 --- a/languages.csv +++ b/languages.csv @@ -52,3 +52,4 @@ Tha,Thai,thai,,to_thai,,,,,,y Tur,Turkish,turkish,,,y,,,n,,n Urd,Urdu,urdu,Hindustani,,,,,,,y Som,Somali,somali,,,,,n,n,,n +Zul,Zulu,zulu,,,,,n,n,,n diff --git a/src/README.md b/src/README.md index fd22f494c..5999aef43 100644 --- a/src/README.md +++ b/src/README.md @@ -12,11 +12,31 @@ This Readme was written by Nemo and edited by Inari on 14th August 2022. # Creating a new resource grammar -If you are working on an RGL for a new language, you will need to run "Clone.hs" in the "src" folder so that you can clone a project from another language to your language to give you a basis to start with. +If you are working on an RGL for a new language, you will need to run "Clone.hs" in the "src" folder so that you can clone a project from another language to your language to give you a basis to start with. -As per the instructions, the syntax is "Clone fromdir todir fromlang tolang", e.g. "runghc Clone swedish danish Swe Dan". You may want to add the option --comment-body after the word "Clone" to comment out every line in the body of the files to start fresh. +### From an existing RGL language -This is especially useful if your new language has very little in common with the language you are copying from because they come from different language families. +If your language already has a close relative in the RGL, then you can clone your language from that one, in order reuse the same structures with only minor modifications. As per the instructions, the syntax is `Clone fromdir todir fromlang tolang`.Suppose you want to clone Slovak from Czech, then do as follows: + +```bash +$ runghc Clone czech slovak Cze Slo +``` + +You may want to add the option `--comment-body` after the word `Clone` to comment out every line in the body of the files. + +```bash +$ runghc Clone --comment-body czech slovak Cze Slo +``` + +### From a generic template + +Often it is easier to start from a rather clean slate, so the recommended way is to clone the [TEMPLATE](TEMPLATE/) module. So suppose you want to start a resource grammar for Albanian, do it as follows: + +```bash +$ runghc Clone TEMPLATE albanian TMP Sqi +``` + +You will see more detailed instructions on how to continue from the cloned template in the [README file](template/README.md). # File hierarchy @@ -43,7 +63,7 @@ https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#my-naming-scheme-for-l # Main goal -You may think of your long-term goal as eventually implementing all the abstract functions found in the "abstract" folder. In other words, you are somewhat constrained by the available categories in Cat.gf and functions in relevant e.g. Noun.gf, Verb.gf etc. files. +You may think of your long-term goal as eventually implementing all the abstract functions found in the "abstract" folder. In other words, you are somewhat constrained by the available categories in Cat.gf and functions in relevant e.g. Noun.gf, Verb.gf etc. files. In the future, if you find that the available functions do not apply to your language, you may search in the Extend.gf file for more optional functions, or in Extra.gf. if it doesn't exist, create your own ExtraLangAbs.gf with the concrete ExtraLang.gf, all in the same directory gf-rgl/src/lang. This blog post contains more information. diff --git a/src/TEMPLATE/AdjectiveTMP.gf b/src/TEMPLATE/AdjectiveTMP.gf new file mode 100644 index 000000000..2122bd073 --- /dev/null +++ b/src/TEMPLATE/AdjectiveTMP.gf @@ -0,0 +1,68 @@ +concrete AdjectiveTMP of Adjective = CatTMP ** open ResTMP, Prelude in { + + flags optimize=all_subs ; + + lin + + -- : AP -> Adv -> AP ; -- warm by nature + AdvAP ap adv = ap ** { + s = ap.s ++ adv.s ; + } ; + + -- : A -> AP ; + PositA a = a ** { + compar = [] ; + } ; + + -- : A -> NP -> AP ; + ComparA a np = a ** { + compar = np.s + } ; + + -- : A2 -> NP -> AP ; -- married to her + -- ComplA2 a2 np = a2 ** { } ; + + -- : A2 -> AP ; -- married to itself + -- ReflA2 a2 = a2 ** { } ; + + -- : A2 -> AP ; -- married + UseA2 = PositA ; + + -- : A -> AP ; -- warmer + -- UseComparA a = a ** { + -- s = \\af => "???" ++ a.s ! af ; + -- compar = [] + -- } ; + + + -- : CAdv -> AP -> NP -> AP ; -- as cool as John + -- CAdvAP adv ap np = ap ** { } ; + +-- The superlative use is covered in $Ord$. + + -- : Ord -> AP ; -- warmest + -- AdjOrd ord = ord ** { + -- compar = [] + -- } ; + -- AdjOrd : Ord -> AP = + AdjOrd ord = ord ; + +-- Sentence and question complements defined for all adjectival +-- phrases, although the semantics is only clear for some adjectives. + + -- : AP -> SC -> AP ; -- good that she is here + -- SentAP ap sc = ap ** { + -- s = \\af => ap.s ! af ++ sc.s + -- } ; + +-- An adjectival phrase can be modified by an *adadjective*, such as "very". + + -- : AdA -> AP -> AP ; + -- AdAP ada ap = ap ** { } ; + + +-- It can also be postmodified by an adverb, typically a prepositional phrase. + + + +} diff --git a/src/TEMPLATE/AdverbTMP.gf b/src/TEMPLATE/AdverbTMP.gf new file mode 100644 index 000000000..7eb5289ba --- /dev/null +++ b/src/TEMPLATE/AdverbTMP.gf @@ -0,0 +1,39 @@ +concrete AdverbTMP of Adverb = CatTMP ** open ResTMP, ParadigmsTMP, Prelude in { +{- +lin + + -- : A -> Adv ; + PositAdvAdj adj = + + -- : CAdv -> A -> NP -> Adv ; -- more warmly than John + ComparAdvAdj cadv a np = + + -- : CAdv -> A -> S -> Adv ; -- more warmly than he runs + ComparAdvAdjS cadv a s = + + -- : Prep -> NP -> Adv ; + PrepNP prep np = ; + +-- Adverbs can be modified by 'adadjectives', just like adjectives. + + -- : AdA -> Adv -> Adv ; -- very quickly + AdAdv ada adv = adv ** + +-- Like adverbs, adadjectives can be produced by adjectives. + + -- : A -> AdA ; -- extremely + PositAdAAdj a = + + -- Subordinate clauses can function as adverbs. + + -- : Subj -> S -> Adv ; + SubjS subj s = {s = subj.s ++ s.s} ; + +-- Comparison adverbs also work as numeral adverbs. + + -- : CAdv -> AdN ; -- less (than five) + AdnCAdv cadv = ; + +-} + +} diff --git a/src/TEMPLATE/AllTMP.gf b/src/TEMPLATE/AllTMP.gf new file mode 100644 index 000000000..8709fafec --- /dev/null +++ b/src/TEMPLATE/AllTMP.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common:../prelude + +concrete AllTMP of AllTMPAbs = + LangTMP, + ExtendTMP + ; diff --git a/src/TEMPLATE/AllTMPAbs.gf b/src/TEMPLATE/AllTMPAbs.gf new file mode 100644 index 000000000..91341ce51 --- /dev/null +++ b/src/TEMPLATE/AllTMPAbs.gf @@ -0,0 +1,5 @@ +--# -path=.:../abstract:../common:prelude + +abstract AllTMPAbs = + Lang, + Extend ; diff --git a/src/TEMPLATE/CatTMP.gf b/src/TEMPLATE/CatTMP.gf new file mode 100644 index 000000000..1daeee1bd --- /dev/null +++ b/src/TEMPLATE/CatTMP.gf @@ -0,0 +1,121 @@ +concrete CatTMP of Cat = CommonX ** open ResTMP, Coordination, Prelude in { + + flags optimize=all_subs ; + + lincat + +--2 Sentences and clauses +-- Constructed in SentenceTMP, and also in IdiomTMP + S = SS ; + QS = SS ; + RS = SS ; + -- relative sentence. Tense and polarity fixed, + -- but agreement may depend on the CN/NP it modifies. + + Cl = ResTMP.LinCl ; + ClSlash = SS ; + SSlash = SS ; -- sentence missing NP; e.g. "she has looked at" + Imp = SS ; -- imperative e.g. "look at this" + +--2 Questions and interrogatives + +-- Constructed in QuestionTMP. + QCl = SS ; + IComp = SS ; -- interrogative complement of copula e.g. "where" + IDet = SS ; -- interrogative determiner e.g. "how many" + IQuant = SS ; -- interrogative quantifier e.g. "which" + IP = SS ; -- interrogative pronoun e.g. "who" + +--2 Subord clauses and pronouns + + RCl = SS ; + RP = SS ; + +--2 Verb phrases + +-- Constructed in VerbTMP. + VP = ResTMP.LinVP ; + VPSlash = SS ; + Comp = SS ; + +--2 Adjectival phrases + +-- Constructed in AdjectiveTMP. + AP = SS ; + +--2 Nouns and noun phrases + +-- Constructed in NounTMP. +-- Many atomic noun phrases e.g. "everybody" +-- are constructed in StructuralTMP. + + CN = ResTMP.LinCN ; + NP = ResTMP.LinNP ; + Pron = SS ; -- NB. Pronouns need enough info to become NP or Quant. + Det = ResTMP.LinDet ; -- s : Str , n : Number + Predet = SS ; + Quant = ResTMP.LinQuant ; -- s : Number => Str + Num = ResTMP.LinDet ; + Card = ResTMP.LinDet ; + ACard = SS ; + Ord = SS ; + DAP = SS ; + + +--2 Numerals + +-- Constructed in NumeralTMP. + + Numeral = ResTMP.LinNumeral ; + Digits = ResTMP.LinNumeral ; + +--2 Structural words + +-- Constructed in StructuralTMP. + Conj = Coordination.ConjunctionDistr ** { + n : Number -- The number of the NP that results from + -- coordinating a list of NPs with that Conj. + } ; -- "[Ann and Bob] are children" → and_Conj.n = Pl + Subj = SS ; + Prep = SS ; + + + +--2 Words of open classes + +-- These are constructed in LexiconTMP and in +-- additional lexicon modules. + + -- TODO: eventually different lincats + VS, -- sentence-complement verb e.g. "claim" + VQ, -- question-complement verb e.g. "wonder" + VA, -- adjective-complement verb e.g. "look" + V = ResTMP.LinV ; + + VV -- verb-phrase-complement verb e.g. "want" + = SS ; + + V2A, -- verb with NP and AP complement e.g. "paint" + V2V, -- verb with NP and V complement e.g. "cause" + V2S, -- verb with NP and S complement e.g. "tell" + V2Q, -- verb with NP and Q complement e.g. "ask" + V2 = SS ; + V3 = SS ; + + A = SS ; + A2 = SS ; + + N = ResTMP.LinN ; + N2 = ResTMP.LinN ; + N3 = ResTMP.LinN ; + PN = SS ; + + -- From the Names module, not in the official API as of 2023-08 + GN = SS ; -- Given name, e.g. "George" + SN = SS ; -- Second name, e.g. "Washington" + LN = SS ; -- Location name, e.g. "Sweden" + + linref + Cl = linCl ; + +} diff --git a/src/TEMPLATE/ConjunctionTMP.gf b/src/TEMPLATE/ConjunctionTMP.gf new file mode 100644 index 000000000..b6b29bf08 --- /dev/null +++ b/src/TEMPLATE/ConjunctionTMP.gf @@ -0,0 +1,147 @@ +concrete ConjunctionTMP of Conjunction = + CatTMP ** open ResTMP, Coordination, Prelude in { + + flags optimize=all_subs ; + + {- Conjunction for category X needs four things: + lincat [X] + lin BaseX + lin ConsX + lin ConjX + + For example, if X is defined as + + lincat X = {s : Number => Str ; g : Gender} ; + + then [X] will split its s field into two, and retain its other fields as is: + + lincat [X] = {s1,s2 : Number => Str ; g : Gender} ; + + Let us look at a simple case: Adv is of type {s : Str} + Then [Adv] is {s1,s2 : Str}. + BaseAdv, ConsAdv and ConjAdv can all use functions defined in prelude/Coordination: + + BaseAdv = twoSS ; + ConsAdv = consrSS comma ; + ConjAdv = conjunctSS ; + + --} + +----------------------------------------------------------------------------- +-- Adverb and other simple {s : Str} types. +lincat + [Adv],[AdV],[IAdv] = {s1,s2 : Str} ; + +lin + BaseAdv, BaseAdV, BaseIAdv = twoSS ; + ConsAdv, ConsAdV, ConsIAdv = consrSS comma ; + ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ; + +{- + +----------------------------------------------------------------------------- +-- S is sometimes already {s : Str}, sometimes open for mood or word order. +-- Simply take the lincat of S, and split the s field into s1 and s2. +-- Then make sure that all of the other fields are retained. + +lincat + [S] = {s1, s2 : …} ; + +lin + -- : S -> S -> ListS ; -- John walks, Mary runs + BaseS x y = + + -- : S -> ListS -> ListS ; -- John walks, Mary runs, Bill swims + ConsS x xs = + + -- : Conj -> ListS -> S ; -- he walks and she runs + ConjS conj xs = + +----------------------------------------------------------------------------- +-- RS is variable on … and has inherent … +-- RS can modify CNs, which are open for …, and have inherent … + +lincat + [RS] = {s1,s2 : … => Str} ; + +lin + + -- : RS -> RS -> ListRS ; -- who walks, whom I know + BaseRS x y = + + -- : RS -> ListRS -> ListRS ; -- who wals, whom I know, who is here + ConsRS x xs = + + -- : Conj -> ListRS -> RS ; -- who walks and whose mother runs + ConjRS conj xs = + + +----------------------------------------------------------------------------- +-- NP is variable on … and has inherent … + +lincat + [NP] = {s1, s2 : …} ; + +lin + -- : NP -> NP -> ListNP ; -- John, Mary + BaseNP x y = + + -- : NP -> ListNP -> ListNP ; -- John, Mary, Bill + ConsNP x xs = + + -- : Conj -> ListNP -> NP ; -- she or we + ConjNP conj xs = + +----------------------------------------------------------------------------- +-- AP is variable on … and has an inherent … + +lincat + [AP] = {s1, s2 : …} ; + +lin + -- : AP -> AP -> ListAP ; -- red, white + BaseAP x y = + + -- : AP -> ListAP -> ListAP ; -- red, white, blue + ConsAP x xs = + + -- : Conj -> ListAP -> AP ; -- cold and warm + ConjAP conj xs = + +----------------------------------------------------------------------------- +-- CN is variable on … +-- CN conjunction is not in the API, so this can be lower prio + +lincat + [CN] = {s1, s2 : …} ; + +lin + -- : CN -> CN -> ListCN ; -- man, woman + BaseCN x y = + + -- : CN -> ListCN -> ListCN ; -- man, woman, child + ConsCN x xs = + + -- : Conj -> ListCN -> CN ; -- man and woman + ConjCN conj xs = + +----------------------------------------------------------------------------- +-- Det and DAP +-- Note that there is no [Det], the way to coordinate Dets is to make them +-- into DAP first, using Noun.DetDAP : Det -> DAP ; +-- DAP ("three small") isn't used in any API functions, so lower prio. + +lincat + [DAP] = {s1, s2 : …} ; + +lin + -- : DAP -> DAP -> ListDAP ; + BaseDAP x y = + + -- : DAP -> ListDAP -> ListDAP ; + ConsDAP xs x = + + -- : Conj -> ListDAP -> Det ; -- his or her + ConjDet conj xs = +-} +} diff --git a/src/TEMPLATE/ConstructionTMP.gf b/src/TEMPLATE/ConstructionTMP.gf new file mode 100644 index 000000000..0aaa2788f --- /dev/null +++ b/src/TEMPLATE/ConstructionTMP.gf @@ -0,0 +1,117 @@ +concrete ConstructionTMP of Construction = CatTMP ** open ParadigmsTMP in { + +lincat + Timeunit = N ; + Weekday = N ; + Monthday = NP ; + Month = N ; + Year = NP ; +{- +lin + + timeunitAdv n time = + let n_card : Card = n ; + n_hours_NP : NP = mkNP n_card time ; + in SyntaxTMP.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ; + + weekdayPunctualAdv w = ; -- on Sunday + weekdayHabitualAdv w = ; -- on Sundays + weekdayNextAdv w = -- next Sunday + weekdayLastAdv w = -- last Sunday + + monthAdv m = mkAdv in_Prep (mkNP m) ; + yearAdv y = mkAdv in_Prep y ; + dayMonthAdv d m = ; -- on 17 TMP + monthYearAdv m y = ; -- in TMP 2012 + dayMonthYearAdv d m y = ; -- on 17 TMP 2013 + + intYear = symb ; + intMonthday = symb ; + +lincat Language = N ; + +lin InLanguage l = mkAdv ???_Prep (mkNP l) ; + +lin + weekdayN w = w ; + monthN m = m ; + + weekdayPN w = mkPN w ; + monthPN m = mkPN m ; + + languageCN l = mkCN l ; + languageNP l = mkNP l ; + + +oper mkLanguage : Str -> N = \s -> mkN s ; + +---------------------------------------------- +---- lexicon of special names + +lin second_Timeunit = mkN "second" ; +lin minute_Timeunit = mkN "minute" ; +lin hour_Timeunit = mkN "hour" ; +lin day_Timeunit = mkN "day" ; +lin week_Timeunit = mkN "week" ; +lin month_Timeunit = mkN "month" ; +lin year_Timeunit = mkN "year" ; + +lin monday_Weekday = mkN "Monday" ; +lin tuesday_Weekday = mkN "Tuesday" ; +lin wednesday_Weekday = mkN "Wednesday" ; +lin thursday_Weekday = mkN "Thursday" ; +lin friday_Weekday = mkN "Friday" ; +lin saturday_Weekday = mkN "Saturday" ; +lin sunday_Weekday = mkN "Sunday" ; + +lin january_Month = mkN "January" ; +lin february_Month = mkN "February" ; +lin march_Month = mkN "March" ; +lin april_Month = mkN "April" ; +lin may_Month = mkN "May" ; +lin june_Month = mkN "June" ; +lin july_Month = mkN "July" ; +lin august_Month = mkN "August" ; +lin september_Month = mkN "September" ; +lin october_Month = mkN "October" ; +lin november_Month = mkN "November" ; +lin december_Month = mkN "December" ; + +lin afrikaans_Language = mkLanguage "Afrikaans" ; +lin amharic_Language = mkLanguage "Amharic" ; +lin arabic_Language = mkLanguage "Arabic" ; +lin bulgarian_Language = mkLanguage "Bulgarian" ; +lin catalan_Language = mkLanguage "Catalan" ; +lin chinese_Language = mkLanguage "Chinese" ; +lin danish_Language = mkLanguage "Danish" ; +lin dutch_Language = mkLanguage "Dutch" ; +lin english_Language = mkLanguage "Euslish" ; +lin estonian_Language = mkLanguage "Estonian" ; +lin finnish_Language = mkLanguage "Finnish" ; +lin french_Language = mkLanguage "French" ; +lin german_Language = mkLanguage "German" ; +lin greek_Language = mkLanguage "Greek" ; +lin hebrew_Language = mkLanguage "Hebrew" ; +lin hindi_Language = mkLanguage "Hindi" ; +lin japanese_Language = mkLanguage "Japanese" ; +lin italian_Language = mkLanguage "Italian" ; +lin latin_Language = mkLanguage "Latin" ; +lin latvian_Language = mkLanguage "Latvian" ; +lin maltese_Language = mkLanguage "Maltese" ; +lin nepali_Language = mkLanguage "Nepali" ; +lin norwegian_Language = mkLanguage "Norwegian" ; +lin persian_Language = mkLanguage "Persian" ; +lin polish_Language = mkLanguage "Polish" ; +lin punjabi_Language = mkLanguage "Punjabi" ; +lin romanian_Language = mkLanguage "Romanian" ; +lin russian_Language = mkLanguage "Russian" ; +lin sindhi_Language = mkLanguage "Sindhi" ; +lin spanish_Language = mkLanguage "Spanish" ; +lin swahili_Language = mkLanguage "Swahili" ; +lin swedish_Language = mkLanguage "Swedish" ; +lin thai_Language = mkLanguage "Thai" ; +lin turkish_Language = mkLanguage "Turkish" ; +lin urdu_Language = mkLanguage "Urdu" ; + +-} +} diff --git a/src/TEMPLATE/ExtendTMP.gf b/src/TEMPLATE/ExtendTMP.gf new file mode 100644 index 000000000..599d48111 --- /dev/null +++ b/src/TEMPLATE/ExtendTMP.gf @@ -0,0 +1,35 @@ +--# -path=.:../common:../abstract + +concrete ExtendTMP of Extend = CatTMP + ** ExtendFunctor - [ + VPS -- finite VP's with tense and polarity + , ListVPS + , VPI + , ListVPI -- infinitive VP's (TODO: with anteriority and polarity) + , MkVPS + , PredVPS + + -- excluded because RGL funs needed for them not implemented yet + , SlashBareV2S + , PredAPVP + , ComplBareVS + , AdvIsNP, AdvIsNPAP + , CompBareCN + , CompIQuant + , ComplSlashPartLast + , ComplDirectVQ + , ComplDirectVS + , DetNPFem, DetNPMasc + , ExistCN, ExistMassCN, ExistPluralCN, ExistsNP + , ExistIPQS, ExistNPQS, ExistS + , PredIAdvVP + , PrepCN + , ReflPossPron + , UttVP, UttVPShort, UttAccNP, UttDatNP, UttAccIP, UttDatIP + , EmptyRelSlash, StrandQuestSlash, StrandRelSlash + , SubjRelNP + , UseComp_ser, UseComp_estar + , iFem_Pron, weFem_Pron, youFem_Pron, youPlFem_Pron, youPolFem_Pron, youPolPlFem_Pron, youPolPl_Pron, theyFem_Pron, theyNeutr_Pron + , GenModNP + + ] with (Grammar=GrammarTMP) ; diff --git a/src/TEMPLATE/GrammarTMP.gf b/src/TEMPLATE/GrammarTMP.gf new file mode 100644 index 000000000..3686dd307 --- /dev/null +++ b/src/TEMPLATE/GrammarTMP.gf @@ -0,0 +1,17 @@ +concrete GrammarTMP of Grammar = + NounTMP + , VerbTMP + , AdjectiveTMP + , AdverbTMP + , NumeralTMP + , SentenceTMP + , QuestionTMP + , RelativeTMP + , ConjunctionTMP + , PhraseTMP + , TextX + , StructuralTMP + , IdiomTMP + , TenseX + , NamesTMP -- Not part of original Grammar, here to trigger compilation + ; \ No newline at end of file diff --git a/src/TEMPLATE/IdiomTMP.gf b/src/TEMPLATE/IdiomTMP.gf new file mode 100644 index 000000000..bc3a072b0 --- /dev/null +++ b/src/TEMPLATE/IdiomTMP.gf @@ -0,0 +1,56 @@ + +--1 Idiom: Idiomatic Expressions + +concrete IdiomTMP of Idiom = CatTMP ** open Prelude, ResTMP, VerbTMP, QuestionTMP, NounTMP, StructuralTMP in { + +-- This module defines constructions that are formed in fixed ways, +-- often different even in closely related languages. + +{- + lin + + + -- ImpersCl : VP -> Cl ; -- it is hot + ImpersCl vp = { + } ; + + -- : NP -> Cl ; -- there is a house + ExistNP np = + + -- ExistIP : IP -> QCl ; -- which houses are there + ExistIP ip = + + -- GenericCl : VP -> Cl ; -- one sleeps + GenericCl 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 = + + ExistIP : IP -> QCl ; -- which houses are there + +-- 7/12/2012 generalizations of these + + ExistNPAdv : NP -> Adv -> Cl ; -- there is a house in Paris + ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris + + -- : VP -> VP ; + ProgrVP vp = vp ** { + } ; + + + -- : VP -> Utt ; -- let's go + ImpPl1 vp = { } ; + + ImpP3 : NP -> VP -> Utt ; -- let John walk + +-- 3/12/2013 non-reflexive uses of "self" + + SelfAdvVP : VP -> VP ; -- is at home himself + SelfAdVVP : VP -> VP ; -- is himself at home + SelfNP : NP -> NP ; -- the president himself (is at home) +-} + +} diff --git a/src/TEMPLATE/LangTMP.gf b/src/TEMPLATE/LangTMP.gf new file mode 100644 index 000000000..27ecda23d --- /dev/null +++ b/src/TEMPLATE/LangTMP.gf @@ -0,0 +1,5 @@ +--# -path=.:../abstract:../common:../prelude:../api +concrete LangTMP of Lang = + GrammarTMP, + LexiconTMP, + ConstructionTMP ; diff --git a/src/TEMPLATE/LexiconTMP.gf b/src/TEMPLATE/LexiconTMP.gf new file mode 100644 index 000000000..c85ec2c00 --- /dev/null +++ b/src/TEMPLATE/LexiconTMP.gf @@ -0,0 +1,419 @@ +concrete LexiconTMP of Lexicon = CatTMP ** + open ParadigmsTMP, ResTMP in { + +---- +-- A +{- +lin add_V3 = mkV3 (mkV "") ; +lin airplane_N = mkN "" ; +lin alas_Interj = mkInterj "" ; +lin already_Adv = mkA "" ; +lin animal_N = mkN "" ; +lin answer_V2S = mkV2S (mkV "") ; +lin apartment_N = mkN "" ; +lin apple_N = mkN "" ; +lin art_N = mkN "" ; +lin ashes_N = mkN "" ; +lin ask_V2Q = mkV2Q (mkV "") ; + +---- +-- B + +lin baby_N = mkN "" ; +lin back_N = mkN "" ; +lin bad_A = mkA "" ; +lin bank_N = mkN "" ; +lin bark_N = mkN "" ; +lin beautiful_A = mkA "" ; +lin become_VA = mkVA (mkV "") ; +lin beer_N = mkN "" ; +lin beg_V2V = mkV2V (mkV "") ; +lin belly_N = mkN "" ; +lin big_A = mkA "" ; +lin bike_N = mkN "" ; +lin bird_N = mkN "" ; +lin bite_V2 = mkV2 "" ; +lin black_A = mkA "" ; -} +lin blood_N = mkN "blood" ; +{-lin blow_V = mkV "" ; +lin blue_A = mkA "" ; +lin boat_N = mkN "" ; +lin bone_N = mkN "" ; +lin boot_N = mkN "" ; +lin boss_N = mkN "" ; +lin book_N = mkN "" ; +lin boy_N = mkN "" ; +lin bread_N = mkN "" ; +lin break_V2 = mkV2 "" ; +lin breast_N = mkN "" ; +lin breathe_V = mkV "" ; +lin broad_A = mkA "" ; +lin brother_N2 = mkN "" ; +lin brown_A = mkA "" ; +lin burn_V = mkV "" ; +lin butter_N = mkN "" ; +lin buy_V2 = mkV2 "" ; + +---- +-- C + +lin camera_N = mkN "" ; +lin cap_N = mkN "" ; +lin car_N = mkN "" ; +lin carpet_N = mkN "" ; +lin cat_N = mkN "" ; +lin ceiling_N = mkN "" ; +lin chair_N = mkN "" ; +lin cheese_N = mkN "" ; +lin child_N = mkN "" ; +lin church_N = mkN "" ; +lin city_N = mkN "" ; +lin clean_A = mkA "" ; +lin clever_A = mkA "" ; +lin close_V2 = mkV2 "" ; +lin cloud_N = mkN "" ; +lin coat_N = mkN "" ; +lin cold_A = mkA "" ; +lin come_V = mkV "" ; +lin computer_N = mkN "" ; +lin correct_A = mkA "" ; +lin count_V2 = mkV2 "" ; +lin country_N = mkN "" ; +lin cousin_N = mkN "" ; +lin cow_N = mkN "" ; +lin cut_V2 = mkV2 "" ; + +---- +-- D + +lin day_N = mkN "" ; -} +lin die_V = mkV "die" ; +{-lin dig_V = mkV "" ; +lin dirty_A = mkA "" ; +lin distance_N3 = mkN3 (mkN "") ; +lin do_V2 = mkV2 "" ; +lin doctor_N = mkN "" ; +lin dog_N = mkN "" ; +lin door_N = mkN "" ; +lin drink_V2 = mkV2 "" ; +lin dry_A = mkA "" ; +lin dull_A = mkA "" ; +lin dust_N = mkN "" ; + +---- +-- E + +lin ear_N = mkN "" ; +lin earth_N = mkN "" ; +lin eat_V2 = mkV "" ; +lin egg_N = mkN "" ; +lin empty_A = mkA "" ; +lin enemy_N = mkN "" ; +lin eye_N = mkN "" ; + +---- +-- F + +lin factory_N = mkN "" ; +lin fall_V = mkV "" ; +lin far_Adv = mkA "" ; +lin fat_N = mkN "" ; +lin father_N2 = mkN2 (mkN "") ; +lin fear_V2 = mkV2 "" ; +lin fear_VS = mkVS (mkV "") ; +lin feather_N = mkN "" ; +lin fight_V2 = mkV2 "" ; +lin find_V2 = mkV2 "" ; +lin fingernail_N = mkN "" ; +lin fire_N = mkN "" ; +lin fish_N = mkN "" ; +lin float_V = mkV "" ; +lin floor_N = mkN "" ; +lin flow_V = mkV "" ; +lin flower_N = mkN "" ; +lin fly_V = mkV "" ; +lin fog_N = mkN "" ; +lin foot_N = mkN "" ; +lin forest_N = mkN "" ; +lin forget_V2 = mkV2 "" ; +lin freeze_V = mkV "" ; +lin fridge_N = mkN "" ; +lin friend_N = mkN "" ; +lin fruit_N = mkN "" ; +lin full_A = mkA "" ; +--lin fun_AV + +---- +-- G + +lin garden_N = mkN "" ; +lin girl_N = mkN "" ; +lin give_V3 = mkV3 (mkV "") ; +lin glove_N = mkN "" ; +lin go_V = mkV "" ; +lin gold_N = mkN "" ; +lin good_A = mkA "" ; +lin grammar_N = mkN "" ; +lin grass_N = mkN "" ; +lin green_A = mkA "" ; + +---- +-- H + +lin hair_N = mkN "" ; +lin hand_N = mkN "" ; +lin harbour_N = mkN "" ; +lin hat_N = mkN "" ; +lin hate_V2 = mkV2 "" ; +lin head_N = mkN "" ; +lin hear_V2 = mkV2 "" ; +lin heart_N = mkN "" ; +lin heavy_A = mkA "" ; +lin hill_N = mkN "" ; +lin hit_V2 = mkV2 "" ; +lin hold_V2 = mkV2 "" ; +lin hope_VS = mkV "" ; +lin horn_N = mkN "" ; +lin horse_N = mkN "" ; +lin hot_A = mkA "" ; +lin house_N = mkN "" ; +lin hunt_V2 = mkV2 "" ; +lin husband_N = mkN "" ; + +-------- +-- I - K + +lin ice_N = mkN "" ; +lin industry_N = mkN "" ; +lin iron_N = mkN "" ; +lin john_PN = mkPN "" ; +lin jump_V = mkV "" ; +lin kill_V2 = mkV2 "" ; +lin king_N = mkN "" ; +lin knee_N = mkN "" ; +lin know_V2 = mkV2 "" ; +lin know_VQ = mkVQ (mkV "") ; +lin know_VS = mkV "" ; + + +---- +-- L + +lin lake_N = mkN "" ; +lin lamp_N = mkN "" ; +lin language_N = mkN "" ; +lin laugh_V = mkV "" ; +lin leaf_N = mkN "" ; +lin learn_V2 = mkV2 "" ; +lin leather_N = mkN "" ; +lin leave_V2 = mkV2 "" ; +lin leg_N = mkN "" ; +lin lie_V = mkV "" ; +lin like_V2 = mkV2 "" ; +lin listen_V2 = mkV2 "" ; +lin live_V = mkV ""; +lin liver_N = mkN "" ; +lin long_A = mkA "" ; +lin lose_V2 = mkV2 "" ; +lin louse_N = mkN "" ; +lin love_N = mkN "" ; +lin love_V2 = mkV2 "" ; + +---- +-- M + +lin man_N = mkN "" ; +lin married_A2 = mkA2 (mkA "") ; +lin meat_N = mkN "" ; +lin milk_N = mkN "" ; +lin moon_N = mkN "" ; +lin mother_N2 = mkN2 (mkN "") ; +lin mountain_N = mkN "" ; +lin mouth_N = mkN "" ; +lin music_N = mkN "" ; + +---- +-- N + +lin name_N = mkN "" ; +lin narrow_A = mkA "" ; +lin near_A = mkA "" ; +lin neck_N = mkN "" ; +lin new_A = mkA "" ; +lin newspaper_N = mkN "" ; +lin night_N = mkN "" ; +lin nose_N = mkN "" ; +lin now_Adv = mkAdv "" ; +lin number_N = mkN "" ; + +-------- +-- O - P + + +lin oil_N = mkN "" ; +lin old_A = mkA "" ; +lin open_V2 = mkV2 "" ; +lin paint_V2A = mkV2A (mkV "") ; +lin paper_N = mkN "" ; +lin paris_PN = mkPN "Paris" ; +lin peace_N = mkN "" ; +lin pen_N = mkN "" ; +lin person_N = mkN "" ; +lin planet_N = mkN "" ; +lin plastic_N = mkN "" ; +lin play_V = mkV "" ; +lin policeman_N = mkN "" ; +lin priest_N = mkN "" ; +lin pull_V2 = mkV2 "" ; +lin push_V2 = mkV2 "" ; +lin put_V2 = mkV2 "" ; + +-------- +-- Q - R + + +lin queen_N = mkN "" ; +lin question_N = mkN "" ; +lin radio_N = mkN "" ; +lin rain_N = mkN "" ; +lin rain_V0 = mkV "" ; +lin read_V2 = mkV2 "" ; +lin ready_A = mkA "" ; +lin reason_N = mkN "" ; +lin red_A = mkA "" ; +lin religion_N = mkN "" ; +lin restaurant_N = mkN "" ; +lin river_N = mkN "" ; +lin road_N = mkN "" ; +lin rock_N = mkN "" ; +lin roof_N = mkN "" ; +lin root_N = mkN "" ; +lin rope_N = mkN "" ; +lin rotten_A = mkA "" ; +lin round_A = mkA "" ; +lin rub_V2 = mkV2 "" ; +lin rubber_N = mkN "" ; +lin rule_N = mkN "" ; +lin run_V = mkV "" ; + +---- +-- S + +lin salt_N = mkN "" ; +lin sand_N = mkN "" ; +lin say_VS = mkVS (mkV "") ; +lin school_N = mkN "" ; +lin science_N = mkN "" ; +lin scratch_V2 = mkV2 "" ; +lin sea_N = mkN "" ; +lin see_V2 = mkV2 "" ; +lin seed_N = mkN "" ; +lin seek_V2 = mkV2 "" ; +lin sell_V3 = mkV3 (mkV "" Meng) emptyPrep emptyPrep ; -- TODO +lin send_V3 = mkV3 (mkV "") ; +lin sew_V = mkV "" ; +lin sharp_A = mkA "" ; +lin sheep_N = mkN "" fem ; +lin ship_N = mkN "" ; +lin shirt_N = mkN "" ; +lin shoe_N = mkN "" ; +lin shop_N = mkN "" ; +lin short_A = mkA "" ; +lin silver_N = mkN "" ; +lin sing_V = mkV "" ; +lin sister_N = mkN "" ; +lin sit_V = mkV "" ; +lin skin_N = mkN "" ; +lin sky_N = mkN "" ; +lin sleep_V = mkV "" ; +lin small_A = mkA "" ; +lin smell_V = mkV "" ; +lin smoke_N = mkN "" ; +lin smooth_A = mkA "" ; +lin snake_N = mkN "" ; +lin snow_N = mkN "" ; +lin sock_N = mkN "" ; +lin song_N = mkN "" ; +lin speak_V2 = mkV2 "" ; +lin spit_V = mkV "" ; +lin split_V2 = mkV2 "" ; +lin squeeze_V2 = mkV2 "" ; +lin stab_V2 = mkV2 "" ; +lin stand_V = mkV "" ; +lin star_N = mkN "" ; +lin steel_N = mkN "" ; +lin stick_N = mkN "" ; +lin stone_N = mkN "" ; +lin stop_V = mkV "" ; +lin stove_N = mkN "" ; +lin straight_A = mkA "" ; +lin student_N = mkN "" ; +lin stupid_A = mkA "" ; +lin suck_V2 = mkV2 "" ; +lin sun_N = mkN "" ; +lin swell_V = mkV "" ; +lin swim_V = mkV "" ; + +---- +-- T + + +lin table_N = mkN "" ; +lin tail_N = mkN "" ; +lin talk_V3 = mkV3 (mkV "" Ber) (mkPrep "") (mkPrep "") ; +lin teach_V2 = mkV2 "" ; +lin teacher_N = mkN "" ; +lin television_N = mkN "" ; +lin thick_A = mkA "" ; +lin thin_A = mkA "" ; +lin think_V = mkV "" ; +lin throw_V2 = mkV2 "" ; +lin tie_V2 = mkV2 "" ; +lin today_Adv = mkA "" ; +lin tongue_N = mkN "" ; +lin tooth_N = mkN "" ; +lin train_N = mkN "" ; +lin travel_V = mkV "" ; +lin tree_N = mkN "" ; +lin turn_V = mkV "" ; + +-------- +-- U - V + +lin ugly_A = mkA "" ; +lin uncertain_A = mkA "" ; +lin understand_V2 = mkV2 "" ; +lin university_N = mkN "" ; +lin village_N = mkN "" ; +lin vomit_V = mkV2 "" ; + +-------- +-- W - Y + +lin wait_V2 = mkV2 "" ; +lin walk_V = mkV "" ; +lin war_N = mkN "" ; +lin warm_A = mkA "" ; +lin wash_V2 = mkV2 "" ; +lin watch_V2 = mkV2 "" ; +lin water_N = mkNoun "" ; +lin wet_A = mkA "" ; +lin white_A = mkA "" ; +lin wide_A = mkA "" ; +lin wife_N = mkN "" ; +lin win_V2 = mkV2 "" ; +lin wind_N = mkN "" ; +lin window_N = mkN "" ; +lin wine_N = mkN "" ; +lin wing_N = mkN "" ; +lin wipe_V2 = mkV2 "" ; +lin woman_N = mkN "" ; +lin wonder_VQ = mkVQ (mkV "") ; +lin wood_N = mkN "" ; +lin worm_N = mkN "" ; +lin write_V2 = mkV2 "" ; +lin year_N = mkN "" ; +lin yellow_A = mkA "" ; +lin young_A = mkA "" ; +-} +} diff --git a/src/TEMPLATE/MissingTMP.gf b/src/TEMPLATE/MissingTMP.gf new file mode 100644 index 000000000..529ad0941 --- /dev/null +++ b/src/TEMPLATE/MissingTMP.gf @@ -0,0 +1,313 @@ +resource MissingTMP = open GrammarTMP, Prelude in { +-- temporary definitions to enable the compilation of RGL API +oper AdAP : AdA -> AP -> AP = notYet "AdAP" ; +oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ; +oper AdNum : AdN -> Card -> Card = notYet "AdNum" ; +oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ; +oper AdVVPSlash : AdV -> VPSlash -> VPSlash = notYet "AdVVPSlash" ; +oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ; +oper AdjCN : AP -> CN -> CN = notYet "AdjCN" ; +oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ; +oper AdjOrd : Ord -> AP = notYet "AdjOrd" ; +oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ; +oper AdvAP : AP -> Adv -> AP = notYet "AdvAP" ; +oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ; +oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ; +oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ; +oper AdvImp : Adv -> Imp -> Imp = notYet "AdvImp" ; +oper AdvNP : NP -> Adv -> NP = notYet "AdvNP" ; +oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ; +oper AdvS : Adv -> S -> S = notYet "AdvS" ; +oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ; +oper AdvVP : VP -> Adv -> VP = notYet "AdvVP" ; +oper AdvVPSlash : VPSlash -> Adv -> VPSlash = notYet "AdvVPSlash" ; +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 CompAP : AP -> Comp = notYet "CompAP" ; +oper CompAdv : Adv -> Comp = notYet "CompAdv" ; +oper CompCN : CN -> Comp = notYet "CompCN" ; +oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ; +oper CompIP : IP -> IComp = notYet "CompIP" ; +oper CompNP : NP -> Comp = notYet "CompNP" ; +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 ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ; +oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ; +oper ComplSlash : VPSlash -> NP -> VP = notYet "ComplSlash" ; +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 ComplVV : VV -> VP -> VP = notYet "ComplVV" ; +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 DetCN : Det -> CN -> NP = notYet "DetCN" ; +oper DetDAP : Det -> DAP = notYet "DetDAP" ; +oper DetNP : Det -> NP = notYet "DetNP" ; +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 IdetCN : IDet -> CN -> IP = notYet "IdetCN" ; +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 MassNP : CN -> NP = notYet "MassNP" ; +oper NumCard : Card -> Num = notYet "NumCard" ; +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 PConjConj : Conj -> PConj = notYet "PConjConj" ; +oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ; +oper PartNP : CN -> NP -> CN = notYet "PartNP" ; +oper PassV2 : V2 -> VP = notYet "PassV2" ; +oper PhrUtt : PConj -> Utt -> Voc -> Phr = notYet "PhrUtt" ; +oper PositA : A -> AP = notYet "PositA" ; +oper PositAdAAdj : A -> AdA = notYet "PositAdAAdj" ; +oper PositAdvAdj : A -> Adv = notYet "PositAdvAdj" ; +oper PossNP : CN -> NP -> CN = notYet "PossNP" ; +oper PossPron : Pron -> Quant = notYet "PossPron" ; +oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ; +oper PredVP : NP -> VP -> Cl = notYet "PredVP" ; +oper PredetNP : Predet -> NP -> NP = notYet "PredetNP" ; +oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ; +oper PrepNP : Prep -> NP -> Adv = notYet "PrepNP" ; +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 ReflVP : VPSlash -> VP = notYet "ReflVP" ; +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" ; +oper SentAP : AP -> SC -> AP = notYet "SentAP" ; +oper SentCN : CN -> SC -> CN = notYet "SentCN" ; +oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ; +oper Slash3V3 : V3 -> NP -> VPSlash = notYet "Slash3V3" ; +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 SlashV2a : V2 -> VPSlash = notYet "SlashV2a" ; +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" ; +oper TFullStop : Phr -> Text -> Text = notYet "TFullStop" ; +oper Use2N3 : N3 -> N2 = notYet "Use2N3" ; +oper Use3N3 : N3 -> N2 = notYet "Use3N3" ; +oper UseA2 : A2 -> AP = notYet "UseA2" ; +oper UseCl : Temp -> Pol -> Cl -> S = notYet "UseCl" ; +oper UseComp : Comp -> VP = notYet "UseComp" ; +oper UseComparA : A -> AP = notYet "UseComparA" ; +oper UseCopula : VP = notYet "UseCopula" ; +oper UseN : N -> CN = notYet "UseN" ; +oper UseN2 : N2 -> CN = notYet "UseN2" ; +oper UsePN : PN -> NP = notYet "UsePN" ; +oper UsePron : Pron -> NP = notYet "UsePron" ; +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 UseV : V -> VP = notYet "UseV" ; +oper UttAP : AP -> Utt = notYet "UttAP" ; +oper UttAdv : Adv -> Utt = notYet "UttAdv" ; +oper UttCN : CN -> Utt = notYet "UttCN" ; +oper UttCard : Card -> Utt = notYet "UttCard" ; +oper UttIAdv : IAdv -> Utt = notYet "UttIAdv" ; +oper UttIP : IP -> Utt = notYet "UttIP" ; +oper UttImpPl : Pol -> Imp -> Utt = notYet "UttImpPl" ; +oper UttImpPol : Pol -> Imp -> Utt = notYet "UttImpPol" ; +oper UttImpSg : Pol -> Imp -> Utt = notYet "UttImpSg" ; +oper UttInterj : Interj -> Utt = notYet "UttInterj" ; +oper UttNP : NP -> Utt = notYet "UttNP" ; +oper UttQS : QS -> Utt = notYet "UttQS" ; +oper UttS : S -> Utt = notYet "UttS" ; +oper UttVP : VP -> Utt = notYet "UttVP" ; +oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ; +oper VocNP : NP -> Voc = notYet "VocNP" ; +oper above_Prep : Prep = notYet "above_Prep" ; +oper active2passive : Cl -> Cl = notYet "active2passive" ; +oper after_Prep : Prep = notYet "after_Prep" ; +oper alas_Interj : Interj = notYet "alas_Interj" ; +oper all_Predet : Predet = notYet "all_Predet" ; +oper almost_AdA : AdA = notYet "almost_AdA" ; +oper almost_AdN : AdN = notYet "almost_AdN" ; +oper already_Adv : Adv = notYet "already_Adv" ; +oper although_Subj : Subj = notYet "although_Subj" ; +oper always_AdV : AdV = notYet "always_AdV" ; +oper as_CAdv : CAdv = notYet "as_CAdv" ; +oper at_least_AdN : AdN = notYet "at_least_AdN" ; +oper at_most_AdN : AdN = notYet "at_most_AdN" ; +oper because_Subj : Subj = notYet "because_Subj" ; +oper before_Prep : Prep = notYet "before_Prep" ; +oper behind_Prep : Prep = notYet "behind_Prep" ; +oper between_Prep : Prep = notYet "between_Prep" ; +oper both7and_DConj : Conj = notYet "both7and_DConj" ; +oper but_PConj : PConj = notYet "but_PConj" ; +oper by8agent_Prep : Prep = notYet "by8agent_Prep" ; +oper by8means_Prep : Prep = notYet "by8means_Prep" ; +oper dconcat : Digits -> Digits -> Digits = notYet "dconcat" ; +oper digits2num : Digits -> Numeral = notYet "digits2num" ; +oper digits2numeral : Card -> Card = notYet "digits2numeral" ; +oper dn : Dig -> Digit = notYet "dn" ; +oper dn10 : Dig -> Sub10 = notYet "dn10" ; +oper dn100 : Dig -> Dig -> Sub100 = notYet "dn100" ; +oper dn1000 : Dig -> Dig -> Dig -> Sub1000 = notYet "dn1000" ; +oper dn1000000a : Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet "dn1000000a" ; +oper dn1000000b : Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet "dn1000000b" ; +oper dn1000000c : Dig -> Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet "dn1000000c" ; +oper during_Prep : Prep = notYet "during_Prep" ; +oper either7or_DConj : Conj = notYet "either7or_DConj" ; +oper every_Det : Det = notYet "every_Det" ; +oper everybody_NP : NP = notYet "everybody_NP" ; +oper everything_NP : NP = notYet "everything_NP" ; +oper everywhere_Adv : Adv = notYet "everywhere_Adv" ; +oper except_Prep : Prep = notYet "except_Prep" ; +oper few_Det : Det = notYet "few_Det" ; +oper for_Prep : Prep = notYet "for_Prep" ; +oper from_Prep : Prep = notYet "from_Prep" ; +oper he_Pron : Pron = notYet "he_Pron" ; +oper here7from_Adv : Adv = notYet "here7from_Adv" ; +oper here7to_Adv : Adv = notYet "here7to_Adv" ; +oper here_Adv : Adv = notYet "here_Adv" ; +oper how8many_IDet : IDet = notYet "how8many_IDet" ; +oper how8much_IAdv : IAdv = notYet "how8much_IAdv" ; +oper how_IAdv : IAdv = notYet "how_IAdv" ; +oper i_Pron : Pron = notYet "i_Pron" ; +oper if_Subj : Subj = notYet "if_Subj" ; +oper if_then_Conj : Conj = notYet "if_then_Conj" ; +oper in8front_Prep : Prep = notYet "in8front_Prep" ; +oper in_Prep : Prep = notYet "in_Prep" ; +oper it_Pron : Pron = notYet "it_Pron" ; +oper john_PN : PN = notYet "john_PN" ; +oper language_title_Utt : Utt = notYet "language_title_Utt" ; +oper left_Ord : Ord = notYet "left_Ord" ; +oper less_CAdv : CAdv = notYet "less_CAdv" ; +oper many_Det : Det = notYet "many_Det" ; +oper more_CAdv : CAdv = notYet "more_CAdv" ; +oper most_Predet : Predet = notYet "most_Predet" ; +oper much_Det : Det = notYet "much_Det" ; +oper nd : Digit -> Dig = notYet "nd" ; +oper nd10 : Sub10 -> Digits = notYet "nd10" ; +oper nd100 : Sub100 -> Digits = notYet "nd100" ; +oper nd1000 : Sub1000 -> Digits = notYet "nd1000" ; +oper nd1000000 : Sub1000000 -> Digits = notYet "nd1000000" ; +oper no_Quant : Quant = notYet "no_Quant" ; +oper no_Utt : Utt = notYet "no_Utt" ; +oper nobody_NP : NP = notYet "nobody_NP" ; +oper not_Predet : Predet = notYet "not_Predet" ; +oper nothing_NP : NP = notYet "nothing_NP" ; +oper num : Sub1000000 -> Numeral = notYet "num" ; +oper num2digits : Numeral -> Digits = notYet "num2digits" ; +oper on_Prep : Prep = notYet "on_Prep" ; +oper only_Predet : Predet = notYet "only_Predet" ; +oper or_Conj : Conj = notYet "or_Conj" ; +oper otherwise_PConj : PConj = notYet "otherwise_PConj" ; +oper part_Prep : Prep = notYet "part_Prep" ; +oper please_Voc : Voc = notYet "please_Voc" ; +oper possess_Prep : Prep = notYet "possess_Prep" ; +oper pot01 : Sub10 = notYet "pot01" ; +oper pot1 : Digit -> Sub100 = notYet "pot1" ; +oper pot110 : Sub100 = notYet "pot110" ; +oper pot111 : Sub100 = notYet "pot111" ; +oper pot1plus : Digit -> Sub10 -> Sub100 = notYet "pot1plus" ; +oper pot1to19 : Digit -> Sub100 = notYet "pot1to19" ; +oper pot2 : Sub10 -> Sub1000 = notYet "pot2" ; +oper pot2plus : Sub10 -> Sub100 -> Sub1000 = notYet "pot2plus" ; +oper pot3 : Sub1000 -> Sub1000000 = notYet "pot3" ; +oper pot3plus : Sub1000 -> Sub1000 -> Sub1000000 = notYet "pot3plus" ; +oper quite_Adv : AdA = notYet "quite_Adv" ; +oper right_Ord : Ord = notYet "right_Ord" ; +oper she_Pron : Pron = notYet "she_Pron" ; +oper so_AdA : AdA = notYet "so_AdA" ; +oper somePl_Det : Det = notYet "somePl_Det" ; +oper someSg_Det : Det = notYet "someSg_Det" ; +oper somebody_NP : NP = notYet "somebody_NP" ; +oper something_NP : NP = notYet "something_NP" ; +oper somewhere_Adv : Adv = notYet "somewhere_Adv" ; +oper that_Quant : Quant = notYet "that_Quant" ; +oper that_Subj : Subj = notYet "that_Subj" ; +oper there7from_Adv : Adv = notYet "there7from_Adv" ; +oper there7to_Adv : Adv = notYet "there7to_Adv" ; +oper there_Adv : Adv = notYet "there_Adv" ; +oper therefore_PConj : PConj = notYet "therefore_PConj" ; +oper they_Pron : Pron = notYet "they_Pron" ; +oper this_Quant : Quant = notYet "this_Quant" ; +oper through_Prep : Prep = notYet "through_Prep" ; +oper to_Prep : Prep = notYet "to_Prep" ; +oper too_AdA : AdA = notYet "too_AdA" ; +oper under_Prep : Prep = notYet "under_Prep" ; +oper very_AdA : AdA = notYet "very_AdA" ; +oper we_Pron : Pron = notYet "we_Pron" ; +oper whatPl_IP : IP = notYet "whatPl_IP" ; +oper whatSg_IP : IP = notYet "whatSg_IP" ; +oper when_IAdv : IAdv = notYet "when_IAdv" ; +oper when_Subj : Subj = notYet "when_Subj" ; +oper where_IAdv : IAdv = notYet "where_IAdv" ; +oper which_IQuant : IQuant = notYet "which_IQuant" ; +oper whoPl_IP : IP = notYet "whoPl_IP" ; +oper whoSg_IP : IP = notYet "whoSg_IP" ; +oper why_IAdv : IAdv = notYet "why_IAdv" ; +oper with_Prep : Prep = notYet "with_Prep" ; +oper without_Prep : Prep = notYet "without_Prep" ; +oper yes_Utt : Utt = notYet "yes_Utt" ; +oper youPl_Pron : Pron = notYet "youPl_Pron" ; +oper youPol_Pron : Pron = notYet "youPol_Pron" ; +oper youSg_Pron : Pron = notYet "youSg_Pron" ; +} \ No newline at end of file diff --git a/src/TEMPLATE/NamesTMP.gf b/src/TEMPLATE/NamesTMP.gf new file mode 100644 index 000000000..8dff2d6be --- /dev/null +++ b/src/TEMPLATE/NamesTMP.gf @@ -0,0 +1,36 @@ +concrete NamesTMP of Names = CatTMP ** open Prelude in { + +-- An API layer to deal with names +-- Not part of the RGL API, but used in the AW project +-- So depends on your goals whether this is high or low priority to implement. +{- + lin + -- : GN -> NP ; + GivenName gn = + + -- : SN -> NP ; + MaleSurname sn = + + -- : SN -> NP ; + FemaleSurname sn = + + -- : SN -> NP ; + PlSurname sn = + + -- : GN -> SN -> NP ; + FullName gn sn = + + lin + -- : LN -> NP ; + UseLN ln = + + -- : LN -> NP ; + PlainLN ln = + + -- : LN -> Adv ; + InLN ln = + + -- : AP -> LN -> LN ; + AdjLN ap ln = +-} +} diff --git a/src/TEMPLATE/NounTMP.gf b/src/TEMPLATE/NounTMP.gf new file mode 100644 index 000000000..b352421a0 --- /dev/null +++ b/src/TEMPLATE/NounTMP.gf @@ -0,0 +1,210 @@ +concrete NounTMP of Noun = CatTMP ** open ResTMP, Prelude in { + + flags optimize=all_subs ; + + lin + +--2 Noun phrases + +-- : Det -> CN -> NP + DetCN det cn = emptyNP ** { + s = det.s ++ cn.s ! det.n + } ; +{- + -- : PN -> NP ; + -- Assuming that lincat PN = lincat NP + UsePN pn = pn ; + + -- : Pron -> NP ; + -- Assuming that lincat Pron = lincat NP + UsePron pron = pron ; + + -- : Predet -> NP -> NP ; -- only the man + PredetNP predet np = + +-- A noun phrase can also be postmodified by the past participle of a +-- verb, by an adverb, or by a relative clause + + -- low prio + -- : NP -> V2 -> NP ; -- the man seen + -- PPartNP np v2 = np ** { + -- s = + -- } ; + + -- : NP -> Adv -> NP ; -- Paris today + AdvNP np adv = np ** { + s = np.s ++ "," ++ adv.s + } ; + + -- : NP -> Adv -> NP ; -- boys, such as .. + ExtAdvNP np adv = AdvNP np {s = "," ++ adv.s} ; + + -- : NP -> RS -> NP ; -- Paris, which is here + RelNP np rs = np ** { + + } ; + +-- Determiners can form noun phrases directly. + + -- : Det -> NP ; + DetNP det = emptyNP ** { + s = \\_ => linDet det ; + } ; +-} + -- MassNP : CN -> NP ; + MassNP cn = emptyNP ** { + s = linCN cn + } ; + + +--2 Determiners + +-- The determiner has a fine-grained structure, in which a 'nucleus' +-- quantifier and an optional numeral can be discerned. + + -- : Quant -> Num -> Det ; + DetQuant quant num = quant ** { + s = quant.s ! num.n ++ num.s ; + n = num.n ; + } ; + + -- : Quant -> Num -> Ord -> Det ; + -- DetQuantOrd quant num ord = quant ** { + + -- } ; + +-- Whether the resulting determiner is singular or plural depends on the +-- cardinal. + +-- All parts of the determiner can be empty, except $Quant$, which is +-- the "kernel" of a determiner. It is, however, the $Num$ that determines +-- the inherent number. + + NumSg = {s = [] ; n = Sg} ; + NumPl = {s = [] ; n = Pl} ; + +{- + -- : Card -> Num ; -- two + NumCard card = card ; + + -- : Digits -> Card ; + NumDigits dig = -- probably like OrdDigits, but choose the NCard form + + -- : Numeral -> Card ; + NumNumeral num = { + s = num.s ! NCard ; + n = num.n -- inherits grammatical number (Sg, Pl, …) from the Numeral + } ; + + -- : AdN -> Card -> Card ; + AdNum adn card = card ** { s = adn.s ++ card.s } ; + + -- : Digits -> Ord ; + OrdDigits digs = digs ** { s = digs.s ! NOrd } ; + + -- : Numeral -> Ord ; + OrdNumeral num = { + s = num.s ! NOrd + } ; + + -- : A -> Ord ; + OrdSuperl a = { + s = "most" ++ a.s ! Superl + } ; + +-- One can combine a numeral and a superlative. + + -- : Numeral -> A -> Ord ; -- third largest + OrdNumeralSuperl num a = { + s = num.s ! NOrd ++ a.s ! Superl + } ; +-} + + -- : Quant + DefArt = mkQuant "the" "the" ; + + -- : Quant + IndefArt = mkQuant "a" [] ; + +{- + -- : Pron -> Quant -- my + PossPron pron = mkQuant pron.s ** { + + } ; +-} + +--2 Common nouns + + -- : N -> CN + UseN n = n ; + +{- + -- : N2 -> CN ; + UseN2 n2 = + + -- : N2 -> NP -> CN ; + ComplN2 n2 np = + + -- : N3 -> NP -> N2 ; -- distance from this city (to Paris) + ComplN3 n3 np = + + -- : N3 -> N2 ; -- distance (from this city) + Use2N3 n3 = lin N2 n3 ** { c2 = n3.c3 } ; + + -- : N3 -> N2 ; -- distance (to Paris) + Use3N3 n3 = lin N2 n3 ; + + -- : AP -> CN -> CN + AdjCN ap cn = + + -- : CN -> RS -> CN ; + RelCN cn rs = + + + -- : CN -> Adv -> CN ; + AdvCN cn adv = + +-- Nouns can also be modified by embedded sentences and questions. +-- For some nouns this makes little sense, but we leave this for applications +-- to decide. Sentential complements are defined in VerbTMP. + + -- : CN -> SC -> CN ; -- question where she sleeps + SentCN cn sc = + +--2 Apposition + +-- This is certainly overgenerating. + + -- : CN -> NP -> CN ; -- city Paris (, numbers x and y) + ApposCN cn np = cn ** { + s = + } ; + +--2 Possessive and partitive constructs +-- NB. Below this, the functions are not in the API, so lower prio to implement + + -- : PossNP : CN -> NP -> CN ; + -- in English: book of someone; point is that we can add a determiner to the CN, + -- so it can become "a book of someone" or "the book of someone" + PossNP cn np = + + + -- : Det -> NP -> NP ; -- three of them, some of the boys + CountNP det np = -- Nonsense for DefArt or IndefArt, but don't worry about that! RGL can contain weird sentences, as long as it contains the non-weird stuff we want + + + -- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples + PartNP cn np = + +--3 Conjoinable determiners and ones with adjectives + + -- : DAP -> AP -> DAP ; -- the large (one) + AdjDAP dap ap = dap ** { + + } ; + + -- : Det -> DAP ; -- this (or that) + DetDAP det = det ; +-} + +} diff --git a/src/TEMPLATE/NumeralTMP.gf b/src/TEMPLATE/NumeralTMP.gf new file mode 100644 index 000000000..2556e67a9 --- /dev/null +++ b/src/TEMPLATE/NumeralTMP.gf @@ -0,0 +1,115 @@ +concrete NumeralTMP of Numeral = CatTMP [Numeral,Digits] ** + open Prelude, ResTMP in { + + lincat + Digit = LinNumeral ; -- 2..9 + Sub10, -- 1..9 + Sub100, -- 1..99 + Sub1000, -- 1..999 + Sub1000000, -- 1..999999 + Sub1000000000, -- 1..999999999 + Sub1000000000000 -- 1..999999999999 + = LinNumeral ; + +-- param CardOrd defined in ResTMP +-- type LinNumeral -""- + + + lin + -- : Sub1000000 -> Numeral ; -- 123456 [coercion to top category] + num x = x ; + + -- : Digit ; + n2 = mkNumeral "two" ; + n3 = mkNumeral "three" ; + n4 = mkNumeral "four" ; + n5 = mkNumeral "five" ; + n6 = mkNumeral "six" ; + n7 = mkNumeral "seven" ; + n8 = mkNumeral "eight" ; + n9 = mkNumeral "nine" ; + + -- : Sub10 ; -- 1 + -- pot01 = + + -- : Digit -> Sub10 ; -- d * 1 + pot0 d = d ; + + -- : Sub100 ; -- 10 + -- pot110 = mkNum "ten" ; + + -- : Sub100 ; -- 11 + -- pot111 = mkNum "eleven" ; + + -- : Digit -> Sub100 ; -- 10 + d + -- pot1to19 d = + + -- : Sub10 -> Sub100 ; -- coercion of 1..9 + pot0as1 n = n ; + + -- : Digit -> Sub100 ; -- d * 10 + -- pot1 d = + + -- : Digit -> Sub10 -> Sub100 ; -- d * 10 + n + -- pot1plus d e = + + -- : Sub100 -> Sub1000 ; -- coercion of 1..99 + pot1as2 n = n ; + + -- : Sub10 -> Sub1000 ; -- m * 100 + -- pot2 d = + + -- : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n + -- pot2plus d e = + + -- : Sub1000 -> Sub1000000 ; -- coercion of 1..999 + pot2as3 n = n ; + + -- : Sub1000 -> Sub1000000 ; -- m * 1000 + -- pot3 d = + + -- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n + -- pot3plus d e = + +-------------------------------------------------------------------------------- +-- Numerals as sequences of digits have a separate, simpler grammar +-- + + lincat + Dig = LinDig ; -- single digit 0..9 + + lin + -- : Dig -> Digits ; -- 8 + IDig d = d ; + + -- : Dig -> Digits -> Digits ; -- 876 + IIDig d e = { + s = table { + NCard => glue (d.s ! NCard) (e.s ! NCard) ; + NOrd => glue (d.s ! NCard) (e.s ! NOrd) + } ; + n = Pl ; + } ; + + -- : Dig ; + D_0 = mkDig "0" ; + D_1 = mkDig "1" ; + D_2 = mkDig "2" ; + D_3 = mkDig "3" ; + D_4 = mkDig "4" ; + D_5 = mkDig "5" ; + D_6 = mkDig "6" ; + D_7 = mkDig "7" ; + D_8 = mkDig "8" ; + D_9 = mkDig "9" ; + + oper + LinDig : Type = {s : CardOrd => Str ; n : Number} ; + mkDig : Str -> LinDig = \s -> { + s = table { + NCard => s ; + NOrd => s + "th" + } ; + n = Pl ; -- TODO: handle number 1 + } ; +} diff --git a/src/TEMPLATE/ParadigmsTMP.gf b/src/TEMPLATE/ParadigmsTMP.gf new file mode 100644 index 000000000..de526a041 --- /dev/null +++ b/src/TEMPLATE/ParadigmsTMP.gf @@ -0,0 +1,211 @@ +resource ParadigmsTMP = open CatTMP, ResTMP, NounTMP, Prelude in { + +oper + +--2 Parameters +-- +-- To abstract over number, valency and (some) case names, +-- we define the following identifiers. The application programmer +-- should always use these constants instead of the constructors +-- defined in $ResSom$. + + Prep : Type ; + noPrep : Prep ; + + -- Add more overload instances if needed for all categories! + +--2 Nouns + + mkN : overload { + mkN : Str -> N ; -- Predictable nouns + } ; + + mkPN : overload { + mkPN : Str -> PN ; -- Proper nouns + } ; + +--2 Adjectives + + mkA : overload { + mkA : Str -> A ; -- Predictable adjective + } ; + + mkA2 : overload { + mkA2 : Str -> A2 ; -- Predictable A2, no preposition + mkA2 : A -> Prep -> A2 ; -- A2 made from A and Prep + } ; + +--2 Verbs + + -- Verbs + mkV : overload { + mkV : Str -> V ; -- Predictable verb + } ; + + + mkV2 : overload { + mkV2 : Str -> V2 ; -- Predictable transitive verb + mkV2 : V -> Prep -> V2 ; -- V2 made from V and Prep + } ; + + mkV3 : overload { + mkV3 : V -> V3 ; -- No prepositions + mkV3 : V -> Prep -> Prep -> V3 ; -- Prepositions for direct and indirect objects given + } ; + + mkVV : overload { + mkVV : V -> VV ; + } ; + + mkVA : overload { + mkVA : V -> VA ; + } ; + + mkVQ : overload { + mkVQ : V -> VQ ; + } ; + + mkVS : overload { + mkV : V -> VS ; + } ; + + -- Etc. do the same for other V subcats (V2A, V2V, V2S, …) + + + ----- + +--2 Structural categories + + -- If prepositions take case, add that as argument to mkPrep + mkPrep : overload { + mkPrep : Str -> Prep ; + } ; + + mkConj : overload { + mkConj : (and : Str) -> Conj ; -- (coffee) and (tea) + mkConj : (either : Str) -> (or : Str) -> Conj ; -- either (coffee) or (tea) + } ; + + mkSubj : overload { + mkSubj : Str -> Subj ; + } ; + + mkAdv : overload { + mkAdv : Str -> Adv ; + } ; + + mkAdV : overload { + mkAdV : Str -> AdV ; + } ; + + mkAdA : overload { + mkAdA : Str -> AdA ; + } ; + + +--. +------------------------------------------------------------------------------- +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. + + Prep = CatTMP.Prep ; + noPrep = mkPrep [] ; + + -- Add more overload instances if needed for all categories! + + -- For explanation of `lin N`, see + -- https://inariksit.github.io/gf/2018/05/25/subtyping-gf.html#lock-fields + + mkN = overload { + mkN : Str -> N = \s -> lin N (ResTMP.mkNoun s) ; + -- TODO: more overload instances + } ; + +{- + mkPN = overload { + mkPN : Str -> PN = … + } ; + +--2 Adjectives + + mkA = overload { + mkA : Str -> A = \s -> … + } ; + + mkA2 = overload { + mkA2 : Str -> A2 = \s -> … + mkA2 : A -> Prep -> A2 = \s -> … + } ; + +--2 Verbs +-} + -- Verbs + mkV = overload { + mkV : Str -> V = \s -> lin V (mkVerb s) ; + } ; + +{- + + mkV2 = overload { + mkV2 : Str -> V2 = \s -> … + mkV2 : V -> Prep -> V2 = \s -> … + } ; + + mkV3 = overload { + mkV3 : V -> V3 = \s -> … + mkV3 : V -> Prep -> Prep -> V3 = \s -> … + } ; + + mkVV = overload { + mkVV : V -> VV = \s -> … + } ; + + mkVA = overload { + mkVA : V -> VA = \s -> … + } ; + + mkVQ = overload { + mkVQ : V -> VQ = \s -> … + } ; + + + mkVS = overload { + mkV : V -> VS = \s -> … + } ; + + -- Etc. do the same for other V subcats (V2A, V2V, V2S, …) + + + ----- +-} + + -- If prepositions take case, add that as argument to mkPrep + mkPrep = overload { + mkPrep : Str -> Prep = \s -> lin Prep {s = s} ; + } ; +{- + mkConj = overload { + mkConj : (and : Str) -> Conj = \s -> … + mkConj : (either : Str) -> (or : Str) -> Conj = \s -> … + } ; + + mkSubj = overload { + mkSubj : Str -> Subj = \s -> … + } ; + + mkAdv = overload { + mkAdv : Str -> Adv = \s -> … + } ; + + mkAdV = overload { + mkAdV : Str -> AdV = \s -> … + } ; + + mkAdA = overload { + mkAdA : Str -> AdA = \s -> … + } ; + +-} +-------------------------------------------------------------------------------- + +} diff --git a/src/TEMPLATE/PhraseTMP.gf b/src/TEMPLATE/PhraseTMP.gf new file mode 100644 index 000000000..4fb1ca272 --- /dev/null +++ b/src/TEMPLATE/PhraseTMP.gf @@ -0,0 +1,27 @@ +concrete PhraseTMP of Phrase = CatTMP ** open Prelude, ResTMP in { + + lin + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + UttS s = s ; +{- + UttQS qs = qs ; + UttIAdv iadv = iadv ; + UttNP np = + UttIP ip = + UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ; + UttImpPl pol imp = + UttImpPol pol imp = {s = pol.s ++ imp.s ! Sg ! pol.p} ; + UttVP vp = {s = linVP vp} ; + UttAP ap = { s = ap.s } ; + UttAdv adv = {s = } ; + UttCN n = {s = } ; + UttCard n = {s = } ; + UttInterj i = i ; -} + NoPConj = {s = []} ; +-- PConjConj conj = {s = conj.s1 ++ conj.s2 ! …} ; + + NoVoc = {s = []} ; +-- VocNP np = { s = "," ++ np.s ! … } ; + +} diff --git a/src/TEMPLATE/QuestionTMP.gf b/src/TEMPLATE/QuestionTMP.gf new file mode 100644 index 000000000..cd1add2a3 --- /dev/null +++ b/src/TEMPLATE/QuestionTMP.gf @@ -0,0 +1,105 @@ +concrete QuestionTMP of Question = CatTMP ** open + Prelude, ResTMP, ParadigmsTMP, (V=VerbTMP), (Noun=NounTMP), (S=StructuralTMP) in { + +-- A question can be formed from a clause ('yes-no question') or +-- with an interrogative. +-- Interrogative pronouns can be formed with interrogative +-- determiners, with or without a noun. + +{- +lin + -- : IDet -> CN -> IP ; -- which five songs + IdetCN idet cn = Noun.DetCN idet cn ** { + } ; + + -- : IDet -> IP ; -- which five + IdetIP idet = Noun.DetNP idet ** {sp = idet.sp}; + + -- : IQuant -> Num -> IDet ; -- which (five) + IdetQuant iquant num = iquant ** { + } ; + + -- : IP -> ClSlash -> QCl ; -- whom does John love + QuestSlash ip cls = cls ** { + + } ; + + -- : Cl -> QCl ; + QuestCl cl = cl ** { + }; + + + -- : IP -> VP -> QCl ; + QuestVP ip cl = cl ** { + } ; + + -- : IAdv -> Cl -> QCl ; -- why does John walk + QuestIAdv iadv cls = { + } ; + + -- : IP -> IComp ; + CompIP ip = {s = ip.s ! } ; -- who (is it) + + -- : IComp -> NP -> QCl ; -- where is John? + QuestIComp icomp np = { + } ; + + +-- Interrogative pronouns can be formed with interrogative +-- determiners, with or without a noun. + + -- : IDet -> CN -> IP ; -- which five songs + IdetCN idet cn = + + -- : IDet -> IP ; -- which five + IdetIP idet = + +-- They can be modified with adverbs. + + -- : IP -> Adv -> IP ; -- who in Paris + AdvIP = Noun.AdvNP ; + +-- Interrogative quantifiers have number forms and can take number modifiers. + + -- : IQuant -> Num -> IDet ; -- which (five) + IdetQuant = Noun.DetQuant ; + +-- Interrogative adverbs can be formed prepositionally. + -- : Prep -> IP -> IAdv ; -- with whom + PrepIP prep ip = + +-- They can be modified with other adverbs. + + -- : IAdv -> Adv -> IAdv ; -- where in Paris + AdvIAdv iadv adv = + +-- Interrogative complements to copulas can be both adverbs and +-- pronouns. + + -- : IAdv -> IComp ; + CompIAdv iadv = iadv ; -- where (is it) + + +-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. + +-- Wh questions with two or more question words require a new, special category. + + lincat + -- buy what where + QVP = + lin + -- : VPSlash -> IP -> QVP ; -- buys what + ComplSlashIP vps ip = + + -- : VP -> IAdv -> QVP ; -- lives where + AdvQVP vp iadv = + + -- : QVP -> IAdv -> QVP ; -- buys what where + AddAdvQVP qvp iadv = + + -- : IP -> QVP -> QCl ; -- who buys what where + QuestQVP ip qvp = +-} + + +} diff --git a/src/TEMPLATE/README.md b/src/TEMPLATE/README.md new file mode 100644 index 000000000..162b60a6b --- /dev/null +++ b/src/TEMPLATE/README.md @@ -0,0 +1,391 @@ +# TEMPLATE + +This is a starting point to clone a new RGL language. It has some pre-populated lincats and lins, mostly in the `Noun` module, but also a few minimal things for verbs and sentences. This README contains a guided tour of lincats and lins to implement first, and the modules also contain comments and suggestions aimed for new grammarians. + +**If you want a 100% just strings template**, you can find that in [github.com/daherb/gf-rgl-template](https://github.com/daherb/gf-rgl-template). If you choose the string-only template, you can still read this document for suggestions about implementation order. + +- [How to use this tutorial](#how-to-use-this-tutorial) +- [Guided tour: what to implement first?](#guided-tour-what-to-implement-first) + * [1. N-CN-NP(-AP)](#1-n-cn-np-ap) + + [Already implemented](#already-implemented) + + [Next steps](#next-steps) + - [More morphology](#more-morphology) + - [More syntax](#more-syntax) + + [How about adjectives?](#how-about-adjectives) + + [Side note: a word about MassNP](#side-note-a-word-about-massnp) + * [2. V-VP](#2-v-vp) + + [Already implemented](#already-implemented-1) + + [Next steps](#next-steps-1) + - [Add morphology](#add-morphology) + - [Add syntax](#add-syntax) + * [3. Cl-S-Utt-Phr](#3-cl-s-utt-phr) + + [Already implemented](#already-implemented-2) + + [Next steps](#next-steps-2) + - [Declarative sentences](#declarative-sentences) + - [Imperatives](#imperatives) + + [Unused or nonexistent forms?](#unused-or-nonexistent-forms) +- [Choose your own adventure: what to implement next](#choose-your-own-adventure-what-to-implement-next) + * [Questions](#questions) + * [Adjectives](#adjectives) + * [Relative clauses](#relative-clauses) + * [Numerals](#numerals) + * [Conjunctions](#conjunctions) + + [List without inflection table and single field](#list-without-inflection-table-and-single-field) + + [List with inflection table and multiple fields](#list-with-inflection-table-and-multiple-fields) + + [Inspiration from existing RGL languages](#inspiration-from-existing-rgl-languages) + * [Phrases](#phrases) + * [Idioms](#idioms) + * [Symbol](#symbol) + * [Extend](#extend) +- [Functions outside the API or otherwise lower priority](#functions-outside-the-api-or-otherwise-lower-priority) +# How to use this tutorial + +If you haven't done so yet, clone your language from this template as instructed [here](../README.md#from-a-generic-template). The cloning doesn't include README.md, so there's only one copy of this README document. + +You can open the grammar in a GF shell and see its functions as follows. (I'm using here the `TMP` concrete syntax, but you should have cloned it to some other concrete syntax with a different extension, so substitute as necessary.) + +``` +$ gf LangTMP.gf +Lang> gr -depth=6 | l -treebank +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN blood_N)) (UseV die_V)))) NoVoc +LangTMP: the blood die +``` + +There are also a couple of unit tests in the [`unittest`](/unittest) directory. To see how to use them, see the [instructions](https://github.com/GrammaticalFramework/gf-rgl/tree/master/unittest#readme). + + +# Guided tour: what to implement first? + +In this section, I group the RGL functions in clusters and suggest an implementation order. If you have different needs, e.g. you're making the resource grammar for a particular application and need specific RGL functions for that, feel free to prioritise your needs. I'm giving this list as a suggestion for people who just want something to start from. + +## 1. N-CN-NP(-AP) + +Most of these are in the Noun module. This is the cluster that has most work done in this template. + +### Already implemented + +With the following functions, it is possible to construct simple noun phrases. + +- `DetCN` +- `DetQuant` +- `DefArt`, `IndefArt` (no problem if they are empty strings in your language!) +- `NumSg`, `NumPl` +- `MassNP` +- `UseN` +- `blood_N` (in Lexicon module) + +You can see all NPs with the following command: + +```bash +Lang> gt -cat=NP | l -treebank +``` + +### Next steps + +#### More morphology +Check the categories and params in `ResTMP`: how well do they apply to your language? Is the initial implementation missing inflectional features that your language has, like case, gender/noun class, other numbers like dual? + +If so, then I would suggest adding the missing morphology before implementing any new syntactic functions. Whenever you change a lincat, e.g. by making something that used to be a Str into an inflection table, all the lins that handle that lincat will break. So it's less painful to change the lincats when the amount of lins is still small. + +#### More syntax +Once you're happy with the morphology, you can start with other lins and lincats. In addition to nouns, the RGL allows making NPs out of pronouns and proper nouns: +- lincat for `Pron` +- lin for `UsePron` and `PossPron` +- lin for some `Pron`s in Structural +- lincat for `PN` +- lin for `UsePN` +- lin for `john_PN` and `paris_PN` in Lexicon + +You can also make the NPs a bit more varied by adding more quantifiers and modifiers: +- lins for more `Quant`s, `Det`s etc. in Structural + +Some things in the Noun module will have to wait for other categories to be done. For instance, `AdjCN` relies on adjectives, `RelCN` on relatives, `NumCard` and `NumNumeral` on numerals, none of which is (properly) implemented in this template. So feel free to postpone the rest. + +### How about adjectives? + +In some languages, adjectives behave like nouns. In other languages, they behave like verbs. In yet other languages, the situation is more complicated. But if your language happens to be one where adjectives are like nouns, it's pretty cheap to just implement adjectives here as well. The minimal set is as follows: + +- lincat for `A` and `AP` +- lin for some `A`s from Lexicon +- lin for `PositA` and `AdjCN` + +But if adjectives are rather like verbs (e.g. Korean), or there are other complications (e.g. Zulu), just postpone their implementation. + + +### Side note: a word about MassNP +In the Noun module, there is a function called `MassNP : CN -> NP`. This is a *mass construction*, which is usually applied to mass nouns like "water". + +However, the RGL does not contain a semantic distinction between mass and count nouns, and thus the `MassNP` function can be applied to any CN. Sometimes this results in semantically weird results. + +As a resource grammarian, don't worry if `MassNP` applied to count nouns sounds weird. It's the application grammarian's problem to choose when to use MassNP and when DetCN. If `MassNP` sounds good when applied to mass nouns, then you're doing it right. + +## 2. V-VP + +### Already implemented + +For verbs, we have much fewer things implemented: a single intransitive verb, and a function that elevates an intransitive verb into a VP. + +* `UseV` +* `die_V` (in Lexicon module) + +You can see all (=1) VPs with the following command. + +```bash +Lang> gt -cat=VP | l -treebank +Langs: UseV die_V +LangTMP: die +``` + +### Next steps + +#### Add morphology + +Just like with nouns, look at the `VForm` param in the Res module, and add the missing inflectional features. If verbs are very complex in your language, it's fine to start with a smaller subset, e.g. only indicative mood, or only a couple of tenses. + +Again, you should extend the `VForm` param, and change the lincats of `V` and `VP` in other ways, if needed. It is very common that the lincat for `VP` has many fields, so that it + +In addition, you could implement some morphological paradigms, so that you can add some verbs in the lexicon. + +#### Add syntax + +In addition to intransitive verbs (`V`), the GF RGL has a large set of verb subcategories. So now you can start adding lincats to `V2` (direct object), `VV` (verbal complement), `VS` (sentence complement) etc. + +The most important are the following: + +- lincat for `V2` and `VPSlash` +- lin for some `V2`s from Lexicon +- lin for `SlashV2a` and `ComplSlash` + +If you have done a thorough implementation on noun morphology, you might find it useful here. For instance, if verbs mark their arguments with cases, now is a great time to add those cases as *inherent* argument in the verbs. (For explanation on parametric vs. inherent, see [GF tutorial](https://www.grammaticalframework.org/doc/tutorial/gf-tutorial.html#toc54)). + +Another way to make VPs is to use adjectives, noun phrases and adverbials as complements. If you haven't implemented adjectives yet, feel free to skip them at this step. But the other complements should be in reach already, so the next most important steps are the following: + +- lincat for `Comp` +- lin for `CompNP`, (`CompAdv`) and `UseComp` +- (If you already have AP: lin for `CompAP`) + +These functions don't care whether your language has an explicit copula or not. Just implement whatever strategy that it uses for non-V❋ predication. + +In terms of word order, you could consider how adverbials attach to verbs. + +## 3. Cl-S-Utt-Phr + +At this level, there is rarely new morphology to be added, but there can be interesting decisions about e.g. word order or subordination. + +### Already implemented + +The following rarely need any changes. By the time an `Utt` is reached, the grammatical decisions should have been already made, and the lincats of `Utt` and `Phr` should be just `{s : Str}`. +- `PhrUtt` +- `NoPConj`, `NoVoc` +- `UttS` + +The following functions, and the lincats they operate on, are implemented in the most naive only-strings way, and they need to be changed. +- `UseCl` +- `TTAnt`, `TPres`, `TPast`, `TFut`, `TCond`, `ASimul`, `AAnter` +- `PPos`, `PNeg` +- `PredVP` + +### Next steps + +#### Declarative sentences + +If you have added verb inflection in the V❋ and VP categories, then you need to connect them to the Cl category. `PredVP : NP → VP → Cl` picks the correct person inflection from its VP argument, but any tense and polarity is still open. So in most languages, the lincat of `Cl` should have an inflection table, and only `UseCl : Temp → Pol → Cl → S` will choose the final form. + +Sometimes even the lincat of `S` has an inflection table or it is discontinuous. That's because `S` can be used in a VP or an Adv, and in those cases, it may have a different word order or inflectional form than as standalone sentence. + +If you're not sure whether the lincat of `S` should be still open for something, try to implement the following functions and see if it needs tweaking. + +- `ComplVS : VS → S → VP` +- `SubjS : Subj → S → Adv` + +#### Imperatives + +In the Sentence module, there are also functions to construct imperatives. Depending on your language, it could be rather easy to implement them after you've added declarative sentences. But nothing depends on imperatives, so you can as well postpone them. + +### Unused or nonexistent forms? + +What if your language has no form that corresponds to e.g. future anterior negative (*won't have walked*)? That's fine, you can put some other form in that slot and move on. + +What if your language has tenses, aspects, moods, politeness forms or any other inflection that isn't accessible via the core RGL? That's fine too, you can always create a language-specific extra module with functions that do access them. If you're working towards a specific application that needs such forms, then you should of course prioritise them. But if covering the core RGL that is in the API is the most important, feel free to postpone all the verbal inflection that is not accessible via the core. + +# Choose your own adventure: what to implement next + +If you've implemented the first 3 clusters, you already have a nice chunk of the RGL! +You have tackled many of the hard decisions, so it's natural that these things can take a long time, and you may need to revise often. + +The following set doesn't have to be followed in any particular order. + +## Questions + +The Question module introduces interrogative noun phrases (`IP`) like *who* or *whose car*, and question clauses (`QCl`) and sentences (`QS`). Their implementation is often similar to that of noun phrases and declarative clauses and sentences. + +Compared to declarative sentences, questions may require more variation in word order. You may need to make some fields discontinuous, e.g. splitting a single `s` field (e.g. *eat porridge*) of a VP into `verb` (*eat*) and `complement` (*porridge*). + +The minimal set to get questions is the following: +- lincat for `QCl` +- lin for `QuestCl` +With these, you get yes/no questions, like "do you walk". + +To get wh-questions, like "who walks", you first need the `IP` category for interrogative noun phrases. Here's a full set for wh-questions with the IP as a subject. +- lincat for `IP`, `IDet` and `IQuant` +- lin for `IDetCN`, `IdetQuant` +- lin for some `IQuant`s and `IP`s in Structural +- lin for `QuestVP` + +The next thing to add is `IAdv` for interrogative adverbs, like "why" or "where". With these, you can ask questions like "why do you walk" and "where are you". +- lincat for `IAdv` +- lin for some `IAdv`s in Structural, and/or `PrepIP` in Question +- lin for `QuestIAdv` +- lincat for `IComp` +- lin for `CompIAdv`, `CompIP` and `QuestIComp` + +Finally, we can also make a question using `IP` as an object, e.g. "who do you like". Where previously we have formed QCls from a normal VP with a special subject (`IP` instead of `NP`), here we introduce a new category `ClSlash`, which is a `Cl` missing an object. So you need the following: +- lincat for `ClSlash` +- lin for `QuestSlash` + +## Adjectives + +If you haven't implemented adjectives yet, it's about time! If your adjectives are more of the nouny type, I hope it's rather straightforward to do them. The minimal cluster is the following: + +- lincat for `A` and `AP` +- lin for `PositA` and `AdjCN` +- lin for `CompAP`, check whether you have to update lincat for `Comp` + +If adjectives behave like verbs, then the lincat for `Comp` and lin for `CompAP` can reuse the lincats and lins of the V-VP cluster. But `AdjCN` can be a bit difficult. Based on previous RGL languages that have verby adjectives, you get a lot of synergy with the Relative module. Basically, APs as modifiers behave just like relative clauses, so `AdjCN` and `RelCN` are similar or even identical. + +## Relative clauses + +These may be complicated, so feel free to postpone until further. But if your APs are verby, it makes sense to implement these in parallel with `AdjCN`, because you will need some way of making verby/clause-y things into modifiers. + +## Numerals + +There is a tentative lincat for numerals, and linearisations for the digits `D_0..D_9` and `n2..n9`, as well as the simple coercions `pot0`, `pot0as1`, `pot1as2`, `pot2as3` and `num`. However, it's possible that the simple lincat needs to be changed, and so I haven't implemented any of the lins that do something complex. + +The numeral module the oldest piece of code in the RGL, and hence it looks pretty strange compared to the rest of the RGL. If you don't understand it, don't worry–just leave it aside until you have other parts implemented. Nothing depends on it, and in fact, I would recommend that your N-CN-NP cluster is solid before you do numerals, because then you know better which inflectional features are needed in numerals. + +But eventually the time comes to tackle numerals. First tip is to check in https://github.com/GrammaticalFramework/gf-contrib/tree/master/numerals whether someone has already implemented them for your language, or a close relative that behaves similarly. Second tip is to look at the existing implementation of any RGL language that you know, and try to reverse engineer based on that. But even if these tips don't work, please submit your grammar to gf-rgl anyway! A grammar without full numeral implementation is much better than no grammar at all. + +Once you have some kind of implementation of the Numeral module, you can connect it to the Noun module by implementing the following. The minimal meaningful set is these two: + +- `NumNumeral : Numeral -> Card` +- `NumCard : Card -> Num` + +With these, you get a `Num` that can be used in `DetQuant` to make a Det, and that unlocks numerals as determiners, like "two cats". + +## Conjunctions + +Conjunction for category X needs 4 things: + +- lincat for `[X]` +- lin for `BaseX` +- lin for `ConsX` +- lin for `ConjX` + +For example, if `X` is defined as +```haskell +lincat X = {s : Case => Str ; a : Agr} ; +``` +then `[X]` will split its s field into two, and retain its other fields as is: + +```haskell +lincat [X] = {s1,s2 : Case => Str ; a : Agr} ; +``` + +### List without inflection table and single field + +Let's start with a simple case: Adv is of type `{s : Str}`. Then `[Adv]` is `{s1,s2 : Str}`. +`BaseAdv`, `ConsAdv` and `ConjAdv` can all use functions defined in [prelude/Coordination](../prelude/Coordination.gf): + +```haskell +lin BaseAdv = twoSS ; +lin ConsAdv = consrSS comma ; +lin ConjAdv = conjunctSS ; +``` + +### List with inflection table and multiple fields + +Let's take the previous example and call it NP. Our lincats are as follows: +```haskell +lincat + NP = {s : Case => Str ; a : Agr} ; -- in Cat + [NP] = {s1,s2 : Case => Str ; a : Agr} ; -- in Conjunction +``` + +Now we need to do a bit more work in our linearisations. +```haskell +lin + BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ; + +oper + conjAgr : Agr -> Agr -> Agr ; + conjAgr agr1 agr2 = -- TODO actual implementation +``` +First, we use the [twoTable](https://github.com/GrammaticalFramework/gf-rgl/blob/master/src/prelude/Coordination.gf#L57-L60) oper from Coordination, which puts the right values in the right fields. + +But it doesn't deal with the rest of the fields, `g : Agr` in our case, and so we need to put it in manually. That's what happens in the *record extension* with the two stars. To combine two Agrs into one Agr, we define an oper `conjAgr`, that takes two Agrs and returns their combination. + +Then let's do the rest of the linearisations. + +```haskell +lin + ConsNP x xs = consrTable NPCase comma x xs ** {a = conjAgr xs.a x.a} ; + ConjNP conj xs = conjunctDistrTable NPCase conj xs ** { + a = -- xs.a, with possible Number input from the Conj + } ; +``` +ConsNP is similar to BaseNP, except that we will now include the separator character. `comma` is defined as the string "," in Prelude, but other languages use other characters, e.g. **、** in Chinese. + +ConjNP puts together a NP from the list of NPs, using a conjunction: "Inari, Krasimir and Aarne". This resulting NP has to also have an `a` field, and in this final stage, we are putting together the `conjAgr` from all the arguments, and also taking into account the Conj itself. For instance, in [English style guides](https://editorsmanual.com/articles/compound-subject-singular-or-plural/), + +> Two or more nouns joined by and form a plural compound subject, which takes plural verbs. But when a compound subject contains or or nor, the verb should agree with the part of the subject closest to it. + +So in the English resource grammar, `and_Conj` has an inherent number Pl, and `or_Conj` has an inherent number Sg. If your language doesn't do that, then it's just the list of NPs that determines the agreement of the resulting coordinated NP. + +### Inspiration from existing RGL languages + +Most existing RGL languages use the Coordination module and its opers that are rather cryptic. Sometimes you can copy and paste an existing RGL language, just adjust the arity of the opers (e.g. call `twoTable3` instead of `twoTable2`) and which `param`s are given to those opers as argument. Other times you need to do more manual tweaking. + +Here are some examples of [coordination strategies that are more complex than English](https://inariksit.github.io/gf/2021/02/22/lists.html#natural-language-strategies-beyond-a-b-and-c). The more your language differs from English, the more work you need to do in the internal params. + +Some of the categories that have list instances may not be able to coordinate in your language. In such a case, you can decide whether to leave it unimplemented (thus trying to use it via the API gives an exception), or linearise something ungrammatical. + +## Phrases + +In the Phrase module, there are functions that create standalone utterances of multiple RGL categories. They are usually rather easy to implement: the `Utt` category should be just a `{s : Str}`, and the task is to decide which of the inflection forms is the standalone form. + +## Idioms + +The Idiom module defines constructions that are formed in idiosyncratic ways. Examples of its constructions are impersonal and generic clauses ("it is warm") and clefts ("it is John who sleeps"). This module is not a dependency of any other module, and its constructions are less frequent than the core modules like Noun and Verb. So this can be done whenever you like. + + +## Symbol + +The Symbol module (exported in the API as Symbolic) is used for embedding symbolic notation in natural-language text, e.g. "level 4". This module is not a dependency of any other, and it mostly depends on Noun. So it can be done any time after the N-CN-NP cluster is solid. + +## Extend + +As the name suggests, this is an extension and not in the API. See [here](https://inariksit.github.io/gf/2021/02/15/rgl-api-core-extensions.html#extend) for more explanation. + +In my experience, the generalisations of VP are useful: `VPS` (VP with a tense and polarity), `VPI` (infinitival VP) and their transitive counterparts `VPS2` and `VPI2`. With these, you can do VP conjunctions, like "she runs and sings", "to eat and sleep". + +Extend is a rather large module, and not all funs have meaningful lins in all languages. So don't feel pressured to fill Extend all at once; often grammarians just add linearisations when the need arises for a particular structure. + +# Functions outside the API or otherwise lower priority + +What is low or high priority depends on the application. But if you want some general guidelines, these are usually less used, or not in the API at all. + +### Not in the API + +- The category DAP + its functions +- CountNP, PossNP, PartNP +- OrdNumeralSuperl +- List instance for CN +TODO: continue the list + +### Expensive + +- `SlashV2VNP` is often expensive, because it has so many arguments. + +For any function that turns out to be expensive, you can comment it out when implementing other parts of the grammar. + +### diff --git a/src/TEMPLATE/RelativeTMP.gf b/src/TEMPLATE/RelativeTMP.gf new file mode 100644 index 000000000..c6c41676c --- /dev/null +++ b/src/TEMPLATE/RelativeTMP.gf @@ -0,0 +1,24 @@ +concrete RelativeTMP of Relative = CatTMP ** open + ResTMP, Prelude in { + +{- +lin + -- : Cl -> RCl ; -- such that John loves her + RelCl cl = cl ** { + } ; + + -- : RP -> VP -> RCl ; + RelVP rp vp = { + } ; + + -- : RP -> ClSlash -> RCl ; -- who I went with + RelSlash rp cls = { + } ; + + -- : RP ; + IdRP = {s = "that"} ; + + -- : Prep -> NP -> RP -> RP ; -- the mother of whom + FunRP prep np rp = +-} +} diff --git a/src/TEMPLATE/ResTMP.gf b/src/TEMPLATE/ResTMP.gf new file mode 100644 index 000000000..7b42876f5 --- /dev/null +++ b/src/TEMPLATE/ResTMP.gf @@ -0,0 +1,296 @@ +resource ResTMP = open Prelude, Predef in { + +-------------------------------------------------------------------------------- +-- General notes + +-- ** Naming ** +{- +I'm using the naming scheme for lincats and opers as explained here: +https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#my-naming-scheme-for-lincats-and-opers +-} + +-- ** File structure ** +-- The rest of this module is organised as follows: + + ----------------------------- + -- Grammatical categor(y|ies) + + {- + General comments on the cat(s) + + params related to the cat(s) + + opers related to the cat(s) + -} + +-------------------------------------------------------------------------------- +-- Nouns + +{-The param Number comes from common/ParamX, and has the values Sg and Pl. + * If your language doesn't have number, remove Number from all records. + * If your language has number with more than 2 values, define your own number in this module + (e.g. uncomment line 56) and use that Number instead of Number. + + The param Gender is defined here, and has the values Gender1 and Gender2. + Currently it's only as a suggestion to be an inherent field in LinN. + * If your language doesn't have gender, remove Gender from all records. + * If your language has genders/noun classes, replace the placeholder Gender1 and Gender1 + with the actual values of your language (there can be more than 2!), and uncomment + the g : Gender field from the definition of LinN. + + If your nouns inflect in more things, like case, you can do one of the following + * Replace the placeholder cases on line 53 and make the table 2-dimensional, like this: + oper LinN : Type = {s : Number => Case => Str ; …} ; + * Make your own parameter that combines all the relevant features, like this: + param NForm = Whatever | You | Need | For | Noun | Inflection ; + oper LinN : Type = {s : NForm => Str ; …} ; + This can be a good idea, if your inflection table has some gaps, i.e. not all combinations are in use + See https://gist.github.com/inariksit/708ab9df2498e88bc63aedf5fc7be2f3#file-tables-gf-L48-L122 for explanation + -} + +param + Gender = Gender1 | Gender2 ; -- Just a placeholder, see lines 34-39 above + Case = Case1 | Case2 | Case3 ; -- Just a placeholder, see lines 41-48 above + Number = Sg + | Pl +-- | Dual -- If your language has numbers other than Sg and Pl, add them to the parameter + ; + Person = P1 | P2 | P3 ; + +oper + LinN : Type = { + s : +-- Case => -- uncomment if your language has case + Number => -- variable number: table {Sg => "house" ; Pl => "houses"} + Str ; + -- g : Gender ; -- inherent gender/noun class, if your language has that + } ; + + -- Most often, the lincat for CN is the same as N, with possibly some additional fields. + -- However, sometimes you need more fields than just the s field, e.g. to keep word order flexible, or to add clitics and make sure they attach to the head, not modifiers. + -- If you don't know what the previous line means, you can get started with just a single s field. + -- You'll notice later whether you need such a field or not. + LinCN : Type = LinN + -- ** {postmod/premod/… : Str} -- if needed + ; + + LinPN : Type = { + s : Str ; + n : Number ; -- Proper nouns often have already an inherent number; you don't usually say "a Paris / many Parises" + -- g : Gender ; -- inherent gender/noun class, if your language has that + } ; + + -- For inflection paradigms, see http://www.grammaticalframework.org/doc/tutorial/gf-tutorial.html#toc56 + mkNoun : Str -> LinN = \str -> { + s = table { + _ => str -- TODO: actual morphology + } ; + -- If your nouns have gender, it should come here as inherent field. + -- Usually you need to give the gender as an argument to mkNoun. + } ; + + linCN : LinCN -> Str = \cn -> cn.s ! Sg + -- ++ cn.postmod -- If there is another field, use here + ; + +--------------------------------------------- +-- Numeral + +-- Used in NumeralTMP + param + CardOrd = NCard | NOrd ; + + oper + LinNumeral : Type = {s : CardOrd => Str ; n : Number} ; + + mkNumeral : Str -> LinNumeral = \s -> { + s = table { + NCard => s ; + NOrd => s + "th" + } ; + n = Pl ; -- NB. probably singular for number 1 + } ; + +--------------------------------------------- +-- Pronoun + +{-The param Person comes from common/ParamX, and has the values P1, P2 and P3. + * If your language doesn't inflect in person, you may be able to remove Person from all records. + - However, consider if it's really never present? How about e.g. reflexive ("myself", "yourself" etc?) + * If your language is more fine-grained than {P1,P2,P3} x {Sg,Pl} (for instance gender and familiarity), + you can define your own param. We provide an example called Agr to take inspiration from—remove if + not needed, or use and refine if needed. +-} + +param + -- These params are just for inspiration, not used anywhere currently. + Agr = SgP1 -- I + | SgP2 Politeness -- e.g. tū, tum, āp (Hindi) — note that the verb really inflects differently for all three! + | SgP3 Gender -- e.g. he, she (verb inflects the same, but distinction in reflexive: himself / herself) + | FillInTheRestYourself ; + Politeness = Intimate | Familiar | Polite ; + +oper + LinPron : Type = { + s : Str ; + -- Alternative if your language has case and pronouns inflect in case (e.g. English I/me/my, she/her/hers) + -- s : Case => Str ; + n : Number ; + p : Person ; + -- Alternative to the `n` and `p` fields: + -- a : Agr -- sketched above, lines 97-103 + } ; + + mkPron : (_ : Str) -> Person -> Number -> LinPron = \str,per,num -> { + s = str ; + {- If there is case inflection, you need a table here + table { + _ => str -- Pronoun inflection is often irregular, so possibly this constructor requires several forms as argument, even if mkNoun is nice and regular + } ; + -} + p = per ; + n = num + } ; + +--------------------------------------------- +-- NP + +{- +In the RGL, a NP may come from a common noun, proper noun or pronoun. +Pronouns are the only ones that have an inherent person (nouns are almost always 3rd person! please give me counterexamples if you can think of any.) +So we can often say that NP's lincat is the same as Prons. + +NB. for later, when you want to make Pron into possessives, you may need more fields in LinPron than in LinNP. +That's why I'm copying over the definition below, instead of the neater `LinNP : Type = LinPron`. +-} + + LinNP : Type = { + s : Str ; + -- Alternative: If anything inflects in case (nouns, pronouns), NP has to also inflect in case! + -- s : Case => Str ; + n : Number ; + p : Person ; + -- Alternative to the `n` and `p` fields: + -- a : Agr -- sketched on lines 97-101 + } ; + + linNP : LinNP -> Str = \np -> np.s ; -- Change when you change LinNP + + emptyNP : LinNP = { -- Change when you change LinNP + s = [] ; + n = Sg ; + p = P3 ; + } ; + +-------------------------------------------------------------------------------- +-- Det, Quant, Card, Ord + + -- If your language has a number, it is very very very likely that + -- Quant has a variable number and Det has inherent number. + + LinQuant : Type = { + s, -- quantifier in a context, e.g. 'this (cat) (is nice)' + sp -- quantifier as standalone, e.g. 'this (is nice)' + : Number => Str ; + } ; + + LinDet : Type = { + s : Str ; + n : Number ; + } ; + + -- Can you reuse your mkNoun? Do nouns and quantifiers inflect the same way? + mkQuant : Str -> Str -> LinQuant = \this, these -> { + s, + sp = table { + Sg => this ; + Pl => these } ; + }; + + mkDet : Str -> Number -> LinDet = \str, num -> { + s = str ; + n = num + } ; + +-------------------------------------------------------------------------------- +-- Adpositions + +{- The main use of Prep is in the fun + + PrepNP : Prep -> NP -> Adv + + Despite the name of the RGL category, a 'Prep' can be a preposition, postposition, + or just an instruction to choose a particular case from the NP. + A language may use one, two or all these strategies. + +-} + +oper + LinPrep : Type = { + s : Str ; + + -- If your language has cases, and different prepositions choose different cases. + -- c2 : Case ; + + -- If your language has both pre- and postpositions, you need an inherent parameter in Prep to record which one a given Prep is. + -- position : PreOrPost ; + } ; + + +-------------------------------------------------------------------------------- +-- Adjectives + + LinA : Type = SS ; + LinA2 : Type = LinA ; + + mkAdj : Str -> LinA = \str -> {s = str} ; + + AdjPhrase : Type = LinA ; -- ** {compar : Str} ; +-------------------------------------------------------------------------------- +-- Verbs + +param + VForm = TODOVF Number Person ; + +oper + LinV : Type = { + s : VForm => Str + } ; + + LinV2 : Type = LinV ** { + c2 : LinPrep ; + } ; + + mkVerb : Str -> LinV = \str -> { + s = table { + _ => str + } + } ; + + copula : LinV = {s = \\_ => "TODO: copula"} ; -- often useful + +------------------ +-- VP + + LinVP : Type = { + s : VForm => Str ; + } ; + + LinVPSlash : Type = LinVP ** { + c2 : LinPrep ; + } ; + + linVP : LinVP -> Str = \vp -> vp.s ! TODOVF Sg P3 ; + +-------------------------------------------------------------------------------- +-- Cl, S + + -- Operations for clauses, sentences + LinCl : Type = { + subj : Str ; + pred : Str ; -- TODO: depend on Temp and Pol + } ; + + linCl : LinCl -> Str = \cl -> cl.subj ++ cl.pred ; + +} diff --git a/src/TEMPLATE/SentenceTMP.gf b/src/TEMPLATE/SentenceTMP.gf new file mode 100644 index 000000000..699c75779 --- /dev/null +++ b/src/TEMPLATE/SentenceTMP.gf @@ -0,0 +1,76 @@ + +concrete SentenceTMP of Sentence = CatTMP ** open + TenseX, ResTMP, (AM=AdverbTMP), Prelude in { + +flags optimize=all_subs ; + +lin + +--2 Clauses + + -- : NP -> VP -> Cl + PredVP np vp = { + subj = np.s ; -- ! Nom, if there are cases + pred = + -- table {something with tense+polarity => + vp.s ! TODOVF np.n np.p + -- TODO: all of the VP's tense and polarity should be open here! + -- PredVP only decides the subject. + -- } + } ; + +{- + -- : SC -> VP -> Cl ; -- that she goes is good + PredSCVP sc vp = ; + +--2 Clauses missing object noun phrases + -- : NP -> VPSlash -> ClSlash ; + SlashVP = + + -- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today + AdvSlash cls adv = + + -- : Cl -> Prep -> ClSlash ; -- (with whom) he walks + SlashPrep cl prep = cl ** {c2 = prep} ; + +-- Imperatives + -- : VP -> Imp ; + ImpVP vp = + +--2 Embedded sentences + + -- : S -> SC ; + EmbedS s = + + -- : QS -> SC ; + EmbedQS qs = + + -- : VP -> SC ; + EmbedVP vp = +-} +--2 Sentences + + -- : Temp -> Pol -> Cl -> S ; + UseCl t p cl = { + s = cl.subj ++ t.s ++ p.s ++ cl.pred -- ! t.t ! p.p -- eventually + } ; +{- + -- : Temp -> Pol -> QCl -> QS ; + UseQCl t p cl = + + -- : Temp -> Pol -> RCl -> RS ; + UseRCl t p cl = + + -- AdvS : Adv -> S -> S ; -- then I will go home + AdvS adv s = + + -- ExtAdvS : Adv -> S -> S ; -- next week, I will go home + ExtAdvS adv s = + + -- : S -> Subj -> S -> S ; + SSubjS s1 subj s2 = + + -- : S -> RS -> S ; -- she sleeps, which is good + RelS sent rs = +-} +} diff --git a/src/TEMPLATE/StructuralTMP.gf b/src/TEMPLATE/StructuralTMP.gf new file mode 100644 index 000000000..a06c1f2c3 --- /dev/null +++ b/src/TEMPLATE/StructuralTMP.gf @@ -0,0 +1,171 @@ +concrete StructuralTMP of Structural = CatTMP ** + open Prelude, ResTMP, (Noun=NounTMP), ParadigmsTMP in { + +------- +-- Ad* +{- +lin almost_AdA = +lin almost_AdN = +lin at_least_AdN = +lin at_most_AdN = +lin so_AdA = +lin too_AdA = +lin very_AdA = + +lin as_CAdv = +lin less_CAdv = +lin more_CAdv = + +lin how8much_IAdv = +lin when_IAdv = + +lin how_IAdv = +lin where_IAdv = +lin why_IAdv = + +lin always_AdV = ss "" ; + +lin everywhere_Adv = ss "" ; +lin here7from_Adv = ss "" ; +lin here7to_Adv = ss "" ; +lin here_Adv = ss "" ; +lin quite_Adv = ss "" ; +lin somewhere_Adv = ss "" ; +lin there7from_Adv = ss "" ; +lin there7to_Adv = ss "" ; +lin there_Adv = ss "" ; + +-} +------- +-- Conj + +-- The lincat of Conj is Coordination.ConjunctionDistr ** {n:Number} +-- which means that there are two fields for the strings, and +-- n:Number which specifies the number of the resulting NP. + +lin and_Conj = {s1 = [] ; s2 = "and" ; n = Pl} ; +-- lin or_Conj = +-- lin if_then_Conj = +lin both7and_DConj = {s1 = "both" ; s2 = "and" ; n = Pl} ; +-- lin either7or_DConj = + +-- lin but_PConj = +-- lin otherwise_PConj = +-- lin therefore_PConj = + + +----------------- +-- *Det and Quant +{- +lin how8many_IDet = +lin every_Det = + +lin all_Predet = {s = ""} ; +lin not_Predet = { s = "" } ; +lin only_Predet = { s = "" } ; +lin most_Predet = {s = ""} ; + +lin few_Det = R.indefDet "" pl ; +lin many_Det = R.indefDet "" pl ; +lin much_Det = R.indefDet "" sg ; + +lin somePl_Det = +lin someSg_Det = + +lin no_Quant = +lin that_Quant = mkQuant "" ; +lin this_Quant = mkQuant "" ; +lin which_IQuant = mkQuant "" ; + +----- +-- NP + +lin somebody_NP = + + +lin everybody_NP = +lin everything_NP = +lin nobody_NP = +lin nothing_NP = +lin somebody_NP = +lin something_NP = + +------- +-- Prep + +lin above_Prep = mkPrep "" ; +lin after_Prep = mkPrep "" ; +lin before_Prep = mkPrep "" ; +lin behind_Prep = mkPrep "" ; +lin between_Prep = = mkPrep "" ; +lin by8agent_Prep = mkPrep "" ; +lin by8means_Prep = mkPrep "" ; +lin during_Prep = mkPrep "" ; +lin except_Prep = mkPrep "" ; +lin for_Prep = mkPrep "" ; +lin from_Prep = mkPrep "" ; +lin in8front_Prep = mkPrep "" ; +lin in_Prep = mkPrep "" ; +lin on_Prep = mkPrep "" ; +lin part_Prep = mkPrep ; +lin possess_Prep = mkPrep "" ; +lin through_Prep = mkPrep "" ; +lin to_Prep = mkPrep "k" ; +lin under_Prep = mkPrep "" ; +lin with_Prep = mkPrep "" ; +lin without_Prep = mkPrep "" ; + +------- +-- Pron + +-- Pronouns are closed class, no constructor in ParadigmsTMP. +lin it_Pron = +lin i_Pron = +lin youPol_Pron = +lin youSg_Pron = +lin he_Pron = +lin she_Pron = +lin we_Pron = +lin youPl_Pron = +lin they_Pron = + +lin whatPl_IP = +lin whatSg_IP = +lin whoPl_IP = +lin whoSg_IP = + +------- +-- Subj + +lin although_Subj = +lin because_Subj = +lin if_Subj = +lin that_Subj = +lin when_Subj = + + +------ +-- Utt + +lin language_title_Utt = ss "" ; +lin no_Utt = ss "" ; +lin yes_Utt = ss "" ; + + +------- +-- Verb + +lin have_V2 = + +lin can8know_VV = -- can (capacity) +lin can_VV = -- can (possibility) +lin must_VV = +lin want_VV = + +------ +-- Voc + +lin please_Voc = ss "" ; +-} + +} diff --git a/src/TEMPLATE/SymbolTMP.gf b/src/TEMPLATE/SymbolTMP.gf new file mode 100644 index 000000000..25d024ef1 --- /dev/null +++ b/src/TEMPLATE/SymbolTMP.gf @@ -0,0 +1,73 @@ +--# -path=.:../abstract:../common:../prelude + +concrete SymbolTMP of Symbol = CatTMP ** + open Prelude, ParadigmsTMP, ResTMP, (Noun=NounTMP) in { + +lin + + -- : Symb -> PN ; -- x + SymbPN i = mkPN_onRuntimeToken i.s ; + + -- : Int -> PN ; -- 27 + IntPN i = mkPN_onRuntimeToken i.s ; + + -- : Float -> PN ; -- 3.14159 + FloatPN i = mkPN_onRuntimeToken i.s ; + + -- : Card -> PN ; -- twelve [as proper name] + NumPN i = mkPN_onRuntimeToken (i.s ! NCard) ; + +lin +-- CNIntNP cn i = {} ; + + -- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y + CNSymbNP det cn xs = + let cnSymb : CN = cn ** {postmod = cn.postmod ++ xs.s} + in Noun.DetCN det cnSymb ; + + -- : CN -> Card -> NP ; -- level five ; level 5 + CNNumNP cn i = + let cnSymb : CN = cn ** {postmod = cn.postmod ++ i.s} + in Noun.MassNP cnSymb ; + + -- : Symb -> S ; + SymbS sy = sy ; + + -- : Symb -> Card ; + SymbNum sy = mkNumeral_onRuntimeToken sy.s ; + + -- : Symb -> Ord ; + SymbOrd sy = sy ; ---- TODO: nothing added to it. Lincat of Ord is just SS from the beginning. + + oper + -- To make Card or PN from a runtime argument, cannot use the single + operation. + -- See https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#unsupported-token-gluing + + mkNumeral_onRuntimeToken : Str -> LinNumeral = \str -> { + s = table { + NCard => str ; + NOrd => str ++ BIND ++ "th" + } ; + n = Pl ; -- NB. probably singular for number 1 + } ; + + mkPN_onRuntimeToken : Str -> LinPN = \str -> { + s = + -- table {_ => -- If lincat of PN changes so that it's an inflection table, uncomment this + str + -- } + ; + n = Sg ; + } ; + +lincat + Symb, [Symb] = SS ; + +lin + MkSymb s = s ; + + BaseSymb = infixSS "and" ; -- this comes between the last two ones + ConsSymb = infixSS "," ; + + +} diff --git a/src/TEMPLATE/VerbTMP.gf b/src/TEMPLATE/VerbTMP.gf new file mode 100644 index 000000000..413cff1d0 --- /dev/null +++ b/src/TEMPLATE/VerbTMP.gf @@ -0,0 +1,114 @@ +concrete VerbTMP of Verb = CatTMP ** open ResTMP, AdverbTMP, Prelude in { + + +lin + +----- +-- VP + -- : V -> VP + -- NB. assumes that lincat V = lincat VP + -- This will most likely change when you start working with VPs + UseV v = v ; + +{- + -- : V2 -> VP ; + PassV2 v2 = + + -- : VPSlash -> VP ; + ReflVP vps = + + -- : VV -> VP -> VP ; + ComplVV vv vp = + + -- : VS -> S -> VP ; + ComplVS vs s = + + -- : VQ -> QS -> VP ; + ComplVQ vq qs = + + -- : VA -> AP -> VP ; + ComplVA va ap = + + -- : Comp -> VP ; + UseComp comp = +-} +-------- +-- Slash +{- + -- : V2 -> VPSlash + SlashV2a v2 = + + -- : V3 -> NP -> VPSlash ; -- give it (to her) + Slash2V3 v3 dobj = + + -- : V3 -> NP -> VPSlash ; -- give (it) to her + Slash3V3 v3 iobj = + + SlashV2A v2 adj = + + -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good + SlashV2S v2s s = + + -- : V2V -> VP -> VPSlash ; -- beg (her) to go + SlashV2V v2v vp = ; + + -- : V2Q -> QS -> VPSlash ; -- ask (him) who came + SlashV2Q v2q qs = ; + + -- : V2A -> AP -> VPSlash ; -- paint (it) red + SlashV2A v2a ap = ; + + + -- : VPSlash -> NP -> VP + -- Often VPSlash has a field called c2, which is used to pick right form of np complement + ComplSlash vps np = vps ** { + compl = np.s ! vps.c2 + } ; + + -- : VV -> VPSlash -> VPSlash ; + SlashVV vv vps = ComplVV vv vps ** { + } ; + + -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy + SlashV2VNP v2v np vps = + + -- : VP -> Adv -> VP ; -- sleep here + AdvVP vp adv = + + -- : AdV -> VP -> VP ; -- always sleep + AdVVP adv vp = + + -- : VPSlash -> Adv -> VPSlash ; -- use (it) here + AdvVPSlash = insertAdv ; + + -- : VP -> Adv -> VP ; -- sleep , even though ... + ExtAdvVP vp adv = ; + + -- : AdV -> VPSlash -> VPSlash ; -- always use (it) + AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ; + + -- : VP -> Prep -> VPSlash ; -- live in (it) + VPSlashPrep vp prep = vp ** {c2 = prep} ; + + +--2 Complements to copula + +-- Adjectival phrases, noun phrases, and adverbs can be used. + + -- : AP -> Comp ; + CompAP ap = + + -- : CN -> Comp ; + CompCN cn = + + -- NP -> Comp ; + CompNP np = + + -- : Adv -> Comp ; + CompAdv adv = + + -- : VP -- Copula alone; + UseCopula = +-} + +} diff --git a/src/TEMPLATE/unittest/nouns.gftest b/src/TEMPLATE/unittest/nouns.gftest new file mode 100644 index 000000000..3fec5e0f2 --- /dev/null +++ b/src/TEMPLATE/unittest/nouns.gftest @@ -0,0 +1,9 @@ +----------------------------------- +-- Just some simple noun phrases -- +----------------------------------- + +Lang: DetCN (DetQuant IndefArt NumSg) (UseN blood_N) +LangTMP: a blood + +Lang: DetCN (DetQuant DefArt NumSg) (UseN blood_N) +LangTMP: the blood diff --git a/src/TEMPLATE/unittest/sentences.gftest b/src/TEMPLATE/unittest/sentences.gftest new file mode 100644 index 000000000..94b8dadd2 --- /dev/null +++ b/src/TEMPLATE/unittest/sentences.gftest @@ -0,0 +1,7 @@ +-------------------------------- +-- Just some simple sentences -- +-------------------------------- + +-- Replace with some tests that make sense for your language! +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN blood_N)) (UseV die_V)))) NoVoc +LangTMP: the blood die diff --git a/src/abstract/Cat.gf b/src/abstract/Cat.gf index 20c19f20c..72bd5f583 100644 --- a/src/abstract/Cat.gf +++ b/src/abstract/Cat.gf @@ -93,6 +93,7 @@ abstract Cat = Common ** { Numeral ; -- cardinal or ordinal in words e.g. "five/fifth" Digits ; -- cardinal or ordinal in digits e.g. "1,000/1,000th" + Decimal ; -- decimal number e.g. "1/2/3.14/-1" --2 Structural words @@ -128,7 +129,8 @@ abstract Cat = Common ** { N3 ; -- three-place relational noun e.g. "connection" GN ; -- given name e.g. "George" SN ; -- second name e.g. "Washington" - PN ; -- proper name e.g. "Paris" + LN ; -- location name e.g. "Sweden" + PN ; -- proper name -- DEPRECATED: QuantSg, QuantPl --- QuantSg ;-- quantifier ('nucleus' of sing. Det) e.g. "every" diff --git a/src/abstract/Common.gf b/src/abstract/Common.gf index 3e852978e..c56f73bf8 100644 --- a/src/abstract/Common.gf +++ b/src/abstract/Common.gf @@ -44,4 +44,8 @@ abstract Common = { Pol ; -- polarity e.g. positive, negative Ant ; -- anteriority e.g. simultaneous, anterior +--2 Measures + + MU ; -- unit of measurement e.g. "km", "cm", "%" + } diff --git a/src/abstract/Documentation.gf b/src/abstract/Documentation.gf index b5afc4ea9..c8c3389d9 100644 --- a/src/abstract/Documentation.gf +++ b/src/abstract/Documentation.gf @@ -14,6 +14,7 @@ fun InflectionN2 : N2 -> Inflection ; InflectionN3 : N3 -> Inflection ; InflectionPN : PN -> Inflection ; + InflectionLN : LN -> Inflection ; InflectionGN : GN -> Inflection ; InflectionSN : SN -> Inflection ; InflectionA : A -> Inflection ; diff --git a/src/abstract/Extend.gf b/src/abstract/Extend.gf index c35e3617f..2aaac7b22 100644 --- a/src/abstract/Extend.gf +++ b/src/abstract/Extend.gf @@ -27,9 +27,11 @@ abstract Extend = Cat ** { CompBareCN : CN -> Comp ; -- (is) teacher + PiedPipingQuestSlash : IP -> ClSlash -> QCl ; -- with whom does John live + PiedPipingRelSlash : RP -> ClSlash -> RCl ; -- with whom John lives StrandQuestSlash : IP -> ClSlash -> QCl ; -- whom does John live with - StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives in - EmptyRelSlash : ClSlash -> RCl ; -- he lives in + StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives with + EmptyRelSlash : ClSlash -> RCl ; -- he lives with -- $VP$ conjunction, separate categories for finite and infinitive forms (VPS and VPI, respectively) @@ -297,13 +299,10 @@ fun fun CardCNCard : Card -> CN -> Card ; -- three million, four lakh, six dozen etc - GivenName : GN -> PN ; - MaleSurname : SN -> PN ; - FemaleSurname : SN -> PN ; - PlSurname : SN -> PN ; - FullName : GN -> SN -> PN ; - fun AnaphPron : NP -> Pron ; +fun + TPastSimple : Tense ; + } diff --git a/src/abstract/Grammar.gf b/src/abstract/Grammar.gf index 25ded6029..8bb5ac420 100644 --- a/src/abstract/Grammar.gf +++ b/src/abstract/Grammar.gf @@ -19,6 +19,6 @@ abstract Grammar = Structural, Idiom, Tense, + Names, Transfer ; - diff --git a/src/abstract/Names.gf b/src/abstract/Names.gf new file mode 100644 index 000000000..0c469f9b1 --- /dev/null +++ b/src/abstract/Names.gf @@ -0,0 +1,14 @@ +abstract Names = Cat ** { + +fun GivenName : GN -> NP ; + MaleSurname : SN -> NP ; + FemaleSurname : SN -> NP ; + PlSurname : SN -> NP ; + FullName : GN -> SN -> NP ; + +fun UseLN : LN -> NP ; + PlainLN : LN -> NP ; + InLN : LN -> Adv ; + AdjLN : AP -> LN -> LN ; + +} diff --git a/src/abstract/Noun.gf b/src/abstract/Noun.gf index 31cfdf59b..413eb3aff 100644 --- a/src/abstract/Noun.gf +++ b/src/abstract/Noun.gf @@ -58,6 +58,7 @@ abstract Noun = Cat ** { data NumDigits : Digits -> Card ; -- 51 + NumDecimal : Decimal -> Card ; -- 3.14, -1, etc NumNumeral : Numeral -> Card ; -- fifty-one -- The construction of numerals is defined in [Numeral Numeral.html]. @@ -155,4 +156,8 @@ abstract Noun = Cat ** { AdjDAP : DAP -> AP -> DAP ; -- the large (one) DetDAP : Det -> DAP ; -- this (or that) +--2 Quantities + + QuantityNP : Decimal -> MU -> NP ; + } diff --git a/src/abstract/Numeral.gf b/src/abstract/Numeral.gf index 01702b5c6..be0d904e7 100644 --- a/src/abstract/Numeral.gf +++ b/src/abstract/Numeral.gf @@ -17,7 +17,7 @@ -- parts of a numeral, which is often incorrect - more work on -- (un)lexing is needed to solve this problem. -abstract Numeral = Cat [Numeral,Digits] ** { +abstract Numeral = Cat [Numeral,Digits,Decimal] ** { cat Digit ; -- 2..9 @@ -53,18 +53,18 @@ data pot3 : Sub1000 -> Sub1000000 ; -- m * 1000 pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n pot3as4 : Sub1000000 -> Sub1000000000 ; -- coercion of 1..999999 - pot3float : Float -> Sub1000000 ; -- 3.5 thousand + pot3decimal : Decimal -> Sub1000000 ; -- 3.5 thousand pot41 : Sub1000000000 ; -- a million instead of one million pot4 : Sub1000 -> Sub1000000000 ; -- m * 1000000000 pot4plus : Sub1000 -> Sub1000000 -> Sub1000000000 ; -- m * 1000000000 + n pot4as5 : Sub1000000000 -> Sub1000000000000 ; -- coercion of 1..999999999 - pot4float : Float -> Sub1000000000 ; -- 3.5 million + pot4decimal : Decimal -> Sub1000000000 ; -- 3.5 million pot51 : Sub1000000000000 ; -- a billion instead of one billion pot5 : Sub1000 -> Sub1000000000000 ; -- m * 1000000000 pot5plus : Sub1000 -> Sub1000000000 -> Sub1000000000000 ; -- m * 1000000000 + n - pot5float : Float -> Sub1000000000000 ; -- 3.5 billion + pot5decimal : Decimal -> Sub1000000000000 ; -- 3.5 billion -- Numerals as sequences of digits have a separate, simpler grammar @@ -77,4 +77,8 @@ data D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig ; + PosDecimal : Digits -> Decimal ; -- 8 + NegDecimal : Digits -> Decimal ; -- -8 + IFrac : Decimal -> Dig -> Decimal ; -- 3.14 -> 3.141 + } diff --git a/src/afrikaans/CatAfr.gf b/src/afrikaans/CatAfr.gf index 09293f065..27b5882a8 100644 --- a/src/afrikaans/CatAfr.gf +++ b/src/afrikaans/CatAfr.gf @@ -62,6 +62,7 @@ concrete CatAfr of Cat = Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural @@ -83,6 +84,9 @@ concrete CatAfr of Cat = N = Noun ; N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ; N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ; - GN, SN, PN = {s : NPCase => Str} ; + PN = {s : NPCase => Str} ; + GN = {s : NPCase => Str; g : Sex} ; + SN = {s : Sex => NPCase => Str; pl : NPCase => Str} ; + LN = {s : Adjf => NPCase => Str ; hasArt : Bool ; n : Number} ; } diff --git a/src/afrikaans/DocumentationAfr.gf b/src/afrikaans/DocumentationAfr.gf index b58c51af4..c080d2068 100644 --- a/src/afrikaans/DocumentationAfr.gf +++ b/src/afrikaans/DocumentationAfr.gf @@ -28,6 +28,12 @@ lin s2 = paragraph (pn.s ! NPNom) } ; + InflectionLN = \ln -> { + t = "pn" ; + s1 = heading1 "Naam" ; + s2 = paragraph (ln.s ! Strong ! NPNom) + } ; + InflectionGN = \pn -> { t = "vnm" ; s1 = heading1 "Voornaam" ; @@ -37,7 +43,7 @@ lin InflectionSN = \pn -> { t = "van" ; s1 = heading1 "Van" ; - s2 = paragraph (pn.s ! NPNom) + s2 = paragraph (pn.s ! Male ! NPNom) } ; InflectionA, InflectionA2 = \adj -> diff --git a/src/afrikaans/ExtendAfr.gf b/src/afrikaans/ExtendAfr.gf index 5becbada8..603378da7 100644 --- a/src/afrikaans/ExtendAfr.gf +++ b/src/afrikaans/ExtendAfr.gf @@ -12,9 +12,4 @@ lin PassVPSlash vps = PassAgentVPSlash vps np = insertAdv (appPrep "door" np.s) (insertInf (vps.s.s ! VPerf) (predV word_V)) ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! NPNom ++ sn.s ! c ; - } ; - } diff --git a/src/afrikaans/GrammarAfr.gf b/src/afrikaans/GrammarAfr.gf index af0d853e2..15b024260 100644 --- a/src/afrikaans/GrammarAfr.gf +++ b/src/afrikaans/GrammarAfr.gf @@ -14,4 +14,5 @@ concrete GrammarAfr of Grammar = TextX, IdiomAfr, StructuralAfr, - TenseX ; + TenseX, + NamesAfr ; diff --git a/src/afrikaans/NamesAfr.gf b/src/afrikaans/NamesAfr.gf new file mode 100644 index 000000000..f079b984f --- /dev/null +++ b/src/afrikaans/NamesAfr.gf @@ -0,0 +1,40 @@ +concrete NamesAfr of Names = CatAfr ** open ResAfr, Prelude in { + +lin GivenName = \n -> {s = n.s ; a = agrP3 Sg ; isPron = False} ; +lin MaleSurname = \n -> {s = n.s ! Male ; a = agrP3 Sg ; isPron = False} ; +lin FemaleSurname = \n -> {s = n.s ! Female; a = agrP3 Sg ; isPron = False} ; +lin PlSurname = \n -> {s = n.pl ; a = agrP3 Sg ; isPron = False} ; + +lin FullName gn sn = + {s = \\c => gn.s ! NPNom ++ sn.s ! gn.g ! c ; a = agrP3 Sg ; isPron = False} ; + +lin UseLN ln = { + s = \\c => case ln.hasArt of { + True => "die" ++ ln.s ! Weak ! c ; + False => ln.s ! Strong ! c + } ; + a = agrP3 ln.n ; + isPron = False + } ; + + PlainLN ln = { + s = \\c => ln.s ! Strong ! c ; + a = agrP3 ln.n ; + isPron = False + } ; + + InLN ln = { + s = appPrep "in" (\\c => case ln.hasArt of { + True => "die" ++ ln.s ! Weak ! c ; + False => ln.s ! Strong ! c + }) + } ; + + AdjLN ap ln = ln ** { + s = \\a,c => + preOrPost ap.isPre + (ap.s ! agrAdj Neutr a (NF ln.n Nom)) + (ln.s ! a ! c) ; + } ; + +} diff --git a/src/afrikaans/NounAfr.gf b/src/afrikaans/NounAfr.gf index 84c73d22f..b265c9192 100644 --- a/src/afrikaans/NounAfr.gf +++ b/src/afrikaans/NounAfr.gf @@ -77,6 +77,8 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; + NumDecimal dec = {s = \\g,c => dec.s ! NCard g c; n = dec.n } ; + NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; @@ -177,4 +179,10 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in { isMod = cn.isMod } ; + QuantityNP n m = { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard Neutr Nom) ; + a = agrP3 n.n ; + isPron = False + } ; + } diff --git a/src/afrikaans/NumeralAfr.gf b/src/afrikaans/NumeralAfr.gf index 222024185..7fee53c75 100644 --- a/src/afrikaans/NumeralAfr.gf +++ b/src/afrikaans/NumeralAfr.gf @@ -1,5 +1,5 @@ -concrete NumeralAfr of Numeral = CatAfr [Numeral,Digits] ** open ResAfr, Prelude in { +concrete NumeralAfr of Numeral = CatAfr [Numeral,Digits,Decimal] ** open ResAfr, Prelude in { flags optimize = all_subs ; coding=utf8 ; @@ -75,6 +75,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! invNum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; diff --git a/src/afrikaans/ParadigmsAfr.gf b/src/afrikaans/ParadigmsAfr.gf index 49f52b4c0..42dbfd8d0 100644 --- a/src/afrikaans/ParadigmsAfr.gf +++ b/src/afrikaans/ParadigmsAfr.gf @@ -73,6 +73,25 @@ oper mkPN : Str -> PN ; -- proper name } ; + mkGN = overload { -- given name + mkGN : Str -> GN = \s -> lin GN {s = \\_ => s; g = Male} ; + mkGN : Str -> Sex -> GN = \s,g -> lin GN {s = \\_ => s; g = g} ; + } ; + + mkSN = overload { -- given name + mkSN : Str -> SN = \s -> lin SN {s = \\_,_ => s; pl = \\_=>s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Male=>\\_=>male; Female=>\\_=>female}; pl=\\_=>pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN -- location name + = \s -> lin LN {s = \\_,_ => s; hasArt = False; n = Sg} ; + mkLN : Str -> Number -> LN -- location name + = \s,n -> lin LN {s = \\_,_ => s; hasArt = False; n = n} ; + } ; + + defLN : LN -> LN = \n -> n ** {hasArt = True} ; + --2 Adjectives @@ -205,6 +224,8 @@ oper feminine = Neutr ; het,neuter = Neutr ; de,utrum = Neutr ; + male = Male ; + female = Female ; mkA = overload { mkA : (vers : Str) -> A = \a -> lin A (regAdjective a) ; @@ -494,4 +515,6 @@ oper -- --} + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/amharic/CatAmh.gf b/src/amharic/CatAmh.gf index 398a62614..ab1cd9181 100644 --- a/src/amharic/CatAmh.gf +++ b/src/amharic/CatAmh.gf @@ -22,6 +22,7 @@ lincat Prep = ResAmh.Prep; Numeral = ResAmh.Numeral; --{s : CardOrd => Case => Str ; n : Number} ; Digits = ResAmh.Digits;--{s : CardOrd => Case => Str ; n : Number ; tail : DTail} ; + Decimal = ResAmh.Decimal; Ord = ResAmh.Ord ; --{ s : Case => Str } ; Num = ResAmh.Num;--{s : Case => Str ; n : Number ; hasCard : Bool} ; Card = ResAmh.Card;--{s : Case => Str ; n : Number} ; diff --git a/src/amharic/NounAmh.gf b/src/amharic/NounAmh.gf index c2816561d..7ff5fb297 100644 --- a/src/amharic/NounAmh.gf +++ b/src/amharic/NounAmh.gf @@ -94,6 +94,7 @@ lin NumCard n = {s = \\s,c => n.s!Masc!Sg!s!c ; n = Pl; hasCard = True} ; NumDigits n = {s = n.s ! NCard } ; + NumDecimal n = {s = n.s ! NCard } ; NumNumeral numeral = {s = numeral.s ! NCard} ; diff --git a/src/amharic/NumeralAmh.gf b/src/amharic/NumeralAmh.gf index 79cad2e3a..421227a27 100644 --- a/src/amharic/NumeralAmh.gf +++ b/src/amharic/NumeralAmh.gf @@ -1,5 +1,5 @@ -concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits] ** open ResAmh,ParamX,Prelude in { +concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits,Decimal] ** open ResAmh,ParamX,Prelude in { flags coding = utf8; lincat @@ -91,6 +91,18 @@ lin pot3plus n m = { D_8 = mkDig "8" ; D_9 = mk2Dig "9" "9ኛ"; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o,g,n,s,c => "-" ++ BIND ++ d.s !o!g!n!s!c ; + hasDot=False + } ; + IFrac d i = { + s = \\o,g,n,s,c => d.s!NCard!Masc!Sg!Indef!c ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g ! n ! s ! c; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND++","++BIND ; diff --git a/src/amharic/ResAmh.gf b/src/amharic/ResAmh.gf index bea4c5bdf..b21ec2910 100644 --- a/src/amharic/ResAmh.gf +++ b/src/amharic/ResAmh.gf @@ -161,6 +161,10 @@ resource ResAmh = PatternsAmh** open Prelude,MorphoAmh,ParamX in { s : CardOrd=>Gender=>Number=>Species=>Case => Str ; tail : DTail } ; + Decimal = { + s : CardOrd=>Gender=>Number=>Species=>Case => Str ; + hasDot : Bool + } ; Ord = {s : Gender=>Number=>Species=>Case => Str} ; diff --git a/src/ancient_greek/CatGrc.gf b/src/ancient_greek/CatGrc.gf index 65cb892b5..06dbfdecf 100644 --- a/src/ancient_greek/CatGrc.gf +++ b/src/ancient_greek/CatGrc.gf @@ -90,6 +90,7 @@ concrete CatGrc of Cat = CommonX - [Temp,Tense] ** open ResGrc, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : Str ; unit : Unit} ; + Decimal = {s : Str ; unit : Unit ; hasDot : Bool} ; -- Structural diff --git a/src/ancient_greek/NounGrc.gf b/src/ancient_greek/NounGrc.gf index fa7b5d117..376e4e241 100644 --- a/src/ancient_greek/NounGrc.gf +++ b/src/ancient_greek/NounGrc.gf @@ -83,6 +83,8 @@ concrete NounGrc of Noun = CatGrc ** open Prelude, ResGrc, (M = MorphoGrc) in { -- TODO: check the following two: NumDigits digits = let num : Number = case digits.unit of {one => Sg ; _ => Pl} in {s = \\g,c => digits.s ++ "'"; n = num ; isCard = True} ; + NumDecimal digits = let num : Number = case digits.unit of {one => Sg ; _ => Pl} + in {s = \\g,c => digits.s ++ "'"; n = num ; isCard = True} ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; AdNum adn num = {s = \\g,c => adn.s ++ num.s ! g ! c ; n = num.n} ; diff --git a/src/ancient_greek/NumeralGrc.gf b/src/ancient_greek/NumeralGrc.gf index a1042a307..42dfcb8d8 100644 --- a/src/ancient_greek/NumeralGrc.gf +++ b/src/ancient_greek/NumeralGrc.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../prelude: -concrete NumeralGrc of Numeral = CatGrc ** open ResGrc, MorphoGrc in { +concrete NumeralGrc of Numeral = CatGrc ** open ResGrc, MorphoGrc, Prelude in { lincat Digit = {s : DForm => CardOrd => Str} ; @@ -81,6 +81,8 @@ lin -- mkDigit d (d+10) (d*10) d-th d-times D_8 = mkDig "h" "p" "w" ; D_9 = mkDig "v" "K" "P" ; -- TODO: replace K by koppa, P by sampi (not in ut -ancientgreek) + PosDecimal d = d ** {hasDot=False} ; + oper TDigit = { s : Unit => Str diff --git a/src/api/SyntaxGer.gf b/src/api/SyntaxGer.gf index 59f495279..441702885 100644 --- a/src/api/SyntaxGer.gf +++ b/src/api/SyntaxGer.gf @@ -1,4 +1,4 @@ ---# -path=.:alltenses:prelude +--# -path=../abstract:.:alltenses:prelude: instance SyntaxGer of Syntax = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ; diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 10fcfb708..5dba84f27 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -67,6 +67,8 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { n : Size } ; Digits = {s : Str; n : Size}; + Decimal = {s : Str; + n : Size; hasDot : Bool}; -- Structural @@ -90,7 +92,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { N = ResAra.Noun ; N2 = ResAra.Noun2 ; N3 = ResAra.Noun3 ; - PN = {s : Case => Str; g : Gender; h : Species} ; + GN, SN, LN, PN = {s : Case => Str; g : Gender; h : Species} ; linref diff --git a/src/arabic/GrammarAra.gf b/src/arabic/GrammarAra.gf index 21bf9f570..c97b1bc5f 100644 --- a/src/arabic/GrammarAra.gf +++ b/src/arabic/GrammarAra.gf @@ -14,7 +14,8 @@ concrete GrammarAra of Grammar = TextX - [Utt], StructuralAra, IdiomAra, - TenseX - [Utt] + TenseX - [Utt], + NamesAra ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/arabic/MorphoAra.gf b/src/arabic/MorphoAra.gf index 808223b4d..53f7a2608 100644 --- a/src/arabic/MorphoAra.gf +++ b/src/arabic/MorphoAra.gf @@ -153,7 +153,8 @@ oper w + "ف" + x + "ع" + y + "ل" + z => { h = w ; m1 = x; m2 = y; t = z} ; w + "ف" + x + ("ع"|"ل") + y - => { h = w ; m1 = x; m2 = ""; t = y} + => { h = w ; m1 = x; m2 = ""; t = y} ; + _ => Predef.error("cannot get FCL pattern from" ++ pat) } ; --opers to interdigitize (make words out of roots and patterns: @@ -204,7 +205,8 @@ oper => mkAssimilated pat (mkRoot3 rS) ; ? + ? + _ => mkBilit pat (mkRoot2 rS) ; --2=> _=> error rS ---- AR error "expected 3--6" - } + } ; + _ => Predef.error("cannot get FCL pattern from" ++ pS) }; ----------------------------------------------------------------------------- diff --git a/src/arabic/NamesAra.gf b/src/arabic/NamesAra.gf new file mode 100644 index 000000000..d89286969 --- /dev/null +++ b/src/arabic/NamesAra.gf @@ -0,0 +1,17 @@ +concrete NamesAra of Names = CatAra ** open ResAra, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> emptyNP ** { + s = n.s ; + a = {pgn = Per3 n.g Sg ; isPron = False} ; + } ; +lin FullName gn sn = emptyNP ** { + s = \\c => gn.s ! c ++ sn.s ! c ; + a = {pgn = Per3 gn.g Sg ; isPron = False} ; + } ; + +lin UseLN pn = emptyNP ** { + s = pn.s ; + a = {pgn = Per3 pn.g Sg ; isPron = False} ; + } ; + +} diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index e22f7c99b..8af8ce0b3 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -130,6 +130,10 @@ lin s = \\_,_,_ => digits.s ; isNum = True }; + NumDecimal dec = dec ** { + s = \\_,_,_ => dec.s ; + isNum = True + }; NumNumeral numeral = numeral ** { s = numeral.s ! NCard ; diff --git a/src/arabic/NumeralAra.gf b/src/arabic/NumeralAra.gf index fd5104698..1fe706348 100644 --- a/src/arabic/NumeralAra.gf +++ b/src/arabic/NumeralAra.gf @@ -1,4 +1,4 @@ -concrete NumeralAra of Numeral = CatAra [Numeral,Digits] ** +concrete NumeralAra of Numeral = CatAra [Numeral,Digits,Decimal] ** open Predef, Prelude, ResAra, MorphoAra in { flags coding=utf8 ; @@ -136,6 +136,20 @@ lincat D_8 = mk1Dig "8" ; D_9 = mk1Dig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s; + n = ThreeTen ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + n = ThreeTen ; + hasDot=True + } ; + oper diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index ce479f944..80506ebbb 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -868,4 +868,99 @@ formV : (root : Str) -> VerbForm -> V = \s,f -> case f of { param VerbForm = FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVII | FormVIII | FormX | FormXI ; + +{- temporarily moved to wiktionary/MoreAra.gf +-- paradigms for Wiktionary extraction +---- TODO: better usage of information in Wiktionary + +oper + wmkN = overload { + wmkN : {sg, pl : Str ; g : Gender} -> N + = \r -> mkN r.sg r.pl r.g nohum ; --- hum/nohum not in Wikt + wmkN : {sg : Str} -> N + = \r -> smartN r.sg ; + wmkN : {sg : Str ; g : Gender ; root : Str} -> N + = \r -> smartN r.sg ** {g = r.g} ; ---- + wmkN : {sg : Str; g : Gender} -> N + = \r -> smartN r.sg ** {g = r.g} ; + wmkN : {sg : Str; pl : Str; g : Gender; root : Str} -> N + = \r -> mkN r.sg r.pl r.g nohum ; --- hum/nohum not in Wikt + wmkN : {sg : Str; pl : Str} -> N + = \r -> mkN r.sg r.pl masc nohum ; ---- ** {g = (smartN r.sg).g} ; + wmkN : {sg, pl : Str ; root : Str} -> N + = \r -> mkN r.sg r.pl masc nohum ; ---- + wmkN : {sg : Str; root : Str} -> N + = \r -> smartN r.sg ; + } ; + + wmkA = overload { + wmkA : {root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; fem_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, sg_patt, pl_patt : Str} -> A + = \r -> mkA r.root r.sg_patt r.pl_patt ; + wmkA : {masc_sg, fem_sg, masc_pl, root, sg_patt, pl_patt : Str} -> A + = \r -> mkA r.root r.sg_patt r.pl_patt ; + wmkA : {fem_pl : Str; fem_sg : Str; masc_sg : Str; root : Str; sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {fem_pl : Str; fem_sg : Str; masc_sg, masc_pl, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg, masc_pl, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, pl_patt : Str} -> A + = \r -> mkA r.root ; ---- + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root : Str} -> A + = \r -> mkA r.root ; ---- + wmkA : {masc_sg, fem_sg, root : Str} -> A + = \r -> mkA r.root ; ---- + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, pl_patt : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; fem_sg : Str; root : Str ; sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg : Str; fem_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; fem_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; masc_pl, pl_patt : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; masc_pl, pl_patt, sg_patt : Str; root : Str} -> A + = \r -> mkA r.sg_patt r.pl_patt ; + wmkA : {masc_sg : Str; masc_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl, pl_patt : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + } ; + + wmkV = overload { + wmkV : {perfect : Str; cls : VerbForm; root : Str} -> V + = \r -> mkV r.root r.cls ; ---- + wmkV : {perfect : Str; cls : VerbForm} -> V + = \r -> mkV r.perfect r.cls ; ---- + wmkV : {perfect : Str; imperfect : Str; cls : VerbForm; root : Str} -> V + = \r -> mkV r.root r.cls ; ---- + wmkV : {perfect : Str; imperfect : Str; cls : VerbForm} -> V + = \r -> mkV r.perfect r.cls ; ---- + wmkV : {root : Str ; cls : VerbForm} -> V + = \r -> mkV r.root r.cls ; + wmkV : {imperfect : Str} -> V + = \r -> variants {} ; ---- mkV r.imperfect ; + } ; +-} } ; diff --git a/src/arabic/wiktionary/Makefile b/src/arabic/wiktionary/Makefile new file mode 100644 index 000000000..00777b200 --- /dev/null +++ b/src/arabic/wiktionary/Makefile @@ -0,0 +1,8 @@ +all: + python3 read_wiktionary.py gf-abs >MorphoDictAraAbs.gf + python3 read_wiktionary.py gf-cnc >MorphoDictAra.gf + python3 read_wiktionary.py gf-map >source_of_MorphoDictAra.jsonl + gf -make MorphoDictAra.gf + python3 read_wiktionary.py eval-funs >eval.jsonl + python3 to_wordnet.py >next_WordNetAra.gf + python3 read_wiktionary.py error-analysis diff --git a/src/arabic/wiktionary/MoreAra.gf b/src/arabic/wiktionary/MoreAra.gf new file mode 100644 index 000000000..f91a73d43 --- /dev/null +++ b/src/arabic/wiktionary/MoreAra.gf @@ -0,0 +1,98 @@ +resource MoreAra = CatAra ** open ParadigmsAra in { + + +-- temporarily moved from ParadigmsAra +-- paradigms for Wiktionary extraction +---- TODO: better usage of information in Wiktionary + +oper + wmkN = overload { + wmkN : {sg, pl : Str ; g : Gender} -> N + = \r -> mkN r.sg r.pl r.g nohum ; --- hum/nohum not in Wikt + wmkN : {sg : Str} -> N + = \r -> smartN r.sg ; + wmkN : {sg : Str ; g : Gender ; root : Str} -> N + = \r -> smartN r.sg ** {g = r.g} ; ---- + wmkN : {sg : Str; g : Gender} -> N + = \r -> smartN r.sg ** {g = r.g} ; + wmkN : {sg : Str; pl : Str; g : Gender; root : Str} -> N + = \r -> mkN r.sg r.pl r.g nohum ; --- hum/nohum not in Wikt + wmkN : {sg : Str; pl : Str} -> N + = \r -> mkN r.sg r.pl masc nohum ; ---- ** {g = (smartN r.sg).g} ; + wmkN : {sg, pl : Str ; root : Str} -> N + = \r -> mkN r.sg r.pl masc nohum ; ---- + wmkN : {sg : Str; root : Str} -> N + = \r -> smartN r.sg ; + } ; + + wmkA = overload { + wmkA : {root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; fem_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, sg_patt, pl_patt : Str} -> A + = \r -> mkA r.root r.sg_patt r.pl_patt ; + wmkA : {masc_sg, fem_sg, masc_pl, root, sg_patt, pl_patt : Str} -> A + = \r -> mkA r.root r.sg_patt r.pl_patt ; + wmkA : {fem_pl : Str; fem_sg : Str; masc_sg : Str; root : Str; sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {fem_pl : Str; fem_sg : Str; masc_sg, masc_pl, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg, masc_pl, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, pl_patt : Str} -> A + = \r -> mkA r.root ; ---- + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root : Str} -> A + = \r -> mkA r.root ; ---- + wmkA : {masc_sg, fem_sg, root : Str} -> A + = \r -> mkA r.root ; ---- + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, pl_patt : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; fem_sg : Str; root : Str ; sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg : Str; fem_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; fem_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; masc_pl, pl_patt : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; masc_pl, pl_patt, sg_patt : Str; root : Str} -> A + = \r -> mkA r.sg_patt r.pl_patt ; + wmkA : {masc_sg : Str; masc_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl, pl_patt : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + } ; + + wmkV = overload { + wmkV : {perfect : Str; cls : VerbForm; root : Str} -> V + = \r -> mkV r.root r.cls ; ---- + wmkV : {perfect : Str; cls : VerbForm} -> V + = \r -> mkV r.perfect r.cls ; ---- expects root + wmkV : {perfect : Str; imperfect : Str; cls : VerbForm; root : Str} -> V + = \r -> mkV r.root r.cls ; ---- + wmkV : {perfect : Str; imperfect : Str; cls : VerbForm} -> V + = \r -> mkV r.perfect r.cls ; ---- expects root + wmkV : {root : Str ; cls : VerbForm} -> V + = \r -> mkV r.root r.cls ; + wmkV : {imperfect : Str} -> V + = \r -> variants {} ; ---- mkV r.imperfect ; -- expects cls I + } ; + +} \ No newline at end of file diff --git a/src/arabic/wiktionary/WordNetAra.gf b/src/arabic/wiktionary/WordNetAra.gf new file mode 100644 index 000000000..992775b69 --- /dev/null +++ b/src/arabic/wiktionary/WordNetAra.gf @@ -0,0 +1,530 @@ +--# -path=.:../gf-wordnet +concrete WordNetAra of WordNet = CatAra ** open MorphoDictAra, MoreAra, ParadigmsAra in { +lin en = variants {} ; --- guess from +lin absolute_3_A = 'مُطْلَق_A' ; -- 4578 [['absolute, utter, very, unlimited, unrestricted'], ['downright'], ['sovereign'], ['liberated, free'], ['implicit']] +-- lin absolute_3_A = 'مُطَلَّق_A' ; -- 8217 [['divorced']] +lin administrative_A = mkA "داري" ; --- guess from داري +lin afghani_1_N = mkN "فغاني" ; --- guess from فغاني +lin afrikaans_N = mkN "لغةفريكانية" ; --- guess from لغةفريكانية +lin age_1_N = 'سِنّ_N' ; -- 480 [['tooth, tusk, fang'], ['point or tip'], ['a spearhead or arrowhead'], ['age (years of life)'], ['cog, sprocket, prong']] +-- lin age_1_N = 'سَنّ_N' ; -- 86682 [['verbal noun of سَنَّ (sanna) (form I)'], ['prescription, introduction, enactment']] +lin akan_N = mkN "الكانية" ; --- guess from الكانية +lin alabama_4_N = mkN "لاباما" ; --- guess from لاباما +lin albanian_2_N = mkN "اللبانية" ; --- guess from اللبانية +lin aleut_N = mkN "الليوتية" ; --- guess from الليوتية +lin amharic_N = mkN "المهرية" ; --- guess from المهرية +lin amir_N = mkN "مير" ; --- guess from مير +lin amount_to_2_V2 = variants {} ; --- guess from يصللى +lin arabic_A = 'عَرَبِي_A' ; -- 2706 [['Arab'], ['Arabic'], ['Arabian']] +lin arabic_N = mkN "العربية" ; --- guess from العربية +lin arapaho_N = mkN "الراباهو" ; --- guess from الراباهو +lin arawak_N = mkN "راواك" ; --- guess from راواك +lin area_6_N = 'مِنْطَقَة_N' ; -- 5712 [['belt, girdle'], ['zone'], ['vicinity, range, district, area, territory, sphere'], ['military sector'], ['area, an administrative subdivision of Kuwait'], ['province']] +-- lin area_6_N = 'مَنْطِقَة_N' ; -- 19267 [['zone'], ['vicinity, range, district, area, territory, sphere'], ['military sector'], ['area, an administrative subdivision of Kuwait'], ['province']] +-- lin area_6_N = 'مَنْطَقَة_N' ; -- 118100 [['verbal noun of مَنْطَقَ (manṭaqa) (form Iq)']] +lin armenian_2_N = mkN "ارمينية" ; --- guess from ارمينية +lin assamese_N = mkN "السامية" ; --- guess from السامية +lin assyrian_2_N = mkN "شوري" ; --- guess from شوري +lin authoritarian_1_A = mkA "استبدادي" ; --- guess from استبدادي +lin average_1_N = mkN "متوسط" ; --- guess from متوسط +lin avestan_N = mkN "الفستية" ; --- guess from الفستية +lin azerbaijani_N = mkN "الذرية" ; --- guess from الذرية +lin balboa_1_N = mkN "بلبوا" ; --- guess from بلبوا +lin balinese_N = mkN "اللغةالبالية" ; --- guess from اللغةالبالية +lin baltic_2_A = mkA "بلطيق" ; --- guess from بلطيق +lin ban_2_N = 'مَنْع_N' ; -- 118052 [['verbal noun of مَنَعَ (manaʕa) (form I)'], ['prevention']] +lin ban_3_N = 'نَهْي_N' ; -- 122876 [['verbal noun of نَهَى (nahā) (form I)'], ['an order not to do something, a prohibition, a proscription'], ['negative imperative, prohibitive; expressing a prohibition with the particle لَا (lā) and the jussive']] +lin bata_N = mkN "باتا" ; --- guess from باتا +lin belarusian_N = 'بِيلَارُوسِيّ_N' ; -- 2861 [['Belarusian (person)']] +lin bengali_3_N = mkN "البنغالية" ; --- guess from البنغالية +lin birr_1_N = 'بَرّ_N' ; -- 128073 [['land, dry land (as opposed to sea)'], ['outside, field']] +-- lin birr_1_N = 'بِرّ_N' ; -- 128094 [['verbal noun of بَرَّ (barra) (form I)'], ['faith, godliness, piety'], ['respectfulness'], ['kindness']] +lin blackfoot_N = mkN "بلاكفوت" ; --- guess from بلاكفوت +lin bole_3_N = 'جِذْع_N' ; -- 18227 [['a tree trunk, body, stock, torso']] +-- lin bole_3_N = 'جَذَع_N' ; -- 19252 [['youth, animal old enough to use (of livestock as well as humans)']] +lin boliviano_N = mkN "بوليفيانو" ; --- guess from بوليفيانو +lin book_1_N = 'كُتَّاب_N' ; -- 2089 [["a traditional school for teaching Qur'an"]] +-- lin book_1_N = 'كِتَاب_N' ; -- 111971 [['verbal noun of كَتَبَ (kataba) (form I)'], ['verbal noun of كَاتَبَ (kātaba) (form III)'], ['letter, note, paper, piece of writing, message'], ['book'], ["the Scripture, the Qur'an or the Bible"], ['record, document, deed, contract'], ['a marriage contract.']] +lin border_1_N = 'حَدّ_N' ; -- 66721 [['verbal noun of حَدَّ (ḥadda) (form I)'], ['limit'], ['boundary, border'], ['frontier'], ['term'], ['end, goal, aim'], ['district'], ['reach, sphere of action'], ['difference'], ['definition'], ['rule'], ['punishment'], ['edge, point'], ['passion'], ['intoxicating strength of liquors'], ['strength, bravery'], ['energy'], ['manner, way'], ['hindrance'], ['side']] +lin breton_N = mkN "البريتونية" ; --- guess from البريتونية +lin bulgarian_N = 'بُلْغارِيّ_N' ; -- 2929 [['Bulgarian (native or inhabitant of Bulgaria)']] +lin burmese_2_N = mkN "البورمية" ; --- guess from البورمية +lin caddo_N = mkN "الكادو" ; --- guess from الكادو +lin cantonese_N = mkN "الكنتونية" ; --- guess from الكنتونية +lin capital_3_N = mkN "عاصمة" ; --- guess from عاصمة +lin captain_1_N = 'نَقِيب_N' ; -- 12918 [['captain'], ['leader, chief'], ['magistrate, head of a community'], ['prefect, governor'], ['intelligent man'], ['master of ceremonies'], ['tongue of a balance'], ['pipe, flute']] +lin carib_N = mkN "الكاريبية" ; --- guess from الكاريبية +lin catalan_N = mkN "القطلونية" ; --- guess from القطلونية +lin catawba_N = mkN "كاتاوبا" ; --- guess from كاتاوبا +lin catering_N = mkN "خدمةغذائية" ; --- guess from خدمةغذائية +lin catholicism_N = mkN "المذهبالكاثوليكي" ; --- guess from المذهبالكاثوليكي +lin cayuga_N = mkN "الكايوجية" ; --- guess from الكايوجية +lin cebuano_N = mkN "السيبونية" ; --- guess from السيبونية +lin chairman_N = 'رَئِيس_N' ; -- 5965 [['boss, chief, leader'], ['director'], ['headmaster, principal'], ['chairman'], ['governor'], ['president'], ['manager, superintendent'], ['conductor'], ['captain']] +lin chancellor_2_N = mkN "مستشار" ; --- guess from مستشار +lin chechen_N = mkN "شيشاني" ; --- guess from شيشاني +lin cherokee_N = mkN "شيروكي" ; --- guess from شيروكي +lin chetrum_N = mkN "نغولترمبوتاني" ; --- guess from نغولترمبوتاني +lin cheyenne_N = mkN "الشايان" ; --- guess from الشايان +lin child_1_N = 'طِفْل_N' ; -- 6665 [['child (a minor)'], ['children (a minor)']] +lin child_2_N = 'طِفْل_N' ; -- 6665 [['child (a minor)'], ['children (a minor)']] +lin chinese_N = 'صِينِيَّة_N' ; -- 2999 [['Chinese language']] +-- lin chinese_N = 'صِينِيَّة_1_N' ; -- 3000 [['Chinese porcelain, china'], ['plate'], ['dish'], ['tray']] +-- lin chinese_N = 'صِينِيَّة_2_N' ; -- 94044 [['feminine singular of صِينِيّ (ṣīniyy, “Chinese person”)']] +lin chinook_4_N = mkN "سالمون" ; --- guess from سالمون +lin chinook_jargon_N = mkN "الشينوكجارجون" ; --- guess from الشينوكجارجون +lin chipewyan_N = mkN "الشيباوايان" ; --- guess from الشيباوايان +lin chippewa_N = mkN "شيبيوا" ; --- guess from شيبيوا +lin choctaw_N = mkN "الشوكتو" ; --- guess from الشوكتو +lin christianity_1_N = 'مَسِيحِيَّة_N' ; -- 3072 [['Christianity'], ['female equivalent of مَسِيحِيّ (masīḥiyy)']] +lin chukchi_N = mkN "لغةتشوكشي" ; --- guess from لغةتشوكشي +lin chuvash_N = mkN "التشوفاشي" ; --- guess from التشوفاشي +lin city_1_N = 'مَدِينَة_N' ; -- 18135 [['town, city'], ['jurisdiction']] +lin coat_of_arms_N = mkN "شعارالنبالة" ; --- guess from شعارالنبالة +lin colon_3_N = mkN "قولون" ; --- guess from قولون +lin commonwealth_3_N = mkN "كومنولث" ; --- guess from كومنولث +lin communist_A = 'شُيُوعِي_A' ; -- 7022 [['communist'], ['Communist'], ['communal']] +lin consider_6_V3 = variants {} ; --- guess from نظراخذبعينالاعتبار +lin constitutional_2_A = 'دُسْتُورِي_A' ; -- 1506 [['constitutional']] +lin coptic_N = mkN "القبطية" ; --- guess from القبطية +lin cordoba_N = mkN "كوردوبا" ; --- guess from كوردوبا +lin cornish_N = mkN "الكورنية" ; --- guess from الكورنية +lin council_1_N = 'مَجْلِس_N' ; -- 15878 [['seat'], ['place of meeting; seat of an assembling body; conference room; court; tribunal'], ['session, sitting, meeting, party'], ['council, college, collegium, board, committee, commission'], ['husainiya']] +lin country_1_N = 'دَوْلَة_N' ; -- 16961 [['state (sovereign polity)'], ['alternation, change']] +lin country_2_N = 'بَلَد_N' ; -- 7321 [['country, land, homeland'], ['town, city'], ['place, village, community']] +lin cree_N = mkN "الكرى" ; --- guess from الكرى +lin crow_6_N = mkN "الغراب" ; --- guess from الغراب +lin culture_6_N = 'ثَقَافَة_N' ; -- 61562 [['verbal noun of ثَقُفَ (ṯaqufa) (form I)'], ['sagacity, intelligence, wit, refinement, culture'], ['culture (civilization)'], ['education, literacy']] +lin currency_1_N = 'عُمْلَة_N' ; -- 7550 [['currency, standardized money']] +-- lin currency_1_N = 'عَمْلَة_N' ; -- 8932 [['evil deed, perfidy']] +-- lin currency_1_N = 'عِمْلَة_N' ; -- 13013 [['mode of acting, manner of service, wise of working on a thing']] +lin current_A = mkA "جار" ; --- guess from جار +lin czech_3_N = mkN "التشيكية" ; --- guess from التشيكية +lin dakota_3_N = mkN "الداكوتا" ; --- guess from الداكوتا +lin dalasi_N = mkN "دلاسى" ; --- guess from دلاسى +lin danish_1_N = mkN "دانماركية" ; --- guess from دانماركية +lin dari_N = mkN "دري" ; --- guess from دري +lin decentralization_2_N = mkN "لامركزية" ; --- guess from لامركزية +lin decline_1_N = 'نَقْص_N' ; -- 122335 [['verbal noun of نَقَصَ (naqaṣa) (form I)'], ['reduction'], ['lack']] +lin delaware_5_N = mkN "الديلوير" ; --- guess from الديلوير +lin democracy_2_N = 'جُمْهُورِيَّة_N' ; -- 15302 [['republicanism'], ['republic']] +-- lin democracy_2_N = 'جُمْهُورِيَّة_1_N' ; -- 65212 [['female equivalent of جُمْهُورِيّ (jumhūriyy)']] +lin democratic_1_A = 'دِيمُقْرَاطِي_A' ; -- 7835 [['democratic']] +lin demographic_N = mkN "ديموغرافي" ; --- guess from ديموغرافي +lin designate_4_V2 = mkV2 'صَمَّمَ_V' ; -- 7721 [['to deafen [+accusative]', 'to deafen'], ['to resolve, to become bent on [+ عَلَى (object)]', 'to resolve, to become bent on'], ['to design, to configure, to devise, to contrive, to fix [+accusative]', 'to design, to configure, to devise, to contrive, to fix']] +lin development_2_N = mkN "تطوير" ; --- guess from تطوير +lin dictatorship_N = mkN "استبدادية" ; --- guess from استبدادية +lin dinar_1_N = mkN "دينار" ; --- guess from دينار +lin dinar_3_N = mkN "دينار" ; --- guess from دينار +lin dinar_5_N = mkN "دينار" ; --- guess from دينار +lin dinar_6_N = mkN "دينار" ; --- guess from دينار +lin dinar_7_N = mkN "دينار" ; --- guess from دينار +lin dinar_8_N = mkN "دينار" ; --- guess from دينار +lin dinar_9_N = mkN "دينار" ; --- guess from دينار +lin dinka_N = mkN "الدنكا" ; --- guess from الدنكا +lin dirham_2_N = mkN "درهم" ; --- guess from درهم +lin dirham_3_N = mkN "درهم" ; --- guess from درهم +lin distribution_1_N = mkN "توزيع" ; --- guess from توزيع +lin dobra_N = mkN "دوبرا" ; --- guess from دوبرا +lin domestic_1_A = mkA "داخلى" ; --- guess from داخلى +lin dong_N = mkN "دونغ" ; --- guess from دونغ +lin dram_3_N = mkN "دراخما" ; --- guess from دراخما +lin drinking_water_N = mkN "ماشرب" ; --- guess from ماشرب +lin dutch_N = 'هُولَنْدِيّ_N' ; -- 3835 [['Netherlander, Dutchman']] +lin east_4_N = 'شَرْق_N' ; -- 8514 [['east; Orient']] +-- lin east_4_N = 'شَرَق_N' ; -- 89149 [['verbal noun of شَرِقَ (šariqa) (form I)']] +lin eastern_4_A = 'شَرْقِي_A' ; -- 8518 [['eastern'], ['Eastern, Oriental']] +lin economy_1_N = 'اِقْتِصَاد_N' ; -- 44555 [['verbal noun of اِقْتَصَدَ (iqtaṣada) (form VIII)'], ['economy (“frugal use of resources”)'], ['economy (“system of production and distribution”)'], ['economics']] +lin education_1_N = 'تَعْلِيم_N' ; -- 100950 [['verbal noun of عَلَّمَ (ʕallama) (form II)'], ['teaching, education']] +lin emperor_1_N = mkN "مبراطور" ; --- guess from مبراطور +lin english_N = mkN "النجليزية" ; --- guess from النجليزية +lin equality_1_N = 'مُسَاوَاة_N' ; -- 84036 [['verbal noun of سَاوَى (sāwā) (form III)'], ['equality, equivalence'], ['equal rights'], ['settlement (of a bill)']] +lin escudo_2_N = mkN "سكودو" ; --- guess from سكودو +lin esperanto_N = mkN "سبرانتو" ; --- guess from سبرانتو +lin estonian_N = mkN "الستونية" ; --- guess from الستونية +lin evenki_N = mkN "اللغةاليفينكية" ; --- guess from اللغةاليفينكية +lin ewe_2_N = mkN "اليوي" ; --- guess from اليوي +lin extreme_1_A = mkA "قصى" ; --- guess from قصى +lin fang_1_N = mkN "الفانج" ; --- guess from الفانج +lin faroese_N = mkN "لغةفاروية" ; --- guess from لغةفاروية +lin father_1_N = 'وَالِد_N' ; -- 9224 [['father'], ['parent'], ['paternal relatives']] +lin federal_4_A = mkA "فيدرالي" ; --- guess from فيدرالي +lin fertility_1_N = mkN "معدلالمواليد" ; --- guess from معدلالمواليد +lin fijian_2_N = mkN "الفيجية" ; --- guess from الفيجية +lin filipino_2_N = mkN "الفلبينية" ; --- guess from الفلبينية +lin finnish_N = mkN "الفنلندية" ; --- guess from الفنلندية +lin firewood_N = mkN "حطب" ; --- guess from حطب +lin flag_1_N = 'عَلَم_N' ; -- 16266 [['sign, token, mark, badge'], ['harelip'], ['road sign, guidepost'], ['flag, banner'], ['authority, luminary, star, personage, distinguished man'], ['a mountain'], ['proper noun']] +-- lin flag_1_N = 'عِلْم_N' ; -- 101070 [['verbal noun of عَلِمَ (ʕalima) (form I)'], ['knowledge, learning, lore'], ['cognition, acquaintance'], ['information'], ['perception, knowledge'], ['(plural عُلُوم (ʕulūm)) science', 'science']] +lin flaw_3_N = 'خَلَل_N' ; -- 9954 [['gap, breach, interstice, interspace, chink'], ['flaw, imbalance, bug, disturbance, trait of disorder']] +lin flemish_2_N = mkN "الفلمنكية" ; --- guess from الفلمنكية +lin flour_N = 'دَقِيق_N' ; -- 9558 [['flour, meal']] +lin following_2_A = mkA "تال" ; --- guess from تال +lin food_1_N = 'طَعَام_N' ; -- 265 [['food'], ['food', 'prepared meal'], ['feeding'], ['wheat'], ['grain, cereal']] +lin forint_N = mkN "فورنتمجري" ; --- guess from فورنتمجري +lin former_3_A = 'سَابِق_A' ; -- 14587 [['preceding, previous'], ['former'], ['active participle of سَبَقَ (sabaqa).']] +lin formula_6_N = mkN "صيغ" ; --- guess from صيغ +lin fox_7_N = mkN "الثعلب" ; --- guess from الثعلب +lin free_1_A = 'حُرّ_A' ; -- 9798 [['free'], ['unimpeded'], ['set free, freedman'], ['born free and noble'], ['virtuous, genuine, true, pure, good'], ['unmixed']] +lin freedom_1_N = 'حُرِّيَّة_N' ; -- 67184 [['verbal noun of حَرَّ (ḥarra) (form I)'], ['freedom, liberty']] +lin french_N = 'فَرَنْسِيَّة_N' ; -- 104633 [['female equivalent of فَرَنْسِيّ (faransiyy, “a Frenchman”): a Frenchwoman'], ['the French language, French']] +lin friulian_N = mkN "الفريلايان" ; --- guess from الفريلايان +lin fula_N = mkN "الفلة" ; --- guess from الفلة +lin full_3_A = mkA "ممتلئ" ; --- guess from ممتلئ +lin galician_N = mkN "الجاليكية" ; --- guess from الجاليكية +lin garment_N = mkN "لباس" ; --- guess from لباس +lin georgian_3_N = mkN "الجورجية" ; --- guess from الجورجية +lin german_N = mkN "المانية" ; --- guess from المانية +lin gikuyu_N = mkN "الكيكيو" ; --- guess from الكيكيو +lin gondi_N = mkN "الجندي" ; --- guess from الجندي +lin gourde_N = mkN "غورد" ; --- guess from غورد +lin government_1_N = 'حُكُومَة_N' ; -- 69517 [['verbal noun of حَكَمَ (ḥakama) (form I)'], ['government'], ['authority, dominion'], ['empire, state'], ['jurisdiction'], ['sentence, judgment']] +lin greek_N = mkN "يونانية" ; --- guess from يونانية +lin gross_1_A = mkA "جمالي" ; --- guess from جمالي +lin growth_3_N = 'زِيَادَة_N' ; -- 81582 [['verbal noun of زَادَ (zāda) (form I)'], ['increase, surplus, addition']] +lin guarani_1_N = mkN "الجواراني" ; --- guess from الجواراني +lin guarani_3_N = mkN "الجوارانى" ; --- guess from الجوارانى +lin gujarati_N = mkN "الغوجاراتية" ; --- guess from الغوجاراتية +lin haida_N = mkN "الهيدا" ; --- guess from الهيدا +lin haitian_creole_N = mkN "الهايتية" ; --- guess from الهايتية +lin hakka_N = mkN "الهاكا" ; --- guess from الهاكا +lin haler_2_N = mkN "معافى" ; --- guess from معافى +lin hani_N = mkN "هاني" ; --- guess from هاني +lin hausa_N = mkN "الهوسا" ; --- guess from الهوسا +lin have_1_V2 = mkV2 'مَلَّكَ_V' ; -- 13781 [['to make the owner'], ['to put in possession'], ['to transfer ownership, to assign, to make over, to convey'], ['to make king']] +-- lin have_1_V2 = mkV2 'مَلَكَ_V' ; -- 14483 [['to take in possession, to take over, to acquire, to seize'], ['to possess, to lay hold, to own, to have, to be the owner'], ['to dominate, to control'], ['to be the master'], ['to be capable, to be able, to be in a position to'], ['to rule, to reign, to exercise authority, to hold sway, to lord over']] +lin hawaiian_N = mkN "لغةهلالهاواي" ; --- guess from لغةهلالهاواي +lin head_4_N = 'شَيْخ_N' ; -- 13596 [['old man'], ['elderly gentleman, elder'], ['sheik, chief, chieftain, patriarch'], ['senator'], ['sheik; Dr.; professor (title of professors and spiritual leaders)'], ['sir (respectful title of address)'], ['master (someone outstanding or excellent)']] +lin healthcare_2_N = mkN "رعايةصحية" ; --- guess from رعايةصحية +lin hereditary_2_A = mkA "موروث" ; --- guess from موروث +lin herero_N = mkN "الهيريرو" ; --- guess from الهيريرو +lin hidatsa_N = mkN "هيداتسا" ; --- guess from هيداتسا +lin high_1_A = mkA "عال" ; --- guess from عال +lin hindi_N = mkN "هندية" ; --- guess from هندية +lin hopi_N = mkN "هوبي" ; --- guess from هوبي +lin hotel_N = 'فُنْدُق_N' ; -- 11607 [['inn'], ['hotel']] +-- lin hotel_N = 'فُنْدُق_1_N' ; -- 50563 [['Alternative form of بُنْدُق (bunduq)']] +lin hryvnia_N = mkN "هريفنا" ; --- guess from هريفنا +lin human_N = 'بَشْر_N' ; -- 49147 [['verbal noun of بَشَرَ (bašara) (form I)']] +-- lin human_N = 'بَشَر_N' ; -- 49243 [['verbal noun of بَشِرَ (bašira) (form I)'], ['verbal noun of بَشَرَ (bašara) (form I)']] +lin hungarian_2_N = mkN "الهنغارية" ; --- guess from الهنغارية +lin hupa_N = mkN "الهبا" ; --- guess from الهبا +lin hybrid_A = mkA "هجن" ; --- guess from هجن +lin icelandic_N = mkN "اليسلندية" ; --- guess from اليسلندية +lin income_N = 'دَخَل_N' ; -- 8181 [['disturbance, imbalance, derangement, disorder, mental defect'], ['defect, infirmity']] +-- lin income_N = 'دَخْل_N' ; -- 11518 [['income'], ['revenues, receipts, returns'], ['interference, intervention'], ['doubt, misgiving']] +lin index_2_N = 'دَلِيل_N' ; -- 123 [['sign, indication, proof, demonstration, evidence, argument'], ['syllogism'], ['road sign'], ['road, street'], ['guidebook'], ['index (alphabetical listing)']] +-- lin index_2_N = 'دَلِيل_1_N' ; -- 8080 [['director'], ['guide'], ['indicator (person who indicates)'], ['discoverer']] +lin individual_4_A = 'شَخْصِي_A' ; -- 13778 [['own'], ['personal'], ['personal']] +lin indonesian_2_N = mkN "الندونيسية" ; --- guess from الندونيسية +lin inequality_N = 'تَفَاوُت_N' ; -- 57194 [['verbal noun of تَفَاوَتَ (tafāwata) (form VI)']] +lin inflation_1_N = 'تَضَخُّم_N' ; -- 55857 [['verbal noun of تَضَخَّمَ (taḍaḵḵama) (form V)'], ['inflation (“increase in prices”)']] +lin ingrian_N = mkN "لغةنغرية" ; --- guess from لغةنغرية +lin inhabitant_1_N = 'مُوَاطِن_N' ; -- 6746 [['citizen; national'], ['countryman, compatriot, fellow citizen']] +lin irish_3_N = mkN "اليرلندية" ; --- guess from اليرلندية +lin islam_2_N = mkN "السلام" ; --- guess from السلام +lin islamic_A = mkA "سلامي" ; --- guess from سلامي +lin island_1_N = 'جَزِيرَة_N' ; -- 11757 [['island'], ['peninsula'], ['area, region, territory, section, district; any separated location, especially one delimited by natural boundaries']] +lin italian_N = mkN "يطالية" ; --- guess from يطالية +lin japanese_N = mkN "اليابانية" ; --- guess from اليابانية +lin javanese_2_N = mkN "الجاوية" ; --- guess from الجاوية +lin kamba_N = mkN "الكامبا" ; --- guess from الكامبا +lin kannada_N = mkN "الكانادا" ; --- guess from الكانادا +lin kansas_4_N = mkN "كانزاس" ; --- guess from كانزاس +lin karakalpak_N = mkN "الكاراكالباك" ; --- guess from الكاراكالباك +lin karelian_N = mkN "الكاريلية" ; --- guess from الكاريلية +lin kashmiri_2_N = mkN "الكشميرية" ; --- guess from الكشميرية +lin kazakh_N = mkN "الكازاخستانية" ; --- guess from الكازاخستانية +lin khanty_N = mkN "خانتي" ; --- guess from خانتي +lin khmer_1_N = mkN "الخميرية" ; --- guess from الخميرية +lin khowar_N = mkN "كهوار" ; --- guess from كهوار +lin kickapoo_N = mkN "كيكابو" ; --- guess from كيكابو +lin kilometre_1_N = 'كَمّ_N' ; -- 647 [['quantity, multitude'], ['quantum']] +-- lin kilometre_1_N = 'كِمّ_N' ; -- 6304 [['calyx of a flower, the envelope or spathe of a palm-tree or the like']] +-- lin kilometre_1_N = 'كُمّ_N' ; -- 16436 [['sleeve of a garment']] +lin kina_N = mkN "كينا" ; --- guess from كينا +lin king_1_N = 'مَلَك_N' ; -- 1462 [['angel']] +-- lin king_1_N = 'مَلِك_N' ; -- 11923 [['king, sovereign, monarch']] +-- lin king_1_N = 'مَلَك_1_N' ; -- 14484 [['possession, property'], ['food and water, resources; anything which regulates, maintains, or sustains; essentials, supplies, utilities'], ['foundation of ones existence'], ['foundation of ones existence', 'agent or effective cause']] +-- lin king_1_N = 'مِلْك_N' ; -- 117902 [['verbal noun of مَلَكَ (malaka) (form I)'], ['property, possession, goods and chattels, fortune, wealth'], ['estate'], ['real estate, landed property']] +-- lin king_1_N = 'مُلْك_N' ; -- 117903 [['verbal noun of مَلَكَ (malaka) (form I)'], ['rule, reign, supreme authority, dominion, dominance, sway, power'], ['sovereignty, kingship, royalty'], ['monarchy']] +-- lin king_1_N = 'مَلْك_N' ; -- 117904 [['verbal noun of مَلَكَ (malaka) (form I)']] +lin kinyarwanda_N = mkN "الكينيارواندا" ; --- guess from الكينيارواندا +lin kip_2_N = mkN "كيب" ; --- guess from كيب +lin koasati_N = mkN "كواساتي" ; --- guess from كواساتي +lin kobo_N = mkN "نيره" ; --- guess from نيره +lin kola_2_N = mkN "كولا" ; --- guess from كولا +lin komi_N = mkN "الكومي" ; --- guess from الكومي +lin kongo_N = mkN "الكونغو" ; --- guess from الكونغو +lin korean_2_N = mkN "الكورية" ; --- guess from الكورية +lin krona_1_N = mkN "كورونا" ; --- guess from كورونا +lin krona_2_N = mkN "كورونا" ; --- guess from كورونا +lin krone_1_N = mkN "كورونا" ; --- guess from كورونا +lin krone_2_N = mkN "كورونا" ; --- guess from كورونا +lin kurdish_N = mkN "الكردية" ; --- guess from الكردية +lin kwacha_1_N = mkN "كواشا" ; --- guess from كواشا +lin kwacha_2_N = mkN "كواشا" ; --- guess from كواشا +lin kwanza_1_N = mkN "كوانزا" ; --- guess from كوانزا +lin kyat_N = mkN "كيات" ; --- guess from كيات +lin ladin_N = mkN "اللغةاللادنية" ; --- guess from اللغةاللادنية +lin language_1_N = 'لُغَة_N' ; -- 12037 [['language'], ['dialect, vernacular'], ['jargon'], ['a variant'], ['Classical Arabic'], ['lexicography, lexicographic literature, lexicographers']] +lin lao_2_N = mkN "اللاوية" ; --- guess from اللاوية +lin large_1_A = 'كَبِير_A' ; -- 1433 [['big, large'], ['great, great importance'], ['old (for a person)']] +lin lari_1_N = mkN "لارى" ; --- guess from لارى +lin latvian_N = 'لَاتْفِيّ_N' ; -- 2513 [['Latvian man']] +lin leader_1_N = 'رَئِيس_N' ; -- 5965 [['boss, chief, leader'], ['director'], ['headmaster, principal'], ['chairman'], ['governor'], ['president'], ['manager, superintendent'], ['conductor'], ['captain']] +lin lempira_N = mkN "لمبيرا" ; --- guess from لمبيرا +lin leone_N = mkN "ليون" ; --- guess from ليون +lin library_1_N = 'مَكْتَبَة_N' ; -- 12230 [['library'], ['bookstore'], ['bookcase'], ['desk'], ['literature']] +lin literacy_N = mkN "محوالمية" ; --- guess from محوالمية +lin lithuanian_N = mkN "الليتوانية" ; --- guess from الليتوانية +lin livonian_N = mkN "ليفونية" ; --- guess from ليفونية +lin low_1_A = 'مُنْخَفِض_A' ; -- 599 [['low (altitude, frequency, price, etc.)'], ['soft, low, subdued, muffled']] +lin low_german_N = mkN "اللمانيةالسفلى" ; --- guess from اللمانيةالسفلى +lin luo_N = mkN "اللو" ; --- guess from اللو +lin macedonian_2_N = mkN "المقدونية" ; --- guess from المقدونية +lin malay_2_N = mkN "الملايو" ; --- guess from الملايو +lin malayalam_N = mkN "الماليالام" ; --- guess from الماليالام +lin malaysian_2_N = mkN "الملايو" ; --- guess from الملايو +lin malt_3_N = mkN "شرابالشعيرجعة" ; --- guess from شرابالشعيرجعة +lin maltese_2_N = mkN "المالطية" ; --- guess from المالطية +lin manat_2_N = mkN "مانات" ; --- guess from مانات +lin manchu_N = mkN "المانشو" ; --- guess from المانشو +lin mandarin_6_N = mkN "يوسفي" ; --- guess from يوسفي +lin mansi_N = mkN "مانسية" ; --- guess from مانسية +lin maori_2_N = mkN "الماورية" ; --- guess from الماورية +lin marathi_N = mkN "الماراثي" ; --- guess from الماراثي +lin margarine_N = mkN "مارغرين" ; --- guess from مارغرين +lin mari_N = mkN "الماري" ; --- guess from الماري +lin median_3_A = 'مُتَوَسِّط_A' ; -- 12899 [['being in the middle, mediating'], ['middle, central'], ['medium'], ['average, middling, indifferent']] +lin medication_1_N = mkN "دوا" ; --- guess from دوا +lin medium_1_A = 'مُتَوَسِّط_A' ; -- 12899 [['being in the middle, mediating'], ['middle, central'], ['medium'], ['average, middling, indifferent']] +lin member_4_N = 'عُضْو_N' ; -- 13692 [['organ'], ['member'], ['limb'], ['branch, piece, section']] +lin menominee_N = mkN "مينوميني" ; --- guess from مينوميني +lin metical_N = mkN "متيكال" ; --- guess from متيكال +lin military_2_A = 'عَسْكَرِي_A' ; -- 614 [['military']] +lin moderate_1_A = 'مُعْتَدِل_A' ; -- 17086 [['straight, even, proportionate'], ['temperate, mild, moderate']] +lin modern_greek_N = mkN "اللغةاليونانيةالحديثة" ; --- guess from اللغةاليونانيةالحديثة +lin mohawk_2_N = mkN "الموهوك" ; --- guess from الموهوك +lin mon_3_N = mkN "الاثنين" ; --- guess from الاثنين +lin monarchy_N = 'مَلَكِيَّة_N' ; -- 13048 [['monarchy']] +-- lin monarchy_N = 'مِلْكِيَّة_N' ; -- 13782 [['ownership, property']] +lin mongolian_2_N = mkN "المنغولية" ; --- guess from المنغولية +lin mother_1_N = mkN "م" ; --- guess from م +lin muslim_A = 'مُسْلِم_A' ; -- 3785 [['Muslim'], ['submitting, accepting, believing.']] +-- lin muslim_A = 'مُسَلَّم_A' ; -- 18466 [['unimpaired, intact, unblemished, flawless'], ['accepted, uncontested, incontestable, indisputable, incontrovertible']] +lin nahuatl_N = mkN "الناهيوتل" ; --- guess from الناهيوتل +lin nanticoke_N = mkN "نانتيكوك" ; --- guess from نانتيكوك +lin navajo_N = mkN "النافاجو" ; --- guess from النافاجو +lin nenets_N = mkN "لغاتالنينيتس" ; --- guess from لغاتالنينيتس +lin nepali_N = mkN "النيبالية" ; --- guess from النيبالية +lin newspaper_3_N = 'جَرِيدَة_N' ; -- 63831 [['singulative of جَرِيد (jarīd, “defoliated palm”)'], ['detachment of horsemen'], ['newspaper']] +lin nganasan_N = mkN "لغةنجاناسان" ; --- guess from لغةنجاناسان +lin nordic_2_A = mkA "شمالي" ; --- guess from شمالي +lin north_3_N = 'شِمَال_N' ; -- 6426 [['case, sheath, wrapping']] +-- lin north_3_N = 'شِمَال_1_N' ; -- 12168 [['left hand'], ['left side'], ['bad omen'], ['handful of ears']] +-- lin north_3_N = 'شَمَال_N' ; -- 13431 [['north wind']] +-- lin north_3_N = 'شَمَال_1_N' ; -- 13432 [['north']] +lin northeast_1_N = mkN "شماليشرقي" ; --- guess from شماليشرقي +lin northwest_3_N = mkN "شماليجنوبي" ; --- guess from شماليجنوبي +lin norwegian_N = mkN "النرويجية" ; --- guess from النرويجية +lin nyamwezi_N = mkN "النيامويزي" ; --- guess from النيامويزي +lin nynorsk_N = mkN "النينورسكالنرويجي" ; --- guess from النينورسكالنرويجي +lin obligatory_1_A = mkA "مفروضواجب" ; --- guess from مفروضواجب +lin occitan_N = mkN "الوكيتانية" ; --- guess from الوكيتانية +lin office_4_N = 'مَكْتَب_N' ; -- 12603 [['maktab, elementary school'], ['desk'], ['office'], ['bureau'], ['study']] +lin official_1_A = 'رَسْمِي_A' ; -- 13575 [['official, legitimate'], ['formal'], ['normal'], ['conventional, according to rule'], ['ceremonial']] +lin official_3_A = 'رَسْمِي_A' ; -- 13575 [['official, legitimate'], ['formal'], ['normal'], ['conventional, according to rule'], ['ceremonial']] +lin oneida_N = mkN "لغةالونيدا" ; --- guess from لغةالونيدا +lin orthodox_3_A = mkA "رثوذكسي" ; --- guess from رثوذكسي +lin osage_N = mkN "الوساج" ; --- guess from الوساج +lin ouguiya_N = mkN "وقية" ; --- guess from وقية +lin paanga_N = mkN "بانجاتونجي" ; --- guess from بانجاتونجي +lin parliamentary_2_A = 'بَرْلَمَانِي_A' ; -- 13881 [['parliamentary']] +lin pashto_1_N = mkN "بشتو" ; --- guess from بشتو +lin periodical_N = mkN "دورية" ; --- guess from دورية +lin persian_N = mkN "الفارسية" ; --- guess from الفارسية +lin peso_1_N = mkN "بيزو" ; --- guess from بيزو +lin peso_2_N = mkN "بيزو" ; --- guess from بيزو +lin peso_3_N = mkN "بيزو" ; --- guess from بيزو +lin peso_5_N = mkN "بيزو" ; --- guess from بيزو +lin peso_6_N = mkN "بيزو" ; --- guess from بيزو +lin peso_7_N = mkN "بيزو" ; --- guess from بيزو +lin peso_8_N = mkN "بيزو" ; --- guess from بيزو +lin plant_2_N = mkN "نبات" ; --- guess from نبات +lin point_10_N = 'نُقْطَة_N' ; -- 8264 [['dot, point'], ['period (punctuation mark)'], ['spot (stain, tarnish)'], ['drop']] +lin polish_4_N = mkN "بولندية" ; --- guess from بولندية +lin politics_2_N = 'سِيَاسَة_N' ; -- 83564 [['verbal noun of سَاسَ (sāsa) (form I)'], ['administration, management'], ['policy'], ['politics'], ['political government (as opposed to رِئَاسَة (riʔāsa, “ecclesiastical government”))']] +lin population_1_N = mkN "سكانعددالسكان" ; --- guess from سكانعددالسكان +lin portuguese_1_N = mkN "برتغالية" ; --- guess from برتغالية +lin position_6_N = mkN "منصبموقع" ; --- guess from منصبموقع +lin potawatomi_N = mkN "بوتاواتومي" ; --- guess from بوتاواتومي +lin pound_2_N = mkN "جنيه" ; --- guess from جنيه +lin pound_4_N = mkN "جنيه" ; --- guess from جنيه +lin pound_5_N = mkN "جنيه" ; --- guess from جنيه +lin pound_6_N = mkN "جنيه" ; --- guess from جنيه +lin pound_8_N = mkN "جنيه" ; --- guess from جنيه +lin powhatan_N = mkN "بوهاتان" ; --- guess from بوهاتان +lin premier_2_N = mkN "رئيسالوزرارائد" ; --- guess from رئيسالوزرارائد +lin presidentFem_3_N = mkN "رئيسرئيسة" ; --- guess from رئيسرئيسة +lin presidentMasc_3_N = 'رَئِيس_N' ; -- 5965 [['boss, chief, leader'], ['director'], ['headmaster, principal'], ['chairman'], ['governor'], ['president'], ['manager, superintendent'], ['conductor'], ['captain']] +lin presidential_1_A = mkA "رياسي" ; --- guess from رياسي +lin prime_minister_2_N = mkN "رئيسالوزرا" ; --- guess from رئيسالوزرا +lin prince_N = mkN "مير" ; --- guess from مير +lin product_2_N = mkN "نتاج" ; --- guess from نتاج +lin prussian_N = mkN "بروسي" ; --- guess from بروسي +lin pula_N = mkN "بولا" ; --- guess from بولا +lin quechua_N = mkN "كيشوا" ; --- guess from كيشوا +lin queen_2_N = 'مَلَكَة_N' ; -- 14486 [['possession'], ['acquisition'], ['attainment, acquired skill or quality, talent, virtue'], ['habit, custom'], ['slavery']] +-- lin queen_2_N = 'مَلِكَة_N' ; -- 14927 [['queen']] +lin quetzal_1_N = mkN "كتزال" ; --- guess from كتزال +lin rand_1_N = mkN "راند" ; --- guess from راند +lin rank_2_V2 = mkV2 'وَضَعَ_V' ; -- 1785 [['to put; to lay; to place; to set; to position; to install; to implant'], ['to lump, to group; to put together'], ['to lump, to group; to put together', 'to lay and cluster (eggs) in a nest'], ['to store away, to stow away, to deposit; to put down, to lay down'], ['to stop holding or using (a tool or an instrument, such as a weapon), to put away or down, to lay down; to put aside', 'to cancel (a law, a regulation, and so on), to abrogate; to set aside'], ['to stop holding or using (a tool or an instrument, such as a weapon), to put away or down, to lay down; to put aside', 'to remove (clothes); to put off or down, to lay off or down, to doff; to take off'], ['to stop holding or using (a tool or an instrument, such as a weapon), to put away or down, to lay down; to put aside', 'to give birth to (a baby), to deliver, to bear'], ['to posit (a law, a regulation, and so on); to impose; to set down, to lay down'], ['to posit (a law, a regulation, and so on); to impose; to set down, to lay down', 'to posit (an explanation, a theory, and so on); to propose, to set forth; to put down'], ['to add'], ['to add', 'to interpose (something, as in a text or a literature, especially falsely), to insert; to interpolate; to put in'], ['to see or treat as lowly, to demean']] +lin rate_2_N = 'سِعْر_N' ; -- 14666 [['price'], ['quote (a summary of work to be done with a set price)']] +-- lin rate_2_N = 'سُعْر_N' ; -- 18715 [['voracious hunger'], ['infection']] +lin rate_4_N = 'مُعَدَّل_N' ; -- 15035 [['rate'], ['average']] +lin real_2_N = mkN "حقيقي" ; --- guess from حقيقي +lin regent_1_N = mkN "قيم" ; --- guess from قيم +lin regime_1_N = mkN "حكومةنطام" ; --- guess from حكومةنطام +lin religion_2_N = 'دَيْن_N' ; -- 74728 [['verbal noun of دَانَ (dāna) (form I)'], ['debt, debit, liability, pecuniary, obligation, financial claim']] +-- lin religion_2_N = 'دِين_N' ; -- 74729 [['verbal noun of دَانَ (dāna, “to be religious”) (form I)'], ['religion, creed, credo, faith, conviction, belief, tenet, rite'], ['conformism, conformance, conformity, compliance, fealty, obedience; God-fearingness, godliness, religiosity, devoutness'], ['law, obligations, duty'], ['custom, habit'], ['judgement, decision, ruling', 'requital, compensation, indemnification'], ['judgement, decision, ruling', 'credit, obligation, account, falling due of a debt']] +lin rental_2_N = mkN "يجار" ; --- guess from يجار +lin representative_3_A = mkA "مندوبممثل" ; --- guess from مندوبممثل +lin republic_2_N = 'جُمْهُورِيَّة_N' ; -- 15302 [['republicanism'], ['republic']] +-- lin republic_2_N = 'جُمْهُورِيَّة_1_N' ; -- 65212 [['female equivalent of جُمْهُورِيّ (jumhūriyy)']] +lin reserve_2_N = mkN "احتياط" ; --- guess from احتياط +lin result_in_V2 = variants {} ; --- guess from سفرعن +lin rial_1_N = 'رِيَال_N' ; -- 918 [['riyal (the official currency of Saudi Arabia and Qatar).'], ['rial (the official currency of Oman, Yemen, and Iran).'], ['real (the official currency of Brazil).'], ['real (any of a number of defunct currencies in the former Spanish and Portuguese Empires)']] +lin rial_2_N = 'رِيَال_N' ; -- 918 [['riyal (the official currency of Saudi Arabia and Qatar).'], ['rial (the official currency of Oman, Yemen, and Iran).'], ['real (the official currency of Brazil).'], ['real (any of a number of defunct currencies in the former Spanish and Portuguese Empires)']] +lin ringgit_N = mkN "رينغيت" ; --- guess from رينغيت +lin riyal_1_N = 'رِيَال_N' ; -- 918 [['riyal (the official currency of Saudi Arabia and Qatar).'], ['rial (the official currency of Oman, Yemen, and Iran).'], ['real (the official currency of Brazil).'], ['real (any of a number of defunct currencies in the former Spanish and Portuguese Empires)']] +lin riyal_2_N = 'رِيَال_N' ; -- 918 [['riyal (the official currency of Saudi Arabia and Qatar).'], ['rial (the official currency of Oman, Yemen, and Iran).'], ['real (the official currency of Brazil).'], ['real (any of a number of defunct currencies in the former Spanish and Portuguese Empires)']] +lin romanian_N = mkN "الرومانية" ; --- guess from الرومانية +lin romansh_N = mkN "الرومانشية" ; --- guess from الرومانشية +lin ron_N = mkN "رون" ; --- guess from رون +lin ruble_2_N = mkN "روبل" ; --- guess from روبل +lin rupee_1_N = mkN "روبية" ; --- guess from روبية +lin rupee_2_N = mkN "روبية" ; --- guess from روبية +lin rupee_3_N = mkN "روبية" ; --- guess from روبية +lin rupee_5_N = mkN "روبية" ; --- guess from روبية +lin rupee_6_N = mkN "روبية" ; --- guess from روبية +lin rupiah_N = mkN "روبية" ; --- guess from روبية +lin russian_N = 'رُوسِيّ_N' ; -- 4075 [['Russian']] +lin sango_N = mkN "السانجو" ; --- guess from السانجو +lin sanskrit_N = mkN "السنسكريتية" ; --- guess from السنسكريتية +lin sardinian_N = mkN "السردينية" ; --- guess from السردينية +lin scots_N = mkN "السكتلندية" ; --- guess from السكتلندية +lin scottish_gaelic_N = mkN "السكتلنديةالغالية" ; --- guess from السكتلنديةالغالية +lin selkup_N = mkN "السيلكب" ; --- guess from السيلكب +lin seneca_N = mkN "السنيكا" ; --- guess from السنيكا +lin serbo_croat_N = mkN "صربوـكرواتي" ; --- guess from صربوـكرواتي +lin serer_N = mkN "السرر" ; --- guess from السرر +lin shariah_1_N = 'شَرِيعَة_N' ; -- 18835 [['way, path'], ['law and legislation'], ['sharia, law']] +lin shilling_1_N = mkN "شلن" ; --- guess from شلن +lin shilling_2_N = mkN "شلن" ; --- guess from شلن +lin shilling_3_N = mkN "شلن" ; --- guess from شلن +lin shilling_4_N = mkN "شلن" ; --- guess from شلن +lin shina_N = mkN "شينا" ; --- guess from شينا +lin shona_N = mkN "الشونا" ; --- guess from الشونا +lin show_2_V2 = mkV2 'عَرَضَ_V' ; -- 5092 [['to appear'], ['to happen, to occur'], ['to show, to display, to present'], ['to expose']] +-- lin show_2_V2 = mkV2 'عَرَّضَ_V' ; -- 6113 [['to broaden, to widen, to enlarge'], ['to place one thing opposite another'], ['to offer, to expose, to hand, to exchange'], ['to write indistinctly, illegibly, to merely hint, to speak obscurely, to write phrases susceptible to multiple meanings or to write letters not distinct'], ['to defame, to slander, to abuse'], ['to underdo the meat'], ['to mark the camel at the hoof'], ['to circumcise children'], ['to become possessed by power of speech, to be eloquent']] +-- lin show_2_V2 = mkV2 'عَرُضَ_V' ; -- 18990 [['to be or become wide']] +lin sindhi_N = mkN "السندية" ; --- guess from السندية +lin sinhala_N = mkN "السنهالية" ; --- guess from السنهالية +lin skagit_N = mkN "سكاكيت" ; --- guess from سكاكيت +lin slovak_2_N = mkN "السلوفاكية" ; --- guess from السلوفاكية +lin slovenian_N = mkN "السلوفينية" ; --- guess from السلوفينية +lin sokoro_N = mkN "سوكورو" ; --- guess from سوكورو +lin som_1_N = mkN "سوم" ; --- guess from سوم +lin som_2_N = mkN "سوم" ; --- guess from سوم +lin somali_N = mkN "الصومالية" ; --- guess from الصومالية +lin sotho_2_N = mkN "السوتوالجنوبية" ; --- guess from السوتوالجنوبية +lin south_3_N = 'جَنُوب_N' ; -- 16691 [['south']] +-- lin south_3_N = 'جُنُوب_N' ; -- 64537 [['verbal noun of جَنَبَ (janaba) (form I)']] +lin southeast_1_N = mkN "جنوبيشرقي" ; --- guess from جنوبيشرقي +lin southwest_1_N = mkN "جنوبيغربي" ; --- guess from جنوبيغربي +lin soviet_A = mkA "سوفييتي" ; --- guess from سوفييتي +lin spanish_N = mkN "سباني" ; --- guess from سباني +lin speak_3_V2 = variants {} ; --- guess from تحدثتكلم +lin spoken_A = mkA "منطوقملفوظ" ; --- guess from منطوقملفوظ +lin sport_1_N = 'رِيَاضَة_N' ; -- 16827 [['sport (physical activity)'], ['mathematics']] +lin square_1_A = 'مُرَبَّع_A' ; -- 12741 [['square, quadratic'], ['fourfold, quadruple'], ['tetragonal, quadrangular']] +lin starch_1_N = mkN "نشا" ; --- guess from نشا +lin state_4_N = mkN "دولةولاية" ; --- guess from دولةولاية +lin succeed_V2 = variants {} ; --- guess from نجحخلف +lin sundanese_N = mkN "السوندانية" ; --- guess from السوندانية +lin supreme_2_A = mkA "عليا" ; --- guess from عليا +lin swahili_N = mkN "السواحيلية" ; --- guess from السواحيلية +lin swazi_2_N = mkN "السواتي" ; --- guess from السواتي +lin swedish_N = mkN "السويدية" ; --- guess from السويدية +lin swiss_N = mkN "سويسري" ; --- guess from سويسري +lin system_1_N = mkN "منظومة" ; --- guess from منظومة +lin system_4_N = 'نِظَام_N' ; -- 17630 [['system'], ['regularity'], ['order'], ['method'], ['rule'], ['regime: perhaps short for نِظَام الْحُكْم (niẓām al-ḥukm, “system of rule”)']] +lin tajik_N = mkN "الطاجيكية" ; --- guess from الطاجيكية +lin taka_N = mkN "تاكا" ; --- guess from تاكا +lin take_12_V2 = variants {} ; --- guess from اخذ +lin tala_N = mkN "تالة" ; --- guess from تالة +lin tamil_2_N = mkN "التاميلية" ; --- guess from التاميلية +lin tampon_N = mkN "سدادةقطنية" ; --- guess from سدادةقطنية +lin tatar_N = mkN "التتارية" ; --- guess from التتارية +lin tax_N = 'رَسْم_N' ; -- 79916 [['verbal noun of رَسَمَ (rasama) (form I)'], ['sketch, drawing, painting, picture, portrait, outline, chart'], ['pattern, structure, design'], ['rasm (Arabic writing without dots)'], ['trace, spoor'], ['tradition, custom'], ['rate, levy, imposition']] +lin telugu_N = mkN "التيلجو" ; --- guess from التيلجو +lin tenge_1_N = mkN "تنغى" ; --- guess from تنغى +lin terrorist_N = mkN "رهابي" ; --- guess from رهابي +lin thai_N = 'تَايْلَانْدِيّ_N' ; -- 4301 [['Thai language']] +-- lin thai_N = 'تَايْلَانْدِيّ_1_N' ; -- 4302 [['Thai man']] +lin tibetan_1_N = mkN "التبتية" ; --- guess from التبتية +lin ticket_1_N = 'تَذْكِرَة_N' ; -- 77511 [['verbal noun of ذَكَّرَ (ḏakkara) (form II)'], ['memorandum, admonition'], ['collection, precepts, summa'], ['ticket']] +lin tlingit_N = mkN "التلينغيتية" ; --- guess from التلينغيتية +lin toda_N = mkN "تودا" ; --- guess from تودا +lin tonga_N = mkN "تونجاجزرتونجا" ; --- guess from تونجاجزرتونجا +lin total_1_A = 'مَجْمُوع_A' ; -- 18478 [['united'], ['reconciled']] +lin transitional_A = mkA "انتقالي" ; --- guess from انتقالي +lin transport_1_N = mkN "وسيلةنقل" ; --- guess from وسيلةنقل +lin tsimshian_N = mkN "التسيمشيان" ; --- guess from التسيمشيان +lin tswana_2_N = mkN "التسوانية" ; --- guess from التسوانية +lin tugrik_1_N = mkN "توغروغ" ; --- guess from توغروغ +lin tulu_N = mkN "لغةتولو" ; --- guess from لغةتولو +lin turkish_N = 'تُرْكِيَّة_N' ; -- 4359 [['Turkish language']] +-- lin turkish_N = 'تُرْكِيَّة_1_N' ; -- 60870 [['female equivalent of تُرْكِيّ (turkiyy, “Turk”):', 'female equivalent of تُرْكِيّ (turkiyy, “Turk”)'], ['female equivalent of تُرْكِيّ (turkiyy, “Turk”):', 'Turkish woman']] +lin turkmen_N = mkN "التركمانية" ; --- guess from التركمانية +lin tuscarora_N = mkN "توسكارورانيفادا" ; --- guess from توسكارورانيفادا +lin udmurt_N = mkN "الدمرت" ; --- guess from الدمرت +lin ukrainian_N = mkN "اوكرانية" ; --- guess from اوكرانية +lin umbundu_N = mkN "المبندو" ; --- guess from المبندو +lin unemployment_N = 'بِطَالَة_N' ; -- 11385 [['idleness'], ['unemployment']] +lin unit_3_N = 'وَحْدَة_N' ; -- 18471 [['unit (a standard measure of a quantity)'], ['unit (a group within an organization that has been assigned a specific duty or function)'], ['unit; module (part of a book or educational course)'], ['union, unity; oneness (the state of being united as one)'], ['loneliness (a feeling of depression resulting from being alone)']] +lin unitary_3_A = mkA "توحيدي" ; --- guess from توحيدي +lin urdu_N = mkN "الردية" ; --- guess from الردية +lin uzbek_N = mkN "الوزبكية" ; --- guess from الوزبكية +lin vat_1_N = mkN "ضريبةالقيمةالمضافة" ; --- guess from ضريبةالقيمةالمضافة +lin veps_N = mkN "فيبسية" ; --- guess from فيبسية +lin vietnamese_2_N = mkN "الفيتنامية" ; --- guess from الفيتنامية +lin walloon_N = mkN "الوالون" ; --- guess from الوالون +lin water_1_N = mkN "ما" ; --- guess from ما +lin welsh_2_N = mkN "لغةويلزية" ; --- guess from لغةويلزية +lin west_2_N = 'غَرَب_N' ; -- 8110 [['the disease of an abscess in the canthus of the eye, lachrymal fistula']] +-- lin west_2_N = 'غَرْب_N' ; -- 102364 [['verbal noun of غَرَبَ (ḡaraba) (form I)'], ['west, occident'], ['vehemence, violence, tempestuousness']] +-- lin west_2_N = 'غَرَب_1_N' ; -- 128137 [['Euphrates poplar (Populus euphratica)'], ['willow (Salix spp.)']] +lin winnebago_N = mkN "وينيباكو" ; --- guess from وينيباكو +lin wolof_N = mkN "الولوف" ; --- guess from الولوف +lin woman_1_N = 'مَرَّة_N' ; -- 926 [['a time, instance, occurrence'], ['Ellipsis of اِسْمُ مَرَّةٍ (ismu marratin).']] +-- lin woman_1_N = 'مِرَّة_N' ; -- 128434 [] +lin won_2_N = mkN "ون" ; --- guess from ون +lin world_1_N = 'عَالِم_N' ; -- 15804 [['scholar, man of letters, scientist'], ['knowledgeable person, savant']] +-- lin world_1_N = 'عَالَم_N' ; -- 19120 [['world'], ['universe, cosmos, existence'], ['world, hereunder, worldly life'], ['things, creation, that which exists before you'], ['nation, people, group, type, or kind']] +lin world_5_N = 'عَالِم_N' ; -- 15804 [['scholar, man of letters, scientist'], ['knowledgeable person, savant']] +-- lin world_5_N = 'عَالَم_N' ; -- 19120 [['world'], ['universe, cosmos, existence'], ['world, hereunder, worldly life'], ['things, creation, that which exists before you'], ['nation, people, group, type, or kind']] +lin xhosa_N = mkN "الخوسا" ; --- guess from الخوسا +lin year_1_N = 'سُنَّة_N' ; -- 1703 [['a usual, recurrent, continual, determinable, or constant thing', 'a common, habitual, popularized, or enforced practice; a custom, convention, or ritual; a social norm or standard'], ['a usual, recurrent, continual, determinable, or constant thing', 'the conduct, habits, behavior, or mannerisms of a person (viewed collectively)'], ['a usual, recurrent, continual, determinable, or constant thing', 'a determinate or predetermined universal law (either normative or historical)'], ['a narrative attributed to an Islamic religious figure (typically Prophet Muhammad), a tradition; a hadith'], ['a narrative attributed to an Islamic religious figure (typically Prophet Muhammad), a tradition; a hadith', 'the body of narratives attributed to Islamic religious figures (viewed collectively)'], ['a religiously canonized tradition or practice', 'the set of canonical traditions whence orthodoxy and orthopraxy are derived (viewed collectively)'], ['a religiously canonized tradition or practice', 'adherence to the religious traditions, traditionalism; orthodoxy and orthopraxy'], ['a religiously canonized tradition or practice', 'a traditional religious practice for which there is a divine reward but for whose omission there is no punishment, a commendable supererogatory act often done as an expression of faith, a religious work of supererogation'], ['the Sunni sect or the adherents thereof (viewed collectively); Sunnism'], ['an image, a form, an appearance, a look']] +-- lin year_1_N = 'سِنَة_N' ; -- 8368 [['drowsiness'], ['slumber; nap']] +-- lin year_1_N = 'سَنَة_N' ; -- 19200 [['year']] +lin yen_2_N = mkN "ين" ; --- guess from ين +lin yiddish_N = mkN "اليديشية" ; --- guess from اليديشية +lin yoruba_N = mkN "اليوروبية" ; --- guess from اليوروبية +lin yuan_N = mkN "يوان" ; --- guess from يوان +lin zapotec_N = mkN "الزابوتيك" ; --- guess from الزابوتيك +lin zhuang_N = mkN "الزهيونج" ; --- guess from الزهيونج +lin zloty_N = mkN "زلوطي" ; --- guess from زلوطي +lin zulu_N = mkN "الزولو" ; --- guess from الزولو +} diff --git a/src/arabic/wiktionary/arabic_utilities.py b/src/arabic/wiktionary/arabic_utilities.py new file mode 100644 index 000000000..8be78bf8c --- /dev/null +++ b/src/arabic/wiktionary/arabic_utilities.py @@ -0,0 +1,171 @@ +# utilities for Arabic script +# in the main mode, converts string literals in stdin 'to' or 'from' Buckwalter +# as specified by the command line argument: +# +# % python3 arabic_utilities.py to b.tmp +# % diff MorphoDictAra.gf b.tmp +# % + +import unicodedata + +def is_arabic(s): + return s and any(1574 <= ord(c) <= 1616 for c in s) + + +def get_arabic(s): + return ''.join([c for c in s if is_arabic(c)]) + + +def unvocalize(s): + return ''.join([c for c in s if 0x621 <= ord(c) <= 0x64a]) + + +# https://en.wikipedia.org/wiki/Buckwalter_transliteration +buckwalter_dict = { + 0x621: "'", # ء + 0x622: '|', # آ + 0x623: '>', # أ + 0x624: '&', # ؤ + 0x625: '<', # إ + 0x626: '}', # ئ + 0x627: 'A', # ا + 0x628: 'b', # ب + 0x629: 'p', # ة + 0x62a: 't', # ت + 0x62b: 'v', # ث + 0x62c: 'j', # ج + 0x62d: 'H', # ح + 0x62e: 'x', # خ + 0x62f: 'd', # د + 0x630: '*', # ذ + 0x631: 'r', # ر + 0x632: 'z', # ز + 0x633: 's', # س + 0x634: '$', # ش + 0x635: 'S', # ص + 0x636: 'D', # ض + 0x637: 'T', # ط + 0x638: 'Z', # ظ + 0x639: 'E', # ع + 0x63a: 'g', # غ + 0x641: 'f', # ف + 0x642: 'q', # ق + 0x643: 'k', # ك + 0x644: 'l', # ل + 0x645: 'm', # م + 0x646: 'n', # ن + 0x647: 'h', # ه + 0x648: 'w', # و + 0x649: 'Y', # ى + 0x64a: 'y', # ي + 0x64b: 'F', # ً + 0x64c: 'N', # ٌ + 0x64d: 'K', # ٍ + 0x64e: 'a', # َ + 0x64f: 'u', # ُ + 0x650: 'i', # ِ + 0x651: '~', # ّ + 0x652: 'o', # ْ + 0x670: '`', # ' + 0x671: '{' # ٱ + } + + +buckwalter_dict_rev = {b: chr(a) for a, b in buckwalter_dict.items()} + +arabic_vowels = {chr(c) for c in {0x64b, 0x64c, 0x64d, 0x64e, 0x64f, 0x650}} + +sound_consonants = {chr(c) for c in range(0x628, 0x648)} # excluding alif, waw, ya + +def to_buckwalter(s): + return ''.join([buckwalter_dict.get(ord(c), c) for c in s]) + + +def from_buckwalter(s): + return ''.join([buckwalter_dict_rev.get(c, c) for c in s]) + + +def drop_final_vowel(s): + if s[-1] in arabic_vowels: + return s[:-1] + else: + return s + + +def normal(s): + return unicodedata.normalize('NFD', s) + +# heuristic for finding the three radicals from certain forms +# works only for sound (strong) 3-radical roots, otherwise None +def get_sound_trigram_root(s): + sounds = [c for c in s if c in sound_consonants] + if len(sounds) == 3: + return ''.join(sounds) + else: + return None + + +# reverse engineer fcl pattern from a given form, with a sound trigram root +# one more condition: each of the root letters occurs exactly ones +# TODO: better use the given root of the lex entry +def get_sound_fcl_pattern(s): + if root := get_sound_trigram_root(s): + if len([c in s for c in root]) == 3: + p = list(s) + r = s.find(root[0]) + p[r] = chr(0x641) + r += s[r+1:].find(root[1]) + 1 + p[r] = chr(0x639) + r += s[r+1:].find(root[2]) + 1 + p[r] = chr(0x644) + p = ''.join(p) +## print('---PATT', s, root, p) + return p + + +# Wikt uses vowel+shadda which is a Unicode normalization +# GF uses shadda+vowel which is linguistically correct +# see https://stackoverflow.com/questions/58559390/in-unicode-should-u0651-arabic-shadda-be-before-or-after-kasra +# unicodedata.normalize does this wrong, as noted by Ariel Gutman +## todo: more direct implementation +def reorder_shadda(s): + return from_buckwalter(to_buckwalter(s).replace('a~', '~a').replace('u~', '~u').replace('i~', '~i')) + + +# quote word forms but not parameters +def quote_if(s, cond=is_arabic, change=reorder_shadda): + if cond(s): + return '"' + change(s) + '"' + else: + return s + + +# for a string, change each string literal in "..." with a change function +# leaving other characters as they are; print the string to stdout as you go +def change_literals(s, change): + inliteral = False + literal = '' + for c in s: + if c == '"' and inliteral: + print('"'+change(literal)+'"', end='') + inliteral = False + literal = '' + elif c == '"': + inliteral = True + elif inliteral: + literal += c + else: + print(c, end='') + + +# convert literals in stdin 'to' or 'from' Buckwalter +if __name__ == '__main__': + import sys + mode = sys.argv[1] + for line in sys.stdin: + if mode == 'from': + change_literals(line, from_buckwalter) + elif mode == 'to': + change_literals(line, to_buckwalter) + + diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py new file mode 100644 index 000000000..da6389e34 --- /dev/null +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -0,0 +1,455 @@ +import gzip +import json +import sys +import unicodedata +import pgf +from arabic_utilities import * + +# data from https://kaikki.org/dictionary/rawdata.html +# thanks Tatu Ylonen: Wiktextract: Wiktionary as Machine-Readable Structured Data, +# Proceedings of the 13th Conference on Language Resources and Evaluation (LREC), pp. 1317-1325, Marseille, 20-25 June 2022. + +""" +This file converts Wiktionary data to GF morphological dictionary files. +It words for Arabic but some functionalities could be modified to other languges. + +The steps to take are the following: + +fetch data: + + raw-wiktextract-data.json.gz from https://kaikki.org/dictionary/rawdata.html + +filter Arabic entries: + + $ python3 read_wiktionary.py raw >wikt_arabic.jsonl + +create GF files: + + $ python3 read_wiktionary.py gf-abs >MorphoDictAraAbs.gf + $ python3 read_wiktionary.py gf-cnc >MorphoDictAra.gf + +automatic evaluation: + + $ gf -make MorphoDictAra.gf + $ python3 read_wiktionary.py gf-map >source_of_MorphoDictAra.jsonl + $ python3 read_wiktionary.py eval + +TODO: +- better generation of GF +- better paradigms to use Wiktionary data +- refactor the code so that it can be used for other languages + +""" + + +MODE = '' + +if __name__ == '__main__': + if not sys.argv[1:]: + print('usage: read_wiktionary (raw | gf-cnc | gf-abs | gf-map | eval | eval-funs | eval-verbose | error-analysis)') + exit() + MODE = sys.argv[1] # + + +# step 1: extract Arabic data from this file using the raw option +WIKTIONARY_DUMP = 'raw-wiktextract-data.json.gz' +EXTRACTED_LANGUAGE = 'Arabic' + +# the following file is generated. +# in the sequel, use this file with gf-abs or gf-cnc option +FILTERED_WIKT = 'wikt_arabic.jsonl' + +# map each successfully extracted GF function to its source record in Wiktionary +# created with option gf-map +FUNCTION_SOURCE_MAP = 'source_of_MorphoDictAra.jsonl' + +# created with $ gf -make MorphoDictAra.gf +PGF_FILE = 'MorphoDictAraAbs.pgf' + +# module to linearize with +CONCRETE_MODULE = 'MorphoDictAra' + +# concrete syntax file, to debug sources of linearizations +CONCRETE_FILE = CONCRETE_MODULE + '.gf' + +# evaluation result file, created with mode eval-funs +EVAL_FILE = 'eval.jsonl' + + +# read a gzipped jsonl file (one object per line), +# showing lines where one of a list of languages is present +# This can be sampled to one of 100k lines by default, 1 for total recall. +def get_gzip_json(file, sample=100000, langs=[]): + with gzip.open(file) as decompressed: + n = 0 + for line in decompressed: + n += 1 + if n % sample == 0: + obj = json.loads(line) + if obj.get('lang', None) in langs: + print(line.decode("utf-8")) +# print(n) + + +# to perform the first step of data extraction, pipe this into a file: +# python3 read_wiktionary.py raw >wikt_arabic.jsonl +if MODE == 'raw': + get_gzip_json(WIKTIONARY_DUMP, 1, [EXTRACTED_LANGUAGE]) + exit() + + +if MODE == 'error-analysis': + evals = {} + with open(EVAL_FILE) as file: + for line in file: + row = json.loads(line) + if labels := row.get('labels', None): + cat = row['fun'][-1] + verdict = row['verdict'] + evals[(cat, labels, verdict)] = evals.get((cat, labels, verdict), 0) + 1 + for labverdict, n in sorted(list(evals.items())): + print(labverdict, n) + + +# generate word_d_C functions starting with d=0, but show d only when >= 1 +def gf_fun(s, pos, disamb=0): + discrim = '_' + str(disamb) if disamb else '' + return ''.join(["'", s, discrim, "_", pos, "'"]) + + +# mapping from GF to Wikt features +arabic_rgl_features = { + # V + 'VPerf': 'perfective', + 'Act': 'active', + 'Pas': 'passive', + 'Per3': 'third-person', + 'Per2': 'second-person', + 'Per1': 'first-person', + 'Masc': 'masculine', + 'Fem': 'feminine', + 'Sing': 'singular', + 'Plur': 'plural', + 'Sg': 'singular', + 'Pl': 'plural', + 'Dl': 'dual', + 'VImpf': 'imperfective', + 'Ind': 'indicative', + 'Cnj': 'subjunctive', + 'Jus': 'jussive', + 'VImp': 'imperative', + # N: also Sg, Pl, Dl + 'Def': 'definite', + 'Indef': 'indefinite', + 'Nom': 'nominative', + 'Acc': 'accusative', + 'Gen': 'genitive', +# 'Bare': +# 'Dat': + 'Const': 'construct' +# 'Poss': + #A: also N features; degree features cannot be found +# 'APosit': 'positive', +# 'AComp': 'comparative' + } + + +# the inflection forms in a wiktionary entry +def wikt_forms_from_obj(obj): + forms = { + reorder_shadda(form['form']): + form.get('tags', []) for + form in obj.get('forms', []) if + 'romanization' not in form.get('tags', []) and + is_arabic(form['form']) + } + # the root (three radicals) is found in this place if at all + root = [find_root(t['expansion']) for + t in obj.get('etymology_templates', []) if + t.get('name', None) =='ar-root'][:1] + if root and root[0].strip(): + forms['root'] = root[0].strip() + + return forms + + +# selection of forms for a given POS from Wikt: noun, adj, or verb +# return a linearization function +def forms_for_pos(obj): + dforms = wikt_forms_from_obj(obj) + forms = dforms.items() + if obj['pos'] == 'noun': + lemma = [drop_final_vowel(form) for form, descr in forms + if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] + plural = [drop_final_vowel(form) for form, descr in forms + if all([w in descr for w in ['construct', 'nominative', 'plural']])][:1] + gender = (['fem'] if 'Arabic feminine nouns' in obj['categories'] + else (['masc'] if 'Arabic masculine nouns' in obj['categories'] + else [])) + gf_entry = { + 'cat': 'N', + 'lemma': lemma, + 'args': { + 'sg': lemma, + 'pl': plural, + 'g': gender + } + } + elif obj['pos'] == 'verb': + lemma = [form for form, descr in forms + if all([w in descr for + w in ["active", "indicative", "masculine", "past", + "perfective", "singular", "third-person"]])][:1] + gf_entry = { + 'cat': 'V', + 'lemma': lemma, + 'args': { + 'perfect': lemma, + 'imperfect': [form for form, descr in forms + if all([w in descr for + w in [ + "active", "indicative", "masculine", "non-past", + "imperfective", "singular", "third-person"]])][:1], + 'cls': ['Form' + max([n for n in [ + 'I', 'II','III','IV','V','VI','VII','VIII','IX','X','XI',''] + if n in ' '.join([c for c in obj['categories'] + if c.endswith('verbs') and any([n in c for n in 'IVX'])])], + key=len)] # max in RGL is XI, in Wikt XIII + } + } + elif obj['pos'] == 'adj': + lemma = [form for form, descr in forms + if all([w in descr for w in [ + 'indefinite', 'masculine', 'singular', 'informal']])][:1] + gf_entry = { + 'cat': 'A', + 'lemma': lemma, + 'args': { + 'masc_sg': lemma, + 'masc_pl': [form for form, descr in forms + if all([w in descr for w in ['indefinite', 'masculine', 'plural', 'informal']])][:1], + 'fem_sg': [form for form, descr in forms + if all([w in descr for w in ['indefinite', 'feminine', 'singular', 'informal']])][:1], + 'fem_pl': [form for form, descr in forms + if all([w in descr for w in ['indefinite', 'feminine', 'plural', 'informal']])][:1], + } + } + for patt in ['masc_sg', 'masc_pl']: + if patt in gf_entry['args']: + if form := gf_entry['args'][patt]: + if spatt := get_sound_fcl_pattern(form[0]): + gf_entry['args'][patt[5:]+'_patt'] = [spatt] # sg_patt, pl_patt + + else: + gf_entry = {f: d for f, d in forms} + + if 'lemma' in gf_entry and gf_entry['lemma']: + gf_entry['lemma'] = gf_entry['lemma'][0] + if 'root' in dforms: + gf_entry['args']['root'] = [dforms['root']] + elif root := get_sound_trigram_root(gf_entry['lemma']): + gf_entry['args']['root'] = [root] + args = sorted([(r, quote_if(x[0])) for r, x in gf_entry['args'].items() if x]) + gf_entry['lin'] = 'wmk' + gf_entry['cat'] + ' {' + ' ; '.join([r + ' = ' + v for (r, v) in args]) + '}' + gf_entry['labels'] = ','.join([r for r, v in args]) + + return gf_entry + + +# "root": ["ش ر ح (š-r-ḥ)"] +def find_root(s): + return ''.join([c for c in s if is_arabic(c)]) + + +# GF code generation + +# start with the header of the desired GF module + +if MODE == 'gf-abs': + print('abstract MorphoDictAraAbs = Cat ** {') +if MODE == 'gf-cnc': + print('concrete MorphoDictAra of MorphoDictAraAbs = CatAra ** open ParadigmsAra, MoreAra in {') + +# go through the Arabic Wiktionary entries +# generate functions with unique names + +if MODE.startswith('gf') or MODE=='json': + with open(FILTERED_WIKT) as file: + seen_gf_funs = {} # to disambiguate names if needed + number = 1 + for line in file: + try: + obj = json.loads(line) + except: + continue + number += 1 # if you find the same word_C again, mark it word_1_C + + # only take entries that are marked as lemmas + if 'Arabic lemmas' in obj.get('categories', []): + entry = { + 'pos': obj['pos'], + 'forms': forms_for_pos(obj), + 'all_forms': wikt_forms_from_obj(obj), + 'senses': [sense['glosses'] for sense in obj.get('senses', []) + if 'glosses' in sense] + } + + # if you only want to see the Wikt information used GF generation + if MODE == 'json': + print(json.dumps(entry, ensure_ascii=False)) + + # if you want to proceed to GF generation + if MODE.startswith('gf'): + + lemma = entry['forms'].get('lemma', None) + if lemma: + cat = entry['forms']['cat'] + lin = entry['forms']['lin'] + labels = entry['forms']['labels'] + discrim = seen_gf_funs.get((lemma, cat), 0) + fun = gf_fun(lemma, cat, discrim) + + # abstract syntax, save in MorphoDictAraAbs.gf + if MODE == 'gf-abs': + print('fun', fun, ':', cat, ';', '--', number, entry['senses']) + + # concrete syntax, save in MorphoDictAra.gf + elif MODE == 'gf-cnc': + print('lin', fun, '=', lin, ';') + + # function-source map, save in source_of_MorphoDictAra.jsonl + elif MODE == 'gf-map': + source = wikt_forms_from_obj(obj) + source['gf_labels'] = labels + mapitem = {'fun': fun, 'source': source} + print(json.dumps(mapitem, ensure_ascii=False)) + + seen_gf_funs[(lemma, cat)] = discrim + 1 # next word_d_C will get a new number + +# terminate the GF file with a closing brace +if MODE in ['gf-abs', 'gf-cnc']: + print('}') + + +# evaluation: +# linearize all words to tables +# compare them to the forms found in Wiktionary +# report on matches + +# format of GF table: +# {'s (AComp Def Bare)': 'الأَيَُونَانِ'} +# coming from pgf tabularLinearize + +# compare the table for one function, returning a report as a dict +def compare_tables(gf, wikt, fun, show_buckwalter=True): + report = {} + for pair in gf.items(): + gf_form = pair[1] + gf_params = pair[0] + gf_tags = tuple(word for word in + pair[0].replace('(', ' ').replace(')', ' ').split() + if word in arabic_rgl_features) + if not gf_tags: + continue # if gf_tags match no Wikt tags, do not include this form + wikt_tags = {arabic_rgl_features[tag] for tag in gf_tags} + wikt_form = None + wikt_descr = None + for form, descr in wikt.items(): + if all([tag in descr for tag in wikt_tags]): + wikt_form = reorder_shadda(form) + wikt_descr = descr + break + report[gf_tags] = { # flat param description with only Wikt-relevant tags + 'gf_params': gf_params, # full param description + 'gf_form': gf_form, + 'wikt_form': wikt_form, + 'wikt_descr': wikt_descr + } + if show_buckwalter: + report[gf_tags]['gf_form_rom'] = to_buckwalter(gf_form) if gf_form else None + report[gf_tags]['wikt_form_rom'] = to_buckwalter(wikt_form) if wikt_form else None + if wikt_form: + report[gf_tags]['voc_match'] = int(normal(gf_form) == normal(wikt_form)) + report[gf_tags]['unvoc_match'] = int(normal(unvocalize(gf_form)) == normal(unvocalize(wikt_form))) + ritems = tuple(report.items()) # need an unmutable structure, because otherwise ints are added to items + report['fun'] = fun + report['labels'] = wikt['gf_labels'] + report['total_found'] = len([f for f, v in ritems if v['wikt_form'] is not None ]) + report['total_voc'] = sum([v.get('voc_match', 0) for f, v in ritems]) + report['total_unvoc'] = sum([v.get('unvoc_match', 0) for f, v in ritems]) + return report + + +# with a given grammar and function, prepare input for compare_tables +# and produce a report, possibly summarizing it +def eval_with_wikt(gr, lang, fun, wikt, verbose=False): + if fun not in gr.functions: + print(fun, 'not found in grammar') + return + gf = {p: s for (p, s) in lang.tabularLinearize(pgf.Expr(fun, [])).items() + if p.startswith('s ')} # require the s field, exclude s2 + report = compare_tables(gf, wikt, fun) + if verbose: + return report + else: + if report['total_found'] == 0: + verdict = 'NOT_FOUND' + flaws = False + elif report['total_found'] == report['total_voc']: + verdict = 'PERFECT' + flaws = False + elif report['total_found'] == report['total_unvoc']: + verdict = 'PERFECT_UNVOC' + flaws = True + elif report['total_voc'] == 0: + verdict = 'TOTALLY_WRONG' + flaws = True + else: + verdict = 'PARTIAL' + flaws = True + summary = { + 'fun': report['fun'], + 'forms': report['total_found'], + 'voc': report['total_voc'], + 'unvoc': report['total_unvoc'], + 'verdict': verdict, + 'labels': report['labels'] + } + + if flaws: + for f, v in report.items(): + if v.get('voc_match', 1) == 0: + summary['first_error'] = v + break + return summary + + +def eval_grammar(pgffile, concretename, mapfile, show=True, verbose=False): + gr = pgf.readPGF(pgffile) + concrete = gr.languages[concretename] + + totals = {'A': {}, 'N': {}, 'V': {}} + + with open(mapfile) as file: + for line in file: + obj = json.loads(line) + fun = obj['fun'][1:-1] + report = eval_with_wikt(gr, concrete, fun, obj['source'], verbose) + + cat = fun[-1] + if 'verdict' in report: + rep = report['verdict'] + totals[cat][rep] = totals[cat].get(rep, 0) + 1 + + if show: + print(json.dumps(report, ensure_ascii=False)) + + print(json.dumps(totals, ensure_ascii=False)) + + +if MODE.startswith('eval'): + verbose = MODE=='eval-verbose' + show = verbose or MODE=='eval-funs' + eval_grammar(PGF_FILE, CONCRETE_MODULE, FUNCTION_SOURCE_MAP, show, verbose) + + diff --git a/src/arabic/wiktionary/to_wordnet.py b/src/arabic/wiktionary/to_wordnet.py new file mode 100644 index 000000000..df82b20df --- /dev/null +++ b/src/arabic/wiktionary/to_wordnet.py @@ -0,0 +1,59 @@ +import sys +import csv +import json + +from arabic_utilities import * + +# to run: python3 to_wordnet.py >arabic-wn-morpho.jsonl +# the following are assumed + +# from https://www.grammaticalframework.org/~krasimir/arabic.tsv.gz +# WN_TSV = 'arabic.tsv' # Krasimir +WN_TSV = 'ar2en_words_gf.csv' # Zarzoura + +# built as explained in ./read_wiktionary.py +MORPHO_GF = 'MorphoDictAraAbs.gf' + + +# fun 'دُبُ_N' : N ; -- 10 [['bear']] +funmap = {} +with open(MORPHO_GF) as gffile: + for line in gffile: + line = line.split() + if line[2:] and line[0] == 'fun': + fun = line[1] + key = unvocalize(fun) + cat = line[3] + sense = ' '.join(line[6:]) + funmap[(key, cat)] = funmap.get((key, cat), []) + funmap[(key, cat)].append({'fun': fun, 'sense': sense}) + + +# abandon_1_V2 ParseAra ترك (1,1,1,3,322,3) +with open(WN_TSV) as wnfile: + print('--# -path=.:../gf-wordnet') + print('concrete WordNetAra of WordNet = CatAra ** open MorphoDictAra, MoreAra, ParadigmsAra in {') + +## wnreader = csv.reader(wnfile, delimiter='\t') + for row in wnfile: +## word = row[-1].strip() # does not show tha arabic, but the second-last word + word = unvocalize(get_arabic(row)) + wnfun = row.split()[-1] # 0 in Krasimir + cat = [c for c in wnfun if c.isalpha()][-1] # the last letter; the dict only contains N, A, V + funs = funmap.get((word, cat), []) + mk = 'mkV2 ' if wnfun.endswith('V2') else '' + results = [' '.join(['lin', wnfun, '=', mk + fs['fun'], ';', '--', str(fs['sense'])]) + for fs in funs] + if results: + print(results[0]) + for r in results[1:]: + print('--', r) + else: + if (cat := wnfun[-2:]) in ['_A', '_N', '_V']: + lin = 'mk' + cat[-1] + ' "' + word + '"' + else: + lin = 'variants {}' + print(' '.join(['lin', wnfun, '=', lin, ';', '---', 'guess from', word])) + print('}') + + diff --git a/src/bantu/CatBantu.gf b/src/bantu/CatBantu.gf index a9d3acf21..9f014c394 100644 --- a/src/bantu/CatBantu.gf +++ b/src/bantu/CatBantu.gf @@ -61,7 +61,8 @@ incomplete concrete CatBantu of Cat = Numeral = {s : CardOrd => Gender => Str ; n : Number} ; - Digits = {s : CardOrd => Gender => Str ; n : Number} ; + Digits = {s : CardOrd => Gender => Str ; n : Number} ; + Decimal = {s : CardOrd => Gender => Str ; n : Number ; hasDot : Bool} ; -- Structural @@ -81,7 +82,7 @@ incomplete concrete CatBantu of Cat = -- N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ; N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Prep} ; N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Prep} ; - GN, SN, PN = {s : Case => Str ; g : Gender} ; + GN, SN, LN, PN = {s : Case => Str ; g : Gender} ; --Tense = {s : Str ; t : ResKam.Tense} ; linref diff --git a/src/bantu/NounBantu.gf b/src/bantu/NounBantu.gf index 847d35984..8da208d67 100644 --- a/src/bantu/NounBantu.gf +++ b/src/bantu/NounBantu.gf @@ -77,6 +77,7 @@ lin NumCard n = n ;--** {hasCard = True} ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = { s = n.s ! NOrd} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/basque/CatEus.gf b/src/basque/CatEus.gf index 7ef710114..28687c0c9 100644 --- a/src/basque/CatEus.gf +++ b/src/basque/CatEus.gf @@ -85,6 +85,7 @@ concrete CatEus of Cat = CommonX ** open ResEus, Prelude in { Numeral = { s : Str ; n : Number } ; Digits = { s : CardOrd => Str ; n : Number } ; + Decimal = { s : CardOrd => Str ; n : Number ; hasDot : Bool} ; diff --git a/src/basque/NounEus.gf b/src/basque/NounEus.gf index ceef7e746..5efb55cec 100644 --- a/src/basque/NounEus.gf +++ b/src/basque/NounEus.gf @@ -125,6 +125,7 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in { -- : Digits -> Card ; NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ; + NumDecimal dec = { s = dec.s ! NCard ; n = dec.n } ; -- : Numeral -> Card ; NumNumeral num = num ; @@ -260,4 +261,4 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in { oper elative : NP -> Str = \np -> glue (np.s ! LocStem) "rik" ; -} \ No newline at end of file +} diff --git a/src/basque/NumeralEus.gf b/src/basque/NumeralEus.gf index 91392fe47..69d6cb73a 100644 --- a/src/basque/NumeralEus.gf +++ b/src/basque/NumeralEus.gf @@ -1,4 +1,4 @@ -concrete NumeralEus of Numeral = CatEus [Numeral,Digits] ** open Prelude, ResEus, ParamX in { +concrete NumeralEus of Numeral = CatEus [Numeral,Digits,Decimal] ** open Prelude, ResEus, ParamX in { oper LinDigit : Type = { s : DForm => Str ; n : Number ; @@ -112,5 +112,18 @@ lin D_9 = mkDig "9" ; lin IDig dig = dig ; -- : Dig -> Digits -> Digits ; lin IIDig dig digs = digs ** {s = \\co => glue (dig.s ! co) (digs.s ! co) } ; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\co => glue "-" (d.s ! co) ; + n = Pl ; + hasDot=False + } ; +lin IFrac d i = { + s = \\co => d.s ! co ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! co ; + n = Pl ; + hasDot=False + } ; } diff --git a/src/bulgarian/CatBul.gf b/src/bulgarian/CatBul.gf index 656713c69..783ebc375 100644 --- a/src/bulgarian/CatBul.gf +++ b/src/bulgarian/CatBul.gf @@ -1,5 +1,5 @@ --# -coding=utf8 -concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, (R = ParamX) in { +concrete CatBul of Cat = CommonX - [Temp,Tense,IAdv,AdV] ** open ResBul, Prelude, Predef, (R = ParamX) in { lincat -- Tensed/Untensed @@ -11,6 +11,9 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( -- Sentence + Temp = {s : Str ; t : ResBul.Tense ; a : R.Anteriority} ; + Tense = {s : Str ; t : ResBul.Tense} ; + Cl = {s : ResBul.Tense => Anteriority => Polarity => Order => Str} ; ClSlash = { s : Agr => ResBul.Tense => Anteriority => Polarity => Order => Str ; @@ -64,6 +67,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( Numeral = {s : CardOrd => Str; n : Number} ; Digits = {s : CardOrd => Str; n : Number; tail : DTail} ; + Decimal = {s : CardOrd => Str; n : Number; hasDot : Bool} ; -- Structural @@ -88,6 +92,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( N3 = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ** {c2,c3 : Preposition} ; GN = {s : Str; g : Sex} ; SN = {s : Sex => Str; pl : Str} ; + LN = {s : Species => Str; defNom: Str; onPrep : Bool; hasArt : Bool; gn : GenNum} ; PN = {s : Str; gn : GenNum} ; lindef @@ -113,7 +118,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( linref SSlash = \ss -> ss.s ! agrP3 (GSg Masc) ++ ss.c2.s; - ClSlash = \cl -> cl.s ! agrP3 (GSg Masc) ! Pres ! Simul ! Pos ! Main ++ cl.c2.s; + ClSlash = \cl -> cl.s ! agrP3 (GSg Masc) ! VPresent ! Simul ! Pos ! Main ++ cl.c2.s; VP = \vp -> linrefVP vp; VPSlash = \vps -> let vp : ResBul.VP diff --git a/src/bulgarian/DocumentationBul.gf b/src/bulgarian/DocumentationBul.gf index 30c4f76c0..7b253ecca 100644 --- a/src/bulgarian/DocumentationBul.gf +++ b/src/bulgarian/DocumentationBul.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common concrete DocumentationBul of Documentation = CatBul ** open - ResBul, + ResBul, Prelude, HTML in { flags coding=utf8 ; @@ -69,7 +69,10 @@ lin tr (intagAttr "th" "rowspan=\"3\"" "ед.ч." ++ th "нечленувано" ++ td (n.s ! (NF Sg Indef))) ++ tr (th "членувано" ++ td (n.s ! (NF Sg Def))) ++ - tr (th "пълен член" ++ td (n.s ! NFSgDefNom)) ++ + (case n.g of { + AMasc _ => tr (th "пълен член" ++ td (n.s ! NFSgDefNom)) ; + _ => "" + }) ++ tr (intagAttr "th" "rowspan=\"2\"" "мн.ч." ++ th "нечленувано" ++ td (n.s ! (NF Pl Indef))) ++ tr (th "членувано" ++ td (n.s ! (NF Pl Def))) ++ @@ -92,6 +95,34 @@ lin s3 = "" } ; + InflectionLN = \n -> { + t = "същ.с." ; + s1= heading1 ("Име за Място"++ + case n.gn of { + GSg Masc => "(м.р.)" ; + GSg Fem => "(ж.р.)" ; + GSg Neut => "(ср.р.)" ; + GPl => "(мн.ч.)" + }) ; + s2 = paragraph (case n.hasArt of { + True => frameTable ( + tr (th "нечленувано" ++ td (n.s ! Indef)) ++ + tr (th "членувано" ++ td (n.s ! Def)) ++ + (case n.gn of { + GSg Masc => tr (th "пълен член" ++ td n.defNom) ; + _ => "" + })) ; + False => n.s ! Indef + }) ++ + heading1 ("Наречие") ++ + paragraph (case n.onPrep of { + True => linCase Dat Pos ; + False => vyv_Str + } ++ + n.s ! Def) ; + s3 = "" + } ; + InflectionGN = \gn -> { t = "същ.с.л." ; s1= heading1 (case gn.g of { @@ -145,7 +176,7 @@ lin } ; InflectionPrep = \prep -> { - t = "пр" ; + t = "пред" ; s1= heading1 ("Предлог") ; s2= paragraph (prep.s) ; s3= "" diff --git a/src/bulgarian/ExtendBul.gf b/src/bulgarian/ExtendBul.gf index 0ca1aa0b6..808be483e 100644 --- a/src/bulgarian/ExtendBul.gf +++ b/src/bulgarian/ExtendBul.gf @@ -183,22 +183,31 @@ lin ComplSlashPartLast = ComplSlash ; lincat - RNP = {s : Role => Str; gn : GenNum} ; + RNP = {s : Role => Str; gn : GenNum; isPron : Bool} ; lin ReflRNP slash rnp = { s = slash.s ; ad = slash.ad ; clitics = slash.clitics ; - compl = \\a => slash.compl1 ! a ++ slash.c2.s ++ rnp.s ! RObj slash.c2.c ++ slash.compl2 ! agrP3 rnp.gn ; - vtype = slash.vtype ; + compl = \\a => slash.compl1 ! a ++ slash.c2.s ++ + case of { + => [] ; + _ => rnp.s ! RObj slash.c2.c + } ++ + slash.compl2 ! agrP3 rnp.gn ; + vtype = case of { + => VMedial slash.c2.c ; + _ => slash.vtype + } ; p = slash.p ; isSimple = False } ; ReflPron = { s = \\role => "себе си"; - gn = GSg Masc + gn = GSg Masc; + isPron = True } ; ReflPoss num cn = @@ -219,15 +228,17 @@ lin RObj c => linCase c Pos ++ s; _ => s } ; - gn = gennum cn.g (numnnum num.nn) + gn = gennum cn.g (numnnum num.nn) ; + isPron = False } ; PredetRNP pred rnp = { s = \\c => pred.s ! rnp.gn ++ rnp.s ! c ; - gn = rnp.gn + gn = rnp.gn ; + isPron = False } ; - AdvRNP np prep rnp = {s = \\role => np.s ! role ++ prep.s ++ rnp.s ! RObj prep.c; gn = np.gn; p = np.p} ; + AdvRNP np prep rnp = {s = \\role => np.s ! role ++ prep.s ++ rnp.s ! RObj prep.c; gn = np.gn; p = np.p; isPron = False} ; AdvRVP vp prep rnp = insertObj (\\a => prep.s ++ rnp.s ! RObj prep.c) Pos vp ; AdvRAP ap prep rnp = { s = \\aform,p => ap.s ! aform ! p ++ prep.s ++ rnp.s ! RObj prep.c ; @@ -303,27 +314,6 @@ lin UseDAP dap = { lin UseComp_estar = UseComp ; UseComp_ser = UseComp ; -lin GivenName = \n -> { - s = n.s ; - gn = GSg (sex2gender n.g) - } ; -lin MaleSurname = \n -> { - s = n.s ! Male ; - gn = GSg Masc - } ; -lin FemaleSurname = \n -> { - s = n.s ! Female; - gn = GSg Fem - } ; -lin PlSurname = \n -> { - s = n.pl ; - gn = GPl - } ; -lin FullName gn sn = { - s = gn.s ++ sn.s ! gn.g ; - gn = GSg (sex2gender gn.g) - } ; - lin ProDrop pro = pro ; lin AnaphPron np = @@ -338,5 +328,7 @@ lin AnaphPron np = => they_Pron } ; +lin TPastSimple = {s = []} ** {t = VPastSimple} ; --# notpresent + } diff --git a/src/bulgarian/GrammarBul.gf b/src/bulgarian/GrammarBul.gf index f9a05a99e..971d0ca22 100644 --- a/src/bulgarian/GrammarBul.gf +++ b/src/bulgarian/GrammarBul.gf @@ -15,7 +15,8 @@ concrete GrammarBul of Grammar = TextBul, StructuralBul, IdiomBul, - TenseX - [CAdv,IAdv,AdV,SC] + TenseBul, + NamesBul ** { flags coding=utf8 ; diff --git a/src/bulgarian/IdiomBul.gf b/src/bulgarian/IdiomBul.gf index c8cd86c25..34bd8dbbc 100644 --- a/src/bulgarian/IdiomBul.gf +++ b/src/bulgarian/IdiomBul.gf @@ -29,6 +29,7 @@ concrete IdiomBul of Idiom = CatBul ** open Prelude, ParadigmsBul, ResBul in { present = verb ! (VPres (numGenNum agr.gn) agr.p) ; aorist = verb ! (VAorist (numGenNum agr.gn) agr.p) ; + imperfect = verb ! (VImperfect (numGenNum agr.gn) agr.p) ; perfect = verb ! (VPerfect (aform agr.gn Indef (RObj Acc))) ; auxPres = auxBe ! VPres (numGenNum agr.gn) agr.p ; @@ -37,14 +38,16 @@ concrete IdiomBul of Idiom = CatBul ** open Prelude, ParadigmsBul, ResBul in { v : {aux1:Str; aux2:Str; main:Str} = case of { - => {aux1=[]; aux2=[]; main=present} + => {aux1=[]; aux2=[]; main=present} ; --# notpresent - => {aux1=[]; aux2=auxPres; main=perfect} ; --# notpresent - => {aux1=[]; aux2=[]; main=aorist} ; --# notpresent - => {aux1=[]; aux2=auxAorist; main=perfect} ; --# notpresent - => {aux1="ще"; aux2=[]; main=present} ; --# notpresent - => {aux1="ще"++auxPres; aux2=[]; main=perfect} ; --# notpresent - => {aux1=auxCondS; aux2=[]; main=perfect} --# notpresent + => {aux1=[]; aux2=auxPres; main=perfect} ; --# notpresent + => {aux1=[]; aux2=[]; main=aorist} ; --# notpresent + => {aux1=[]; aux2=auxAorist; main=perfect} ; --# notpresent + => {aux1=[]; aux2=[]; main=imperfect} ; --# notpresent + => {aux1=[]; aux2=auxAorist; main=perfect} ; --# notpresent + => {aux1="ще"; aux2=[]; main=present} ; --# notpresent + => {aux1="ще"++auxPres; aux2=[]; main=perfect} ; --# notpresent + => {aux1=auxCondS; aux2=[]; main=perfect} --# notpresent } ; in case o of { diff --git a/src/bulgarian/MorphoBul.gf b/src/bulgarian/MorphoBul.gf index 1e34262e5..612d85f7e 100644 --- a/src/bulgarian/MorphoBul.gf +++ b/src/bulgarian/MorphoBul.gf @@ -165,6 +165,7 @@ oper NF Sg Indef => sg ; NF Sg Def => case sg of { _+"а"=>sg+"та" ; + _+"ю"=>sg+"та" ; _+"я"=>sg+"та" ; _+"о"=>sg+"то" ; _+"у"=>sg+"то" ; diff --git a/src/bulgarian/MorphoFunsBul.gf b/src/bulgarian/MorphoFunsBul.gf index 903a99610..fe1f077db 100644 --- a/src/bulgarian/MorphoFunsBul.gf +++ b/src/bulgarian/MorphoFunsBul.gf @@ -291,6 +291,19 @@ oper \s,gn -> {s = s; gn = gn ; lock_PN = <>} ; } ; + mkLN = overload { + mkLN : Str -> LN = \s -> lin LN {s = \\_ => s; defNom=s; onPrep = False; hasArt = False; gn = GSg Masc} ; + mkLN : Str -> Gender -> LN = + \s,g -> lin LN {s = \\_ => s; defNom=s; onPrep = False; hasArt = False; gn = GSg g} ; + mkLN : Str -> GenNum -> LN = + \s,gn -> lin LN {s = \\_ => s; defNom=s; onPrep = False; hasArt = False; gn = gn} ; + mkLN : Str -> Str -> GenNum -> LN = + \s1,s2,gn -> lin LN {s = table Species [s2; s1]; defNom=s2; onPrep = False; hasArt = True; gn = gn} ; + mkLN : Str -> Str -> Str -> LN = + \s1,s2,s3 -> lin LN {s = table Species [s3; s2]; defNom=s1; onPrep = False; hasArt = True; gn = GSg Masc} ; + } ; + + onLN : LN -> LN = \n -> n ** {onPrep = True} ; --2 IAdv -- diff --git a/src/bulgarian/NamesBul.gf b/src/bulgarian/NamesBul.gf new file mode 100644 index 000000000..d15a0950c --- /dev/null +++ b/src/bulgarian/NamesBul.gf @@ -0,0 +1,77 @@ +concrete NamesBul of Names = CatBul ** open ResBul, Prelude in { + +lin GivenName = \n -> { + s = table { RObj c => linCase c Pos ++ n.s; + _ => n.s + } ; + gn = GSg (sex2gender n.g) ; + p = NounP3 Pos + } ; +lin MaleSurname = \n -> { + s = table { RObj c => linCase c Pos ++ n.s ! Male; + _ => n.s ! Male + } ; + gn = GSg Masc ; + p = NounP3 Pos + } ; +lin FemaleSurname = \n -> { + s = table { RObj c => linCase c Pos ++ n.s ! Female; + _ => n.s ! Female + } ; + gn = GSg Fem ; + p = NounP3 Pos + } ; +lin PlSurname = \n -> { + s = table { RObj c => linCase c Pos ++ n.pl ; + _ => n.pl + } ; + gn = GPl ; + p = NounP3 Pos + } ; +lin FullName gn sn = { + s = table { RObj c => linCase c Pos ++ gn.s ++ sn.s ! gn.g ; + _ => gn.s ++ sn.s ! gn.g + } ; + gn = GSg (sex2gender gn.g) ; + p = NounP3 Pos + } ; + +lin UseLN = \n -> { + s = table { RSubj => n.defNom ; + RObj c => linCase c Pos ++ n.s ! Def ; + RVoc => n.s ! Indef + } ; + gn = n.gn ; + p = NounP3 Pos + } ; + +lin PlainLN = \n -> { + s = table { RObj c => linCase c Pos ++ n.s ! Indef ; + _ => n.s ! Indef + } ; + gn = n.gn ; + p = NounP3 Pos + } ; + + InLN n = { + s = case n.onPrep of { + True => linCase Dat Pos ; + False => vyv_Str + } ++ + n.s ! Def + } ; + + AdjLN ap n = n ** { + s = \\sp => case of { + => ap.s ! aform n.gn sp RSubj ! P3 ++ n.s ! Indef ; + => ap.s ! aform n.gn Indef RSubj ! P3 ++ n.s ! Indef ; + => n.s ! sp ++ ap.s ! aform n.gn Indef RSubj ! P3 + } ; + defNom = case of { + => ap.s ! ASgMascDefNom ! P3 ++ n.s ! Indef ; + => ap.s ! aform n.gn Indef RSubj ! P3 ++ n.s ! Indef ; + => n.defNom ++ ap.s ! aform n.gn Indef RSubj ! P3 + } ; + } ; + +} diff --git a/src/bulgarian/NounBul.gf b/src/bulgarian/NounBul.gf index 2fd91ca14..0dd9715f2 100644 --- a/src/bulgarian/NounBul.gf +++ b/src/bulgarian/NounBul.gf @@ -116,6 +116,7 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in { NumCard n = {s=n.s; nn=n.nn; nonEmpty = True} ; NumDigits n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ; + NumDecimal n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ; OrdDigits n = {s = \\aform => n.s ! NOrd aform} ; NumNumeral numeral = {s = \\gspec => numeral.s ! NCard gspec; nn = case numeral.n of {Sg => NNum Sg; Pl => NCountable}} ; @@ -238,4 +239,11 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in { p = dap.p } ; DetDAP det = det ; + + QuantityNP n m = { + s = \\role => preOrPost m.isPre m.s (n.s ! NCard (CFMasc Indef NonHuman)) ; + gn = gennum (AMasc NonHuman) n.n ; + p = NounP3 Pos + } ; + } diff --git a/src/bulgarian/NumeralBul.gf b/src/bulgarian/NumeralBul.gf index 170351fdd..4a4fb4e25 100644 --- a/src/bulgarian/NumeralBul.gf +++ b/src/bulgarian/NumeralBul.gf @@ -1,5 +1,5 @@ --# -coding=utf8 -concrete NumeralBul of Numeral = CatBul [Numeral,Digits] ** open Prelude, ResBul in { +concrete NumeralBul of Numeral = CatBul [Numeral,Digits,Decimal] ** open Prelude, ResBul in { flags coding=utf8 ; @@ -97,8 +97,11 @@ lin pot3plus n m = { n = Pl } ; lin pot3as4 n = n ; -lin pot3float f = { - s = \\c,nf => f.s ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c ; +lin pot3decimal d = { + s = \\c,nf => case d.n of { + Sg => mkCardOrd100 "хиляда" "хилядата" "хиляден" ! NCard (CFMasc Indef NonHuman) ; + Pl => d.s ! NCard (CFFem Indef) ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c + } ; n = Pl } ; @@ -109,7 +112,7 @@ lin pot41 = { lin pot4 n = { s = \\c,nf => case n.n of { Sg => mkCardOrd100 "милион" "милионите" "милионен" ! c ; - Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиони" "милионите" "милионен" ! c + Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиона" "милионите" "милионен" ! c } ; n = Pl } ; @@ -118,8 +121,17 @@ lin pot4plus n1 n2 = { n = Pl } ; lin pot4as5 n = n ; -lin pot4float f = { - s = \\c,nf => f.s ++ mkCardOrd100 "милиона" "милиона" "милионен" ! c ; +lin pot4decimal d = { + s = \\c,nf => case c of { + NCard (CFMasc s a) => d.s ! NCard (CFMasc s NonHuman) ; + NCard (CFMascDefNom a) => d.s ! NCard (CFMascDefNom NonHuman) ; + NCard cf => d.s ! NCard cf ; + NOrd _ => d.s ! NCard (CFMasc Indef NonHuman) + } ++ + case d.n of { + Sg => "милион" ; + Pl => "милиона" + } ; n = Pl } ; @@ -130,7 +142,7 @@ lin pot51 = { lin pot5 n = { s = \\c,nf => case n.n of { Sg => mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! c ; - Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! c + Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиярда" "милиярдите" "милиярден" ! c } ; n = Pl } ; @@ -138,8 +150,12 @@ lin pot5plus n1 n2 = { s = \\o,f => (pot5 n1).s ! o ! f ++ "и" ++ n2.s ! o ! f; n = Pl } ; -lin pot5float f = { - s = \\c,nf => f.s ++ mkCardOrd100 "милиярда" "милиярда" "милиярден" ! c ; +lin pot5decimal d = { + s = \\c,nf => d.s ! NCard (CFFem Indef) ++ + case d.n of { + Sg => mkCardOrd100 "милиярд" "милиярда" "милиярден" ! c ; + Pl => mkCardOrd100 "милиярда" "милиярдите" "милиярден" ! c + } ; n = Pl } ; @@ -168,9 +184,19 @@ lin pot5float f = { D_8 = mk3Dig "8" "8на" "8ми" Pl ; D_9 = mk3Dig "9" "9има" "9ти" Pl ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False; n = Pl} ; + IFrac d i = { + s = \\o => d.s ! NCard (CFMasc Indef NonHuman) ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper spaceIf : DTail -> Str = \t -> case t of { - T3 => SOFT_BIND ; + T3 => SOFT_SPACE ; _ => BIND } ; diff --git a/src/bulgarian/ParadigmsBul.gf b/src/bulgarian/ParadigmsBul.gf index 1c6d19ecd..474494106 100644 --- a/src/bulgarian/ParadigmsBul.gf +++ b/src/bulgarian/ParadigmsBul.gf @@ -2116,4 +2116,7 @@ oper adjAdv : A -> Str -> A = \a,adv -> a ** {adv = adv} ; + + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/bulgarian/ResBul.gf b/src/bulgarian/ResBul.gf index 8be1f534a..7a10e08fd 100644 --- a/src/bulgarian/ResBul.gf +++ b/src/bulgarian/ResBul.gf @@ -8,7 +8,7 @@ -- implement $Test$, it moreover contains regular lexical -- patterns needed for $Lex$. -resource ResBul = ParamX ** open Prelude, Predef in { +resource ResBul = ParamX - [Tense,Pres,Past,Fut,Cond] ** open Prelude, Predef in { flags coding=utf8 ; optimize=all ; @@ -47,7 +47,6 @@ resource ResBul = ParamX ** open Prelude, Predef in { param Gender = Masc | Fem | Neut ; - Sex = Male | Female ; Species = Indef | Def ; @@ -69,7 +68,7 @@ resource ResBul = ParamX ** open Prelude, Predef in { | VNoun NForm | VGerund ; - + VType = VNormal | VMedial Case @@ -78,6 +77,14 @@ resource ResBul = ParamX ** open Prelude, Predef in { VVType = VVInf Aspect | VVGerund ; + Tense = + VPresent + | VPastSimple --# notpresent + | VPastImperfect --# notpresent + | VFut --# notpresent + | VCond --# notpresent + ; + -- The order of sentence is needed already in $VP$. Order = Main | Inv | Quest ; @@ -470,7 +477,7 @@ resource ResBul = ParamX ** open Prelude, Predef in { ia2e : Str -> Str = -- to be used when the next syllable has vowel different from "а","ъ","о" or "у" \s -> case s of { - x + "я" + y@(["бвгджзклмнпрстфхцчш"]*) + x@(?+_) + "я" + y@(["бвгджзклмнпрстфхцчш"]*) => x+"е"+y; _ => s }; @@ -534,10 +541,12 @@ resource ResBul = ParamX ** open Prelude, Predef in { present = verb.s ! asp ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ; presentImperf = verb.s ! Imperf ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ; aorist = verb.s ! asp ! (VAorist (numGenNum clitic.agr.gn) clitic.agr.p) ; + imperfect = verb.s ! Imperf ! (VImperfect (numGenNum clitic.agr.gn) clitic.agr.p) ; perfect = verb.s ! asp ! (VPerfect (aform clitic.agr.gn Indef (RObj Acc))) ; auxPres = auxBe ! VPres (numGenNum clitic.agr.gn) clitic.agr.p ; auxAorist = auxBe ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ; + auxImperf = auxBe ! VImperfect (numGenNum clitic.agr.gn) clitic.agr.p ; auxCondS = auxCond ! numGenNum clitic.agr.gn ! clitic.agr.p ; apc : Str -> Str = \s -> @@ -581,14 +590,16 @@ resource ResBul = ParamX ** open Prelude, Predef in { verbs : {aux:{s1:Str; s2:Str}; main:Str} = case of { - => {aux=vf2 clitic.s; main=presentImperf} + => {aux=vf2 clitic.s; main=presentImperf} ; --# notpresent - => {aux=vf1 clitic.s; main=perfect} ; --# notpresent - => {aux=vf2 clitic.s; main=aorist} ; --# notpresent - => {aux=vf4 auxAorist; main=perfect} ; --# notpresent - => {aux=vf3 clitic.s; main=present} ; --# notpresent - => {aux=vf3 (apc []); main=perfect} ; --# notpresent - => {aux=vf4 auxCondS; main=perfect} --# notpresent + => {aux=vf1 clitic.s; main=perfect} ; --# notpresent + => {aux=vf2 clitic.s; main=aorist} ; --# notpresent + => {aux=vf4 auxAorist; main=perfect} ; --# notpresent + => {aux=vf2 clitic.s; main=imperfect} ; --# notpresent + => {aux=vf4 auxImperf; main=perfect} ; --# notpresent + => {aux=vf3 clitic.s; main=present} ; --# notpresent + => {aux=vf3 (apc []); main=perfect} ; --# notpresent + => {aux=vf4 auxCondS; main=perfect} --# notpresent } in verb.ad.s ++ li0 ++ verbs.aux.s1 ++ verbs.main ++ verbs.aux.s2 ; @@ -859,4 +870,9 @@ resource ResBul = ParamX ** open Prelude, Predef in { Female => Fem } ; + vyv_Str : Str + = pre { "в" ; + "във" / strs {"в" ; "ф" ; "В" ; "Ф"} + } ; + } diff --git a/src/bulgarian/StructuralBul.gf b/src/bulgarian/StructuralBul.gf index 4ee12dba1..1dae72eed 100644 --- a/src/bulgarian/StructuralBul.gf +++ b/src/bulgarian/StructuralBul.gf @@ -44,9 +44,7 @@ concrete StructuralBul of Structural = CatBul ** if_Subj = ss "ако" ; in8front_Prep = mkPrep "пред" ; i_Pron = mkPron "аз" "мой" "моя" "моят" "моя" "моята" "мое" "моето" "мои" "моите" (GSg Masc) PronP1 ; - in_Prep = mkPrep (pre { "в" ; - "във" / strs {"в" ; "ф" ; "В" ; "Ф"} - }) ; + in_Prep = mkPrep vyv_Str ; it_Pron = mkPron "то" "негов" "неговия" "неговият" "негова" "неговата" "негово" "неговото" "негови" "неговите" (GSg Neut) PronP3 ; less_CAdv = X.mkCAdv "по-малко" "от" ; many_Det = mkDeterminerPl "много" ; diff --git a/src/bulgarian/TenseBul.gf b/src/bulgarian/TenseBul.gf new file mode 100644 index 000000000..295d2be98 --- /dev/null +++ b/src/bulgarian/TenseBul.gf @@ -0,0 +1,9 @@ +concrete TenseBul of Tense = CatBul [Tense,Temp], TenseX - [Temp,Tense,TPres,TPast,TFut,TCond,IAdv,AdV,SC] ** open ResBul in { + +lin + TPres = {s = []} ** {t = VPresent} ; + TPast = {s = []} ** {t = VPastImperfect} ; --# notpresent + TFut = {s = []} ** {t = VFut} ; --# notpresent + TCond = {s = []} ** {t = VCond} ; --# notpresent + +} diff --git a/src/catalan/CatCat.gf b/src/catalan/CatCat.gf index 746836316..3b097e8c2 100644 --- a/src/catalan/CatCat.gf +++ b/src/catalan/CatCat.gf @@ -1,6 +1,6 @@ --# -path=.:../romance:../abstract:../common:prelude concrete CatCat of Cat = - CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] ** + CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with -- JS restore TPast for notpresent (ResRomance = ResCat) ; diff --git a/src/catalan/CompatibilityCat.gf b/src/catalan/CompatibilityCat.gf index bfadae52d..71d41751a 100644 --- a/src/catalan/CompatibilityCat.gf +++ b/src/catalan/CompatibilityCat.gf @@ -6,6 +6,6 @@ concrete CompatibilityCat of Compatibility = CatCat ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/catalan/DiffCat.gf b/src/catalan/DiffCat.gf index b157d3cd5..a43c5d70c 100644 --- a/src/catalan/DiffCat.gf +++ b/src/catalan/DiffCat.gf @@ -225,4 +225,10 @@ oper polNegDirSubj = RPos ; +param + HasArt = NoArt | UseArt ; + +oper + superlCanBePost = False ; + } diff --git a/src/catalan/DocumentationCatFunctor.gf b/src/catalan/DocumentationCatFunctor.gf index 351fddbde..8b30bba5c 100644 --- a/src/catalan/DocumentationCatFunctor.gf +++ b/src/catalan/DocumentationCatFunctor.gf @@ -40,6 +40,42 @@ lin ) } ; + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Prenom" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \gn -> { + t = "pn" ; + s1 = heading1 "Família" ; + s2 = gn.s ! Masc + } ; + + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nom Propi" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nom de la Ubicació" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; diff --git a/src/catalan/ExtendCat.gf b/src/catalan/ExtendCat.gf index b157182b6..c0de2ffd9 100644 --- a/src/catalan/ExtendCat.gf +++ b/src/catalan/ExtendCat.gf @@ -15,10 +15,4 @@ concrete ExtendCat of Extend = CatCat ** ExtendRomanceFunctor-- - ParadigmsCat in { -- put your own definitions here -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; - } ; diff --git a/src/catalan/GrammarCat.gf b/src/catalan/GrammarCat.gf index a1a4fda2b..018253be1 100644 --- a/src/catalan/GrammarCat.gf +++ b/src/catalan/GrammarCat.gf @@ -11,10 +11,11 @@ concrete GrammarCat of Grammar = RelativeCat, ConjunctionCat, PhraseCat, - TextX - [SC,Temp,Tense,Pol,PPos,PNeg], + TextX - [SC,Temp,Tense,Pol,PPos,PNeg,MU], IdiomCat, StructuralCat, - TenseCat + TenseCat, + NamesCat ** { diff --git a/src/catalan/LexiconCat.gf b/src/catalan/LexiconCat.gf index bbdc4a3c9..d681c2319 100644 --- a/src/catalan/LexiconCat.gf +++ b/src/catalan/LexiconCat.gf @@ -10,7 +10,7 @@ flags oper regFN : Str -> N = \s -> femN (regN s) ; regMN : Str -> N = \s -> regN s ; - irregMN : Str -> Str -> N = \pa,pans -> M.mkNounIrreg pa pans masculine ** {lock_N=<>} ; + irregMN : Str -> Str -> N = \pa,pans -> M.mkNounIrreg pa pans masculine ** {relType=D.NRelPrep D.P_de; lock_N=<>} ; saberV : V = verbV (saber_99 "saber") ; lin diff --git a/src/catalan/NamesCat.gf b/src/catalan/NamesCat.gf new file mode 100644 index 000000000..e64c20fc5 --- /dev/null +++ b/src/catalan/NamesCat.gf @@ -0,0 +1,41 @@ +concrete NamesCat of Names = CatCat ** open ResCat, CommonRomance, Prelude in { + +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ! gn.g ; + g = gn.g + } ; + +lin PlainLN n = heavyNP { + s = \\c => n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + UseArt => artDef True n.g n.num c ++ n.s ; + _ => n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin InLN n = { + s = "en" ++ case n.art of { + UseArt => artDef True n.g n.num Acc ++ n.s; + _ => prepCase Acc ++ n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + +} diff --git a/src/catalan/NumeralCat.gf b/src/catalan/NumeralCat.gf index 1d5f69386..374ba7829 100644 --- a/src/catalan/NumeralCat.gf +++ b/src/catalan/NumeralCat.gf @@ -1,4 +1,4 @@ -concrete NumeralCat of Numeral = CatCat [Numeral,Digits] ** +concrete NumeralCat of Numeral = CatCat [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoCat, Prelude in { flags coding=utf8 ; @@ -158,6 +158,20 @@ param D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":o") ; diff --git a/src/catalan/ParadigmsCat.gf b/src/catalan/ParadigmsCat.gf index da1488720..62713fd79 100644 --- a/src/catalan/ParadigmsCat.gf +++ b/src/catalan/ParadigmsCat.gf @@ -139,6 +139,39 @@ oper mkPN : N -> PN ; } ; + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = Masc ; + num = Sg} ; + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = g ; + num = Sg} ; + mkLN : Str -> Gender -> Number -> LN = \s,g,n -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = g ; + num = n} + } ; + + defLN : LN -> LN = \n -> n ** {art = UseArt} ; + --2 Adjectives @@ -302,6 +335,8 @@ oper CopulaType = DiffCat.CopulaType ; masculine = Masc ; feminine = Fem ; + male = Masc ; + female = Fem ; singular = Sg ; plural = Pl ; serCopula = DiffCat.serCopula ; @@ -313,11 +348,11 @@ oper mkPrep p = {s = p ; c = Acc ; isDir = False ; lock_Prep = <>} ; - mk2N x y g = mkNounIrreg x y g ** {lock_N = <>} ; - regN x = mkNomReg x ** {lock_N = <>} ; - compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ; - femN x = {s = x.s ; g = feminine ; lock_N = <>} ; - mascN x = {s = x.s ; g = masculine ; lock_N = <>} ; + mk2N x y g = mkNounIrreg x y g ** {relType = NRelPrep P_de; lock_N = <>} ; + regN x = mkNomReg x ** {relType = NRelPrep P_de; lock_N = <>} ; + compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; relType = x.relType ; lock_N = <>} ; + femN x = x ** {g = feminine} ; + mascN x = x ** {g = masculine} ; mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ; deN2 n = mkN2 n genitive ; @@ -490,7 +525,7 @@ oper mkN = overload { mkN : (llum : Str) -> N = regN ; - mkN : Str -> Gender -> N = \s,g -> {s = (regN s).s ; g = g ; lock_N = <>}; + mkN : Str -> Gender -> N = \s,g -> (regN s) ** {g = g}; mkN : (disc,discos : Str) -> Gender -> N = mk2N } ; regN : Str -> N ; @@ -553,6 +588,6 @@ oper mk2V2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; - + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False; hasArt=False} ; } ; diff --git a/src/catalan/StructuralCat.gf b/src/catalan/StructuralCat.gf index 4833b786a..a66a8a41d 100644 --- a/src/catalan/StructuralCat.gf +++ b/src/catalan/StructuralCat.gf @@ -30,11 +30,16 @@ lin during_Prep = mkPrep "durant" ; ---- either7or_DConj = {s1,s2 = "o" ; n = Sg} ; everybody_NP = makeNP ["tothom"] Masc Sg ; - every_Det = {s,sp = \\_,_ => "cada" ; n = Sg ; s2 = [] ; isNeg = False} ; + every_Det = { + s,sp = \\_,_ => "cada"; + spn =\\c => prepCase c ++ "tot" ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; everything_NP = pn2np (mkPN "tot" Masc) ; everywhere_Adv = ss ["a tot arreu"] ; few_Det = { - s,sp = \\g,c => prepCase c ++ genForms "pocs" "poques" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + s,sp = \\g,c => prepCase c ++ genForms "pocs" "poques" ! g ; + spn = \\c => prepCase c ++ "pocs" ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; --- first_Ord = {s = \\ag => (regA "primer").s ! Posit ! AF ag.g ag.n} ; for_Prep = mkPrep ["per a"] ; from_Prep = complGen ; --- @@ -64,12 +69,16 @@ lin less_CAdv = X.mkCAdv "menys" conjThan ; ---- many_Det = { - s,sp = \\g,c => prepCase c ++ genForms "molts" "moltes" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + s,sp = \\g,c => prepCase c ++ genForms "molts" "moltes" ! g ; + spn = \\c => prepCase c ++ "molts" ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; more_CAdv = X.mkCAdv "més" conjThan ; most_Predet = {s = \\_,c => prepCase c ++ ["la majoria"] ; c = CPrep P_de ; a = PNoAg} ; much_Det = { - s,sp = \\g,c => prepCase c ++ genForms "molt" "molta" ! g ; n = Sg ; s2 = [] ; isNeg = False} ; + s,sp = \\g,c => prepCase c ++ genForms "molt" "molta" ! g ; + spn = \\c => prepCase c ++ "molt" ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; must_VV = deVV (verbV (haver_59 "haver" True)) ; no_Utt = ss "no" ; on_Prep = mkPrep "sobre" ; @@ -89,10 +98,14 @@ lin Fem Sg P3 ; so_AdA = ss "tan" ; somebody_NP = pn2np (mkPN ["alg˙"] Masc) ; - somePl_Det = {s,sp = - \\g,c => prepCase c ++ genForms "alguns" "algunes" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + somePl_Det = { + s,sp = \\g,c => prepCase c ++ genForms "alguns" "algunes" ! g ; + spn = \\c => prepCase c ++ "alguns" ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; someSg_Det = { - s,sp = \\g,c => prepCase c ++ genForms "algun" "alguna" ! g ; n = Sg ; s2 = [] ; isNeg = False} ; + s,sp = \\g,c => prepCase c ++ genForms "algun" "alguna" ! g ; + spn = \\c => prepCase c ++ "quelcom" ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; something_NP = pn2np (mkPN ["quelcom"] Masc) ; somewhere_Adv = ss ["a algun lloc"] ; that_Quant = @@ -103,6 +116,7 @@ lin in { s = \\_ => aquell ; sp = aquell ; + spn= aquell ! Sg ! Masc ; s2 = [] ; isNeg = False } ; there_Adv = mkAdv "allà" ; -- all· @@ -122,6 +136,7 @@ lin in { s = \\_ => aquest ; sp = aquest ; + spn= aquest ! Sg ! Masc ; s2 = [] ; isNeg = False } ; through_Prep = mkPrep "mitjançant" ; @@ -172,7 +187,7 @@ oper lin if_then_Conj = {s1 = "si" ; s2 = "llavors" ; n = Sg ; lock_Conj = <>} ; - + no_Quant = let capS : Str = "cap" ; @@ -183,6 +198,7 @@ lin in { s = \\_ => cap ; sp = cap ; + spn= \\c => prepCase c ++ "res" ; s2 = [] ; isNeg = True } ; nobody_NP = pn2npNeg (mkPN "ningú") ; diff --git a/src/chinese/CatChi.gf b/src/chinese/CatChi.gf index 86360be10..7caa895e5 100644 --- a/src/chinese/CatChi.gf +++ b/src/chinese/CatChi.gf @@ -57,6 +57,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu Numeral = {s,p : Str} ; Card, Digits = {s : Str} ; + Decimal = {s : Str ; hasDot : Bool} ; -- Structural @@ -80,7 +81,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu N = ResChi.Noun ; N2 = ResChi.Noun ** {c2 : Preposition} ; N3 = ResChi.Noun ** {c2,c3 : Preposition} ; - GN, SN, PN = SS ; + GN, SN, LN, PN = SS ; -- overridden diff --git a/src/chinese/DocumentationChi.gf b/src/chinese/DocumentationChi.gf index 6fb613930..0e2b84b86 100644 --- a/src/chinese/DocumentationChi.gf +++ b/src/chinese/DocumentationChi.gf @@ -112,20 +112,26 @@ lin } ; InflectionPN = \n -> { - t = "v" ; + t = "pn" ; s1 = heading1 "Proper Name" ; s2 = n.s } ; + InflectionLN = \n -> { + t = "pn" ; + s1 = heading1 "Location Name" ; + s2 = n.s + } ; + InflectionGN = \n -> { - t = "v" ; + t = "pn" ; s1 = heading1 "Given Name" ; s2 = n.s } ; InflectionSN = \n -> { - t = "v" ; - s1 = heading1 "Surname Name" ; + t = "pn" ; + s1 = heading1 "Family Name" ; s2 = n.s } ; diff --git a/src/chinese/ExtendChi.gf b/src/chinese/ExtendChi.gf index e88b0944a..771da61d7 100644 --- a/src/chinese/ExtendChi.gf +++ b/src/chinese/ExtendChi.gf @@ -11,7 +11,7 @@ concrete ExtendChi of Extend = CatChi ** , MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2 , ProDrop, ComplDirectVS, ComplDirectVQ , PassVPSlash, PassAgentVPSlash - , GerundAdv, GerundNP, ByVP ] + , GerundAdv, GerundNP, ByVP, ApposNP ] with (Grammar=GrammarChi) ** open Prelude , Coordination @@ -83,13 +83,11 @@ concrete ExtendChi of Extend = CatChi ** AdvVP (UseV ) (mkAdv (":" ++ quoted utt.s)) ; -- DEFAULT complement added as Adv in quotes + lin + ApposNP np1 np2 = {s = np1.s ++ np2.s; det = np1.det} ; + oper mkAdv : Str -> CatChi.Adv ; mkAdv str = lin Adv {s = str ; advType = ATManner ; hasDe = False} ; -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s - } ; - }; diff --git a/src/chinese/GrammarChi.gf b/src/chinese/GrammarChi.gf index a57c24ab9..7b8af2c83 100644 --- a/src/chinese/GrammarChi.gf +++ b/src/chinese/GrammarChi.gf @@ -14,7 +14,8 @@ concrete GrammarChi of Grammar = TextChi, StructuralChi, IdiomChi, - TenseChi + TenseChi, + NamesChi ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/chinese/NamesChi.gf b/src/chinese/NamesChi.gf new file mode 100644 index 000000000..6d5291548 --- /dev/null +++ b/src/chinese/NamesChi.gf @@ -0,0 +1,15 @@ +concrete NamesChi of Names = CatChi ** open ResChi, ParadigmsChi, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ** {det = []} ; +lin FullName gn sn = { + s = gn.s ++ sn.s ; + det = [] + } ; + +lin UseLN ln = ln ** {det = []} ; + +lin InLN ln = + let prep : Prep = mkPrep "里" [] + in ss (appPrep prep (linNP (ln ** {det = []}))) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ? + +} diff --git a/src/chinese/NounChi.gf b/src/chinese/NounChi.gf index 9912791ef..30cd7ddec 100644 --- a/src/chinese/NounChi.gf +++ b/src/chinese/NounChi.gf @@ -62,6 +62,7 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { NumCard n = n ** {numType = NTFull} ; NumDigits d = d ** {numType = NTFull} ; + NumDecimal d = d ** {numType = NTFull} ; OrdDigits d = {s = ordinal_s ++ d.s} ; NumNumeral numeral = {s = numeral.p} ; -- liang instead of yi diff --git a/src/chinese/NumeralChi.gf b/src/chinese/NumeralChi.gf index 52bb9076f..71df8d7f7 100644 --- a/src/chinese/NumeralChi.gf +++ b/src/chinese/NumeralChi.gf @@ -1,4 +1,4 @@ -concrete NumeralChi of Numeral = CatChi [Numeral,Digits] ** open ResChi, Prelude in { +concrete NumeralChi of Numeral = CatChi [Numeral,Digits,Decimal] ** open ResChi, Prelude in { flags coding = utf8 ; @@ -162,4 +162,16 @@ lin pot4as5 n = n ; D_8 = ss "8" ; D_9 = ss "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + hasDot=False + } ; + IFrac d i = { + s=d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + hasDot=True + } ; + } diff --git a/src/chinese/ParadigmsChi.gf b/src/chinese/ParadigmsChi.gf index a130bd08e..ec0568d08 100644 --- a/src/chinese/ParadigmsChi.gf +++ b/src/chinese/ParadigmsChi.gf @@ -215,6 +215,8 @@ oper = \s -> lin RP {s = table {True => [] ; False => word s}} ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + --. auxiliary oper diff --git a/src/chinese/ParseChi.gf b/src/chinese/ParseChi.gf deleted file mode 100644 index 771442790..000000000 --- a/src/chinese/ParseChi.gf +++ /dev/null @@ -1,162 +0,0 @@ ---# -path=.:../english:../abstract:../translator - -concrete ParseChi of ParseEngAbs = - TenseChi, ---- CatChi, - NounChi - [PPartNP], - AdjectiveChi, - NumeralChi, - SymbolChi [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], - ConjunctionChi, - VerbChi - [SlashV2V, PassV2, UseCopula, ComplVV, CompAP, AdvVP], - AdverbChi, - PhraseChi, - SentenceChi, - QuestionChi - [QuestCl], - RelativeChi, - IdiomChi [NP, VP, Tense, Cl, ProgrVP, ExistNP, SelfAdvVP, SelfAdVVP, SelfNP], - ConstructionChi, - DocumentationChi, - ExtraChi [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, PassAgentVPSlash, - Temp, Pol, Conj, VPS, ListVPS, S, Num, CN, RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP, - VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, - ClSlash, RCl, EmptyRelSlash, ListCN, ConjCN, BaseCN, ConsCN], - - DictionaryChi - - ** -open ResChi, ParadigmsChi, SyntaxChi, Prelude, (G = GrammarChi), (E = ExtraChi) in { - -flags - literal=Symb ; - coding = utf8 ; - - --- Chinese-specific overrides - -lin - CompAP = G.CompAP | E.CompBareAP ; -- he is good | he good - - AdvVP vp adv = E.TopicAdvVP vp adv | G.AdvVP vp adv ; -- he *today* here sleeps | *today* he here sleeps - - QuestCl cl = G.QuestCl cl | E.QuestRepV cl ; -- he comes 'ma' | he come not come - -lin - - EmptyRelSlash slash = mkRCl ; - - that_RP = which_RP ; - --- lexical entries - --- another_Quant = mkQuantifier "otro" "otra" "otros" "otras" ; --- some_Quant = mkQuantifier "algún" "alguna" "algunos" "algunas" ; --- anySg_Det = mkDeterminer "algún" "alguna" Sg False ; ---- also meaning "whichever" ? --- each_Det = SyntaxChi.every_Det ; - --- but_Subj = {s = "pero" ; m = Indic} ; ---- strange to have this as Subj - -{- - myself_NP = regNP "myself" singular ; - yourselfSg_NP = regNP "yourself" singular ; - himself_NP = regNP "himself" singular ; - herself_NP = regNP "herself" singular ; - itself_NP = regNP "itself" singular ; - ourself_NP = regNP "ourself" plural ; - yourselfPl_NP = regNP "yourself" plural ; - themself_NP = regNP "themself" plural ; - themselves_NP = regNP "themselves" plural ; --} - -CompoundCN num noun cn = {s = num.s ++ noun.s ++ cn.s ; c = cn.c} ; ---- -DashCN noun cn = {s = noun.s ++ cn.s ; c = cn.c} ; ---- - -{- - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! Sg ! Nom ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; --} - - GerundN v = { - s = v.s ; - c = ge_s ---- ge - } ; - - GerundAP v = { - s = v.s ++ de_s ; ---- - monoSyl = False ; - hasAdA = True ; --- - } ; - - PastPartAP v = { - s = v.s ++ de_s ; - monoSyl = False ; - hasAdA = True ; --- - } ; - - ----- PastPartAP v = v ; ---- - -{- - OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ; --} - - PositAdVAdj a = {s = a.s} ; - - - UseQuantPN q pn = {s = q.s ++ ge_s ++ pn.s} ; ---- ge - - SlashV2V v a p vp = - insertObj (ResChi.mkNP (a.s ++ p.s ++ useVerb vp.verb ! p.p ! APlain ++ vp.compl)) - (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; ---- aspect - -{- - SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++ - v.c3 ++ - vpi.s ! VVAux ! a) - (predVc v) ; --} - ----- TODO: find proper expressions for OSV and OVS in Chi - PredVPosv np vp = PredVP np vp ; ---- (lin NP np) (lin VP vp) ; ---- - PredVPovs np vp = PredVP np vp ; ---- (lin NP np) (lin VP vp) ; ---- - - - CompS s = insertObj s (predV copula []) ; ---- - - - CompQS qs = insertObj qs (predV copula []) ; ---- - CompVP ant p vp = insertObj (ss (infVP vp)) (predV copula []) ; ---- - -{- - VPSlashVS vs vp = - insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs []) ** - {c2 = ""; gapInMiddle = False} ; - --} - - PastPartRS ant pol vp = { ---- copied from PresPartRS - s = ant.s ++ pol.s ++ vp.prePart ++ useVerb vp.verb ! pol.p ! APlain ++ vp.compl ++ which_RP.s ---- aspect - } ; ---- ?? - - - PresPartRS ant pol vp = { ---- copied from RelVP - s = ant.s ++ pol.s ++ vp.prePart ++ useVerb vp.verb ! pol.p ! APlain ++ vp.compl ++ which_RP.s ---- aspect - } ; ---- ?? - - ComplVV v a p vp = { - verb = v ; - compl = a.s ++ p.s ++ vp.topic ++ vp.prePart ++ useVerb vp.verb ! p.p ! APlain ++ vp.compl ; ---- aspect - prePart, topic = [] - } ; - - ApposNP np1 np2 = { - s = np1.s ++ chcomma ++ np2.s - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - -} diff --git a/src/chinese/pinyin/NumeralChi.gf b/src/chinese/pinyin/NumeralChi.gf index bcaf6892c..7769d3622 100644 --- a/src/chinese/pinyin/NumeralChi.gf +++ b/src/chinese/pinyin/NumeralChi.gf @@ -160,4 +160,16 @@ lin pot3plus n m = D_8 = ss "8" ; D_9 = ss "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + hasDot=False + } ; + IFrac d i = { + s=d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + hasDot=True + } ; + } diff --git a/src/common/CommonX.gf b/src/common/CommonX.gf index 3052a0649..bc1fd23b4 100644 --- a/src/common/CommonX.gf +++ b/src/common/CommonX.gf @@ -1,4 +1,4 @@ -concrete CommonX of Common = open (R = ParamX) in { +concrete CommonX of Common = open (R = ParamX), Prelude in { lincat Text = {s : Str} ; @@ -20,4 +20,6 @@ concrete CommonX of Common = open (R = ParamX) in { Ant = {s : Str ; a : R.Anteriority} ; Pol = {s : Str ; p : R.Polarity} ; + MU = {s : Str ; isPre : Bool} ; + } diff --git a/src/common/ExtendFunctor.gf b/src/common/ExtendFunctor.gf index a5711b37c..cdbfa7dfa 100644 --- a/src/common/ExtendFunctor.gf +++ b/src/common/ExtendFunctor.gf @@ -22,9 +22,11 @@ lin GenModNP num np cn = DetCN (DetQuant DefArt num) (AdvCN cn (PrepNP possess_Prep np)) ; -- this man's car(s) ; DEFAULT the car of this man GenModIP = variants {} ; -- Num -> IP -> CN -> IP ; -- whose car(s) CompBareCN cn = CompCN cn ; -- (is) teacher ; DEFAULT is a teacher - StrandQuestSlash = QuestSlash ; -- whom does John live with ; DEFAULT with whom does John live - StrandRelSlash = RelSlash ; -- that he lives in ; DEFAULT in which he lives - EmptyRelSlash = RelSlash IdRP ; -- he lives in ; DEFAULT in which he lives + StrandQuestSlash = QuestSlash ; -- whom does John live with (default in Eng) + StrandRelSlash = RelSlash ; -- that he lives in (standard in Eng) + PiedPipingQuestSlash = QuestSlash ; -- with whom does John live (default in most languages) + PiedPipingRelSlash = RelSlash ; -- in which he lives (default in most languages) + EmptyRelSlash = RelSlash IdRP ; -- he lives in ; that he lives in MkVPS vp = variants {} ; -- Temp -> Pol -> VP -> VPS ; -- hasn't slept ConjVPS = variants {} ; -- Conj -> [VPS] -> VPS ; -- has walked and won't sleep PredVPS = variants {} ; -- NP -> VPS -> S ; -- has walked and won't sleep @@ -125,6 +127,8 @@ lin UttDatIP ip = UttAccIP (lin IP ip) ; -- whom (dative) ; DEFAULT who UttVPShort = UttVP ; -- have fun, as opposed to "to have fun" ; DEFAULT UttVP + TPastSimple = Grammar.TPast ; --# notpresent + SQuestVPS = variants {} ; -- : NP -> VPS -> QS ; -- has she walked QuestVPS = variants {} ; -- : IP -> VPS -> QS ; -- who has walked diff --git a/src/common/ParamX.gf b/src/common/ParamX.gf index a99406651..20cd9eba6 100644 --- a/src/common/ParamX.gf +++ b/src/common/ParamX.gf @@ -18,6 +18,9 @@ resource ParamX = open Prelude in { | Cond --# notpresent ; + param + Sex = Male | Female ; + param Polarity = Pos | Neg ; diff --git a/src/croatian/CatHrv.gf b/src/croatian/CatHrv.gf index 065e479ba..16745d891 100644 --- a/src/croatian/CatHrv.gf +++ b/src/croatian/CatHrv.gf @@ -68,5 +68,6 @@ concrete CatHrv of Cat = lincat Numeral = {s : AdjForms ; size : NumSize} ; lincat Digits = {s : Str ; size : NumSize} ; + lincat Decimal = {s : Str ; size : NumSize ; hasDot : Bool} ; } diff --git a/src/croatian/ExtendHrv.gf b/src/croatian/ExtendHrv.gf index 5fa1d39c4..8eba3b1f7 100644 --- a/src/croatian/ExtendHrv.gf +++ b/src/croatian/ExtendHrv.gf @@ -26,6 +26,8 @@ concrete ExtendHrv of Extend = CatHrv ** ,ComplBareVS ,CompIQuant ,CompBareCN + ,PiedPipingQuestSlash + ,PiedPipingRelSlash ] with (Grammar = GrammarHrv) ** diff --git a/src/croatian/NounHrv.gf b/src/croatian/NounHrv.gf index ee4faf67f..7a83d73a3 100644 --- a/src/croatian/NounHrv.gf +++ b/src/croatian/NounHrv.gf @@ -89,6 +89,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumDecimal dec = dec ** {s = \\_,_ => dec.s} ; NumNumeral nu = { s = \\g,c => (adjFormsAdjective nu.s).s ! g ! Sg ! c ; ---- TODO Sg? size = nu.size diff --git a/src/croatian/NumeralHrv.gf b/src/croatian/NumeralHrv.gf index 40756b3e6..64ac816e3 100644 --- a/src/croatian/NumeralHrv.gf +++ b/src/croatian/NumeralHrv.gf @@ -1,6 +1,6 @@ concrete NumeralHrv of Numeral = - CatHrv [Numeral, Digits] ** + CatHrv [Numeral, Digits, Decimal] ** open ResHrv, @@ -125,6 +125,20 @@ oper mkThousand : Str -> NumSize -> Str = \attr,size -> IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = dd.size} ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + size = d.size ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + size = d.size ; + hasDot=True + } ; + D_0 = { s = "0" ; size = NS_1} ; ---- ?? D_1 = { s = "1" ; size = NS_1} ; D_2 = { s = "2" ; size = NS_2_4} ; diff --git a/src/czech/CatCze.gf b/src/czech/CatCze.gf index 31f01a73a..041669300 100644 --- a/src/czech/CatCze.gf +++ b/src/czech/CatCze.gf @@ -66,6 +66,7 @@ concrete CatCze of Cat = lincat Numeral = Determiner ; ---- TODO: should contain Ord as well lincat Digits = {s:Str ; size : NumSize} ; + lincat Decimal = {s:Str ; size : NumSize ; hasDot : Bool} ; } diff --git a/src/czech/ExtendCze.gf b/src/czech/ExtendCze.gf index 12659f690..9d094ebcc 100644 --- a/src/czech/ExtendCze.gf +++ b/src/czech/ExtendCze.gf @@ -25,6 +25,9 @@ concrete ExtendCze of Extend = CatCze ** ,ComplBareVS ,CompIQuant ,CompBareCN + ,PiedPipingQuestSlash + ,PiedPipingRelSlash + ,TPastSimple ] with (Grammar = GrammarCze) ** @@ -35,4 +38,4 @@ in { lin ReflPossPron = justDemPronFormsAdjective reflPossessivePron ; -} \ No newline at end of file +} diff --git a/src/czech/NounCze.gf b/src/czech/NounCze.gf index 4bc4d2315..6b31f8f72 100644 --- a/src/czech/NounCze.gf +++ b/src/czech/NounCze.gf @@ -96,6 +96,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumDecimal ds = ds ** {s = \\_,_ => ds.s} ; NumNumeral nu = nu ; diff --git a/src/czech/NumeralCze.gf b/src/czech/NumeralCze.gf index c9a7a3333..ece5fd5ae 100644 --- a/src/czech/NumeralCze.gf +++ b/src/czech/NumeralCze.gf @@ -1,6 +1,6 @@ concrete NumeralCze of Numeral = - CatCze [Numeral,Digits] ** + CatCze [Numeral,Digits,Decimal] ** open ResCze, @@ -117,4 +117,18 @@ oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ; D_8 = { s = "8" ; size = Num5} ; D_9 = { s = "9" ; size = Num5} ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + size = Num5 ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + size = Num5 ; + hasDot=True + } ; + } diff --git a/src/danish/NumeralDan.gf b/src/danish/NumeralDan.gf index 3e8a84f28..c817b0cec 100644 --- a/src/danish/NumeralDan.gf +++ b/src/danish/NumeralDan.gf @@ -1,4 +1,4 @@ -concrete NumeralDan of Numeral = CatDan [Numeral,Digits] ** open MorphoDan,Prelude in { +concrete NumeralDan of Numeral = CatDan [Numeral,Digits,Decimal] ** open MorphoDan,Prelude in { flags coding=utf8 ; @@ -67,6 +67,20 @@ lin n9 = mkTal "ni" "nitten" "halvfems" "niende" "halvfemsindstyvende" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s=\\o=>d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + hasDot=True; + n = Pl + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/dutch/CatDut.gf b/src/dutch/CatDut.gf index 382aa2824..b72a8bfb9 100644 --- a/src/dutch/CatDut.gf +++ b/src/dutch/CatDut.gf @@ -59,6 +59,7 @@ concrete CatDut of Cat = Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural @@ -81,6 +82,9 @@ concrete CatDut of Cat = N = Noun ; N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ; N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ; - GN, SN, PN = {s : NPCase => Str} ; + PN = {s : NPCase => Str} ; + GN = {s : NPCase => Str; g : Sex} ; + SN = {s : Sex => NPCase => Str; pl : NPCase => Str} ; + LN = {s : Adjf => NPCase => Str ; hasArt : Bool ; n : Number} ; } diff --git a/src/dutch/DocumentationDutFunctor.gf b/src/dutch/DocumentationDutFunctor.gf index 920a7db3d..6b5dadb17 100644 --- a/src/dutch/DocumentationDutFunctor.gf +++ b/src/dutch/DocumentationDutFunctor.gf @@ -36,6 +36,30 @@ lin ) } ; + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 "Naam" ; + s2 = paragraph (pn.s ! NPNom) + } ; + + InflectionLN = \ln -> { + t = "pn" ; + s1 = heading1 "Naam" ; + s2 = paragraph (ln.s ! Strong ! NPNom) + } ; + + InflectionGN = \pn -> { + t = "vnm" ; + s1 = heading1 "Voornaam" ; + s2 = paragraph (pn.s ! NPNom) + } ; + + InflectionSN = \pn -> { + t = "van" ; + s1 = heading1 "Van" ; + s2 = paragraph (pn.s ! Male ! NPNom) + } ; + InflectionA, InflectionA2 = \adj -> let gforms : AForm -> Str = \a -> @@ -61,7 +85,7 @@ lin InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> { t = "adv" ; - s1 = heading1 (heading preposition_Category) ; + s1 = heading1 "Bijwoord" ; s2 = paragraph adv.s } ; diff --git a/src/dutch/ExtendDut.gf b/src/dutch/ExtendDut.gf index f1ed70fde..6769eda51 100644 --- a/src/dutch/ExtendDut.gf +++ b/src/dutch/ExtendDut.gf @@ -121,9 +121,4 @@ lin isPron = False } ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! NPNom ++ sn.s ! c - } ; - } diff --git a/src/dutch/GrammarDut.gf b/src/dutch/GrammarDut.gf index 14084207a..4144ee76f 100644 --- a/src/dutch/GrammarDut.gf +++ b/src/dutch/GrammarDut.gf @@ -14,4 +14,5 @@ concrete GrammarDut of Grammar = TextX, IdiomDut, StructuralDut, - TenseX ; + TenseX, + NamesDut ; diff --git a/src/dutch/NamesDut.gf b/src/dutch/NamesDut.gf new file mode 100644 index 000000000..e62b4729a --- /dev/null +++ b/src/dutch/NamesDut.gf @@ -0,0 +1,43 @@ +concrete NamesDut of Names = CatDut ** open Prelude, ResDut in { + +lin GivenName = \n -> noMerge ** {s = n.s ; a = agrP3 Sg ; isPron = False} ; +lin MaleSurname = \n -> noMerge ** {s = n.s ! Male ; a = agrP3 Sg ; isPron = False} ; +lin FemaleSurname = \n -> noMerge ** {s = n.s ! Female; a = agrP3 Sg ; isPron = False} ; +lin PlSurname = \n -> noMerge ** {s = n.pl ; a = agrP3 Sg ; isPron = False} ; +lin FullName gn sn = + noMerge ** {s = \\c => gn.s ! NPNom ++ sn.s ! gn.g ! c ; a = agrP3 Sg ; isPron = False} ; + +lin UseLN ln = noMerge ** { + s = \\c => case ln.hasArt of { + True => "de" ++ ln.s ! Weak ! c ; + False => ln.s ! Strong ! c + } ; + a = agrP3 ln.n ; + isPron = False + } ; + +lin PlainLN ln = noMerge ** { + s = \\c => ln.s ! Strong ! c ; + a = agrP3 ln.n ; + isPron = False + } ; + +lin InLN ln = { + s = "in" ++ case ln.hasArt of { + True => "de" ++ ln.s ! Weak ! NPAcc ; + False => ln.s ! Strong ! NPAcc + } + } ; + +lin AdjLN ap ln = ln ** { + s = \\a,c => + let gan : Gender*Adjf*NForm = case ap.isPre of { + True => ; + False => } ; + af = agrAdj gan.p1 gan.p2 gan.p3 ; + in preOrPost ap.isPre + (ap.s ! agrP3 Sg ! af) + (ln.s ! a ! c) ; + } ; + +} diff --git a/src/dutch/NounDut.gf b/src/dutch/NounDut.gf index 18e522914..849725580 100644 --- a/src/dutch/NounDut.gf +++ b/src/dutch/NounDut.gf @@ -85,6 +85,8 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; + NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = let tiende : AForm => Str = \\af => numeral.s ! NOrd af in table {APred => tiende ! AAttr Utr ; @@ -199,4 +201,10 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { DetDAP det = det ; + QuantityNP n m = noMerge ** { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard Utr Nom) ; + a = agrP3 n.n ; + isPron = False + } ; + } diff --git a/src/dutch/NumeralDut.gf b/src/dutch/NumeralDut.gf index 00697295c..f13fdfb81 100644 --- a/src/dutch/NumeralDut.gf +++ b/src/dutch/NumeralDut.gf @@ -1,4 +1,4 @@ -concrete NumeralDut of Numeral = CatDut [Numeral,Digits] ** open ResDut, Prelude in { +concrete NumeralDut of Numeral = CatDut [Numeral,Digits,Decimal] ** open ResDut, Prelude in { flags optimize = all_subs ; coding=utf8 ; @@ -74,6 +74,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! invNum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; diff --git a/src/dutch/ParadigmsDut.gf b/src/dutch/ParadigmsDut.gf index f5e3b84e9..dbbbc972a 100644 --- a/src/dutch/ParadigmsDut.gf +++ b/src/dutch/ParadigmsDut.gf @@ -76,6 +76,24 @@ oper mkPN : N -> PN ; -- proper name from noun } ; + mkGN = overload { -- given name + mkGN : Str -> GN = \s -> lin GN {s = \\_ => s; g = Male} ; + mkGN : Str -> Sex -> GN = \s,g -> lin GN {s = \\_ => s; g = g} ; + } ; + + mkSN = overload { -- given name + mkSN : Str -> SN = \s -> lin SN {s = \\_,_ => s; pl = \\_=>s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Male=>\\_=>male; Female=>\\_=>female}; pl=\\_=>pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN -- location name + = \s -> lin LN {s = \\_,_ => s; hasArt = False; n = Sg} ; + mkLN : Str -> Number -> LN -- location name + = \s,n -> lin LN {s = \\_,_ => s; hasArt = False; n = n} ; + } ; + + defLN : LN -> LN = \n -> n ** {hasArt = True} ; --2 Adjectives @@ -249,6 +267,10 @@ oper de,utrum = Utr ; nominative = Nom ; genitive = Gen ; + male = Male ; + female = Female ; + singular = Sg ; + plural = Pl ; mkA = overload { mkA : (vers : Str) -> A = \a -> lin A (regAdjective a) ; @@ -439,4 +461,6 @@ oper -- --} + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/egekusii/NumeralGus.gf b/src/egekusii/NumeralGus.gf index b149a1001..0fec94442 100644 --- a/src/egekusii/NumeralGus.gf +++ b/src/egekusii/NumeralGus.gf @@ -71,6 +71,20 @@ lin pot3plus n m = { s = table { D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o,g => "-" ++ BIND ++ d.s ! o ! g ; + n = Pl + hasDot=False + } ; + IFrac d i = { + s = \\o,g => d.s ! NCard ! g ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; diff --git a/src/english/CatEng.gf b/src/english/CatEng.gf index 7731e26c2..35bfc2d22 100644 --- a/src/english/CatEng.gf +++ b/src/english/CatEng.gf @@ -81,6 +81,7 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in { Numeral = {s : Bool => CardOrd => Case => Str ; n : Number} ; Digits = {s : CardOrd => Case => Str ; n : Number ; tail : DTail} ; + Decimal = {s : CardOrd => Case => Str ; n : Number ; hasDot : Bool} ; -- Structural @@ -106,7 +107,14 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in { N = {s : Number => Case => Str ; g : Gender} ; N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ; N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Str} ; - GN, SN, PN = {s : Case => Str ; g : Gender} ; + PN = {s : Case => Str ; g : Gender} ; + GN = {s : Case => Str ; g : Sex} ; + SN = {s : Sex => Case => Str; p : Case => Str} ; + LN = {s : Case => Str; + prep : LNPrep; -- preposition "in Scandinavia", "on the Balkans", "at the South Pole" + art : Bool; -- plain name "United States" vs "the United States" + n : Number; + } ; lindef SSlash = \s -> {s = s; c2 = ""} ; diff --git a/src/english/DocumentationEng.gf b/src/english/DocumentationEng.gf index d5441e742..7df89b438 100644 --- a/src/english/DocumentationEng.gf +++ b/src/english/DocumentationEng.gf @@ -1,6 +1,7 @@ --# -path=.:../abstract:../common concrete DocumentationEng of Documentation = CatEng ** open ResEng, + Prelude, HTML in { lincat @@ -38,31 +39,48 @@ lin ) } ; - InflectionGN = \pn -> { - t = "gn" ; - s1 = heading1 ("Given Name" ++ - case pn.g of { - Neutr => ""; - Masc => "(masc)"; - Fem => "(fem)" + InflectionLN = \n -> { + t = "ln" ; + s1 = heading1 ("Location Name" ++ + case n.n of { + Sg => ""; + Pl => "(plural)" }) ; s2 = frameTable ( tr (th "nom" ++ th "gen") ++ - tr (td (pn.s ! Nom) ++ td (pn.s ! Gen)) + tr (td (n.s ! Nom) ++ td (n.s ! Gen)) + ) ++ + heading1 ("Adverb") ++ + paragraph (case n.prep of { + InPrep => "in" ; + OnPrep => "on" ; + AtPrep => "at" + } ++ + case n.art of { + True => "the" ++ n.s ! Nom ; + False => n.s ! Nom + }) ; + } ; + + InflectionGN = \gn -> { + t = "gn" ; + s1 = heading1 ("Given Name" ++ + case gn.g of { + Male => "(male)"; + Female => "(female)" + }) ; + s2 = frameTable ( + tr (th "nom" ++ th "gen") ++ + tr (td (gn.s ! Nom) ++ td (gn.s ! Gen)) ) } ; InflectionSN = \pn -> { t = "sn" ; - s1 = heading1 ("Secondary Name" ++ - case pn.g of { - Neutr => ""; - Masc => "(masc)"; - Fem => "(fem)" - }) ; + s1 = heading1 "Secondary Name" ; s2 = frameTable ( tr (th "nom" ++ th "gen") ++ - tr (td (pn.s ! Nom) ++ td (pn.s ! Gen)) + tr (td (pn.s ! Male ! Nom) ++ td (pn.s ! Male ! Gen)) ) } ; diff --git a/src/english/ExtendEng.gf b/src/english/ExtendEng.gf index 94e87a497..ec15e1ce9 100644 --- a/src/english/ExtendEng.gf +++ b/src/english/ExtendEng.gf @@ -16,7 +16,8 @@ concrete ExtendEng of Extend = FocusAP, FocusAdV, FocusAdv, FocusObj, GenIP, GenModIP, GenModNP, GenNP, GenRP, GerundAdv, GerundCN, GerundNP, IAdvAdv, ICompAP, InOrderToVP, NominalizeVPSlashNP, PassAgentVPSlash, PassVPSlash, ProgrVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, PredVPSVV, PredetRNP, PrepCN, - EmbedSSlash, PredIAdvVP, PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, StrandQuestSlash, StrandRelSlash, + EmbedSSlash, PredIAdvVP, PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, + StrandQuestSlash, StrandRelSlash, PiedPipingQuestSlash, PiedPipingRelSlash, UncontractedNeg, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP, A2VPSlash, N2VPSlash, CardCNCard, ProDrop, theyFem_Pron, theyNeutr_Pron ] @@ -50,6 +51,15 @@ concrete ExtendEng of Extend = GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ; GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ; + PiedPipingRelSlash rp slash = { + s = \\t,a,p,agr => + slash.c2 ++ rp.s ! RPrep (fromAgr agr).g ++ slash.s ! t ! a ! p ! oDir ; + c = NPAcc + } ; + + PiedPipingQuestSlash ip slash = + mkQuestion (ss (slash.c2 ++ ip.s ! NPAcc)) slash ; + StrandQuestSlash ip slash = {s = \\t,a,b,q => (mkQuestion (ss (ip.s ! NPAcc)) slash).s ! t ! a ! b ! q ++ slash.c2 @@ -474,13 +484,6 @@ lin CardCNCard card cn = lin theyFem_Pron = mkPron "they" "them" "their" "theirs" plural P3 feminine ; lin theyNeutr_Pron = mkPron "they" "them" "their" "theirs" plural P3 nonhuman ; -lin GivenName gn = gn ; -lin MaleSurname, FemaleSurname = \sn -> sn ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c ; - g = gn.g - } ; - lin AnaphPron np = case np.a of { AgP1 Sg => i_Pron ; diff --git a/src/english/GrammarEng.gf b/src/english/GrammarEng.gf index c2600a7b3..7280125c5 100644 --- a/src/english/GrammarEng.gf +++ b/src/english/GrammarEng.gf @@ -14,7 +14,8 @@ concrete GrammarEng of Grammar = TextX - [Pol,PPos,PNeg,SC,CAdv], StructuralEng, IdiomEng, - TenseX - [Pol,PPos,PNeg,SC,CAdv] + TenseX - [Pol,PPos,PNeg,SC,CAdv], + NamesEng ** open ResEng, Prelude in { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/english/NamesEng.gf b/src/english/NamesEng.gf new file mode 100644 index 000000000..b88a75b2d --- /dev/null +++ b/src/english/NamesEng.gf @@ -0,0 +1,50 @@ +concrete NamesEng of Names = CatEng ** open Prelude, ResEng in { + +lin GivenName gn = { + s = \\c => gn.s ! npcase2case c ; + a = case gn.g of { + Male => agrgP3 Sg Masc ; + Female => agrgP3 Sg Fem + } + } ; +lin MaleSurname = \sn -> {s = \\c => sn.s ! Male ! npcase2case c ; a = agrgP3 Sg Masc} ; +lin FemaleSurname = \sn -> {s = \\c => sn.s ! Female ! npcase2case c ; a = agrgP3 Sg Fem} ; +lin PlSurname = \sn -> {s = \\c => sn.p ! npcase2case c ; a = agrgP3 Pl Masc} ; +lin FullName gn sn = { + s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! npcase2case c ; + a = case gn.g of { + Male => agrgP3 Sg Masc ; + Female => agrgP3 Sg Fem + } + } ; + +lin UseLN n = { + s = \\c => case n.art of { + True => "the" ++ n.s ! npcase2case c ; + False => n.s ! npcase2case c + } ; + a = agrP3 n.n + } ; + +lin PlainLN n = { + s = \\c => n.s ! npcase2case c ; + a = agrP3 n.n + } ; + +lin InLN n = { + s = case n.prep of { + InPrep => "in" ; + OnPrep => "on" ; + AtPrep => "at" + } ++ + case n.art of { + True => "the" ++ n.s ! Nom ; + False => n.s ! Nom + } ; + } ; + +lin AdjLN ap n = n ** { + s = \\c => preOrPost ap.isPre (ap.s ! agrP3 n.n) (n.s ! c) ; + } ; + +} diff --git a/src/english/NounEng.gf b/src/english/NounEng.gf index af3cd446b..760460e91 100644 --- a/src/english/NounEng.gf +++ b/src/english/NounEng.gf @@ -77,6 +77,8 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in { NumDigits n = {s,sp = \\_ => n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd} ; + NumDecimal d = {s,sp = \\_ => d.s ! NCard ; n = d.n} ; + NumNumeral numeral = {s,sp = \\d => numeral.s ! d ! NCard; n = numeral.n} ; OrdNumeral numeral = {s = numeral.s ! True ! NOrd} ; @@ -174,4 +176,9 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in { DetDAP d = d ; + QuantityNP n m = { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard ! Nom) ; + a = agrgP3 n.n Neutr + } ; + } diff --git a/src/english/NumeralEng.gf b/src/english/NumeralEng.gf index 999da63db..e71e80bdf 100644 --- a/src/english/NumeralEng.gf +++ b/src/english/NumeralEng.gf @@ -1,4 +1,4 @@ -concrete NumeralEng of Numeral = CatEng [Numeral,Digits] ** open Prelude, ResEng in { +concrete NumeralEng of Numeral = CatEng [Numeral,Digits,Decimal] ** open Prelude, ResEng in { lincat Digit = {s : DForm => CardOrd => Case => Str} ; @@ -57,8 +57,8 @@ lin pot3 n = { lin pot3plus n m = { s = \\d,o,c => n.s ! d ! NCard ! Nom ++ "thousand" ++ m.s ! False ! o ! c; n = Pl} ; lin pot3as4 n = n ; -lin pot3float f = { - s = \\d,o,c => f.s ++ mkCard o "thousand" ! c ; n = Pl} ; +lin pot3decimal f = { + s = \\d,o,c => f.s ! NCard ! Nom ++ mkCard o "thousand" ! c ; n = Pl} ; lin pot41 = { s = \\d,o,c => case d of {True => []; False => "a"} ++ @@ -74,8 +74,8 @@ lin pot4plus n1 n2 = { n = Pl } ; lin pot4as5 n = n ; -lin pot4float f = { - s = \\d,o,c => f.s ++ pot41.s ! True ! o ! c ; n = Pl} ; +lin pot4decimal f = { + s = \\d,o,c => f.s ! NCard ! Nom ++ pot41.s ! True ! o ! c ; n = Pl} ; lin pot51 = { s = \\d,o,c => case d of {True => []; False => "a"} ++ @@ -90,8 +90,8 @@ lin pot5plus n1 n2 = { s = \\d,o,c => n1.s ! d ! NCard ! Nom ++ pot51.s ! True ! NCard ! Nom ++ "and" ++ n2.s ! True ! o ! c; n = Pl } ; -lin pot5float f = { - s = \\d,o,c => f.s ++ pot51.s ! True ! o ! c ; n = Pl} ; +lin pot5decimal f = { + s = \\d,o,c => f.s ! NCard ! Nom ++ pot51.s ! True ! o ! c ; n = Pl} ; -- numerals as sequences of digits @@ -118,6 +118,16 @@ lin pot5float f = { D_8 = mkDig "8" ; D_9 = mkDig "9" ; +lin PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o,c=>"-" ++ BIND ++ d.s ! o ! c; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o,c=>d.s ! NCard ! Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! c ; + hasDot=True; + n = Pl + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND ++ "," ++ BIND ; diff --git a/src/english/ParadigmsEng.gf b/src/english/ParadigmsEng.gf index 0d331c9ff..36a00e5d9 100644 --- a/src/english/ParadigmsEng.gf +++ b/src/english/ParadigmsEng.gf @@ -129,6 +129,7 @@ oper -- -- Proper names, with a regular genitive, are formed from strings. +oper mkPN : overload { mkPN : Str -> PN ; @@ -139,6 +140,47 @@ oper mkPN : N -> PN --% } ; + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = table {Gen => s + "'s" ; _ => s} ; + prep = InPrep ; + art = False ; + n = Sg} ; + + mkLN : Str -> Number -> LN = \s,n -> + lin LN {s = table {Gen => s + "'s" ; _ => s} ; + prep = InPrep ; + art = False ; + n = n} ; + } ; + + defLN : LN -> LN = \n -> n ** {art = True} ; + onLN : LN -> LN = \n -> n ** {prep = OnPrep} ; + atLN : LN -> LN = \n -> n ** {prep = AtPrep} ; + + mkGN = overload { + mkGN : Str -> GN = \s -> + lin GN {s = table {Gen => s + "'s" ; _ => s} ; + g = Male} ; + + mkGN : Str -> Sex -> GN = \s,g -> + lin GN {s = table {Gen => s + "'s" ; _ => s} ; + g = g} ; + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> + lin SN {s = \\_ => table {Gen => s + "'s" ; _ => s} ; + p = table {Gen => s + "'s" ; _ => s}} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> + lin SN {s = table { + Male => table {Gen => male + "'s" ; _ => male} ; + Female => table {Gen => female + "'s" ; _ => female} + } ; + p = table {Gen => pl + "'s" ; _ => pl} + } ; + } ; + -- To extract the number of a noun phrase ifPluralNP : NP -> Bool @@ -379,6 +421,8 @@ mkVoc s = lin Voc (ss s) ; nonhuman = Neutr ; masculine = Masc ; feminine = Fem ; + male = Male ; + female = Female ; singular = Sg ; plural = Pl ; nominative = npNom ; @@ -598,6 +642,8 @@ mkVoc s = lin Voc (ss s) ; us_britishV : Str -> V = \s -> case s of { _ + ("el" | "al" | "ol") => regV s | mkV s (s + "s") (s + "led") (s + "led") (s + "ling") ; _ + "or" => regV s | regV (Predef.tk 2 s + "our") ; + _ + "ise" => regV (Predef.tk 2 s + "ze") | regV s ; + _ + "ize" => regV s | regV (Predef.tk 2 s + "se") ; _ => regV s } ; @@ -777,6 +823,8 @@ mkVoc s = lin Voc (ss s) ; mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> lin Conj (sd2 x y ** {n = n}) ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + ---- obsolete -- Comparison adjectives may two more forms. diff --git a/src/english/QuestionEng.gf b/src/english/QuestionEng.gf index 775a8f867..95ba15107 100644 --- a/src/english/QuestionEng.gf +++ b/src/english/QuestionEng.gf @@ -21,7 +21,7 @@ concrete QuestionEng of Question = CatEng ** open ResEng, Prelude in { {s = \\t,a,b,q => (mkQuestion (ss (ip.s ! NPAcc)) slash).s ! t ! a ! b ! q ++ slash.c2 } ; - --- changed AR 5/6/2016: uses stranding; pied-piping in ExtraEng + --- changed AR 5/6/2016: uses stranding; pied-piping in ExtraEng and ExtendEng QuestIAdv iadv cl = mkQuestion iadv cl ; diff --git a/src/english/RelativeEng.gf b/src/english/RelativeEng.gf index 512d6e1a8..d2572a3e0 100644 --- a/src/english/RelativeEng.gf +++ b/src/english/RelativeEng.gf @@ -22,8 +22,8 @@ concrete RelativeEng of Relative = CatEng ** open ResEng, Prelude in { c = npNom } ; --- Pied piping: "that we are looking at". Pied piping and empty --- relative are defined in $ExtraEng.gf$ ("at which we are looking", +-- Preposition stranding: "that we are looking at". Pied piping and empty +-- relative are defined in $ExtendEng.gf$ ("at which we are looking", -- "we are looking at"). RelSlash rp slash = { diff --git a/src/english/ResEng.gf b/src/english/ResEng.gf index 1257ca98b..440f22519 100644 --- a/src/english/ResEng.gf +++ b/src/english/ResEng.gf @@ -690,4 +690,7 @@ param finalComma : Str = pre {"," | "." => []; "" => SOFT_BIND ++ ","; _ => []} ; frontComma : Str = SOFT_BIND ++ "," ; +param + LNPrep = InPrep | OnPrep | AtPrep ; + } diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index 28fdd42f7..a1338df1c 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -63,6 +63,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural @@ -91,7 +92,10 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { c2,c3 : Compl ; isPre,isPre2 : Bool } ; - GN, SN, PN = {s : Case => Str} ; + PN = {s : Case => Str} ; + LN = {s : Case => Str; n : Number} ; + GN = {s : Case => Str; g : Sex} ; + SN = {s : Sex => Case => Str; pl : Case => Str} ; linref VP = \vp -> linV vp.v ; diff --git a/src/estonian/DocumentationEstFunctor.gf b/src/estonian/DocumentationEstFunctor.gf index 9441583e1..e310ef793 100644 --- a/src/estonian/DocumentationEstFunctor.gf +++ b/src/estonian/DocumentationEstFunctor.gf @@ -36,6 +36,33 @@ lin s2 = inflNoun (caseplus2nf noun) } ; + InflectionPN = \pn -> { + t = "s" ; + s1 = heading1 "Õige Nimi" ; + s2 = inflPN pn.s + } ; + + InflectionLN = \ln -> { + t = "s" ; + s1 = heading1 "Asukoha Nimi" ; + s2 = inflPN ln.s + } ; + + InflectionGN = \gn -> { + t = "s" ; + s1 = heading1 "Eesnimi"++case gn.g of { + Male => "(mees)" ; + Female => "(naine)" + } ; + s2 = inflPN gn.s + } ; + + InflectionSN = \sn -> { + t = "s" ; + s1 = heading1 "Perekonnanimi" ; + s2 = inflPN (sn.s ! Male) + } ; + InflectionA, InflectionA2 = \adj -> let posit : (AForm => Str) = adj.s ! Posit ; compar : (AForm => Str) = adj.s ! Compar ; @@ -272,6 +299,20 @@ oper tr (th (heading instructive_Parameter) ++ td (nouns Sg Terminative) ++ td (nouns Pl Terminative)) ) ; + inflPN : (ResEst.Case => Str) -> Str = \pn -> + frameTable ( + tr (th (heading nominative_Parameter) ++ td (pn ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (pn ! Gen)) ++ + tr (th (heading partitive_Parameter) ++ td (pn ! Part)) ++ + tr (th (heading translative_Parameter) ++ td (pn ! Transl)) ++ + tr (th (heading illative_Parameter) ++ td (pn ! Illat)) ++ + tr (th (heading inessive_Parameter) ++ td (pn ! Iness)) ++ + tr (th (heading elative_Parameter) ++ td (pn ! Elat)) ++ + tr (th (heading allative_Parameter) ++ td (pn ! Allat)) ++ + tr (th (heading adessive_Parameter) ++ td (pn ! Adess)) ++ + tr (th (heading ablative_Parameter) ++ td (pn ! Ablat)) + ) ; + lin NoDefinition t = {s=t.s}; MkDefinition t d = {s="

Definitsioon:"++t.s++d.s++"

"}; diff --git a/src/estonian/ExtendEst.gf b/src/estonian/ExtendEst.gf index aaaf8ff59..3700bb36e 100644 --- a/src/estonian/ExtendEst.gf +++ b/src/estonian/ExtendEst.gf @@ -436,10 +436,4 @@ concrete ExtendEst of Extend = -- : VP -> Adv ; -- ilma raamatut nägemata WithoutVP vp = {s = "ilma" ++ infVPdefault vp InfMata} ; - -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c - } ; - } diff --git a/src/estonian/GrammarEst.gf b/src/estonian/GrammarEst.gf index 1daf4bd42..01339dc7d 100644 --- a/src/estonian/GrammarEst.gf +++ b/src/estonian/GrammarEst.gf @@ -12,7 +12,8 @@ concrete GrammarEst of Grammar = TextX, IdiomEst, StructuralEst, - TenseX + TenseX, + NamesEst ** { flags startcat = Phr ; unlexer = finnish ; lexer = text ; diff --git a/src/estonian/NamesEst.gf b/src/estonian/NamesEst.gf new file mode 100644 index 000000000..38eee3e19 --- /dev/null +++ b/src/estonian/NamesEst.gf @@ -0,0 +1,44 @@ +concrete NamesEst of Names = CatEst ** open ResEst, ParadigmsEst, Prelude in { + +lin GivenName n = emptyNP ** { + s = \\c => n.s ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; +lin MaleSurname n = emptyNP ** { + s = \\c => n.s ! Male ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; +lin FemaleSurname n = emptyNP ** { + s = \\c => n.s ! Female ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; +lin PlSurname n = emptyNP ** { + s = \\c => n.pl ! npform2case Sg c ; + a = agrP3 Pl ; + isPron = False + } ; +lin FullName gn sn = emptyNP ** { + s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; + +lin UseLN, PlainLN = \ln -> emptyNP ** { + s = \\c => ln.s ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; + +lin InLN pn = { + s = appCompl True Pos (casePrep inessive) + (emptyNP ** { + s = \\c => pn.s ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + }) + } ; + +} diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index 290a798a6..96e4489d8 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -120,6 +120,11 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in } ; OrdDigits numeral = {s = \\nc => numeral.s ! NOrd nc} ; + NumDecimal numeral = { + s = \\n,c => numeral.s ! NCard (NCase n c) ; + n = numeral.n + } ; + NumNumeral numeral = { s = \\n,c => numeral.s ! NCard (NCase n c) ; n = numeral.n @@ -214,6 +219,12 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in ApposCN cn np = cn ** {postmod = cn.postmod ++ linNP (NPCase Nom) np} ; --- luvun x + QuantityNP n m = emptyNP ** { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard (NCase Sg Nom)) ; + a = agrP3 n.n ; + isPron = False + } ; + oper numN : NForm -> Number = \nf -> case nf of { NCase n _ => n diff --git a/src/estonian/NumeralEst.gf b/src/estonian/NumeralEst.gf index db30ad22b..712f5f123 100644 --- a/src/estonian/NumeralEst.gf +++ b/src/estonian/NumeralEst.gf @@ -1,4 +1,4 @@ -concrete NumeralEst of Numeral = CatEst [Numeral,Digits] ** open Prelude, ParadigmsEst, MorphoEst in { +concrete NumeralEst of Numeral = CatEst [Numeral,Digits,Decimal] ** open Prelude, ParadigmsEst, MorphoEst in { -- Notice: possessive forms are not used. They get wrong, since every -- part is made to agree in them. @@ -146,6 +146,20 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard (NCase Sg Nom) ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o MorphoEst.Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ; diff --git a/src/estonian/ParadigmsEst.gf b/src/estonian/ParadigmsEst.gf index 8a2369b91..0e8723f40 100644 --- a/src/estonian/ParadigmsEst.gf +++ b/src/estonian/ParadigmsEst.gf @@ -42,6 +42,9 @@ resource ParadigmsEst = open -- defined in $ResEst$. oper + male = Male ; + female = Female ; + Number : Type ; singular : Number ; @@ -610,6 +613,55 @@ oper mkPN_1 : Str -> PN = \s -> lin PN {s = \\c => (mk1N s).s ! NCase Sg c} ; + mkLN = overload { + mkLN : Str -> LN = + \s -> lin LN {s = \\c => (mk1N s).s ! NCase Sg c ; + n = Sg} ; + mkLN : Str -> Number -> LN = + \s,n -> lin LN {s = \\c => (mk1N s).s ! NCase n c ; + n = n} ; + mkLN : N -> LN = + \noun -> lin LN {s = \\c => noun.s ! NCase Sg c ; + n = Sg} ; + mkLN : N -> Number -> LN = + \noun,n -> lin LN {s = \\c => noun.s ! NCase n c ; + n = n} ; + } ; + + mkGN = overload { + mkGN : Str -> GN = + \s -> lin GN {s = \\c => (mk1N s).s ! NCase Sg c ; + g = Male} ; + mkGN : Str -> Sex -> GN = + \s,g -> lin GN {s = \\c => (mk1N s).s ! NCase Sg c ; + g = g} ; + mkGN : N -> GN = + \noun -> lin GN {s = \\c => noun.s ! NCase Sg c ; + g = Male} ; + mkGN : N -> Sex -> GN = + \noun,g -> lin GN {s = \\c => noun.s ! NCase Sg c ; + g = g} ; + } ; + + mkSN = overload { + mkSN : Str -> SN = + \s -> lin SN {s = \\_,c => (mk1N s).s ! NCase Sg c ; + pl = \\c => (mk1N s).s ! NCase Sg c} ; + mkSN : Str -> Str -> Str -> SN = + \male,female,pl -> lin SN {s = table {Male =>\\c => (mk1N male).s ! NCase Sg c ; + Female=>\\c => (mk1N female).s ! NCase Sg c} ; + pl = \\c => (mk1N pl).s ! NCase Sg c} ; + mkSN : N -> SN = + \noun -> lin SN {s = \\_,c => noun.s ! NCase Sg c ; + pl = \\c => noun.s ! NCase Sg c} ; + mkSN : N -> N -> N -> SN = + \male,female,pl -> lin SN {s = table {Male =>\\c => male.s ! NCase Sg c ; + Female=>\\c => female.s ! NCase Sg c} ; + pl = \\c => pl.s ! NCase Sg c} ; + } ; + + prepLN : LN -> Prep -> LN = \n,s -> n ** {c = s} ; + -- adjectives mkA = overload { @@ -922,4 +974,6 @@ oper mkAV a = a ; mkA2V a p = mkA2 a p ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } ; diff --git a/src/finnish/CatFin.gf b/src/finnish/CatFin.gf index 08b07efe7..7e93e5b41 100644 --- a/src/finnish/CatFin.gf +++ b/src/finnish/CatFin.gf @@ -72,6 +72,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural @@ -95,7 +96,10 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in { N = SNoun ; N2 = SNoun ** {c2 : Compl ; isPre : Bool ; postmod : Number => Str} ; N3 = SNoun ** {c2,c3 : Compl ; isPre,isPre2 : Bool} ; - GN, SN, PN = SPN ; + PN = SPN ; + LN = SPN ** {n : Number} ; + GN = SPN ** {g : Sex} ; + SN = {s : Sex => SPN; pl : SPN} ; linref SSlash = \ss -> ss.s ++ ss.c2.s.p1 ; diff --git a/src/finnish/DocumentationFinFunctor.gf b/src/finnish/DocumentationFinFunctor.gf index 47dec43d7..05a8f85cd 100644 --- a/src/finnish/DocumentationFinFunctor.gf +++ b/src/finnish/DocumentationFinFunctor.gf @@ -33,20 +33,29 @@ lin InflectionPN = \pn -> { t = "s" ; - s1 = heading1 (heading noun_Category) ; + s1 = heading1 "Oikea Nimi" ; s2 = inflPN (\c -> pn.s ! c) } ; - InflectionGN = \pn -> { + InflectionLN ln = { t = "s" ; - s1 = heading1 "Etunimi" ; - s2 = inflPN (\c -> pn.s ! c) + s1 = heading1 "Paikannimi" ; + s2 = inflPN (\c -> ln.s ! c) } ; - InflectionSN = \pn -> { + InflectionGN gn = { + t = "s" ; + s1 = heading1 "Etunimi"++case gn.g of { + Male => "(mies)" ; + Female => "(nainen)" + } ; + s2 = inflPN (\c -> gn.s ! c) + } ; + + InflectionSN sn = { t = "s" ; s1 = heading1 "Sukunimi" ; - s2 = inflPN (\c -> pn.s ! c) + s2 = inflPN (\c -> (sn.s ! Male).s ! c) } ; InflectionA, InflectionA2 = \adj -> { diff --git a/src/finnish/ExtendFin.gf b/src/finnish/ExtendFin.gf index 093956e1c..10689d760 100644 --- a/src/finnish/ExtendFin.gf +++ b/src/finnish/ExtendFin.gf @@ -10,6 +10,8 @@ concrete ExtendFin of Extend = ,CardCNCard ,UttAccNP ,AdjAsCN, AdjAsNP + ,ApposNP + ,PresPartAP, PastPartAP ] with (Grammar = GrammarFin) ** @@ -240,11 +242,24 @@ lin CardCNCard card cn = { lin UttAccNP np = {s = P.addNegation np.isNeg ++ np.s ! NPAcc} ; lin AdjAsCN ap = {s = ap.s ! True ; postmod = \\_ => ap.p ; h = Back} ; ---- Harmony just a guess lin AdjAsNP ap = MassNP (AdjAsCN ap) ; +lin ApposNP np1 np2 = np1 ** {s = \\npf => np1.s ! npf ++ np2.s ! NPSep} ; +lin PresPartAP vp = { + s = \\_,nf => preCompVP vp (PresPartAct (AN nf)) ; + p = [] ; + hasPrefix = False + } ; +lin PastPartAP vps = { + s = \\_,nf => preCompVP (PastPartAct (AN nf)) ; + p = vps.c2.s.p1 ; + hasPrefix = False + } ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c - } ; - +oper + -- ruohoa syövä, Ranskassa valmistettu + preCompVP : S.VP -> VForm -> Str = \vp, vform -> + vp.s2 ! True ! Pos ! agrP3 Sg ++ + vp.adv ! Pos ++ + vp.s.s ! vform ++ + vp.ext ; } diff --git a/src/finnish/GrammarFin.gf b/src/finnish/GrammarFin.gf index 297a4f2d7..c43971632 100644 --- a/src/finnish/GrammarFin.gf +++ b/src/finnish/GrammarFin.gf @@ -14,7 +14,8 @@ concrete GrammarFin of Grammar = TextX, IdiomFin, StructuralFin, - TenseX + TenseX, + NamesFin ** { flags startcat = Phr ; unlexer = finnish ; lexer = text ; diff --git a/src/finnish/Kotus.gf b/src/finnish/Kotus.gf index ccf325d99..983bad35c 100644 --- a/src/finnish/Kotus.gf +++ b/src/finnish/Kotus.gf @@ -1,5 +1,5 @@ -resource Kotus = open MorphoFin, Prelude in { +resource Kotus = open MorphoFin, Prelude, Predef in { flags coding=utf8 ; -- interpretations of paradigms in KOTUS word list, used in DictFin. @@ -32,11 +32,15 @@ oper = \s -> dArpi s (init s + "en") ; d07A : Str -> NForms -- 70 väki = \s -> dArpi s (init (weakGrade s) + "en") ; - d08 : Str -> NForms -- 99 à la carte - = \s -> dNukke s (s + "n") ; + d08 : Str -> NForms -- 99 nalle + = \s -> let defaultNForms : NForms = dNukke s (s + "n") ; + nallejen : Str = s + "jen" ; + in exceptPlGen defaultNForms nallejen ; d08A : Str -> NForms -- 5 vinaigrette - = \s -> dNukke s (weakGrade s + "n") ; - d09 : Str -> NForms -- 696 ääriraja + = \s -> let defaultNForms : NForms = dNukke s (weakGrade s + "n") ; + nukkejen : Str = s + "jen" ; + in exceptPlGen defaultNForms nukkejen ; + d09 : Str -> NForms -- 696 kala = \s -> let a = last s in dSilakka s (s + "n") (init s + case a of {"a" => "o" ; _ => "ö"} + "j" + a) ; @@ -44,6 +48,7 @@ oper = \s -> case s of { x + "aaka" => dSilakka s (x+"aa'an") (x+"aakoja") ; x + "aika" => dSilakka s (x+"ajan") (x+"aikoja") ; -- lots of compound words in NewDictFin that end in aika, but are not analysed as compounds + x + "ahka" => dSilakka s (x+"ahan") (x+"ahkoja") ; -- nahka~nahan not covered by weakGrade _ => let a = last s in dSilakka s (weakGrade s + "n") @@ -55,7 +60,10 @@ oper _ => dSilakka s (s + "n") (init s + "i" + vowelHarmony (last s)) } ; d10A : Str -> NForms -- 284 änkkä - = \s -> dSilakka s (weakGrade s + "n") (init s + "i" + vowelHarmony (last s)) ; + = \s -> case s of { + x + "hka" => dSilakka s (x+"han") (x+"hkia") ; -- tuhka, uhka + _ => dSilakka s (weakGrade s + "n") (init s + "i" + vowelHarmony (last s)) + } ; d11 : Str -> NForms -- 46 ödeema = \s -> dSilakka s (weakGrade s + "n") (init s + "i" + vowelHarmony (last s)) ; d12 : Str -> NForms -- 1125 örinä @@ -96,9 +104,21 @@ oper d24 : Str -> NForms -- 20 uni = \s -> dArpi s (init s + "en") ; d25 : Str -> NForms -- 9 tuomi - = \s -> dArpi s (init s + "en") ; + -- Class 25 is a bit heterogeneous, lumi~lunta,liemi~lientä vs. luomi~luomea (?luonta). + -- To force e.g. toimi~tointa, use the 4-argument smart paradigm. /IL 2023 + -- TODO: how about forcing pl genitive also with nt? + = \s -> + let defaultNForms : NForms = dArpi s (init s + "en") ; + in case s of { + "lumi" => exceptSgPart defaultNForms "lunta" ; + "liemi" => exceptSgPart defaultNForms "lientä" ; + _ => defaultNForms } ; d26 : Str -> NForms -- 113 ääri - = \s -> dArpi s (init s + "en") ; +-- kielten,puolten,vuorten; default mkN gives kielien,puolien,vuorien + = \s -> + let defaultNForms : NForms = dArpi s (init s + "en") ; + puolten : Str = init s + "ten" ; + in exceptPlGen defaultNForms puolten ; d27 : Str -> NForms -- 23 vuosi = \s -> dArpi s (Predef.tk 2 s + "den") ; d28 : Str -> NForms -- 13 virsi @@ -128,9 +148,15 @@ oper d33 : Str -> NForms -- 168 väistin = \s -> dLiitin s (init s + "men") ; d33A : Str -> NForms -- 181 yllytin - = \s -> dLiitin s (strongGrade (init s) + "men") ; + = \s -> let + pyyhkimen : Str = case s of { -- strongGrade doesn't work for all + x + "hin" => x + "hkimen" ; -- pyyhin~pyyhkimen + x + "jin" => x + "kimen" ; -- suljin~sulkimen + _ => strongGrade (init s) + "men" + } ; + in dLiitin s pyyhkimen ; d34 : Str -> NForms -- 1 alaston - = \s -> let alastom = init s in + = \s -> let alastom = init s + "m" in nForms10 s (alastom + "an") (s + "ta") (alastom + "ana") (alastom + "aan") (alastom + "ien") (alastom + "ia") (alastom + "ina") (alastom + "issa") @@ -175,7 +201,7 @@ oper = \s -> let kevä = init s in nForms10 s (kevä + "än") (s + "tä") (kevä + "änä") (kevä + "äseen") - (s + "iden") (kevä + "itä") (kevä + "inä") (kevä + "issä") + (kevä + "iden") (kevä + "itä") (kevä + "inä") (kevä + "issä") (kevä + "isiin") ; d45 : Str -> NForms -- 23 yhdes = \s -> let yhde = init s ; a = vowelHarmony s in @@ -258,7 +284,7 @@ oper c65 : Str -> VForms -- 1 käydä = \s -> let kay = Predef.tk 2 s ; kavi = init kay + "vi" in vForms12 s (kay + "n") kay (kay + "vät") (kay + "kää") (kay + "dään") - (kavi + "n") kavi (kavi + "si") (kay + "nyt") (kay + "tty") + (kavi + "n") kavi (kavi + "si") (kay + "nyt") (kay + "ty") (kay + "nee") ; -- just one verb c66 : Str -> VForms -- 268 öristä = \s -> cKuunnella s (Predef.tk 2 s + "in") ; @@ -319,4 +345,16 @@ oper fcompoundNK : (Str -> NForms) -> Str -> Str -> NForms = \d,x,y -> let ys = d y in \\v => x + ys ! v ; +-- 25, 26 etc. should override the default dArpi on singular partitive and plural genitive +-- lunta, *lumea, puolten, *puolien + exceptSgPart : NForms -> Str -> NForms = \defaultNForms,lunta -> + table { + 2 => lunta ; + m => defaultNForms ! m } ; + + exceptPlGen : NForms -> Str -> NForms = \defaultNForms,puolten -> + table { + 5 => puolten ; + m => defaultNForms ! m } ; + } diff --git a/src/finnish/MorphoFin.gf b/src/finnish/MorphoFin.gf index 3d3742186..c2c1b6c96 100644 --- a/src/finnish/MorphoFin.gf +++ b/src/finnish/MorphoFin.gf @@ -155,9 +155,9 @@ resource MorphoFin = ResFin ** open Prelude in { silakk = init silakka ; silaka = init silakan ; silak = init silaka ; - silakkaa = silakka + case o of { - "o" | "ö" => "t" + a ; -- radiota - _ => a -- sammakkoa + silakkaa = silakka + case silakka of { + _ + #vowel + ("o" | "ö") => "t" + a ; -- radiota + _ => a -- sammakkoa } ; silakoiden = case of { _ + "i" + ("a" | "ä") => -- asemia @@ -726,6 +726,11 @@ resource MorphoFin = ResFin ** open Prelude in { _ => "y" } ; + oöHarmony : Str -> Str = \a -> case a of { + "a" => "o" ; + _ => "ö" + } ; + VForms : Type = Predef.Ints 11 => Str ; vForms12 : (x1,_,_,_,_,_,_,_,_,_,_,x12 : Str) -> VForms = @@ -859,6 +864,10 @@ resource MorphoFin = ResFin ** open Prelude in { -- Auxiliaries ----------------------------------------- + vowel : pattern Str = #("a"|"e"|"i"|"o"|"u"|"y"|"ä"|"ö") ; + + consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"z") ; + -- The following function defines how grade alternation works if it is active. -- In general, *whether there is* grade alternation must be given in the lexicon -- (cf. "auto - auton" not "audon"; "vihje - vihjeen" not "vihkeen"). diff --git a/src/finnish/NamesFin.gf b/src/finnish/NamesFin.gf new file mode 100644 index 000000000..8ecbf92f1 --- /dev/null +++ b/src/finnish/NamesFin.gf @@ -0,0 +1,43 @@ +concrete NamesFin of Names = CatFin ** open ResFin, StemFin, Prelude in { + +lin GivenName n = { + s = snoun2np Sg n ; + a = agrP3 Sg ; + isPron = False ; isNeg = False + } ; +lin MaleSurname n = { + s = snoun2np Sg (n.s ! Male) ; + a = agrP3 Sg ; + isPron = False ; isNeg = False + } ; +lin FemaleSurname n = { + s = snoun2np Sg (n.s ! Female) ; + a = agrP3 Sg ; + isPron = False ; isNeg = False + } ; +lin PlSurname n = { + s = snoun2np Pl n.pl ; + a = agrP3 Pl ; + isPron = False ; isNeg = False + } ; +lin FullName gn sn = { + s = snoun2np Sg {s = \\c => gn.s ! Nom ++ (sn.s ! gn.g).s ! c} ; + a = agrP3 Sg ; + isPron = False ; isNeg = False + } ; + +lin UseLN, PlainLN = \ln -> { + s = snoun2np ln.n ln ; + a = agrP3 ln.n ; + isPron = False ; isNeg = False + } ; + +lin InLP ln = { + s = appCompl True Pos ln.c { s = snoun2np ln.n ln ; + a = agrP3 ln.n ; + isPron = False ; + isNeg = False + } + } ; + +} diff --git a/src/finnish/NounFin.gf b/src/finnish/NounFin.gf index fa9857fb0..8743cb410 100644 --- a/src/finnish/NounFin.gf +++ b/src/finnish/NounFin.gf @@ -143,6 +143,11 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in } ; OrdDigits numeral = {s = \\f => numeral.s ! NOrd f} ; + NumDecimal numeral = { + s = \\n,c => numeral.s ! NCard (NCase n c) ; + n = numeral.n + } ; + NumNumeral numeral = { s = \\n,c => numeral.s ! NCard (NCase n c) ; n = numeral.n @@ -291,6 +296,13 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in DetDAP d = d ; + QuantityNP n m = { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard (NCase Sg Nom)) ; + a = agrP3 n.n ; + isPron = False ; + isNeg = False + } ; + oper numN : NForm -> Number = \nf -> case nf of { NCase n _ => n ; diff --git a/src/finnish/NumeralFin.gf b/src/finnish/NumeralFin.gf index b182c1b8e..2e136b3e3 100644 --- a/src/finnish/NumeralFin.gf +++ b/src/finnish/NumeralFin.gf @@ -1,4 +1,4 @@ -concrete NumeralFin of Numeral = CatFin [Numeral,Digits] ** open Prelude, ParadigmsFin, MorphoFin, StemFin in { +concrete NumeralFin of Numeral = CatFin [Numeral,Digits,Decimal] ** open Prelude, ParadigmsFin, MorphoFin, StemFin in { -- Notice: possessive forms are not used. They get wrong, since every -- part is made to agree in them. @@ -73,10 +73,10 @@ lin s = \\c => d.s ! NumAttr ! c ++ nBIND d.n ++ tuhattaN.s ! d.n ! c ++ e.s ! NumIndep ! c } ; pot3as4 n = n ; - pot3float f = {n = Pl ; s = \\c => f.s ++ BIND ++ tuhattaN.s ! Pl ! c} ; + pot3decimal d = {n = Pl ; s = \\c => d.s ! NCard (NCase Sg Nom) ++ BIND ++ tuhattaN.s ! Pl ! c} ; pot4as5 n = n ; - pot4float f = {n = Pl ; s = \\c => f.s ++ "miljoonaa"} ; -- KA: case inflection missing + pot4decimal d = {n = Pl ; s = \\c => d.s ! NCard (NCase Sg Nom) ++ "miljoonaa"} ; -- KA: case inflection missing pot51 = {n = Pl ; s = \\c => "miljardi"} ; -- KA: case inflection missing @@ -180,6 +180,20 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard (NCase Sg Nom) ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o MorphoFin.Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ; diff --git a/src/finnish/ParadigmsFin.gf b/src/finnish/ParadigmsFin.gf index 5555b0155..2d4c9ca93 100644 --- a/src/finnish/ParadigmsFin.gf +++ b/src/finnish/ParadigmsFin.gf @@ -422,6 +422,9 @@ mkVS = overload { Case = MorphoFin.Case ; Number = MorphoFin.Number ; + male = Male ; + female = Female ; + singular = Sg ; plural = Pl ; @@ -709,8 +712,6 @@ mkVS = overload { } } ; - consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"z") ; - -- like nForms2, but 2nd argument is Pl Genitive nForms2plGen : (sydan,sydanten : Str) -> NForms = \sydan,sydanten -> table { @@ -841,6 +842,36 @@ mkVS = overload { } } ; + mkLN = overload { + mkLN : Str -> LN = \s -> lin LN (snoun2spn (mk1N s) ** {n = Sg}) ; + mkLN : Str -> Number -> LN = \s,n -> lin LN (snoun2spn (mk1N s) ** {n = n}) ; + mkLN : N -> LN = \noun -> lin LN (snoun2spn noun ** {n = Sg}) ; + mkLN : N -> Number -> LN = \noun,n -> lin LN (snoun2spn noun ** {n = n}) ; + } ; + + mkGN = overload { + mkGN : Str -> GN = \s -> lin GN (snoun2spn (mk1N s) ** {g = Male}) ; + mkGN : Str -> Sex -> GN = \s,g -> lin GN (snoun2spn (mk1N s) ** {g = g}) ; + mkGN : N -> GN = \noun -> lin GN (snoun2spn noun ** {g = Male}) ; + mkGN : N -> Sex -> GN = \noun,g -> lin GN (snoun2spn noun ** {g = g}) ; + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> let spn = snoun2spn (mk1N s) in lin SN {s = \\_=>spn; pl=spn} ; + mkSN : Str -> Str -> Str -> SN + = \male,female,pl -> lin SN { + s = table {Male =>snoun2spn (mk1N male); + Female=>snoun2spn (mk1N female)}; + pl= snoun2spn (mk1N pl) + } ; + mkSN : N -> SN = \noun -> let spn = snoun2spn noun in lin SN {s = \\_=>spn; pl=spn} ; + mkSN : N -> N -> N -> SN + = \male,female,pl -> lin SN { + s = table {Male =>snoun2spn male; + Female=>snoun2spn female}; + pl= snoun2spn pl + } ; + } ; -- adjectives @@ -1050,4 +1081,6 @@ mkVS = overload { mkAV v = v ** {lock_A = <>} ; --- mkA2V v p = mkA2 p ** {lock_A2 = <>} ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } ; diff --git a/src/finnish/ResFin.gf b/src/finnish/ResFin.gf index 8a39b06ed..b236f7aec 100644 --- a/src/finnish/ResFin.gf +++ b/src/finnish/ResFin.gf @@ -30,7 +30,7 @@ resource ResFin = ParamX ** open Prelude in { --- These cases are possible for subjects. - SubjCase = SCNom | SCGen | SCPart | SCIness | SCElat | SCAdess | SCAblat ; + SubjCase = SCNom | SCGen | SCPart | SCIness | SCElat | SCAdess | SCAblat | SCAcc ; oper appSubjCase : SubjCase -> ResFin.NP -> Str = \sc,np -> np.s ! subjcase2npform sc ; @@ -42,7 +42,8 @@ oper SCIness => NPCase Iness ; SCElat => NPCase Elat ; SCAdess => NPCase Adess ; - SCAblat => NPCase Ablat + SCAblat => NPCase Ablat ; + SCAcc => NPAcc } ; npform2subjcase : NPForm -> SubjCase = \sc -> case sc of { @@ -52,6 +53,7 @@ oper NPCase Elat => SCElat ; NPCase Adess => SCAdess ; NPCase Ablat => SCAblat ; + NPAcc => SCAcc ; _ => SCNom } ; diff --git a/src/finnish/StemFin.gf b/src/finnish/StemFin.gf index f0de1ec12..00eb3558e 100644 --- a/src/finnish/StemFin.gf +++ b/src/finnish/StemFin.gf @@ -378,7 +378,8 @@ oper s = \\t,a,b => let agrfin = case vp.sc of { - SCNom => ; + SCNom => ; + SCAcc => ; _ => -- minun täytyy, minulla on } ; verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ; diff --git a/src/finnish/StructuralFin.gf b/src/finnish/StructuralFin.gf index 39aa1b2d9..6b2ad0e75 100644 --- a/src/finnish/StructuralFin.gf +++ b/src/finnish/StructuralFin.gf @@ -216,6 +216,21 @@ oper } } ; + kukinInt : MorphoFin.Number => MorphoFin.Case => Str = + let ku : Noun = nForms2N (dUkko "ku" "kun") + in table { + Sg => table { + Part => "kutakin" ; + Illat => "kuhunkin" ; + c => ku.s ! NCase Sg c + "kin" + } ; + Pl => table { + Gen => "kuidenkin" ; + Part => "kuitakin" ; + c => ku.s ! NCase Pl c + "kin" + } + } ; + kukaInt : MorphoFin.Number => (MorphoFin.Case) => Str = let kuka = snoun2nounBind (mkN "kuka" "kenen" "ketä" "kenä" "keneen" diff --git a/src/finnish/VerbFin.gf b/src/finnish/VerbFin.gf index e70847c3a..0bade5825 100644 --- a/src/finnish/VerbFin.gf +++ b/src/finnish/VerbFin.gf @@ -79,7 +79,8 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin, StemFin in { ) ** {c2 = vp.c2} ; ---- correct ?? -} - SlashV2VNP = StemFin.slashV2VNP ; ---- compilation to pgf takes too long 6/8/2013 hence a simplified version in stemmed/ +---- +SlashV2VNP = StemFin.slashV2VNP ; ---- compilation to pgf takes too long 6/8/2013 hence a simplified version in stemmed/ AdvVP vp adv = insertAdv (\\_ => adv.s) vp ; ExtAdvVP vp adv = insertAdv (\\_ => embedInCommas adv.s) vp ; diff --git a/src/finnish/infinitives/Infinitive.gf b/src/finnish/infinitives/Infinitive.gf new file mode 100644 index 000000000..f8f9cb91a --- /dev/null +++ b/src/finnish/infinitives/Infinitive.gf @@ -0,0 +1,71 @@ +abstract Infinitive = + + Grammar - [ + VPSlashPrep, --- to avoid certain spurious ambiguities, to be fixed + PassV2 ---- temporarily disabled, to be fixed + ], + Lexicon + ** { + +flags startcat = Utt ; + +cat + RAdv ; -- reflexive adverbs, e.g. mennäkse (ni/si/...) + +fun + UseV2 : V2 -> VP ; -- to use V2 intransitively, suppressing object + RAdvVP : VP -> RAdv -> VP ; -- syödä elääkseni + + X_NP, Y_NP, Z_NP : NP ; -- unknown subjects and objects + tulla_VV : VV ; -- tulla (tekemään), explicit future tense + + PresPartPassSubjVP : VP -> VP ; -- (minun) on mentävä + PresPartPassObjVP : VPSlash -> VP ; -- (oluesta) on pidettävä + + PastPartPassAdv : NP -> VP -> Adv ; -- junan mentyä + + PresPartActAP : VP -> AP ; -- (lihaa) syövä + PastPartActAP : VP -> AP ; -- (lihaa) syönyt + PresPartPassAP : VPSlash -> AP ; -- (tänään) syötävä + PastPartPassAP : VPSlash -> AP ; -- (tänään) syöty + + AgentPartAP : NP -> VPSlash -> AP ; -- koiran syömä + + Inf1LongRAdv : VP -> RAdv ; -- mennäkse (ni/si/...) + + Inf2InessAdv : NP -> VP -> Adv ; -- junan mennessä + Inf2InessRAdv : VP -> RAdv ; -- mennessään + + Inf2InessPassAdv : VP -> Adv ; -- odotettaessa (junaa), touhuttaessa (junan kanssa) + Inf2InessPassInvAdv : NP -> VPSlash -> Adv ; -- junaa odotettaessa, junan kanssa touhutessa + + Inf2InstrAdv : VP -> Adv ; -- odottaen (junaa) + Inf2InstrInvAdv : NP -> VPSlash -> Adv ; -- junaa odottaen + + Inf3InessAdv : VP -> Adv ; -- odottamassa (junaa) + Inf3InessInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamassa + + Inf3ElatAdv : VP -> Adv ; -- odottamasta (junaa) + Inf3ElatInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamasta + + Inf3IllatAdv : VP -> Adv ; -- odottamaan (junaa) + Inf3IllatInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamaan + + Inf3AdessAdv : VP -> Adv ; -- odottamalla (junaa) + Inf3AdessInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamalla + + Inf3AbessAdv : VP -> Adv ; -- odottamatta (junaa) + Inf3AbessInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamatta + + ComplPresPartActVS : VS -> NP -> VP -> VP ; -- sanoa junan menevän + ComplPastPartActVS : VS -> NP -> VP -> VP ; -- sanoa junan menneen + + ComplPresPartActReflVS : VS -> VP -> VP ; -- sanoa menevänsä + ComplPastPartActReflVS : VS -> VP -> VP ; -- sanoa menneensä + + ComplPresPartPassVS : VS -> NP -> VPSlash -> VP ; -- sanoa junaa odotettavan + ComplPastPartPassVS : VS -> NP -> VPSlash -> VP ; -- sanoa junaa odotetun + + + +} \ No newline at end of file diff --git a/src/finnish/infinitives/InfinitiveFin.gf b/src/finnish/infinitives/InfinitiveFin.gf new file mode 100644 index 000000000..249b97804 --- /dev/null +++ b/src/finnish/infinitives/InfinitiveFin.gf @@ -0,0 +1,211 @@ +--# -path=..:alltenses + +concrete InfinitiveFin of Infinitive = + GrammarFin - [ + VPSlashPrep, + PassV2], + LexiconFin + ** open + ResFin, + StemFin, + Prelude, + ParadigmsFin + in { + +lincat + RAdv = {s : Agr => Str} ; + +lin + UseV2 v2 = predSV v2 ; + RAdvVP vp radv = insertObj (\\_,_ => radv.s) vp ; ---- can be wrong word order + + X_NP = MassNP (UseN (mkN "X" "X:n")) ; + Y_NP = MassNP (UseN (mkN "Y" "Z:n")) ; + Z_NP = MassNP (UseN (mkN "Z" "Z:n")) ; + + PresPartPassSubjVP vp = vp ** { + s = vpVerbOlla ** {sc = SCGen} ; + s2 = \\b,p,a => vp.s.s ! PresPartPass (AN (NCase Sg Nom)) ++ vp.s2 ! b ! p ! a ; + } ; + + PresPartPassObjVP vpslash = vpslash ** { + s = vpVerbOlla ** {sc = npform2subjcase vpslash.c2.c} ; + s2 = \\b,p,a => vpslash.c2.s.p2 ++ vpslash.s.s ! PresPartPass (AN (NCase Sg Nom)) ++ vpslash.s2 ! b ! p ! a ; + } ; + + PastPartPassAdv np vp = { + s = np.s ! NPCase Gen ++ + vp.s.s ! PastPartPass (AN (NCase Sg Part)) ++ + vp.s2 ! True ! Pos ! np.a ++ + vp.adv ! Pos ++ + vp.ext + } ; + + PresPartActAP vp = { + s = \\_, nf => preCompVP vp (PresPartAct (AN nf)) ; + hasPrefix = False ; + p = [] + } ; + + PastPartActAP vp = { + s = \\_, nf => preCompVP vp (PastPartAct (AN nf)) ; + hasPrefix = False ; + p = [] + } ; + + PresPartPassAP vp = { + s = \\_, nf => preCompVP (PresPartPass (AN nf)) ; + hasPrefix = False ; + p = [] + } ; + + PastPartPassAP vp = { + s = \\_, nf => preCompVP (PastPartPass (AN nf)) ; + hasPrefix = False ; + p = [] + } ; + + AgentPartAP np vp = { + s = \\_, nf => + np.s ! NPCase Gen ++ + vp.s2 ! True ! Pos ! np.a ++ + vp.adv ! Pos ++ + vp.c2.s.p2 ++ + vp.s.s ! AgentPart (AN nf) ++ + vp.ext ; + hasPrefix = False ; + p = [] + } ; + + Inf1LongRAdv vp = { + s = \\a => + infVP SCNom Pos infAdvAgr vp Inf1Long ++ BIND ++ + case vp.s.h of {Back => possSuffix a ; Front => possSuffixFront a} + } ; + + Inf2InessAdv np vp = { + s = np.s ! NPCase Gen ++ + infVP SCNom Pos np.a vp Inf2Iness + } ; + + Inf2InessRAdv vp = { + s = \\a => + infVP SCNom Pos infAdvAgr vp Inf2Iness ++ BIND ++ + case vp.s.h of {Back => possSuffix a ; Front => possSuffixFront a} + } ; + + + Inf2InessPassAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf2InessPass + } ; + + Inf2InessPassInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf2InessPass + } ; + + Inf2InstrAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf2Instr + } ; + + Inf2InstrInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf2Instr + } ; + + Inf3InessAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Iness + } ; + + Inf3InessInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Iness + } ; + + Inf3ElatAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Elat + } ; + + Inf3ElatInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Elat + } ; + + Inf3IllatAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Illat + } ; + + Inf3IllatInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Illat + } ; + + + Inf3AdessAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Adess + } ; + + Inf3AdessInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Adess + } ; + + + Inf3AbessAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Abess + } ; + + Inf3AbessInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Abess + } ; + + ComplPresPartActVS vs np vp = + insertExtrapos (subjPartVP np vp (NPCase Gen) (PresPartAct (AN (NCase Sg Gen)))) (predSV vs) ; + ComplPastPartActVS vs np vp = + insertExtrapos (subjPartVP np vp (NPCase Gen) (PastPartAct (AN (NCase Sg Gen)))) (predSV vs) ; + + ComplPresPartActReflVS vs vp = + insertObj (\\_,_,agr => subjPartAgrVP vp (PresPartAct (AN (NPossGen Sg))) agr) (predSV vs) ; + ComplPastPartActReflVS vs vp = + insertObj (\\_,_,agr => subjPartAgrVP vp (PastPartAct (AN (NPossGen Sg))) agr) (predSV vs) ; + + ComplPresPartPassVS vs np vps = + insertExtrapos (subjPartVP np (NPCase Part) (PresPartPass (AN (NCase Sg Gen)))) (predSV vs) ; + ComplPastPartPassVS vs np vps = + insertExtrapos (subjPartVP np (NPCase Part) (PastPartPass (AN (NCase Sg Gen)))) (predSV vs) ; + + + +oper + infAppCompl : Compl -> ResFin.NP -> Str = \co, np -> + appCompl False Neg co np ; -- not fin, Acc becomes Part + + infAdvAgr : Agr = agrP3 Sg ; --- ? + + -- hänen syövän, häntä syödyn, häntä syötävän + subjPartVP : ResFin.NP -> StemFin.VP -> NPForm -> VForm -> Str = \np, vp, npform, vform -> + np.s ! npform ++ + vp.s.s ! vform ++ + vp.s2 ! True ! Pos ! np.a ++ + vp.adv ! Pos ++ + vp.ext ; + + -- tiedän syöväni, tiedän syöneeni + subjPartAgrVP : StemFin.VP -> VForm -> Agr -> Str = \vp, vform, agr -> + vp.s.s ! vform ++ BIND ++ + case vp.s.h of {Back => possSuffix agr ; Front => possSuffixFront agr} ++ + vp.s2 ! True ! Pos ! agr ++ + vp.adv ! Pos ++ + vp.ext ; + + + -- ruohoa syövä, Ranskassa valmistettu + preCompVP : StemFin.VP -> VForm -> Str = \vp, vform -> + vp.s2 ! True ! Pos ! infAdvAgr ++ + vp.adv ! Pos ++ + vp.s.s ! vform ++ + vp.ext ; + + +} \ No newline at end of file diff --git a/src/finnish/infinitives/InterpretInfinitives.hs b/src/finnish/infinitives/InterpretInfinitives.hs new file mode 100644 index 000000000..40ad9680e --- /dev/null +++ b/src/finnish/infinitives/InterpretInfinitives.hs @@ -0,0 +1,139 @@ +{-# LANGUAGE GADTs #-} + +module Main where + +import Infinitive +import PGF +import Data.List + +data Fact = Fact { + content :: [Fact], + tense :: Maybe GTemp, + polarity :: Maybe GPol, + agent :: Maybe GNP, + action :: Either GVS GVP + } + +initFact = Fact [] Nothing Nothing Nothing (Left undefined) + +factTree fact = GUseCl mtense mpolarity (GPredVP magent mvp) + where + mvp = case action fact of + Left vs -> GComplVS vs (factTree (head (content fact))) ---- head -> ambiguity + Right vp -> vp + mtense = maybe presentTense id (tense fact) + mpolarity = maybe positivePol id (polarity fact) + magent = maybe GX_NP id (agent fact) + +presentTense = GTTAnt GTPres GASimul +pastTense = GTTAnt GTPast GASimul +perfectTense = GTTAnt GTPres GAAnter +pluperfectTense = GTTAnt GTPast GAAnter +positivePol = GPPos +negativePol = GPNeg + + +facts :: Infinitive.Tree a -> [Fact] +facts t = case t of + GUseCl temp pol s -> + [f{ + tense = Just temp, + polarity = Just pol + } | f <- facts s] + GAdjCN (GAgentPartAP np vpslash) cn -> + [initFact{ + tense = Just perfectTense, + agent = Just np, + action = Right (GComplSlash vpslash (GMassNP cn))}] + GPredVP ag (GUseComp (GCompAP (GAgentPartAP np vpslash))) -> + [initFact{ + tense = Just perfectTense, + agent = Just np, + action = Right (GComplSlash vpslash ag)}] + GPredVP np (GComplPresPartActReflVS vs vp) -> + [initFact{ + agent = Just np, + action = Left vs, + content = [ + initFact{ + agent = Just np, + action = Right vp + }]}] + GPredVP np (GComplPastPartActReflVS vs vp) -> + [initFact{ + agent = Just np, + action = Left vs, + content = [ + initFact{ + tense = Just perfectTense, + agent = Just np, + action = Right vp + }]}] + GPredVP np (GAdvVP vp adv) -> + [f{agent = Just np} | f <- facts vp ++ facts adv] +---- GPredVP np (GRAdvVP vp (GInf1LongRAdv vpa)) -> +---- [f{agent = Just np, action = } | f <- facts vp ++ facts adv] + GPredVP np vp -> + [f{agent = Just np} | f <- facts vp] + GUseV v -> + [initFact{ + action = Right t}] + GUseV2 v -> + [initFact{ + action = Right (GComplSlash (GSlashV2a v) GY_NP)}] +{- + GComplPresPartActVS vs np vp -> + [initFact{ + attitude = + Just vs, + agent = Just np, + action = Just vp}] + GComplPastPartActVS vs np vp -> + [initFact{ + tense = Just perfectTense, + attitude = Just vs, + agent = Just np, + action = Just vp}] + GInf3AbessAdv vp -> + [initFact{ + polarity = Just negativePol, + action = Just vp}] + GComplPresPartPassVS vs np vpslash -> + [initFact{ + attitude = Just vs, + action = Just (GComplSlash vpslash np)}] + GComplPastPartPassVS vs np vpslash -> + [initFact{ + tense = Just perfectTense, + attitude = Just vs, + action = Just (GComplSlash vpslash np)}] +-} + _ -> composOpMPlus facts t + + +shortest = take 1 . sortOn treesize + +treesize t = case unApp t of + Just (f, xs) -> 1 + sum (map treesize xs) + _ -> 1 + + +treat gr fin cat s = [ + (showExpr [] t ++ "\t" ++ linearize gr fin t) + | pt <- shortest (parse gr fin cat s), + let gt = map (gf . factTree) (facts (fg pt :: GUtt)), + t <- gt + ] + + +main = do + gr <- readPGF "Infinitive.pgf" + putStrLn "gr" + let Just fin = readLanguage "InfinitiveFin" + let typ = startCat gr + flip mapM_ [0..] $ \_ -> do + putStr "> " + s <- getLine + let ss = treat gr fin typ s + putStrLn $ unlines ss + diff --git a/src/finnish/infinitives/Makefile b/src/finnish/infinitives/Makefile new file mode 100644 index 000000000..a87f4df2e --- /dev/null +++ b/src/finnish/infinitives/Makefile @@ -0,0 +1,7 @@ +all: pgf hs + +pgf: + gf --make -output-format=haskell -haskell=lexical -lexical=N,A,Adv,V,V2,VS,VV,PN --haskell=gadt InfinitiveFin.gf + +hs: + ghc --make InterpretInfinitives.hs diff --git a/src/french/CatFre.gf b/src/french/CatFre.gf index 47d5b7d26..fe6d40ec1 100644 --- a/src/french/CatFre.gf +++ b/src/french/CatFre.gf @@ -1,5 +1,5 @@ --# -path=.:../romance:../common:../abstract:../common:prelude -concrete CatFre of Cat = CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] +concrete CatFre of Cat = CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with (ResRomance = ResFre) ; diff --git a/src/french/CompatibilityFre.gf b/src/french/CompatibilityFre.gf index 9d3dff908..b1b905243 100644 --- a/src/french/CompatibilityFre.gf +++ b/src/french/CompatibilityFre.gf @@ -6,6 +6,6 @@ concrete CompatibilityFre of Compatibility = CatFre ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/french/DiffFre.gf b/src/french/DiffFre.gf index bafd709fb..d65ede464 100644 --- a/src/french/DiffFre.gf +++ b/src/french/DiffFre.gf @@ -338,4 +338,10 @@ instance DiffFre of DiffRomance - [ verbHyphen : Verb -> Str = \v -> v.s ! (VInfin True) ; --- kluge: use this field to store - or -t- +param + HasArt = NoArt | UseArt | AlwaysArt ; + +oper + superlCanBePost = False ; + } ; diff --git a/src/french/DocumentationFreFunctor.gf b/src/french/DocumentationFreFunctor.gf index 8dd61dcc8..5a90f25ef 100644 --- a/src/french/DocumentationFreFunctor.gf +++ b/src/french/DocumentationFreFunctor.gf @@ -40,6 +40,52 @@ lin ) } ; + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nom Propre" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Prénom" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \gn -> { + t = "pn" ; + s1 = heading1 "Nom de Famille" ; + s2 = gn.s ! Masc + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nom de la Localisation" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s ++ + heading2 "Adverbe" ++ + paragraph (let p : {s : Str; c:Prepos} = + case ln.onPrep of { + True => {s="en"; c=PNul} ; + False => {s=""; c=P_a} + } + in p.s ++ case ln.art of { + AlwaysArt => artDef True ln.g ln.num (CPrep p.c) ++ ln.s; + _ => prepCase (CPrep p.c) ++ ln.s + }) + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; diff --git a/src/french/ExtendFre.gf b/src/french/ExtendFre.gf index 12d88f0d5..bffb25e13 100644 --- a/src/french/ExtendFre.gf +++ b/src/french/ExtendFre.gf @@ -4,8 +4,8 @@ concrete ExtendFre of Extend = CatFre ** ExtendFunctor - [ ---- iFem_Pron, youFem_Pron, weFem_Pron, youPlFem_Pron, theyFem_Pron, youPolFem_Pron, youPolPl_Pron, youPolPlFem_Pron, - ExistCN, ExistMassCN, ExistPluralCN, - PassVPSlash, PassAgentVPSlash, ApposNP + ExistCN, ExistMassCN, ExistPluralCN, RNP, ReflRNP, + PassVPSlash, PassAgentVPSlash, ApposNP, CompoundN ] -- put the names of your own definitions here with (Grammar = GrammarFre) ** @@ -19,6 +19,9 @@ concrete ExtendFre of Extend = ParadigmsFre in { -- put your own definitions here +lincat + RNP = {s : Agr => Case => Str} ; + lin ExistCN cn = let @@ -43,6 +46,17 @@ lin PassVPSlash vps = passVPSlash vps [] ; PassAgentVPSlash vps np = passVPSlash vps (let by = in by.s ++ (np.s ! by.c).ton) ; + ReflRNP v rnp = -- VPSlash -> RNP -> VP ; -- love my family and myself + case v.c2.isDir of { + True => insertRefl v ; + False => insertComplement + (\\a => let agr = verbAgr a in v.c2.s ++ rnp.s ! agr ! v.c2.c) v + } ; + + ReflPron = { -- RNP ; -- myself + s = \\agr,c => reflPron agr.n agr.p c + } ; + oper passVPSlash : VPSlash -> Str -> VP = \vps, agent -> let auxvp = predV auxPassive @@ -50,7 +64,7 @@ oper vps ** { s = auxvp.s ; agr = auxvp.agr ; - comp = \\a => vps.comp ! a ++ (let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) ++ agent ; + comp = \\a => (let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) ++ vps.comp ! a ++ agent ; } ; lin ApposNP np1 np2 = np1 ** { -- guessed by KA @@ -59,10 +73,43 @@ lin ApposNP np1 np2 = np1 ** { -- guessed by KA } ; } ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; +lin CompoundN a b = lin N { + s = \\n => b.s ! n ++ + case b.relType of { + NRelPrep p => prepCase (CPrep p) ; -- tasa de suicidio + NRelNoPrep => [] -- connessione internet = internet connection + } ++ + a.s ! Sg ; + g = b.g ; + relType = b.relType + } ; + +lin UseDAP = \dap -> + let + g = Masc ; + n = dap.n + in heavyNPpol dap.isNeg { + s = dap.spn ; + a = agrP3 g n ; + hasClit = False + } ; + UseDAPMasc = \dap -> + let + g = Masc ; + n = dap.n + in heavyNPpol dap.isNeg { + s = dap.sp ! g ; + a = agrP3 g n ; + hasClit = False + } ; + UseDAPFem dap = + let + g = Fem ; + n = dap.n + in heavyNPpol dap.isNeg { + s = dap.sp ! g ; + a = agrP3 g n ; + hasClit = False + } ; } diff --git a/src/french/ExtraFre.gf b/src/french/ExtraFre.gf index 73f76d6d0..d249ce8b2 100644 --- a/src/french/ExtraFre.gf +++ b/src/french/ExtraFre.gf @@ -74,10 +74,10 @@ concrete ExtraFre of ExtraFreAbs = ExtraRomanceFre ** lin tout_Det = { - s = \\g,c => prepCase c ++ genForms "tout" "toute" ! g ; - sp = \\g,c => prepCase c ++ genForms "tout" "toute" ! g ; + s,sp = \\g,c => prepCase c ++ genForms "tout" "toute" ! g ; + spn= \\c => prepCase c ++ "tout" ; n = Sg ; - s2 = [] ; + s2 = \\c => [] ; isNeg = False } ; diff --git a/src/french/GrammarFre.gf b/src/french/GrammarFre.gf index 97cd5e438..3de5bab56 100644 --- a/src/french/GrammarFre.gf +++ b/src/french/GrammarFre.gf @@ -11,10 +11,11 @@ concrete GrammarFre of Grammar = RelativeFre, ConjunctionFre, PhraseFre, - TextX - [SC,Temp,Tense,Pol,PPos,PNeg], + TextX - [SC,Temp,Tense,Pol,PPos,PNeg,MU], IdiomFre, StructuralFre, - TenseFre + TenseFre, + NamesFre ** { flags startcat = Phr ; diff --git a/src/french/MakeStructuralFre.gf b/src/french/MakeStructuralFre.gf index 5969d05a9..037d2c20f 100644 --- a/src/french/MakeStructuralFre.gf +++ b/src/french/MakeStructuralFre.gf @@ -23,6 +23,7 @@ oper in lin Quant { s = \\_ => aucun ; sp = aucun ; + spn= \\c => prepCase c ++ sm ; s2 = [] ; isNeg = False } ; @@ -38,9 +39,15 @@ oper mkInterj : Str -> Interj = \s -> lin Interj (ss s) ; mkDet = overload { - mkDet : Str -> Det = \s -> lin Det {s,sp = \\_,c => prepCase c ++ s ; n = Sg ; s2 = [] ; isNeg = False} ; + mkDet : Str -> Det = \s -> lin Det { + s,sp = \\_,c => prepCase c ++ s ; + spn = \\c => prepCase c ++ s ; + n = Sg ; s2 = \\g => [] ; isNeg = False + } ; mkDet : Str -> Str -> Number -> Det = \m,f,n -> lin Det { - s,sp = \\g,c => prepCase c ++ case g of {Masc => m ; Fem => f} ; n = n ; s2 = [] ; isNeg = False + s,sp = \\g,c => prepCase c ++ case g of {Masc => m ; Fem => f} ; + spn = \\c => prepCase c ++ m ; + n = n ; s2 = \\g => [] ; isNeg = False } ; } ; diff --git a/src/french/NamesFre.gf b/src/french/NamesFre.gf new file mode 100644 index 000000000..dc935ba68 --- /dev/null +++ b/src/french/NamesFre.gf @@ -0,0 +1,46 @@ +concrete NamesFre of Names = CatFre ** open Prelude, ResFre, CommonRomance, PhonoFre in { + +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ! gn.g ; + g = gn.g + } ; + +lin PlainLN n = heavyNP { + s = \\c => prepCase c ++ n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + AlwaysArt | UseArt => artDef True n.g n.num c ++ n.s ; + _ => n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin InLN n = { + s = let p : {s : Str; c:Prepos} = + case n.onPrep of { + True => {s="en"; c=PNul} ; + False => {s=""; c=P_a} + } + in p.s ++ case n.art of { + AlwaysArt => artDef True n.g n.num (CPrep p.c) ++ n.s; + _ => prepCase (CPrep p.c) ++ n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + +} diff --git a/src/french/NumeralFre.gf b/src/french/NumeralFre.gf index 5e667d8bf..56e505cf1 100644 --- a/src/french/NumeralFre.gf +++ b/src/french/NumeralFre.gf @@ -1,4 +1,4 @@ -concrete NumeralFre of Numeral = CatFre [Numeral,Digits] ** +concrete NumeralFre of Numeral = CatFre [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoFre, Prelude in { flags coding=utf8 ; @@ -171,6 +171,20 @@ oper hyphen = BIND ++ "-" ++ BIND ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "ème") ; diff --git a/src/french/ParadigmsFre.gf b/src/french/ParadigmsFre.gf index e87fcd92e..8310ac1da 100644 --- a/src/french/ParadigmsFre.gf +++ b/src/french/ParadigmsFre.gf @@ -138,6 +138,41 @@ oper mkPN : N -> PN ; -- gender inherited from noun } ; + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = Masc ; + num = Sg} ; + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = g ; + num = Sg} ; + mkLN : Str -> Gender -> Number -> LN = \s,g,num -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = g ; + num = num} ; + } ; + + + defLN : LN -> LN = \n -> n ** {art = AlwaysArt} ; + useDefLN : LN -> LN = \n -> n ** {art = UseArt} ; + enLN : LN -> LN = \n -> n ** {onPrep = True} ; --2 Adjectives @@ -334,8 +369,10 @@ oper Gender = MorphoFre.Gender ; Number = MorphoFre.Number ; - masculine = Masc ; - feminine = Fem ; + masculine, male = Masc ; + feminine, female = Fem ; + male = Masc ; + female = Fem ; singular = Sg ; plural = Pl ; @@ -356,16 +393,16 @@ oper regGenN : Str -> Gender -> N ; regN : Str -> N ; mk2N : (oeil,yeux : Str) -> Gender -> N ; - mk2N x y g = mkCNomIrreg x y g ** {lock_N = <>} ; + mk2N x y g = mkCNomIrreg x y g ** {relType = NRelPrep P_de; lock_N = <>} ; regN x = regGenN x g where { g = case of { _ + ("e" | "ion") => Fem ; _ => Masc } } ; - regGenN x g = mkNomReg x g ** {lock_N = <>} ; + regGenN x g = mkNomReg x g ** {relType = NRelPrep P_de; lock_N = <>} ; compN : N -> Str -> N ; - compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ; + compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; relType = NRelPrep P_de ; lock_N = <>} ; mkN = overload { mkN : Str -> N = regN ; @@ -553,5 +590,6 @@ oper _ => VFalse -- prend-il } ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False; hasArt=False} ; } ; diff --git a/src/french/ParseEngFre.gf b/src/french/ParseEngFre.gf deleted file mode 100644 index b6b36e4f1..000000000 --- a/src/french/ParseEngFre.gf +++ /dev/null @@ -1,110 +0,0 @@ ---# -path=alltenses:.:../english -concrete ParseEngFre of ParseEngAbs = - TenseFre, - NounFre - [PPartNP], - AdjectiveFre, - NumeralFre, - SymbolFre [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], - ConjunctionFre, - VerbFre - [SlashV2V, PassV2, UseCopula, ComplVV], - AdverbFre, - PhraseFre, - SentenceFre, - QuestionFre, - RelativeFre, - IdiomFre [NP, VP, Tense, Cl, ProgrVP, ExistNP], - ExtraFre [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, - Temp, Pol, Conj, VPS, ListVPS, S, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, - VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, - ClSlash, RCl, EmptyRelSlash], - - DictEngFre ** -open MorphoFre, ResFre, ParadigmsFre, SyntaxFre, Prelude, (CR = CommonRomance) in { - -flags literal=Symb ; coding = utf8 ; - -lin - ComplVV v ant p vp = insertComplement - (\\a => prepCase v.c2.c ++ specVP vp ant p a) (predV v) ; - - PPartNP np vp = heavyNP { - s = \\c => (np.s ! c).comp ++ - (vp.s).s ! CR.VPart np.a.g np.a.n ++ - vp.comp ! np.a ++ vp.ext ! RPos ; - a = np.a - } ; - - CompoundCN num noun cn = { - s = \\n => num.s ! noun.g ++ glue (noun.s ! num.n) (cn.s ! n) ; - g = cn.g - } ; - - - DashCN noun1 noun2 = { - s = \\n => noun1.s ! Sg ++ "-" ++ noun2.s ! n ; - g = noun2.g - } ; - - GerundN v = { - s = \\n => v.s ! VGer ; - g = CR.Masc - } ; - - GerundAP v = { - s = \\c => case c of - {CR.AF gg nn => v.s ! CR.VGer; - _ => "NONEXISTENT" }; - isPre = False} ; - - PastPartAP v = { - s = \\c => case c of - {CR.AF gg nn => v.s ! CR.VPart gg nn ; - _ => v.s ! CR.VPart CR.Masc Sg}; - isPre = False} ; - - OrdCompar a = {s = \\c => a.s ! Compar ! AF c.g c.n} ; - - PositAdVAdj a = {s = a.s ! Posit ! AA } ; - - UseQuantPN q pn = heavyNP{ - s = \\c => q.s ! False ! Sg ! pn.g ! c ++ - pn.s ; - a = CR.agrP3 pn.g Sg} ; - - - SlashV2V v ant p vp = - (insertComplement - (\\a => prepCase v.c3.c ++ specVP vp ant p a) - (predV v)) ** {c2 = v.c2} ; - - -- PredVPosV np vp - -- PredVPosv np vp TO DO : ask what they are ? - - - - CompS s = {s = \\_ => "que" ++ s.s ! CR.Indic} ; - CompVP ant pol vp = {s = \\a => specVP vp ant pol a} ; - - -lin - that_RP = which_RP ; - - UttAdV adv = adv; - -oper - specVP : VP -> Ant -> Pol -> Agr -> Str = \vp,ant,pp,agr -> - let - iform = False ; ---- meaning: no clitics - pol : CR.RPolarity = CR.RPos; - inf = vp.s.s ! VInfin iform ; -- TO DO: fix anteriority - neg = vp.neg ! pol ; --- Neg not in API - obj = neg.p2 ++ vp.comp ! agr ++ vp.ext ! pol ; ---- pol - refl = case vp.s.vtyp of { - VRefl => reflPron agr.n agr.p Acc ; ---- case ? - _ => [] - } ; - in - neg.p1 ++ clitInf iform (refl ++ vp.clit1 ++ vp.clit2 ++ vp.clit3) inf ++ obj ; - - -} diff --git a/src/french/ParseFre.gf b/src/french/ParseFre.gf deleted file mode 100644 index a19fc4a35..000000000 --- a/src/french/ParseFre.gf +++ /dev/null @@ -1,189 +0,0 @@ ---# -path=.:../english/:../abstract:../romance:alltenses:../translator -concrete ParseFre of ParseEngAbs = - TenseFre, --- CatFre, - NounFre - [PPartNP], - AdjectiveFre, - NumeralFre, - SymbolFre [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], - ConjunctionFre, - VerbFre - [SlashV2V, PassV2, UseCopula, ComplVV], - AdverbFre, - PhraseFre, - SentenceFre, - QuestionFre - [QuestCl, QuestIAdv], -- more variants here - RelativeFre, - IdiomFre [NP, VP, Tense, Cl, ProgrVP, ExistNP, SelfAdvVP, SelfAdVVP, SelfNP], - ConstructionFre, - DocumentationFre, - ExtraFre [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, PassAgentVPSlash, - Temp, Pol, Conj, VPS, ListVPS, S, Num, CN, RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP, - VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, - ClSlash, RCl, EmptyRelSlash], - - DictionaryFre ** -open PhonoFre, MorphoFre, ResFre, CommonRomance, ParadigmsFre, SyntaxFre, Prelude, (G = GrammarFre) in { - -flags - literal=Symb ; - coding = utf8 ; - --- overrides from Lang - -lin - QuestCl cl = - {s = \\t,a,p => -- est-ce qu'il dort ? - let cls = cl.s ! DDir ! t ! a ! p - in table { - QDir => "est-ce" ++ elisQue ++ cls ! Indic ; - QIndir => subjIf ++ cls ! Indic - } - } - | {s = \\t,a,p => -- dort-il ? - let cls = cl.s ! DInv ! t ! a ! p - in table { - QDir => cls ! Indic ; - QIndir => subjIf ++ cls ! Indic - } - } - | G.QuestCl cl -- il dort ? - ; - - - QuestIAdv iadv cl = - G.QuestIAdv iadv cl -- où dort-il - | {s = \\t,a,p,q => -- où est-ce qu'il dort - let - ord = DDir ; - cls = cl.s ! ord ! t ! a ! p ! Indic ; - why = iadv.s - in why ++ "est-ce" ++ elisQue ++ cls - } ; - -lin --- missing from ExtraFre; should not really be there either - - GenNP np = - let denp = (np.s ! ResFre.genitive).ton in { - s = \\_,_,_,_ => [] ; - sp = \\_,_,_ => denp ; - s2 = denp ; - isNeg = False ; - } ; - - EmptyRelSlash slash = mkRCl which_RP (lin ClSlash slash) ; - - that_RP = which_RP ; - - UncNeg = negativePol ; - --- lexical entries - ----- another_Quant = mkQuantifier "autre" "autre" "autres" "autres" ; ----- some_Quant = mkQuantifier "quelqu'un" "quelqu'une" "quelques-uns" "quelques-unes" ; ----- anySg_Det = mkDeterminer "n'importe quel" "n'importe quelle" Sg False ; ---- also meaning "whichever" ? --- each_Det = SyntaxFre.every_Det ; - - but_Subj = {s = "mais" ; m = Indic} ; ---- strange to have this as Subj - -{- - myself_NP = regNP "myself" singular ; - yourselfSg_NP = regNP "yourself" singular ; - himself_NP = regNP "himself" singular ; - herself_NP = regNP "herself" singular ; - itself_NP = regNP "itself" singular ; - ourself_NP = regNP "ourself" plural ; - yourselfPl_NP = regNP "yourself" plural ; - themself_NP = regNP "themself" plural ; - themselves_NP = regNP "themselves" plural ; --} - - CompoundCN num noun cn = { - s = \\n => cn.s ! n ++ elisDe ++ noun.s ! num.n ; - g = cn.g - } ; - -{- - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! Sg ! Nom ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; - - GerundN v = { - s = \\n,c => v.s ! VPresPart ; - g = Neutr - } ; - - GerundAP v = { - s = \\agr => v.s ! VPresPart ; - isPre = True - } ; --} - - PastPartAP v = { - s = table { - AF g n => v.s ! VPart g n ; - _ => v.s ! VPart Masc Sg ---- the adverb form - } ; - isPre = True - } ; - -{- - OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ; --} - - PositAdVAdj a = {s = a.s ! Posit ! AA} ; - -{- - UseQuantPN q pn = {s = \\c => q.s ! False ! Sg ++ pn.s ! npcase2case c ; a = agrgP3 Sg pn.g} ; - - SlashV2V v ant p vp = insertObjc (\\a => v.c3 ++ ant.s ++ p.s ++ - infVP v.typ vp ant.a p.p a) - (predVc v) ; - - SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++ - v.c3 ++ - vpi.s ! VVAux ! a) - (predVc v) ; --} - ComplVV v a p vp = - insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v) ; ---- a,p - ----- TODO: find proper expressions for OSV and OVS in Fre - PredVPosv np vp = mkCl (lin NP np) (lin VP vp) ; - PredVPovs np vp = mkCl (lin NP np) (lin VP vp) ; - - - CompS s = {s = \\_ => "de" ++ "que" ++ s.s ! Indic} ; ---- de ? - -{- - CompQS qs = {s = \\_ => qs.s ! QIndir} ; - CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ - infVP VVInf vp ant.a p.p a} ; - - VPSlashVS vs vp = - insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) ** - {c2 = ""; gapInMiddle = False} ; - - PastPartRS ant pol vps = { - s = \\agr => vps.ad ++ vps.ptp ++ vps.s2 ! agr ; - c = npNom - } ; - - PresPartRS ant pol vp = { - s = \\agr => vp.ad ++ vp.prp ++ vp.s2 ! agr ; - c = npNom - } ; - - ApposNP np1 np2 = { - s = \\c => np1.s ! c ++ "," ++ np2.s ! npNom ; - a = np1.a - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - --} - -} diff --git a/src/french/StructuralFre.gf b/src/french/StructuralFre.gf index 9af3fb3e5..6df71d8fe 100644 --- a/src/french/StructuralFre.gf +++ b/src/french/StructuralFre.gf @@ -36,13 +36,17 @@ lin every_Det = { s = \\_,c => prepCase c ++ "chaque" ; sp = \\g,c => prepCase c ++ genForms "chacun" "chacune" ! g ; - n = Sg ; - s2 = [] ; + spn= \\c => prepCase c ++ "tout" ; + n = Sg ; + s2 = \\g => [] ; isNeg = False } ; everything_NP = pn2np (mkPN ["tout"] Masc) ; everywhere_Adv = ss "partout" ; - few_Det = {s,sp = \\g,c => prepCase c ++ "peu" ++ elisDe ; n = Pl ; s2 = [] ; isNeg = False} ; + few_Det = { + s,sp = \\g,c => prepCase c ++ "peu" ++ elisDe ; + spn = \\c => prepCase c ++ "peu" ++ elisDe ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; --- DEPREC first_Ord = {s = \\ag => (regA "premier").s ! Posit ! AF ag.g ag.n} ; for_Prep = mkPreposition "pour" ; from_Prep = complGen ; --- @@ -68,10 +72,15 @@ lin "il" (elision "l") "lui" "lui" "son" (elisPoss "s") "ses" Masc Sg P3 ; less_CAdv = X.mkCAdv "moins" conjThan ; - many_Det = {s,sp = \\_,c => prepCase c ++ "plusieurs" ; n = Pl ; s2 = [] ; isNeg = False} ; + many_Det = { + s,sp = \\_,c => prepCase c ++ "plusieurs" ; + spn = \\c => prepCase c ++ "plusieurs" ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; more_CAdv = X.mkCAdv "plus" conjThan ; most_Predet = {s = \\_,c => prepCase c ++ ["la plupart"] ; c = CPrep P_de ; a = PNoAg} ; - much_Det = {s,sp = \\_,c => prepCase c ++ "beaucoup" ++ elisDe ; n = Pl ; s2 = [] ; isNeg = False} ; + much_Det = {s,sp = \\_,c => prepCase c ++ "beaucoup" ++ elisDe ; + spn = \\c => prepCase c ++ "beaucoup" ++ elisDe ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; must_VV = mkVV (devoir_V2 ** {lock_V = <>}) ; ---b no_Phr = ss "non" ; no_Utt = ss "non" ; @@ -91,8 +100,14 @@ lin so_AdA = ss "si" ; somebody_NP = pn2np (mkPN ["quelqu'un"] Masc) ; - somePl_Det = {s,sp = \\_,c => prepCase c ++ "quelques" ; n = Pl ; s2 = [] ; isNeg = False} ; ---- sp - someSg_Det = {s,sp = \\_,c => prepCase c ++ "quelque" ; n = Sg ; s2 = [] ; isNeg = False} ; ----sp + somePl_Det = { + s,sp = \\_,c => prepCase c ++ "quelques" ; + spn = \\c => prepCase c ++ "quelque chose" ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; ---- sp + someSg_Det = { + s,sp = \\_,c => prepCase c ++ "quelque" ; + spn = \\c => prepCase c ++ "quelque chose" ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; ----sp something_NP = pn2np (mkPN ["quelque chose"] Masc) ; somewhere_Adv = ss ["quelque part"] ; --- ne - pas @@ -106,6 +121,7 @@ lin Sg => \\g,c => prepCase c ++ genForms "celui-là" "celle-là" ! g ; Pl => \\g,c => prepCase c ++ genForms "ceux-là" "celles-là" ! g } ; + spn= \\c => prepCase c ++ "celui-là" ; s2 = [] ; ---- "-là" ; isNeg = False } ; @@ -130,6 +146,7 @@ lin Sg => \\g,c => prepCase c ++ genForms "celui-ci" "celle-ci" ! g ; Pl => \\g,c => prepCase c ++ genForms "ceux-ci" "celles-ci" ! g } ; + spn= \\c => prepCase c ++ "cela" ; s2 = [] ; ---- "-ci" isNeg = False } ; @@ -188,6 +205,7 @@ lin in { s = \\_ => aucun ; sp = aucun ; + spn= aucun ! Sg ! Masc ; s2 = [] ; isNeg = True } ; diff --git a/src/german/AdjectiveGer.gf b/src/german/AdjectiveGer.gf index c014c6246..9d44194d8 100644 --- a/src/german/AdjectiveGer.gf +++ b/src/german/AdjectiveGer.gf @@ -10,14 +10,18 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { c = <[],[]> ; ext = [] } ; - ComparA a np = { - s = \\af => a.s ! Compar ! af ++ conjThan ++ np.s ! NPC Nom ++ bigNP np ; + ComparA a np = + let nps = np.s ! False ! Nom ++ bigNP np + in { + s = \\af => a.s ! Compar ! af ++ conjThan ++ nps ; isPre = True ; c = <[],[]> ; ext = [] } ; - CAdvAP ad ap np = ap ** { - s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ np.s ! NPC Nom ++ bigNP np ; + CAdvAP ad ap np = + let nps = np.s ! False ! Nom ++ bigNP np in + ap ** { + s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ nps ; isPre = False } ; UseComparA a = { @@ -36,33 +40,32 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { -- $SuperlA$ belongs to determiner syntax in $Noun$. - ComplA2 a np = - let CExt = case a.c2.isPrep of { - False => ; - True => <[], appPrepNP a.c2 np> } - in { - s = a.s ! Posit ; - isPre = True ; - c = CExt ; - ext = [] + ComplA2 a np = + let CExt = case a.c2.isPrep of { + isCase => ; + _ => <[], appPrepNP a.c2 np> } + in { + s = a.s ! Posit ; + isPre = True ; + c = CExt ; + ext = [] } ; ReflA2 a = - let - compl = appPrep a.c2 (\\k => usePrepC k (\c -> reflPron ! agrP3 Sg ! c)) ; - CExt = case a.c2.isPrep of - {False => ; - True => <[], compl> } - in { - s = a.s ! Posit ; - isPre = True ; - c = CExt ; - ext = [] + let + compl = appPrep a.c2 (reflPron ! agrP3 Sg) ; + CExt = case a.c2.isPrep of + {isCase => ; _ => <[], compl> } + in { + s = a.s ! Posit ; + isPre = True ; + c = CExt ; + ext = [] } ; SentAP ap sc = ap ** { isPre = False ; - ext = ap.ext ++ sc.s + ext = ap.ext ++ sc.s } ; AdAP ada ap = ap ** {s = \\a => ada.s ++ ap.s ! a} ; diff --git a/src/german/AdverbGer.gf b/src/german/AdverbGer.gf index df7774411..6cf2673df 100644 --- a/src/german/AdverbGer.gf +++ b/src/german/AdverbGer.gf @@ -4,7 +4,7 @@ concrete AdverbGer of Adverb = CatGer ** open ResGer, Prelude in { PositAdvAdj a = {s = a.s ! Posit ! APred} ; ComparAdvAdj cadv a np = { - s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ np.s ! NPC Nom + s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ np.s ! False ! Nom ++ bigNP np } ; ComparAdvAdjS cadv a s = { s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ s.s ! Sub diff --git a/src/german/AllGer.gf b/src/german/AllGer.gf index dd57eec3d..83e6751f5 100644 --- a/src/german/AllGer.gf +++ b/src/german/AllGer.gf @@ -1,10 +1,9 @@ --# -path=.:../abstract:../common:../api:../prelude -concrete AllGer of AllGerAbs = +concrete AllGer of AllGerAbs = LangGer, IrregGer, ---- ExtendGer, ---- to replace ExtraGer ExtraGer - ** - open ExtendGer in ---- to force compilation - {} ; + ** open ExtendGer in {} ---- to force compilation + ; diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index 48016759c..1f4c64b9e 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -1,4 +1,5 @@ -concrete CatGer of Cat = +--# -path=.:../abstract:../common:../prelude +concrete CatGer of Cat = CommonX - [Tense,Temp] ** open ResGer, Prelude in { @@ -41,7 +42,7 @@ concrete CatGer of Cat = VPSlash = ResGer.VPSlash ; Comp = {s : Agr => Str ; ext : Str} ; --- Adjective +-- Adjective (HL 7/23: we need c : Agr => Str * Str to handle reflexive objects, cf ReflA2) AP = {s : AForm => Str ; isPre : Bool ; c: Str * Str ; ext : Str} ; -- ich bin [c1 ihm] treu @@ -57,20 +58,25 @@ concrete CatGer of Cat = adv : Str ; -- Haus [adv auf dem Hügel] g : Gender } ; - NP = ResGer.NP ; + NP = ResGer.NP ; Pron = {s : NPForm => Str ; a : Agr} ; - Det, DAP = {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} ; + Det = {s,sp : Bool => Gender => Case => Str ; -- True if DefArt is dropped, HL 8/22 + n : Number ; a : Adjf ; isDef, hasDefArt : Bool} ; + DAP = {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef,hasDefArt : Bool} ; + -- HL 7/2022: first Bool = True if used to glue in Sg with preposition + -- second Bool is True if a cardinal number is present Quant = { - s : Bool => Number => Gender => PCase => Str ; -- Bool is True if a cardinal number is present - sp : Bool => Number => Gender => PCase => Str ; + s, sp : Bool => Bool => Number => Gender => Case => Str ; a : Adjf ; aPl : Adjf ; --- to distinguish "meine guten Freunde" / "gute Freunde" + hasDefArt : Bool } ; Predet = { - s : Number => Gender => PCase => Str ; + s : Number => Gender => Case => Str ; c : {p : Str ; k : PredetCase} ; a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ... } ; + Num = {s : Gender => Case => Str ; n : Number ; isNum : Bool} ; Card = {s : Gender => Case => Str ; n : Number} ; Ord = {s : AForm => Str} ; @@ -78,7 +84,8 @@ concrete CatGer of Cat = -- Numeral Numeral = {s : CardOrd => Str ; n : Number } ; - Digits = {s : CardOrd => Str ; n : Number } ; + Digits = {s : CardOrd => Str ; n : Number ; isDig, tail1to19 : Bool} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural @@ -103,6 +110,7 @@ concrete CatGer of Cat = GN = {s : Case => Str; g : Sex} ; SN = {s : Sex => Case => Str} ; PN = {s : Case => Str; g : Gender; n : Number} ; + LN = {s : Adjf => Case => Str; hasArt : Bool; g : Gender; n : Number} ; -- tense with possibility to choose conjunctive forms @@ -110,24 +118,29 @@ concrete CatGer of Cat = Tense = {s : Str ; t : ResGer.Tense ; m : Mood} ; linref - NP = \np -> np.s!(NPC Nom) ++ np.ext ++ np.rc ; -- HL 6/2019 + NP = \np -> np.s ! False ! Nom ++ np.ext ++ np.rc ; -- HL 7/2022 Bool added CN = \cn -> cn.s ! Strong ! Pl ! Nom ++ cn.adv ++ cn.ext ++ cn.rc ! Pl ; - SSlash = \ss -> ss.s ! Main ++ ss.c2.s ; - ClSlash = \cls -> cls.s ! MIndic ! Pres ! Simul ! Pos ! Main ++ cls.c2.s ; + SSlash = \ss -> ss.s ! Main ++ ss.c2.s ! GPl ; + ClSlash = \cls -> cls.s ! MIndic ! Pres ! Simul ! Pos ! Main ++ cls.c2.s ! GPl ; VP = \vp -> useInfVP False vp ; - VPSlash = \vps -> useInfVP False vps ++ vps.c2.s ++ vps.ext; + VPSlash = \vps -> useInfVP False vps ++ vps.c2.s ! GPl ++ vps.ext; - AP = \ap -> ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ++ ap.ext ; - A2 = \a2 -> a2.s ! Posit ! APred ++ a2.c2.s ; + AP = \ap -> ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ++ ap.ext ; + A2 = \a2 -> a2.s ! Posit ! APred ++ a2.c2.s ! GPl ; V, VS, VQ, VA = \v -> useInfVP False (predV v) ; - V2, V2A, V2Q, V2S = \v -> useInfVP False (predV v) ++ v.c2.s ; - V3 = \v -> useInfVP False (predV v) ++ v.c2.s ++ v.c3.s ; + V2, V2A, V2Q, V2S = \v -> useInfVP False (predV v) ++ v.c2.s ! GPl ; + V3 = \v -> useInfVP False (predV v) ++ v.c2.s ! GPl ++ v.c3.s ! GPl; VV = \v -> useInfVP v.isAux (predVGen v.isAux v) ; - V2V = \v -> useInfVP v.isAux (predVGen v.isAux v) ++ v.c2.s ; + V2V = \v -> useInfVP v.isAux (predVGen v.isAux v) ++ v.c2.s ! GPl ; Conj = \c -> c.s1 ++ c.s2 ; + + Det = \det -> det.s ! False ! Masc ! Nom ; + Prep = \prep -> case prep.isPrep of {isPrepDefArt => prep.s ! GSg Masc ; + _ => prep.s ! GPl } ; + } diff --git a/src/german/ConjunctionGer.gf b/src/german/ConjunctionGer.gf index 0a9ae9445..790461bd5 100644 --- a/src/german/ConjunctionGer.gf +++ b/src/german/ConjunctionGer.gf @@ -9,9 +9,15 @@ concrete ConjunctionGer of Conjunction = ConjAdv conj ss = conjunctDistrSS conj ss ; - ConjNP conj ss = heavyNP (conjunctDistrTable PCase conj ss ** { - a = Ag Fem (conjNumber conj.n (numberAgr ss.a)) (personAgr ss.a) ; - }) ; + ConjNP conj ss = heavyNP ( + {s = \\_ => (conjunctDistrTable Case conj ss).s ; + a = let n : Number = (conjNumber conj.n (numberAgr ss.a)) ; + p : Person = personAgr ss.a ; + agr : Agr = case of { => AgPl q ; + => AgSgP3 Neutr ; + => AgSgP1 ; + => AgSgP2 } + in (conjAgr agr ss.a) }) ; ConjAP conj ss = conjunctDistrTable AForm conj ss ** { isPre = ss.isPre ; c = ss.c ; ext = ss.ext} ; @@ -39,20 +45,20 @@ concrete ConjunctionGer of Conjunction = BaseAdv = twoSS ; ConsAdv = consrSS comma ; BaseNP x y = { - s1 = \\c => x.s ! c ++ bigNP x ; - s2 = \\c => y.s ! c ++ bigNP y ; + s1 = \\c => x.s ! False ! c ++ bigNP x ; + s2 = \\c => y.s ! False ! c ++ bigNP y ; a = conjAgr x.a y.a } ; ConsNP xs x = { - s1 = \\c => xs.s ! c ++ bigNP xs ++ comma ++ x.s1 ! c ; + s1 = \\c => xs.s ! False ! c ++ bigNP xs ++ comma ++ x.s1 ! c ; s2 = x.s2 ; a = conjAgr xs.a x.a } ; - BaseAP x y = { + BaseAP x y = lin AP { s1 = bigAP x ; s2 = bigAP y ; isPre = andB x.isPre y.isPre ; c = <[],[]> ; ext = []} ; - ConsAP xs x = { + ConsAP xs x = lin AP { s1 = \\a => (bigAP xs) ! a ++ comma ++ x.s1 ! a ; s2 = x.s2 ; isPre = andB x.isPre xs.isPre ; @@ -60,12 +66,12 @@ concrete ConjunctionGer of Conjunction = ext = []} ; BaseRS x y = twoTable RelGenNum x y ** {c = y.c} ; ConsRS xs x = consrTable RelGenNum comma xs x ** {c = xs.c} ; - BaseCN x y = { + BaseCN x y = lin CN { s1 = bigCN x ; s2 = bigCN y ; g = x.g ; --- gender of first CN, used e.g. in articles } ; - ConsCN x xs = { + ConsCN x xs = lin CN { s1 = \\a,n,c => bigCN x ! a ! n ! c ++ comma ++ xs.s1 ! a ! n ! c ; s2 = xs.s2 ; g = x.g ; --- gender of first CN, used e.g. in articles @@ -75,7 +81,7 @@ concrete ConjunctionGer of Conjunction = lincat [S] = {s1,s2 : Order => Str} ; [Adv] = {s1,s2 : Str} ; - [NP] = {s1,s2 : PCase => Str ; a : Agr} ; + [NP] = {s1,s2 : Case => Str ; a : Agr} ; [AP] = {s1,s2 : AForm => Str ; isPre : Bool; c : Str * Str ; ext : Str} ; [RS] = {s1,s2 : RelGenNum => Str ; c : Case} ; [CN] = {s1,s2 : Adjf => Number => Case => Str ; g : Gender} ; diff --git a/src/german/ConstructionGer.gf b/src/german/ConstructionGer.gf index ab90fadeb..7f43a4a25 100644 --- a/src/german/ConstructionGer.gf +++ b/src/german/ConstructionGer.gf @@ -1,42 +1,65 @@ --# -path=.:../abstract -concrete ConstructionGer of Construction = CatGer ** - open SyntaxGer, SymbolicGer, ParadigmsGer, +concrete ConstructionGer of Construction = CatGer ** + open SyntaxGer, SymbolicGer, (P = ParadigmsGer), (L = LexiconGer), (E = ExtraGer), (G = GrammarGer), (I = IrregGer), (R = ResGer), (N = NounGer), Prelude in { flags coding=utf8 ; +oper + mkPrep : Str -> P.Case -> Prep = P.mkPrep ; + mkV2 : V -> V2 = P.mkV2 ; + accPrep = P.accPrep ; + datPrep = P.datPrep ; + anDat_Prep = P.anDat_Prep ; + inDat_Prep = P.inDat_Prep ; + + dative = P.dative ; + accusative = P.accusative ; + feminine = P.feminine ; + neuter = P.neuter ; + regV = P.regV ; + invarA = P.invarA ; lin - hungry_VP = mkVP (mkA "hungrig") ; - thirsty_VP = mkVP (mkA "durstig") ; - tired_VP = mkVP (mkA "müde") ; - scared_VP = mkVP have_V2 (mkNP (mkN "Angst" "Ängste" feminine)) ; - ill_VP = mkVP (mkA "krank") ; - ready_VP = mkVP (mkA "bereit") ; + hungry_VP = mkVP (P.mkA "hungrig") ; + thirsty_VP = mkVP (P.mkA "durstig") ; + tired_VP = mkVP (P.mkA "müde") ; + scared_VP = mkVP have_V2 (mkNP (P.mkN "Angst" "Ängste" feminine)) ; + ill_VP = mkVP (P.mkA "krank") ; + ready_VP = mkVP (P.mkA "bereit") ; has_age_VP card = mkVP (lin AP (mkAP (lin AdA (mkUtt (mkNP L.year_N))) L.old_A)) ; have_name_Cl x y = mkCl (lin NP x) (mkV2 I.heißen_V) (lin NP y) ; married_Cl x y = ----mkCl (lin NP x) L.married_A2 (lin NP y) | - mkCl (mkNP and_Conj (lin NP x) (lin NP y)) (mkA "verheiratet") ; + mkCl (mkNP and_Conj (lin NP x) (lin NP y)) (P.mkA "verheiratet") ; what_name_QCl x = mkQCl how_IAdv (mkCl (lin NP x) I.heißen_V) ; ---- how_old_QCl x = mkQCl (E.ICompAP (mkAP L.old_A)) (lin NP x) ; ---- compilation slow - how_old_QCl x = mkQCl (E.IAdvAdv (ParadigmsGer.mkAdv "alt")) (mkCl (lin NP x) G.UseCopula) ; ---- + how_old_QCl x = mkQCl (E.IAdvAdv (P.mkAdv "alt")) (mkCl (lin NP x) G.UseCopula) ; ---- how_far_QCl x = mkQCl (E.IAdvAdv L.far_Adv) (mkCl (mkVP (SyntaxGer.mkAdv to_Prep (lin NP x)))) ; -- some more things weather_adjCl ap = mkCl (mkVP (lin AP ap)) ; - is_right_VP = mkVP have_V2 (mkNP (ParadigmsGer.mkN "Recht")) ; - is_wrong_VP = mkVP have_V2 (mkNP (ParadigmsGer.mkN "Unrecht")) ; + is_right_VP = mkVP have_V2 (mkNP (P.mkN "Recht")) ; + is_wrong_VP = mkVP have_V2 (mkNP (P.mkN "Unrecht")) ; n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP (lin CN cn)))) (lin A a) ; n_unit_CN card unit cn = mkCN (invarA (mkUtt (mkNP (lin CN unit))).s) cn ; - bottle_of_CN np = N.ApposCN (mkCN (mkN "Flasche")) np ; - cup_of_CN np = N.ApposCN (mkCN (mkN "Tasse")) np ; - glass_of_CN np = N.ApposCN (mkCN (mkN "Glas" "Gläser" neuter)) np ; + bottle_of_CN np = N.ApposCN (mkCN (P.mkN "Flasche")) np ; + cup_of_CN np = N.ApposCN (mkCN (P.mkN "Tasse")) np ; + glass_of_CN np = N.ApposCN (mkCN (P.mkN "Glas" "Gläser" neuter)) np ; + + few_X_short_of_Y np x y = -- np.dat fehlen (wenige x).nom an y + let + xs : NP = (mkNP G.few_Det x) ; + ys : NP = (mkNP G.IndefArt y) ; + fehlen_V3 : V3 = P.mkV3 (regV "fehlen") datPrep (mkPrep "an" dative) ; + vp : VP = mkVP (mkVPSlash fehlen_V3 np) ys + in + mkS (mkCl xs vp) ; -- spatial deixis and motion verbs where_go_QCl np = mkQCl (lin IAdv (ss "wohin")) (mkCl np (mkVP L.go_V)) ; @@ -46,15 +69,103 @@ lin come_here_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "her") ; come_from_here_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "von hier") ; - go_there_VP = mkVP (mkVP L.go_V) (ParadigmsGer.mkAdv "hin") ; + go_there_VP = SyntaxGer.mkVP (SyntaxGer.mkVP L.go_V) (ParadigmsGer.mkAdv "hin") ; come_there_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "hin") ; come_from_there_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "von dort") ; lincat + Timeunit = N ; + Hour = {short:Str ; long:Str ; adv:Adv} ; Weekday = N ; Monthday = NP ; Month = N ; Year = NP ; + +-- timeunitAdv : Card -> Timeunit -> Adv ; -- (for) three hours +-- timeunitRange : Card -> Card -> Timeunit -> Adv ; -- (cats live) ten to twenty years +lin + timeunitAdv n time = + let n_hours_NP : NP = mkNP n time + in SyntaxGer.mkAdv (for_Prep | accPrep) n_hours_NP ; + + timeunitRange l u time = + {s = l.s ! R.Masc ! R.Nom ++ "bis" ++ u.s ! R.Masc ! R.Nom ++ time.s ! R.Pl ! R.Nom} ; + + oper + mkHour : Str -> Str -> Str -> Hour + = \n,m,daytime -> + let numeral : Str -> Str = \k -> (SyntaxGer.mkUtt (SyntaxGer.mkCard k)).s + in lin Hour {short = numeral n ; long = numeral m ; adv = P.mkAdv daytime} ; + +lin + oneHour = mkHour "1" "1" "nachts" ; + twoHour = mkHour "2" "2" "nachts" ; + threeHour = mkHour "3" "3" "nachts" ; + fourHour = mkHour "4" "4" "morgens" ; + fiveHour = mkHour "5" "5" "morgens" ; + sixHour = mkHour "6" "6" "morgens" ; + sevenHour = mkHour "7" "7" "morgens" ; + eightHour = mkHour "8" "8" "vormittags" ; + nineHour = mkHour "9" "9" "vormittags" ; + tenHour = mkHour "10" "10" "vormittags" ; + elevenHour = mkHour "11" "11" "vormittags" ; + twelveHour = mkHour "12" "12" "mittags" ; + thirteenHour = mkHour "13" "1" "mittags" ; + fourteenHour = mkHour "14" "2" "mittags" ; + fifteenHour = mkHour "15" "3" "nachmittags" ; + sixteenHour = mkHour "16" "4" "nachmittags" ; + seventeenHour = mkHour "17" "5" "nachmittags" ; + eighteenHour = mkHour "18" "6" "nachmittags" ; + nineteenHour = mkHour "19" "7" "abends" ; + twentyHour = mkHour "20" "8" "abends" ; + twentyOneHour = mkHour "21" "9" "abends" ; + twentyTwoHour = mkHour "22" "10" "abends" ; + twentyThreeHour = mkHour "23" "11" "abends" ; + twentyFourHour = mkHour "24" "12" "nachts" ; + + -- timeHour : Hour -> Adv -- at three a.m./p.m. + -- um drei Uhr nachts/nachmittags + + timeHour h = let ada : AdA = lin AdA {s = "um" ++ h.long ++ "Uhr"} + in SyntaxGer.mkAdv ada h.adv ; + + -- timeHourMinute : Hour -> Card -> Adv ; -- at six forty a.m./p.m. + -- um sechs/achtzehn Uhr vierzig + timeHourMinute h card = + let min : Str = (SyntaxGer.mkUtt card).s + in P.mkAdv ("um" ++ h.short ++ "Uhr" ++ min) ; + +{- -- Remark (HL 7/2023): +-- To avoid massive overgeneration, we'd better replace Card here by + cat + Minute ; + fun + timeHourMinute : Hour -> Minute -> Adv ; -- at six forty a.m./p.m. + min_1 : Minute ; + min_2 : Minute ; -- ... min_60 : Minute ; + lastMinute : Minute ; + + oper + Min : PType = Predef.Ints 3 ; -- short for 60 + minutes : Min => Str = table {0 => "0" ; 1 => "1" ; 2 => "2" ; 3 => "3"} ; + mkMinute : Min -> Minute = \j -> lin Minute {s = minutes ! j ; i = j} ; + + lincat + Minute = { s : Str ; i : Min } ; + lin + min_1 = mkMinute 1 ; + min_2 = mkMinute 2 ; + lastMinute = mkMinute 3 ; + timeHourMinute h m = P.mkAdv ("um" ++ h.short ++ ":" ++ m.s ++ "Uhr") ; + +-- But this definition of timeHourMinute causes a compiler error! In +-- timeHourMinute = \h,m -> mkAdv (... ++ m.s ++ ..) +-- the argument m is not really restricted to Min, but an unbounded Int, so +-- m.s = {s = minutes ! j ; i = j}.s = (table (Ints 3) [...]) ! j +-- cannot be reduced in Compute.ConcreteNew, as *the compiler does not enforce* +-- 0 =< j =< 3. +-} + lin weekdayPunctualAdv w = SyntaxGer.mkAdv anDat_Prep (mkNP the_Det w) ; -- am Montag weekdayHabitualAdv w = SyntaxGer.mkAdv (mkPrep "" accusative) (mkNP every_Det w) ; ---- jeden Montag @@ -63,9 +174,9 @@ lin monthAdv m = SyntaxGer.mkAdv inDat_Prep (mkNP the_Det m) ; yearAdv y = SyntaxGer.mkAdv (mkPrep "im Jahr" dative) y ; ---- - dayMonthAdv d m = ParadigmsGer.mkAdv ("am" ++ d.s ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom) ; -- am 17 Mai + dayMonthAdv d m = ParadigmsGer.mkAdv ("am" ++ d.s ! True ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom) ; -- am 17. Mai monthYearAdv m y = SyntaxGer.mkAdv inDat_Prep (mkNP the_Det (mkCN m y)) ; -- im Mai 2012 - dayMonthYearAdv d m y = ParadigmsGer.mkAdv ("am" ++ d.s ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom ++ y.s ! accusative) ; -- am 17 Mai 2013 + dayMonthYearAdv d m y = ParadigmsGer.mkAdv ("am" ++ d.s ! True ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom ++ y.s ! True ! accusative) ; -- am 17. Mai 2013 intYear = symb ; intMonthday = symb ; @@ -78,37 +189,45 @@ lin weekdayN w = w ; monthN m = m ; - weekdayPN w = mkPN w ; - monthPN m = mkPN m ; + weekdayPN w = P.mkPN w ; + monthPN m = P.mkPN m ; languageNP l = mkNP l ; languageCN l = mkCN l ; -oper mkLanguage : Str -> N = \s -> mkN s neuter ; ---- produces Neuter +oper mkLanguage : Str -> N = \s -> P.mkN s neuter ; ---- produces Neuter ---------------------------------------------- ---- lexicon of special names -lin monday_Weekday = mkN "Montag" ; -lin tuesday_Weekday = mkN "Dienstag" ; -lin wednesday_Weekday = mkN "Mittwoch" ; -lin thursday_Weekday = mkN "Donnerstag" ; -lin friday_Weekday = mkN "Freitag" ; -lin saturday_Weekday = mkN "Samstag" ; -lin sunday_Weekday = mkN "Sonntag" ; +lin second_Timeunit = P.mkN "Sekunde" ; +lin minute_Timeunit = P.mkN "Minute" ; +lin hour_Timeunit = P.mkN "Stunde" ; +lin day_Timeunit = P.mkN "Tag" ; +lin week_Timeunit = P.mkN "Woche" ; +lin month_Timeunit = P.mkN "Monat"; +lin year_Timeunit = P.mkN "Jahr" "Jahre" neuter ; -lin january_Month = mkN "Januar" ; -lin february_Month = mkN "Februar" ; -lin march_Month = mkN "März" ; -lin april_Month = mkN "April" ; -lin may_Month = mkN "Mai" ; -lin june_Month = mkN "Juni" ; -lin july_Month = mkN "Juli" ; -lin august_Month = mkN "August" ; -lin september_Month = mkN "September" ; -lin october_Month = mkN "Oktober" ; -lin november_Month = mkN "November" ; -lin december_Month = mkN "Dezember" ; +lin monday_Weekday = P.mkN "Montag" ; +lin tuesday_Weekday = P.mkN "Dienstag" ; +lin wednesday_Weekday = P.mkN "Mittwoch" ; +lin thursday_Weekday = P.mkN "Donnerstag" ; +lin friday_Weekday = P.mkN "Freitag" ; +lin saturday_Weekday = P.mkN "Samstag" ; +lin sunday_Weekday = P.mkN "Sonntag" ; + +lin january_Month = P.mkN "Januar" ; +lin february_Month = P.mkN "Februar" ; +lin march_Month = P.mkN "März" ; +lin april_Month = P.mkN "April" ; +lin may_Month = P.mkN "Mai" ; +lin june_Month = P.mkN "Juni" ; +lin july_Month = P.mkN "Juli" ; +lin august_Month = P.mkN "August" ; +lin september_Month = P.mkN "September" ; +lin october_Month = P.mkN "Oktober" ; +lin november_Month = P.mkN "November" ; +lin december_Month = P.mkN "Dezember" ; lin afrikaans_Language = mkLanguage "Afrikaans" ; lin amharic_Language = mkLanguage "Amharisch" ; diff --git a/src/german/DocumentationGerFunctor.gf b/src/german/DocumentationGerFunctor.gf index eedea374e..13b24527d 100644 --- a/src/german/DocumentationGerFunctor.gf +++ b/src/german/DocumentationGerFunctor.gf @@ -25,13 +25,13 @@ oper lin InflectionN, InflectionN2, InflectionN3 = \noun -> { t = "s" ; - s1 = heading1 (heading noun_Category ++ + s1 = heading1 (heading noun_Category ++ case noun.g of { - Masc => "("+heading masculine_Parameter+")" ; + Masc => "("+heading masculine_Parameter+")" ; Fem => "("+heading feminine_Parameter+")" ; Neutr => "("+heading neuter_Parameter+")" }) ; - s2 = frameTable ( + s2 = frameTable ( tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++ tr (th (heading nominative_Parameter) ++ td (noun.s ! Sg ! Nom) ++ td (noun.s ! Pl ! Nom)) ++ tr (th (heading genitive_Parameter) ++ td (noun.s ! Sg ! Gen) ++ td (noun.s ! Pl ! Gen)) ++ @@ -40,6 +40,66 @@ lin ) } ; + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Eigenname" ++ + "("+case of { + => heading masculine_Parameter ; + => heading feminine_Parameter ; + => heading neuter_Parameter ; + <_,Pl> => heading plural_Parameter + } ++")") ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (pn.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (pn.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (pn.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (pn.s ! Acc)) + ) + } ; + + InflectionGN = \gn -> { + t = "vn" ; + s1 = heading1 ("Vorname" ++ + case gn.g of { + Male => "(männlich)" ; + Female => "(weiblich)" + }) ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (gn.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (gn.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (gn.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (gn.s ! Acc)) + ) ; + } ; + + InflectionSN = \sn -> { + t = "fn" ; + s1 = heading1 ("Familienname") ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (sn.s ! Male ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (sn.s ! Male ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (sn.s ! Male ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (sn.s ! Male ! Acc)) + ) ; + } ; + + InflectionLN = \ln -> { + t = "pn" ; + s1 = heading1 ("Standortnamen" ++ + "("+case of { + => heading masculine_Parameter ; + => heading feminine_Parameter ; + => heading neuter_Parameter ; + <_,Pl> => heading plural_Parameter + } ++")") ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (ln.s ! Strong ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (ln.s ! Strong ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (ln.s ! Strong ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (ln.s ! Strong ! Acc)) + ) + } ; + InflectionA, InflectionA2 = \adj -> let gforms : Degree -> ResGer.Case -> Str = \d,c -> @@ -48,8 +108,8 @@ lin td (adj.s ! d ! (AMod (GSg Neutr) c)) ++ td (adj.s ! d ! (AMod GPl c)) ; dtable : Parameter -> Degree -> Str = \s,d -> - paragraph (heading2 (heading s) ++ frameTable ( - tr (th [] ++ th (heading masculine_Parameter) ++ th (heading feminine_Parameter) ++ th (heading neuter_Parameter) ++ + paragraph (heading2 (heading s) ++ frameTable ( + tr (th [] ++ th (heading masculine_Parameter) ++ th (heading feminine_Parameter) ++ th (heading neuter_Parameter) ++ th (heading plural_Parameter)) ++ tr (th (heading nominative_Parameter) ++ gforms d Nom) ++ tr (th (heading genitive_Parameter) ++ gforms d Gen) ++ @@ -163,7 +223,7 @@ oper let vfin : VForm -> Str = \f -> verb.s ! f ++ verb.prefix ; - gforms : Number -> Person -> Str = \n,p -> + gforms : ParadigmsGer.Number -> Person -> Str = \n,p -> td (vfin (VFin False (VPresInd n p))) ++ td (vfin (VFin False (VPresSubj n p))) ++ td (vfin (VFin False (VImpfInd n p))) --# notpresent diff --git a/src/german/ExtendGer.gf b/src/german/ExtendGer.gf index 4c60590d0..ddfa488db 100644 --- a/src/german/ExtendGer.gf +++ b/src/german/ExtendGer.gf @@ -4,9 +4,11 @@ concrete ExtendGer of Extend = CatGer ** ExtendFunctor - [ InOrderToVP, - VPS, ListVPS, VPI, ListVPI, + VPS, ListVPS, VPI, ListVPI, RNP, RNPList, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, + ComplSlashPartLast, + Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, Conj_RNP, CardCNCard, CompoundN, PassVPSlash, PassAgentVPSlash, PastPartAP, PastPartAgentAP ] @@ -44,7 +46,7 @@ lin PredVPS np vpi = let - subj = np.s ! NPC Nom ++ bigNP np ; + subj = np.s ! False ! Nom ++ bigNP np ; agr = np.a ; in { s = \\o => @@ -69,7 +71,7 @@ lin t = tm.t ; m = tm.m ; subj = [] ; - verb = vps.s ! ord ! agr ! VPFinite m t a ; + verb = vps.s ! ord ! agr2vagr agr ! VPFinite m t a ; haben = verb.inf2 ; neg = tm.s ++ p.s ++ vp.a1 ++ negation ! b ; -- HL 8/19 ++ vp.a1 ! b ; -- obj1 = (vp.nn ! agr).p1 ; @@ -115,21 +117,21 @@ lin ConjVPS = conjunctDistrTable2 Order Agr ; UseDAP det = { - s = \\c => det.sp ! Neutr ! c ; + s = \\b,c => det.sp ! Neutr ! c ; a = agrP3 det.n ; w = case det.isDef of { True => WLight ; _ => WHeavy } ; rc, ext = [] } ; UseDAPMasc det = { - s = \\c => det.sp ! Masc ! c ; + s = \\b,c => det.sp ! Masc ! c ; a = agrP3 det.n ; w = WLight ; rc, ext = [] } ; UseDAPFem det = { - s = \\c => det.sp ! Fem ! c ; + s = \\b,c => det.sp ! Fem ! c ; a = agrP3 det.n ; w = WLight ; rc, ext = [] @@ -138,20 +140,10 @@ lin lin CardCNCard card cn = { s = \\g,c => - (Grammar.DetCN (Grammar.DetQuant Grammar.IndefArt (Grammar.NumCard card)) cn).s ! NPC c ; + (Grammar.DetCN (Grammar.DetQuant Grammar.IndefArt (Grammar.NumCard card)) cn).s ! False ! c ; n = Pl } ; -lin GivenName = \n -> { s = n.s; g = sex2gender n.g; n = Sg } ; -lin MaleSurname = \n -> { s = n.s ! Male ; g = Masc; n = Sg } ; -lin FemaleSurname = \n -> { s = n.s ! Female ; g = Fem; n = Sg } ; -lin PlSurname = \n -> { s = n.s ! Male ; g = Masc; n = Pl } ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! c ; - g = sex2gender gn.g ; - n = Sg - } ; - lin PassVPSlash vp = insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) ** { c1 = subjPrep vp.c2 } ; @@ -176,7 +168,7 @@ lin PastPartAgentAP vp np = in { s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3 ++ vp.a2 ++ agent ++ vp.adj ++ vp.inf.inpl.p2 - ++ vp.c2.s -- junk if not TV + ++ vp.c2.s ! GPl -- junk if not TV ++ vp.ext ++ (vp.inf.extr ! a) ++ vp.s.s ! VPastPart af ; isPre = True ; c = <[],[]> ; @@ -195,4 +187,118 @@ lin CompoundN a x = g = x.g } ; + +-- Reflexive noun phrases -- (HL 5/2022: improved and completed, RNPList added) + + lincat + RNP = {s : Agr => Case => Str ; rc,ext : Str ; isPron : Bool} ; -- Case, not PCase !!! + RNPList = {s1,s2 : Agr => Case => Str} ; + + linref + RNP = \rnp -> rnp.s ! AgSgP3 Masc ! Acc ++ rnp.ext ++ rnp.rc ; + + lin + ReflRNP vps rnp = + insertObjReflNP rnp vps ; + + ReflPron = { -- with personal pronoun nominative + s = ResGer.reflPron ; rc,ext = [] ; isPron = True } ; + + -- We might define ReflPron by the stronger reflPronSelf below, using "selbst" + -- to distinguish personal pronoun from reflexive pronoun: + -- du kennst mich vs. ich kenne mich selbst + -- er kennt ihn vs. er kennt sich (selbst) + -- sie kennen sich (selbst) =/= sie kennen einander + + ReflPoss num cn = + {s = \\a,c => let adjf = case num.n of {Sg => Strong ; Pl => Weak} -- Duden 477, HL 5/2022 + in possPron a num.n cn.g c ++ num.s ! cn.g ! c -- HL 5/2022: meine wenigstens 3 cn, + ++ cn.s ! adjfCase adjf c ! num.n ! c -- not: wenigstens 3 meine cn + ++ cn.adv ; + ext = cn.ext ; rc = cn.rc ! num.n ; + isPron = False} ; + + -- We might define ReflPoss by the stronger reflPossPron below, using "eigen(er)" + -- to distinguish possessive pronoun from reflexive possessive pronoun: + -- du kennst meine Fehler vs. ich kenne meine eigenen Fehler + -- er|sie|es kennt seine|ihre Fehler vs. er|sie|es kennt seine|ihre|seine eigenen Fehler + + PredetRNP pred rnp = rnp ** { -- HL 5/2022 + s = \\a,c => let n : Number = case pred.a of {PAg n => n ; _ => numberAgr a} ; + g : Gender = genderAgr a ; + d = case pred.c.k of {NoCase => c ; PredCase k => (prepC k).c} ; + in case rnp.isPron of { + True => pred.s ! Pl ! Masc ! c ++ "von" ++ rnp.s ! a ! Dat ; + _ => pred.s ! n ! genderAgr a ! c ++ pred.c.p ++ rnp.s ! a ! d} ; + ext = rnp.ext ; rc = rnp.rc ; + isPron = False} ; + -- ok: alle von uns; die meisten von uns ; wrong: *nur von uns =/= nur wir +{- + AdvRNP np prep rnp = {s = \\a,c => np.s ! c + ++ appPrep prep (rnp.s ! a) ++ rnp.ext ++ rnp.rc ; + ext = np.ext ; rc = np.rc ; isPron = False} ; + + AdvRAP ap prep rnp = + let -- ? adv ++ ap.s ! af + adv = appPrep prep (rnp.s ! agrP3 Sg) ; -- bug: fixed agreement + in ap ** { s = \\af => ap.s ! af ++ adv } ; -- e.g. unknown in one's youth + + ReflA2RNP adj rnp = -- would need AP.c : Agr => Str*Str, not AP.c : Str*Str + let -- as we have no reflexive AP, + compl = appPrep adj.c2 (rnp.s ! agrP3 Sg) ; -- we use a fixed agreement + in { + s = adj.s ! Posit ; + isPre = True ; + c = case adj.c2.isPrep of {False => ; True => <[], compl>} ; + ext = rnp.ext ++ rnp.rc + } ; + + PossPronRNP pron num cn rnp = + GrammarGer.DetCN (GrammarGer.DetQuant (GrammarGer.PossPron pron) num) + (GrammarGer.PossNP cn (lin NP {s = \\pc => -- usePrepC pc (\c -> rnp.s ! pron.a ! c) ; + rnp.s ! pron.a ! pc ; + a = pron.a ; + w = WLight ; + ext = rnp.ext ; + rc = rnp.rc})) ; + + -- AdvRVP : VP -> Prep -> RNP -> VP not implemented, as the reflexive adverb (Prep + RNP): Agr => Str + -- could only be added to vp.a2:Str with fixed agreement, but can depend on nominal subject or object, + -- e.g. "er spricht mit ihr über sein Kind" vs. "er spricht mit ihr über ihr Kind". +-} + ConjRNP conj rnps = conjunctDistrTable2 Agr Case conj rnps + ** {isPron = False ; ext,rc = []} ; + + Base_rr_RNP x y = twoTable2 Agr Case x y ; + Base_nr_RNP x y = twoTable2 Agr Case {s = \\_,c => x.s ! False ! c ++ x.ext ++ x.rc} y ; + Base_rn_RNP x y = twoTable2 Agr Case x {s = \\_,c => y.s ! False ! c ++ y.ext ++ y.rc} ; + + Cons_rr_RNP x xs = consrTable2 Agr Case comma x xs ; + Cons_nr_RNP x xs = consrTable2 Agr Case comma {s = \\_,c => x.s ! False ! c ++ x.ext ++ x.rc} xs ; +{- + oper +-- reflPronSelf : Agr => Case => Str = \\a => \\c => reflPron ! a ! c ++ "selbst" ; + + -- reflPossPron : Agr -> Number -> Gender -> Case -> Str = + -- let eigen = adjForms "eigen" "eigen" in + -- \a,n,g,c -> possPron a n g c ++ (eigen ! (AMod (gennum g n) c)) ; + + insertObjReflNP : RNP -> ResGer.VPSlash -> ResGer.VP = -- HL 5/2022 + \rnp,vp -> insertObjRNP rnp vp.c2 vp ; + + insertObjRNP : RNP -> Preposition -> ResGer.VPSlash -> ResGer.VP = -- HL 5/2022 + \rnp,prep,vp -> -- generalize ResGer.insertObjRefl + let -- prep = vp.c2 ; + c = case prep.c of { NPC cc => cc ; _ => Acc } ; -- put rnp.ext ++ rnp.rc to vp.ext ? + obj : Agr => Str = \\a => prep.s ++ rnp.s ! a ! c ++ rnp.ext ++ rnp.rc + in vp ** { + nn = \\a => + let vpnn = vp.nn ! a in + case of { -- consider non-pron rnp as light, add to vpnn.p2 + => ; -- pronoun switch: + => ; -- accPron < pron + => ; -- < non-pron nominal + => } -- or prepositional + } ; +-} } diff --git a/src/german/ExtraGer.gf b/src/german/ExtraGer.gf index 848139163..7772ea5ba 100644 --- a/src/german/ExtraGer.gf +++ b/src/german/ExtraGer.gf @@ -29,29 +29,28 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** ICompAP ap = {s = \\_ => "wie" ++ ap.s ! APred ; ext = ap.c.p1 ++ ap.c.p2 ++ ap.ext} ; - CompIQuant iq = {s = table {Ag g n p => iq.s ! n ! g ! Nom} ; ext = ""} ; + CompIQuant iq = {s = table {a => iq.s ! numberAgr a ! genderAgr a ! Nom} ; ext = ""} ; IAdvAdv adv = {s = "wie" ++ adv.s} ; DetNPMasc det = { - s = \\c => det.sp ! Masc ! c ; + s = \\b,c => det.sp ! b ! Masc ! c ; a = agrgP3 Masc det.n ; - w = WLight ; + w = case det.isDef of {True => WLight ; _ => WHeavy} ; ext, rc = [] } ; DetNPFem det = { - s = \\c => det.sp ! Fem ! c ; + s = \\b,c => det.sp ! b ! Fem ! c ; a = agrgP3 Fem det.n ; - w = WLight ; + w = case det.isDef of {True => WLight ; _ => WHeavy} ;--WLight ; ext, rc = [] } ; EmptyRelSlash slash = { s = \\m,t,a,p,gn => - appPrep slash.c2 (\\k => usePrepC k (\c -> relPron ! gn ! c)) ++ - slash.s ! m ! t ! a ! p ! Sub ; - c = (prepC slash.c2.c).c + appPrep slash.c2 (relPron ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ; + c = slash.c2.c } ; PassVPSlash vp = @@ -83,7 +82,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** in { s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3 ++ vp.a2 ++ agent ++ vp.adj ++ vp.inf.inpl.p2 - ++ vp.c2.s -- junk if not TV + ++ vp.c2.s ! GPl -- junk if not TV ++ vp.ext ++ (vp.inf.extr ! a) ++ vp.s.s ! VPastPart af ; isPre = True ; c = <[],[]> ; @@ -100,7 +99,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** PredVPS np vpi = let - subj = np.s ! NPC Nom ++ bigNP np ; + subj = np.s ! False ! Nom ++ bigNP np ; agr = np.a ; in { s = \\o => @@ -120,12 +119,13 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** Sub => True ; -- glue prefix to verb _ => False } ; + vagr = agr2vagr agr ; b = p.p ; a = tm.a ; t = tm.t ; m = tm.m ; subj = [] ++ tm.s ++ p.s ; - verb = vps.s ! ord ! agr ! VPFinite m t a ; + verb = vps.s ! ord ! vagr ! VPFinite m t a ; haben = verb.inf2 ; neg = tm.s ++ p.s ++ vp.a1 ++ negation ! b ; -- HL 8/19 ++ vp.a1 ! b ; -- obj1 = (vp.nn ! agr).p1 ; @@ -177,13 +177,13 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** RNPList = {s1,s2 : Agr => Case => Str} ; linref - RNP = \rnp -> rnp.s ! (Ag Masc Sg P3) ! Acc ++ rnp.ext ++ rnp.rc ; + RNP = \rnp -> rnp.s ! AgSgP3 Masc ! Acc ++ rnp.ext ++ rnp.rc ; lin ReflRNP vps rnp = - insertObjReflNP vps rnp ; + insertObjReflNP rnp vps ; - ReflPron = { -- personal pronoun, with "sich" in P3 Sg + ReflPron = { -- with personal pronoun nominative s = ResGer.reflPron ; rc,ext = [] ; isPron = True } ; -- We might define ReflPron by the stronger reflPronSelf below, using "selbst" @@ -206,38 +206,38 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** -- er|sie|es kennt seine|ihre Fehler vs. er|sie|es kennt seine|ihre|seine eigenen Fehler PredetRNP pred rnp = rnp ** { -- HL 5/2022 - s = \\a,c => let n = case pred.a of {PAg n => n ; _ => numberAgr a} ; + s = \\a,c => let n : Number = case pred.a of {PAg n => n ; _ => numberAgr a} ; g = genderAgr a ; - d = case pred.c.k of {NoCase => c ; PredCase k => (prepC k).c} ; + d = case pred.c.k of {NoCase => c ; PredCase k => k} ; in case rnp.isPron of { - True => pred.s ! Pl ! Masc ! (NPC c) ++ "von" ++ rnp.s ! a ! Dat ; - _ => pred.s ! n ! genderAgr a ! (NPC c) ++ pred.c.p ++ rnp.s ! a ! d} ; + True => pred.s ! Pl ! Masc ! c ++ "von" ++ rnp.s ! a ! Dat ; + _ => pred.s ! n ! genderAgr a ! c ++ pred.c.p ++ rnp.s ! a ! d} ; ext = rnp.ext ; rc = rnp.rc ; isPron = False} ; -- ok: alle von uns; die meisten von uns ; wrong: *nur von uns =/= nur wir - AdvRNP np prep rnp = {s = \\a,c => np.s ! (NPC c) - ++ appPrepC prep (rnp.s ! a) ++ rnp.ext ++ rnp.rc ; + AdvRNP np prep rnp = {s = \\a,c => np.s ! False ! c + ++ appPrep prep (rnp.s ! a) ++ rnp.ext ++ rnp.rc ; ext = np.ext ; rc = np.rc ; isPron = False} ; AdvRAP ap prep rnp = let -- ? adv ++ ap.s ! af - adv = appPrepC prep (rnp.s ! agrP3 Sg) ; -- bug: fixed agreement + adv = appPrep prep (rnp.s ! agrP3 Sg) ; -- bug: fixed agreement in ap ** { s = \\af => ap.s ! af ++ adv } ; -- e.g. unknown in one's youth ReflA2RNP adj rnp = -- would need AP.c : Agr => Str*Str, not AP.c : Str*Str let -- as we have no reflexive AP, - compl = appPrepC adj.c2 (rnp.s ! agrP3 Sg) ; -- we use a fixed agreement + compl = appPrep adj.c2 (rnp.s ! agrP3 Sg) ; -- we use a fixed agreement in { s = adj.s ! Posit ; isPre = True ; - c = case adj.c2.isPrep of {False => ; True => <[], compl>} ; + c = case adj.c2.isPrep of {isCase => ; _ => <[], compl>} ; ext = rnp.ext ++ rnp.rc } ; PossPronRNP pron num cn rnp = N.DetCN (N.DetQuant (N.PossPron pron) num) - (N.PossNP cn (lin NP {s = \\pc => usePrepC pc (\c -> rnp.s ! pron.a ! c) ; + (N.PossNP cn (lin NP {s = \\_,c => rnp.s ! pron.a ! c ; a = pron.a ; w = WLight ; ext = rnp.ext ; @@ -251,11 +251,11 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** ** {isPron = False ; ext,rc = []} ; Base_rr_RNP x y = twoTable2 Agr Case x y ; - Base_nr_RNP x y = twoTable2 Agr Case {s = \\_,c => x.s ! (NPC c) ++ x.ext ++ x.rc} y ; - Base_rn_RNP x y = twoTable2 Agr Case x {s = \\_,c => y.s ! (NPC c) ++ y.ext ++ y.rc} ; + Base_nr_RNP x y = twoTable2 Agr Case {s = \\_,c => x.s ! False ! c ++ x.ext ++ x.rc} y ; + Base_rn_RNP x y = twoTable2 Agr Case x {s = \\_,c => y.s ! False ! c ++ y.ext ++ y.rc} ; Cons_rr_RNP x xs = consrTable2 Agr Case comma x xs ; - Cons_nr_RNP x xs = consrTable2 Agr Case comma {s = \\_,c => x.s ! (NPC c) ++ x.ext ++ x.rc} xs ; + Cons_nr_RNP x xs = consrTable2 Agr Case comma {s = \\_,c => x.s ! False ! c ++ x.ext ++ x.rc} xs ; oper reflPronSelf : Agr => Case => Str = \\a => \\c => reflPron ! a ! c ++ "selbst" ; @@ -264,10 +264,26 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** let eigen = adjForms "eigen" "eigen" in \a,n,g,c -> possPron a n g c ++ (eigen ! (AMod (gennum g n) c)) ; - insertObjReflNP : ResGer.VPSlash -> RNP -> ResGer.VP = -- HL 5/2022 - \vp,rnp -> -- generalize ResGer.insertObjRefl - let prep = vp.c2 ; - c = case prep.c of { NPC cc => cc ; _ => Acc } ; -- put rnp.ext ++ rnp.rc to vp.ext ? + insertObjReflNP : RNP -> ResGer.VPSlash -> ResGer.VP = -- HL 5/2022 + \rnp,vp -> insertObjRNP rnp vp.c2 vp ; + + insertObjRNP : RNP -> Preposition -> ResGer.VPSlash -> ResGer.VP = -- HL 5/2022 + \rnp,prep,vp -> -- generalize ResGer.insertObjRefl + let -- prep = vp.c2 ; + c : Case = case prep.c of { cc => cc ; _ => Acc } ; -- put rnp.ext ++ rnp.rc to vp.ext ? + obj : Agr => Str = \\a => prep.s ! GPl ++ rnp.s ! a ! c ++ rnp.ext ++ rnp.rc + in vp ** { + nn = \\a => + let vpnn = vp.nn ! a in + case of { -- consider non-pron rnp as light, add to vpnn.p2 + => ; -- pronoun switch: + => ; -- accPron < pron + => ; -- < non-pron nominal + <_,_,_> => } -- or prepositional + } ; +{- insertObjRNP : RNP -> Preposition -> ResGer.VPSlash -> ResGer.VPSlash = -- HL 8/2023 + \rnp,prep,vp -> -- generalize ResGer.insertObjNP + let c = case prep.c of { NPC cc => cc ; _ => Acc } ; obj : Agr => Str = \\a => prep.s ++ rnp.s ! a ! c ++ rnp.ext ++ rnp.rc in vp ** { nn = \\a => @@ -278,7 +294,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** => ; -- < non-pron nominal => } -- or prepositional } ; - +-} -- SS: implementation of some of the relevant Foc rules from Extra lincat @@ -298,8 +314,8 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** -- "treu ist sie ihm" -- "froh ist sie dass er da ist" -- "stolz ist sie auf ihn" - subj = mkSubj np vp.c1 ; - cl = mkClause subj.p1 subj.p2 vp + subj = mkSubject np vp.c1 ; + cl = mkClause subj.s subj.a vp in mkFoc adj cl ; UseFoc t p f = {s = t.s ++ p.s ++ f.s ! t.m ! t.t ! t.a ! p.p} ; @@ -333,9 +349,9 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** AdvFor adv fcl = fcl ** {a2 = adv.s} ; - FtoCl cl = - let subj = mkSubj cl.subj cl.c1 - in DisToCl subj.p1 subj.p2 cl ; + FtoCl cl = + let subj = mkSubject cl.subj cl.c1 + in DisToCl subj.s subj.a cl ; oper -- extra operations for ExtraGer @@ -344,9 +360,9 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** lin Foc {s = \\m,t,a,p => focus ++ cl.s ! m ! t ! a ! p ! Inv} ; esSubj : CatGer.NP = lin NP { - s = \\_ => "es" ; + s = \\_,_ => "es" ; rc, ext = [] ; - a = Ag Neutr Sg P3 ; + a = AgSgP3 Neutr ; w = WPron } ; @@ -358,7 +374,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** Sub => True ; -- glue prefix to verb _ => False } ; - verb = vps.s ! ord ! agr ! VPFinite m t a ; + verb = vps.s ! ord ! agr2vagr agr ! VPFinite m t a ; neg = vp.a1 ++ negation ! b ; -- HL 8/19 vp.a1 ! b ; obj1 = (vp.nn ! agr).p1 ; obj2 = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ; diff --git a/src/german/ExtraGerAbs.gf b/src/german/ExtraGerAbs.gf index 54c29f61c..e63d01154 100644 --- a/src/german/ExtraGerAbs.gf +++ b/src/german/ExtraGerAbs.gf @@ -29,7 +29,7 @@ abstract ExtraGerAbs = Extra [ Pass3V3 : V3 -> VPSlash ; -- wir bekommen den Beweis erklärt - -- further constructions usin RNP, declared in abstract/Extra.gf: + -- further constructions using RNP, declared in abstract/Extra.gf or Extend.gf: AdvRNP : NP -> Prep -> RNP -> RNP ; -- a dispute with his wife AdvRVP : VP -> Prep -> RNP -> VP ; -- lectured about her travels @@ -39,4 +39,5 @@ abstract ExtraGerAbs = Extra [ -- NOTE: generalizes ReflA2 PossPronRNP : Pron -> Num -> CN -> RNP -> NP ; -- his abandonment of his wife and children + } diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index ea79032a7..5e2a85c28 100644 --- a/src/german/GrammarGer.gf +++ b/src/german/GrammarGer.gf @@ -1,8 +1,8 @@ --# -path=.:../abstract:../common:prelude concrete GrammarGer of Grammar = - NounGer, - VerbGer, + NounGer, + VerbGer, AdjectiveGer, AdverbGer, NumeralGer, @@ -14,7 +14,8 @@ concrete GrammarGer of Grammar = TextX - [Tense,Temp], IdiomGer, StructuralGer, - TenseGer + TenseGer, + NamesGer ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/german/IdiomGer.gf b/src/german/IdiomGer.gf index 4802a1dd6..0d8d65fa5 100644 --- a/src/german/IdiomGer.gf +++ b/src/german/IdiomGer.gf @@ -10,7 +10,7 @@ concrete IdiomGer of Idiom = CatGer ** CleftNP np rs = mkClause "es" (agrP3 Sg) (insertExtrapos (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ---- - (insertObj (\\_ => np.s ! NPC rs.c ++ bigNP np) (predV MorphoGer.sein_V))) ; + (insertObj (\\_ => np.s ! False ! rs.c ++ bigNP np) (predV MorphoGer.sein_V))) ; CleftAdv ad s = mkClause "es" (agrP3 Sg) (insertExtrapos (conjThat ++ s.s ! Sub) @@ -19,14 +19,13 @@ concrete IdiomGer of Idiom = CatGer ** ExistNP np = mkClause "es" (agrP3 Sg) - (insertObj (\\_ => appPrep geben.c2 np.s ++ bigNP np) + (insertObj (\\_ => appPrep geben.c2 (np.s ! False) ++ bigNP np) (predV geben)) ; ExistIP ip = { s = \\m,t,a,p => let - cls = - (mkClause "es" (agrP3 Sg) (predV geben)).s ! m ! t ! a ! p ; + cls = (mkClause "es" (agrP3 Sg) (predV geben)).s ! m ! t ! a ! p ; who = ip.s ! Acc in table { QDir => who ++ cls ! Inv ; @@ -36,7 +35,7 @@ concrete IdiomGer of Idiom = CatGer ** ExistNPAdv np adv= mkClause "es" (agrP3 Sg) - (insertAdv adv.s (insertObj (\\_ => appPrep geben.c2 np.s ++ bigNP np) + (insertAdv adv.s (insertObj (\\_ => appPrep geben.c2 (np.s ! False) ++ bigNP np) (predV geben))) ; ExistIPAdv ip adv = { @@ -54,19 +53,19 @@ concrete IdiomGer of Idiom = CatGer ** ProgrVP = insertAdv "eben" ; ---- ImpPl1 vp = {s = - (mkClause "wir" (Ag Fem Pl P1) vp).s ! + (mkClause "wir" (AgPl P1) vp).s ! MConjunct ! Pres ! Simul ! Pos ! Inv } ; ImpP3 np vp = { - s = (mkClause ((mkSubj np vp.c1).p1) np.a vp).s ! + s = (mkClause ((mkSubject np vp.c1).s) np.a vp).s ! MConjunct ! Pres ! Simul ! Pos ! Inv } ; SelfAdvVP vp = insertAdv "selbst" vp ; SelfAdVVP vp = insertAdv "selbst" vp ; SelfNP np = np ** { - s = \\c => np.s ! c ++ "selbst" ++ bigNP np ; + s = \\b,c => np.s ! b ! c ++ "selbst" ++ bigNP np ; isPron = False ; } ; diff --git a/src/german/LangGer.gf b/src/german/LangGer.gf index 811ae3b75..640144ba3 100644 --- a/src/german/LangGer.gf +++ b/src/german/LangGer.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../api:../prelude -concrete LangGer of Lang = +concrete LangGer of Lang = GrammarGer, LexiconGer ,ConstructionGer diff --git a/src/german/LexiconGer.gf b/src/german/LexiconGer.gf index 93a39cac9..8c2714a78 100644 --- a/src/german/LexiconGer.gf +++ b/src/german/LexiconGer.gf @@ -13,6 +13,7 @@ flags lin add_V3 = dirV3 (prefixV "hinzu" (regV "fügen")) zu_Prep ; airplane_N = mkN "Flugzeug" "Flugzeuge" neuter ; + alas_Interj = {s = "ach"} ; already_Adv = mkAdv "schon" ; answer_V2S = mkV2S (regV "antworten") datPrep ; apartment_N = mkN "Wohnung" ; @@ -58,7 +59,7 @@ lin clever_A = mk3A "klug" "klüger" "klügste" ; close_V2 = dirV2 Irreg.schließen_V ; coat_N = mkN "Jacke" | mkN "Mantel" "Mantel" masculine; - cold_A = regA "kalt" ; + cold_A = mk3A "kalt" "kälter" "kälteste" ; come_V = seinV (mk6V "kommen" "kommt" "komm" "kam" "käme" "gekommen") ; computer_N = reg2N "Rechner" "Rechner" masculine ; country_N = reg2N "Land" "Länder" neuter ; @@ -185,7 +186,7 @@ lin sock_N = reg2N "Strumpf" "Strümpfe" masculine ; song_N = reg2N "Lied" "Lieder" neuter ; speak_V2 = dirV2 Irreg.sprechen_V ; - star_N = mkN "Sterne" ; + star_N = mkN "Stern" ; steel_N = mkN "Stahl" ; stone_N = mkN "Stein" ; stop_V = seinV Irreg.halten_V ; @@ -211,7 +212,8 @@ lin dirV2 (irregV "verstehen" "versteht" "verstand" "verstände" "verstanden") ; university_N = reg2N "Universität" "Universitäten" feminine ; village_N = reg2N "Dorf" "Dörfer" neuter ; - wait_V2 = prepV2 (regV "warten") (mkPrep "auf" accusative) ; +-- wait_V2 = prepV2 (regV "warten") (mkPrep "auf" accusative) ; + wait_V2 = prepV2 (regV "warten") (mkPrep "auf" "auf den" "auf die" ("aufs" | "auf das") accusative); walk_V = seinV Irreg.gehen_V ; warm_A = mk3A "warm" "wärmer" "wärmste" ; war_N = mkN "Krieg" ; @@ -235,14 +237,14 @@ lin dry_A = regA "trocken" ; dull_A = regA "stumpf" ; full_A = regA "voll" ; - heavy_A = mkA "schwer" "schwere" "schwerer" "schwerste" ; + heavy_A = mkA "schwer" "schwerer" "schwerste" ; near_A = mk3A "nahe" "näher" "nächste" ; rotten_A = regA "verdorben" ; round_A = regA "rund" ; sharp_A = mk3A "scharf" "schärfer" "schärfste" ; smooth_A = regA "glatt" ; straight_A = regA "gerade" ; - wet_A = regA "naß" ; + wet_A = mk4A "naß" "nass" "nasser" "nasseste" ; wide_A = regA "breit" ; animal_N = reg2N "Tier" "Tiere" neuter ; ashes_N = mkN "Asche" ; @@ -295,7 +297,7 @@ lin sand_N = mkN "Sand" ; seed_N = mkN "Same" ; skin_N = mkN "Haut" "Häute" feminine ; - sky_N = mkN "Himmel" ; ---- pl + sky_N = mkN "Himmel" ; smoke_N = mkN "Rauch" ; snow_N = mkN "Schnee" "Schneen" masculine ; ---- pl stick_N = mkN "Stock" "Stöcke" masculine ; diff --git a/src/german/MakeStructuralGer.gf b/src/german/MakeStructuralGer.gf index 6b2482a03..be9dab510 100644 --- a/src/german/MakeStructuralGer.gf +++ b/src/german/MakeStructuralGer.gf @@ -17,7 +17,7 @@ oper c = noCase ; a = PAgNone } ; - mkPredet : A -> Str -> PCase -> Bool -> Number -> Predet = \a,p,c,b,n -> + mkPredet : A -> Str -> Case -> Bool -> Number -> Predet = \a,p,c,b,n -> lin Predet { s = appAdj a ; c = {p = p ; k = PredCase c} ; @@ -27,11 +27,11 @@ oper -- e.g. das selbe mmkQuant : Quant -> A -> Quant = \q,a -> q ** { - s,sp = \\x,n,g,c => q.s ! x ! n ! g ! c ++ a.s ! Posit ! agrAdj g q.a n ((prepC c).c) + s,sp = \\b,x,n,g,c => q.s ! b ! x ! n ! g ! c ++ a.s ! Posit ! agrAdj g q.a n c } ; -- e.g. derjenige mmbQuant : Quant -> A -> Quant = \q,a -> q ** { - s,sp = \\x,n,g,c => q.s ! x ! n ! g ! c + a.s ! Posit ! agrAdj g q.a n ((prepC c).c) + s,sp = \\b,x,n,g,c => q.s ! b ! x ! n ! g ! c + a.s ! Posit ! agrAdj g q.a n c } ; } diff --git a/src/german/MarkupGer.gf b/src/german/MarkupGer.gf index 79fe7c95e..b3e410cd0 100644 --- a/src/german/MarkupGer.gf +++ b/src/german/MarkupGer.gf @@ -1,10 +1,10 @@ ---# -path=.:../abstract:../common +--# -path=.:../abstract:../common:../prelude: -concrete MarkupGer of Markup = CatGer, MarkHTMLX ** { +concrete MarkupGer of Markup = CatGer, MarkHTMLX ** open Prelude in { lin MarkupCN m cn = cn ** {s = \\a,n,c => appMark m (cn.s ! a ! n ! c)} ; --- other fields e.g ext intact - MarkupNP m np = np ** {s = \\c => appMark m (np.s ! c)} ; + MarkupNP m np = np ** {s = \\b,c => appMark m (np.s ! b ! c)} ; MarkupAP m ap = ap ** {s = \\a => appMark m (ap.s ! a)} ; MarkupAdv m adv = {s = appMark m adv.s} ; MarkupS m s = {s = \\o => appMark m (s.s ! o)} ; diff --git a/src/german/MorphoGer.gf b/src/german/MorphoGer.gf index 05df59961..dc46adc7a 100644 --- a/src/german/MorphoGer.gf +++ b/src/german/MorphoGer.gf @@ -17,24 +17,25 @@ oper -- For $StructuralGer$. - mkPrep : Str -> PCase -> Preposition = \s,c -> - {s = s ; s2 = [] ; c = c ; isPrep = True} ; + mkPrep : Str -> Case -> Preposition = \s,c -> + {s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep} ; - nameNounPhrase : Gender -> {s : Case => Str} -> {s : PCase => Str ; - a : Agr ; - w : Weight ; - ext,rc : Str} = - \g,name -> heavyNP { - s = \\c => usePrepC c (\k -> name.s ! k) ; - a = agrgP3 g Sg + nameNounPhrase : Gender -> {s : Case => Str} -> {s : Bool => Case => Str ; + a : Agr ; + w : Weight ; + ext,rc : Str} = + \g,name -> { + s = \\_,c => name.s ! c ; + a = agrgP3 g Sg ; + ext,rc = [] ; + w = WHeavy -- ok? } ; - detLikeAdj : Bool -> Number -> Str -> - {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> + detLikeAdj : Bool -> Number -> Str -> + {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> {s,sp = appAdj (regA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; - - detUnlikeAdj : Bool -> Number -> Str -> - {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> + detUnlikeAdj : Bool -> Number -> Str -> + {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> {s,sp = appAdj (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; mkOrd : {s : Degree => AForm => Str} -> {s : AForm => Str} = \a -> diff --git a/src/german/NamesGer.gf b/src/german/NamesGer.gf new file mode 100644 index 000000000..5f6f8391c --- /dev/null +++ b/src/german/NamesGer.gf @@ -0,0 +1,86 @@ +concrete NamesGer of Names = CatGer ** open ResGer, Prelude, (P=ParadigmsGer) in { + +lin GivenName gn = { + s = \\_,c => gn.s ! c ; + a = agrgP3 (sex2gender gn.g) Sg ; + w = WLight ; + rc, ext = [] + } ; + +lin MaleSurname sn = { + s = \\_,c => sn.s ! Male ! c ; + a = agrgP3 Masc Sg ; + w = WLight ; + rc, ext = [] + } ; + +lin FemaleSurname sn = { + s = \\_,c => sn.s ! Female ! c ; + a = agrgP3 Fem Sg ; + w = WLight ; + rc, ext = [] + } ; + +lin PlSurname sn = { + s = \\_,c => sn.s ! Male ! c ; + a = agrgP3 Masc Pl ; + w = WLight ; + rc, ext = [] + } ; + +lin FullName gn sn = { + s = \\_,c => gn.s ! Nom ++ sn.s ! gn.g ! c ; + a = agrgP3 (sex2gender gn.g) Sg ; + w = WLight ; + rc, ext = [] + } ; + +-- UseLN : LN -> NP ; +lin UseLN ln = { + s = \\b,c => case ln.hasArt of { + True => case b of { + True => [] ; -- defart dropped + False => artDef ! (gennum ln.g ln.n) ! c + } ++ + ln.s ! (adjfCase Weak c) ! c ; + False => ln.s ! Strong ! c + } ; + a = agrgP3 ln.g ln.n ; + w = WLight ; + rc, ext = [] + } ; + +-- PlainLN : LN -> NP ; +lin PlainLN ln = { + s = \\_,c => ln.s ! Strong ! c ; + a = agrgP3 ln.g ln.n ; + w = WLight ; + rc, ext = [] + } ; + +-- InLN : LN -> Adv ; +lin InLN ln = { + s = appPrepNP P.inDat_Prep { + s = \\b,c => case ln.hasArt of { + True => case b of { + True => [] ; -- defart dropped + False => artDef ! (gennum ln.g ln.n) ! c + } ++ + ln.s ! (adjfCase Weak c) ! c ; + False => ln.s ! Strong ! c + } ; + a = agrgP3 ln.g ln.n ; + w = WLight ; + rc, ext = [] + } + } ; + +-- AdjLN : AP -> LN -> LN ; +lin AdjLN ap ln = ln ** { + s = \\a,c => + preOrPost ap.isPre + (ap.c.p1 ++ ap.c.p2 ++ ap.s ! agrAdj ln.g a ln.n c ++ ap.ext) + (ln.s ! a ! c) ; + } ; + +} diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 848fd6de9..558ab8a14 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -1,80 +1,70 @@ +--# -path=.:../abstract:../common: concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { flags optimize=all_subs ; --- Remark: np.isLight makes ResGer.insertObjNP expensive, for ComplSlash, SlashVP + -- HL 21.7.2022: the dropping of DefArt in Prep+DefArt works by selecting from + -- np.s via b = det.hasDefArt = True the forms without det.s and from prep.s + -- the preposition glued with definite article singular, depending on gender, case. lin DetCN det cn = { - s = \\c => det.s ! cn.g ! c ++ - (let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k ++ cn.adv) ; - a = agrgP3 cn.g det.n ; + s = \\b,c => det.s ! b ! cn.g ! c ++ cn.s ! (adjfCase det.a c) ! det.n ! c ++ cn.adv ; + a = agrgP3 cn.g det.n ; -- isLight = det.isDef ; -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann - -- isPron = False ; -- HL 6/2019 (but:) sehe (die|einige) Männer nicht - -- don't see a|no man = sehe keinen Mann - w = case det.isDef of { True => WLight ; _ => WHeavy } ; - rc = cn.rc ! det.n ; - ext = cn.ext + -- HL 6/2019 (but:) sehe (die|einige) Männer nicht; don't see a|no man = sehe keinen Mann + w = case det.isDef of { True => case det.hasDefArt of { True => WDefArt ; + _ => WLight } ; + _ => WHeavy } ; + rc = cn.rc ! det.n ; + ext = cn.ext } ; - DetNP det = { - s = \\c => det.sp ! Neutr ! c ; -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en + DetNP det = { -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en + s = \\b,c => det.sp ! b ! Neutr ! c ; a = agrP3 det.n ; - -- isLight = det.isDef ; -- isPron = False ; -- HL 6/2019: don't apply pronoun switch: ich gebe ihr das vs. ich gebe es ihr w = case det.isDef of { True => WLight ; _ => WHeavy } ; rc, ext = [] } ; UsePN pn = { - s = \\c => usePrepC c (\k -> pn.s ! k) ; + s = \\_,c => pn.s ! c ; a = agrgP3 pn.g pn.n ; --- isLight = True ; -- means: this is not a heavy NP, but comes before negation --- isPron = False ; -- HL 6/2019: to regulate Pron/NonPronNP order - w = WLight ; - rc, ext = [] + w = WLight ; -- means: this is not a heavy NP, but comes before negation + rc, ext = [] -- Pron => Light, HL 6/2019: to regulate Pron/NonPronNP order } ; UsePron pron = { - s = \\c => usePrepC c (\k -> pron.s ! NPCase k) ; + s = \\_,c => pron.s ! NPCase c ; a = pron.a ; - -- isLight = True ; - -- isPron = True ; w = WPron ; rc, ext = [] } ; PredetNP pred np = let ag = case pred.a of {PAg n => agrP3 n ; _ => np.a} in np ** { - s = \\c0 => + s = \\b,c0 => let c = case pred.c.k of {NoCase => c0 ; PredCase k => k} in - pred.s ! numberAgr ag ! genderAgr np.a ! c0 ++ pred.c.p ++ np.s ! c ; + pred.s ! numberAgr ag ! genderAgr np.a ! c0 ++ pred.c.p ++ np.s ! b ! c ; a = ag ; - -- isLight = False ; - -- isPron = False - w = WHeavy + w = WHeavy } ; PPartNP np v2 = np ** { - s = \\c => np.s ! c ++ embedInCommas (v2.s ! VPastPart APred) ; --- invar part --- isPron = False + s = \\b,c => np.s ! b ! c ++ embedInCommas (v2.s ! VPastPart APred) ; --- invar part w = WHeavy } ; - {- "eine erfolgreiche Frau, geliebt von vielen," but only with v2 not possible in German? - HL: PPartNP np vps|vp: "der Autor, heute vergessen" , "der Mond, gerade aufgegangen," - -} + -- SS: "eine erfolgreiche Frau, geliebt von vielen," but only with v2 not possible in German? + -- HL: PPartNP np vps|vp: "der Autor, heute vergessen" , "der Mond, gerade aufgegangen," AdvNP np adv = np ** { - s = \\c => np.s ! c ++ adv.s ; - -- isLight = False ; - -- isPron = False + s = \\b,c => np.s ! b ! c ++ adv.s ; w = WHeavy } ; ExtAdvNP np adv = np ** { - s = \\c => np.s ! c ++ embedInCommas adv.s ; - -- isLight = False ; - -- isPron = False + s = \\b,c => np.s ! b ! c ++ embedInCommas adv.s ; w = WHeavy } ; @@ -83,35 +73,38 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { n = num.n ; a = quant.a in { - s = \\g,c => quant.s ! num.isNum ! n ! g ! c ++ (let k = (prepC c).c in - num.s!g!k ++ ord.s ! agrAdj g (adjfCase a k) n k) ; - sp = \\g,c => quant.sp ! num.isNum ! n ! g ! c ++ (let k = (prepC c).c in - num.s!g!k ++ ord.s ! agrAdj g (adjfCase quant.aPl k) n k) ; + s = \\b,g,c => quant.s ! b ! num.isNum ! n ! g ! c ++ num.s!g!c + ++ ord.s ! agrAdj g (adjfCase a c) n c ; + sp = \\b,g,c => quant.sp ! b ! num.isNum ! n ! g ! c ++ num.s!g!c + ++ ord.s ! agrAdj g (adjfCase quant.aPl c) n c ; n = n ; a = case n of {Sg => a ; Pl => quant.aPl} ; isDef = case of { => False ; _ => True} ; + hasDefArt = quant.hasDefArt ; } ; DetQuant quant num = let n = num.n ; - a = quant.a + a = quant.a ; + b = andB quant.hasDefArt (case num.n of {Sg => True ; _ => False}) in { - s = \\g,c => quant.s ! num.isNum ! n ! g ! c ++ (let k = (prepC c).c in - num.s!g!k) ; - sp = \\g,c => quant.sp ! num.isNum ! n ! g ! c ++ (let k = (prepC c).c in - num.s!g!k) ; -- HL: der+er,den+en ; der drei,den drei+en + s = \\b,g,c => quant.s ! b ! num.isNum ! n ! g ! c ++ num.s ! g ! c ; + sp = \\_,g,c => quant.sp ! False ! num.isNum ! n ! g ! c ++ num.s ! g ! c ; + -- HL: der+er,den+en ; der drei,den drei+en n = n ; a = case n of {Sg => a ; Pl => quant.aPl} ; isDef = case of { => False ; _ => True} ; + hasDefArt = quant.hasDefArt ; } ; PossPron p = { - s = \\_,n,g,c => usePrepC c (\k -> p.s ! NPPoss (gennum g n) k) ; - sp = \\_,n,g,c => usePrepC c (\k -> p.s ! NPPoss (gennum g n) k) ; + s = \\_,_,n,g,c => p.s ! NPPoss (gennum g n) c ; + sp = \\_,_,n,g,c => p.s ! NPPoss (gennum g n) c ; a = Strong ; aPl = Weak ; + hasDefArt = False ; } ; NumCard n = n ** {isNum = True} ; @@ -122,6 +115,9 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; + NumFloat dig1 dig2 = {s = \\g,c => dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! NCard g c ; n = Pl } ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; + NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; @@ -132,46 +128,42 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { OrdNumeralSuperl n a = {s = \\af => n.s ! NOrd APred ++ Predef.BIND ++ a.s ! Superl ! af} ; -- drittbeste DefArt = { - s = \\_,n,g,c => artDefContr (gennum g n) c ; --- sp = \\_,n,g,c => artDefContr (gennum g n) c ; ---- deren, denen ... - sp = \\_,n,g,c => case of { - => let sp = prepC c ; gn = gennum g n - in sp.s ++ artDef ! gn ! sp.c ; - => let sp = prepC c in sp.s ++ "die" ; - => let sp = prepC c ; gn = gennum g n - in sp.s ++ (artDef ! gn ! sp.c + "en") ; - => "denen" ; -- HL 6/2019 - => "derer" ; -- HL 6/2019 - _ => artDefContr (gennum g n) c } ; -- von den+en - a, aPl = Weak + s = table{True => \\_,n,g,c => [] ; -- definite article dropped + False => \\_,n,g,c => artDef ! (gennum g n) ! c} ; + sp = \\_,_,n,g,c => case of { + => "denen" ; -- HL 6/2019 + => "derer" ; -- HL 6/2019 + _ => artDef ! (gennum g n) ! c } ; -- von den+en + a, aPl = Weak ; + hasDefArt = True } ; IndefArt = { - s = table { - True => \\_,_,c => usePrepC c (\k -> []) ; + s = \\_ => table { + True => \\_,_,c => [] ; False => table { - Sg => \\g,c => usePrepC c (\k -> "ein" + pronEnding ! GSg g ! k) ; - Pl => \\_,c => usePrepC c (\k -> []) + Sg => \\g,c => "ein" + pronEnding ! GSg g ! c ; + Pl => \\_,c => [] } } ; - sp = table { - True => \\_,_,c => usePrepC c (\k -> []) ; + sp = \\_ => table { + True => \\_,_,c => [] ; False => table { - Sg => \\g,c => usePrepC c (\k -> (detUnlikeAdj False Sg "ein").s ! g ! NPC k) ; - Pl => \\_,c => usePrepC c (\k -> caselist "einige" "einige" "einigen" "einiger" ! k) + Sg => \\g,c => (detUnlikeAdj False Sg "ein").s ! g ! c ; + Pl => \\_,c => caselist "einige" "einige" "einigen" "einiger" ! c } } ; - a, aPl = Strong + a, aPl = Strong ; + hasDefArt = False } ; MassNP cn = { - s = \\c => usePrepC c (\k -> cn.s ! Strong ! Sg ! k) ++ cn.adv ; + s = \\_,c => cn.s ! Strong ! Sg ! c ++ cn.adv ; a = agrgP3 cn.g Sg ; - -- isLight = True ; -- ich trinke Bier nicht vs. ich trinke kein Bier - -- isPron = False ; - w = WLight ; + w = WLight ; -- ich trinke Bier nicht vs. ich trinke kein Bier rc = cn.rc ! Sg ; - ext = cn.ext + ext = cn.ext ; + hasDefArt = False } ; UseN, UseN2 = \n -> { @@ -184,8 +176,8 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { ComplN2 f x = { s = \\_,n,c => f.s ! n ! c ++ appPrepNP f.c2 x ; g = f.g ; - rc = \\_ => [] ; - ext,adv = [] + rc = \\_ => [] ; + ext,adv = [] } ; ComplN3 f x = { @@ -221,8 +213,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { ---- another layer of embedInCommas needed if there is a non-empty rc RelNP np rs = np ** { - rc = (np.rc ++ embedInCommas (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a)))) ; - -- isPron = False + rc = np.rc ++ embedInCommas (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ; w = case isPron np of { True => WLight ; _ => np.w } } ; @@ -231,11 +222,51 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { AdvCN cn a = cn ** {adv = cn.adv ++ a.s} ; ApposCN cn np = let g = cn.g in cn ** { - s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPC c ++ bigNP np } ; + s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! c ++ bigNP np } ; PossNP cn np = cn ** { - s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPP CVonDat ++ bigNP np } ; + s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep vonDat (np.s ! False) ++ bigNP np } ; - DetDAP det = det ; + PartNP cn np = case np.w of { + WPron => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep vonDat (np.s ! False) ++ np.rc} ; + _ => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! Gen ++ np.ext ++ np.rc} + }; -- glass of wine + + CountNP det np = -- drei der Kinder | drei von den Kindern -- HL 7/22, ad-hoc TODO + -- det or numeral? np or rather (DefArt +) cn? drei (einiger Kinder) ? + let g : Gender = genderAgr np.a + in { + s = \\b,c => det.s ! b ! g ! c ++ appPrepNP vonDat np ++ bigNP np ; + a = agrgP3 g det.n ; + w = case det.isDef of { True => WLight ; _ => WHeavy } ; + rc = np.rc ; + ext = np.ext + } ; + + AdjDAP dap ap = -- the large (one) -- HL 8/22 der auf dich stolze; die ihm treue; der so dumme, infzu + {s, sp = \\g,c => dap.s ! g ! c ++ ap.c.p1 ++ ap.c.p2 ++ ap.s ! (AMod (gennum g dap.n) c) ++ ap.ext ; + a = dap.a ; n = dap.n ; isDef = dap.isDef ; hasDefArt = dap.hasDefArt } ; + + DetDAP det = { + s = \\g,c => det.s ! False ! g ! c ; -- HL 7/22 todo: check + sp = \\g,c => det.sp ! False ! g ! c ; + n = det.n ; a = det.a ; isDef = det.isDef ; hasDefArt = det.hasDefArt + } ; + + QuantityNP dig m = { + s = \\_,c => preOrPost m.isPre m.s (dig.s ! invNum) ; + a = agrP3 Pl ; + w = WLight ; + rc = "" ; + ext = "" ; + } ; + + QuantityFloatNP dig1 dig2 m = { + s = \\_,c => preOrPost m.isPre m.s (dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! invNum) ; + a = agrP3 Pl ; + w = WLight ; + rc = "" ; + ext = "" ; + } ; } diff --git a/src/german/NumeralGer.gf b/src/german/NumeralGer.gf index befad3c51..eab2cc238 100644 --- a/src/german/NumeralGer.gf +++ b/src/german/NumeralGer.gf @@ -1,4 +1,4 @@ -concrete NumeralGer of Numeral = CatGer [Numeral,Digits] ** open MorphoGer, Prelude in { +concrete NumeralGer of Numeral = CatGer [Numeral,Digits,Decimal] ** open MorphoGer, Prelude in { flags optimize = all_subs ; coding=utf8 ; @@ -12,14 +12,14 @@ lincat lin num x = x ; - n2 = mkDigit "zwei" "zwölf" "zwanzig" "zweite" ; + n2 = mkDigit "zwei" "zwölf" "zwanzig" "zweite" ; n3 = mkDigit "drei" "dreizehn" "dreissig" "dritte" ; - n4 = regDigit "vier" ; - n5 = regDigit "fünf" ; - n6 = regDigit "sechs" ; - n7 = mkDigit "sieben" "siebzehn" "siebzig" "siebte" ; - n8 = mkDigit "acht" "achzehn" "achzig" "achte" ; - n9 = regDigit "neun" ; + n4 = regDigit "vier" ; + n5 = regDigit "fünf" ; + n6 = mkDigit "sechs" "sechzehn" "sechzig" "sechste" ; + n7 = mkDigit "sieben" "siebzehn" "siebzig" "siebte" ; + n8 = mkDigit "acht" "achtzehn" "achtzig" "achte" ; + n9 = regDigit "neun" ; pot01 = { s = \\f => table { @@ -50,12 +50,12 @@ lin pot3plus n m = {s = \\g => multiple n.s n.n ++ "tausend" ++ m.s ! g ; n = Pl} ; pot3as4 n = n ; - pot3float f = {s = \\g => - f.s ++ cardOrd "tausend" "tausendte" ! g ; n = Pl} ; ---- + pot3decimal d = {s = \\g => + d.s ! invNum ++ cardOrd "tausend" "tausendte" ! g ; n = Pl} ; ---- pot4as5 n = n ; - pot4float f = {s = \\g => - f.s ++ cardOrd "Millionen" "Millionte" ! g ; n = Pl} ; ---- + pot4decimal d = {s = \\g => + d.s ! invNum ++ cardOrd "Millionen" "Millionte" ! g ; n = Pl} ; ---- pot51 = {s = \\g => "einer Milliarde"; n = Pl} ; -- KA: case inflection missing @@ -69,17 +69,33 @@ oper Dig = TDigit ; lin - IDig d = d ; + IDig d = {s = table{NCard g c => d.s ! NCard g c ; + NOrd APred => "am" ++ d.s ! invNum ++ BIND ++ "ten"; + NOrd amod => d.s ! NOrd amod} ; + n = d.n ; + isDig = True ; + tail1to19 = notB d.isZero} ; - IIDig d i = { - s = \\o => d.s ! invNum ++ BIND ++ i.s ! o ; - n = Pl - } ; + -- HL 11/2023 added case endings or ordinals to digits + -- NCard Masc Nom (= invNum): 0,1, 19, 20,21,... + -- NOrd (AMid (GSg Masc) Nom): 0ter,1ter,...,19ter, 20ster,21ster,...,99ster, 100ster + -- 101ter,...,119ter,120ster,... , 200ster + IIDig d i = + let isPld : Bool = case d.n of {Sg => False ; _ => True} ; + b : Bool = case i.isDig of {True => isPld ; _ => notB i.tail1to19} ; + i' : Digits = case b of {True => IDig (mkDig (i.s ! invNum ++ BIND ++ "s")) ; + _ => i } + in {s = table {NCard g c => d.s ! invNum ++ BIND ++ i.s ! NCard g c ; + NOrd APred => "am" ++ d.s ! invNum ++ BIND ++ i'.s ! invNum ++ BIND ++ "ten" ; + NOrd af => d.s ! invNum ++ BIND ++ i'.s ! NOrd af} ; + n = Pl ; + isDig = False ; + tail1to19 = case i.isDig of {True => notB isPld ; False => i.tail1to19} + } ; - ---- TODO: case endings of ordinals - D_0 = mkDig "0" ; - D_1 = mk3Dig "1" "1e" Sg ; - D_2 = mk2Dig "2" "2e" ; + D_0 = mk2Dig "0" Sg ** {isZero = True} ; + D_1 = mk2Dig "1" Sg ; + D_2 = mkDig "2" ; D_3 = mkDig "3" ; D_4 = mkDig "4" ; D_5 = mkDig "5" ; @@ -88,18 +104,38 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => case o of { + NOrd APred => "am" ++ "-" ++ BIND ++ d.s ! NOrd (AMod GPl Dat) ; + _ => "-" ++ BIND ++ d.s ! o} ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s=\\o=>d.s ! invNum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl; + hasDot=True + } ; + oper - mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; - mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; + mkDig : Str -> TDigit = \c -> mk2Dig c Pl ; + + mk2Dig : Str -> Number -> TDigit = \c,n -> mk3Dig c (c + "t") n ; -- like Duden 464 (4.Auflage) mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { - s = table {NCard _ _ => c ; NOrd _ => o} ; - n = n + s = table {NCard _ _ => c ; -- 0,...,9 + NOrd af => (regA o).s ! Posit ! af} ; -- (ein) 0ter .. 9ter | (der) 0te ... 9te + n = n ; -- NOrd APred: "0",... or "am 0ten",... ? + isZero = False } ; TDigit = { n : Number ; - s : CardOrd => Str + s : CardOrd => Str ; + isZero : Bool } ; } diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index 098e44a72..6190f0117 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -51,12 +51,6 @@ oper dative : Case ; genitive : Case ; - anDat_Case : Case ; -- preposition "an" dative with contraction "am" --% - inAcc_Case : Case ; -- preposition "in" accusative with contraction "ins" --% - inDat_Case : Case ; -- preposition "in" dative with contraction "im" --% - zuDat_Case : Case ; -- preposition "zu" dative with contractions "zum", "zur" --% - vonDat_Case : Case ; - -- To abstract over number names, we define the following. Number : Type ; @@ -147,6 +141,7 @@ mkN : overload { } ; + mkGN : overload { mkGN : Str -> Sex -> GN ; -- regular name with genitive in "s" mkGN : (nom,gen : Str) -> Sex -> GN ; -- name with other genitive @@ -165,10 +160,36 @@ mkN : overload { mkSN : (nom,acc,dat,gen : Str) -> GN ; -- name with all case forms } ; + mkLN = overload { + mkLN : Str -> LN = \s -> regLN s Masc ; -- regular name with genitive in "s", masculine + mkLN : Str -> Number -> LN = \s,n -> regLN s Masc ** {n=n} ; -- regular name with genitive in "s", masculine + mkLN : Str -> Gender -> LN = regLN ; -- regular name with genitive in "s" + +-- If only the genitive differs, two strings are needed. + + mkLN : (nom,gen : Str) -> Gender -> LN = mk2LN ; -- name with other genitive + +-- In the worst case, all four forms are needed. + + mkLN : (nom,acc,dat,gen : Str) -> Gender -> LN = \nom,acc,dat,gen,g -> + lin LN {s = \\a => table {Nom => nom ; Acc => acc ; Dat => dat ; Gen => gen} ; + g = g ; n = Sg ; + hasArt = False} + + } ; + + defLN : LN -> LN = \n -> n ** {hasArt = True} ; + + mk2LN : (karolus, karoli : Str) -> Gender -> LN = \karolus, karoli, g -> + lin LN {s = \\a => table {Gen => karoli ; _ => karolus} ; g = g ; n = Sg ; + hasArt = False} ; + regLN : (horst : Str) -> Gender -> LN = \horst, g -> + mk2LN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) g ; + -- To extract the number of a noun phrase - ifPluralNP : NP -> Bool - = \np -> case (numberAgr np.a) of {Sg => False ; Pl => True} ; + -- ifPluralNP : NP -> Bool + -- = \np -> case (numberAgr np.a) of {Sg => False ; Pl => True} ; --2 Adjectives @@ -213,6 +234,10 @@ mkN : overload { mkPrep : Str -> Case -> Prep ; -- e.g. "durch" + accusative mkPrep : Case -> Str -> Prep ; -- postposition mkPrep : Str -> Case -> Str -> Prep ; -- both sides + -- for prepositions glued with DefArt in singular + -- e.g. "auf" "auf den" "auf die" "aufs" + accusative + mkPrep : Str -> Str -> Str -> Str -> Case -> Prep ; + mkPrep : Case -> Prep ; -- convert case to preposition } ; -- Often just a case with the empty string is enough. @@ -221,13 +246,16 @@ mkN : overload { datPrep : Prep ; -- no string, just dative case genPrep : Prep ; -- no string, just genitive case --- A couple of common prepositions (the first two always with the dative). +-- A couple of common prepositions (the first three always with the dative). - von_Prep : Prep ; -- von + dative - zu_Prep : Prep ; -- zu + dative, with contractions zum, zur - anDat_Prep : Prep ; -- an + dative, with contraction am - inDat_Prep : Prep ; -- in + dative, with contraction ins - inAcc_Prep : Prep ; -- in + accusative, with contraction im + von_Prep : Prep ; -- von + dative, with contraction vom + zu_Prep : Prep ; -- zu + dative, with contractions zum, zur + bei_Prep : Prep ; -- bei + dative, with contraction beim + anDat_Prep : Prep ; -- an + dative, with contraction am + anAcc_Prep : Prep ; -- an + accusative, with contraction ans + inDat_Prep : Prep ; -- in + dative, with contraction im + inAcc_Prep : Prep ; -- in + accusative, with contraction ins + aufAcc_Prep : Prep ; -- auf + accusative, with contraction aufs --2 Verbs @@ -310,12 +338,12 @@ mkV2 : overload { -- Three-place (ditransitive) verbs need two prepositions, of which -- the first one or both can be absent. - accdatV3 : V -> V3 ; -- geben + dat(c2) + acc(c3) (Eng: no prepositions) - dirV3 : V -> Prep -> V3 ; -- senden + acc + nach (preposition on second arg) + accdatV3 : V -> V3 ; -- geben + dat(c2) + acc(c3) (Eng: give sb sth) + dirV3 : V -> Prep -> V3 ; -- senden + acc(c2) + nach(c3) mkV3 : overload { mkV3 : V -> V3 ; -- geben + dat(c3) + acc(c2) (Eng: give sth to-sb) - mkV3 : V -> Prep -> Prep -> V3 ; -- sprechen + mit + über + mkV3 : V -> Prep -> Prep -> V3 ; -- sprechen + mit(c2) + über(c3) } ; --3 Other complement patterns @@ -326,39 +354,39 @@ mkV2 : overload { mkV0 : V -> V0 ; --% mkVS : V -> VS ; - mkV2V : overload { -- with zu; object-control - mkV2V : V -> V2V ; - mkV2V : V -> Prep -> V2V ; + mkV2V : overload { -- with zu + mkV2V : V -> V2V ; -- object-control verb (zu-inf), e.g. bitte jmdn, sich auszuruhen + mkV2V : V -> Prep -> V2V ; -- object-control verb with prep, e.g. appelliere an jmdn, zu schweigen } ; auxV2V : overload { -- without zu - auxV2V : V -> V2V ; + auxV2V : V -> V2V ; -- object-control auxiliary, e.g. lasse jmdn sich ausruhen auxV2V : V -> Prep -> V2V ; } ; - subjV2V : V2V -> V2V ; -- force subject-control + subjV2V : V2V -> V2V ; -- force subject-control, e.g. verspreche jmdm, mich auszuruhen mkV2A : overload { - mkV2A : V -> V2A ; + mkV2A : V -> V2A ; -- e.g. male etwas blau mkV2A : V -> Prep -> V2A ; } ; mkV2S : overload { - mkV2S : V -> V2S ; - mkV2S : V -> Prep -> V2S ; + mkV2S : V -> V2S ; -- e.g. antworte jmdm, dass S + mkV2S : V -> Prep -> V2S ; -- e.g. berichte an jmdn, dass S } ; mkV2Q : overload { - mkV2Q : V -> V2Q ; + mkV2Q : V -> V2Q ; -- e.g. frage jmdn, ob S mkV2Q : V -> Prep -> V2Q ; } ; - mkVV : V -> VV ; -- with zu - auxVV : V -> VV ; -- without zu + mkVV : V -> VV ; -- with zu, e.g. versuche, zu schlafen + auxVV : V -> VV ; -- without zu, e.g. will schlafen mkVA : overload { - mkVA : V -> VA ; + mkVA : V -> VA ; -- e.g. bleibe gesund mkVA : V -> Prep -> VA ; } ; - mkVQ : V -> VQ ; + mkVQ : V -> VQ ; -- e.g. frage mich, ob S mkAS : A -> AS ; --% @@ -383,25 +411,20 @@ mkV2 : overload { -- The definitions should not bother the user of the API. So they are -- hidden from the document. - - Gender = MorphoGer.Gender ; - Case = MorphoGer.PCase ; + Case = MorphoGer.Case ; Number = MorphoGer.Number ; + masculine = Masc ; feminine = Fem ; - neuter = Neutr ; - male = Male ; - female = Female ; - nominative = NPC Nom ; - accusative = NPC Acc ; - dative = NPC Dat ; - genitive = NPC Gen ; - anDat_Case = NPP CAnDat ; - inAcc_Case = NPP CInAcc ; - inDat_Case = NPP CInDat ; - zuDat_Case = NPP CZuDat ; - vonDat_Case = NPP CVonDat ; + neuter = Neutr ; + male = Male ; + female = Female ; + + nominative = Nom ; + accusative = Acc ; + dative = Dat ; + genitive = Gen ; singular = Sg ; plural = Pl ; @@ -544,7 +567,7 @@ mkV2 : overload { dunk + "el" => mk3A a (dunk + "ler") (dunk + "leste") ; te + "uer" => mk3A a (te + "urer") (te + "ureste") ; _ + "e" => mk3A a (a + "r") (a + "ste") ; - _ + ("t" | "d" | "s" | "sch" | "z") => mk3A a (a + "er") (a + "este") ; + _ + ("t" | "d" | "s" | "ß" | "sch" | "z" | "au" | "eu") => mk3A a (a + "er") (a + "este") ; _ => mk3A a (a + "er") (a + "ste") } ; @@ -555,20 +578,31 @@ mkV2 : overload { mkAdv s = {s = s ; lock_Adv = <>} ; mkPrep = overload { - mkPrep : Str -> PCase -> Prep = \s,c -> {s = s ; s2 = [] ; c = c ; isPrep = True ; lock_Prep = <>} ; - mkPrep : PCase -> Str -> Prep = \c,s -> {s = [] ; s2 = s ; c = c ; isPrep = True ; lock_Prep = <>} ; - mkPrep : Str -> PCase -> Str -> Prep = \s,c,t -> {s = s ; s2 = t ; c = c ; isPrep = True ; lock_Prep = <>} + mkPrep : Str -> Case -> Prep = \s,c -> + {s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep ; lock_Prep = <>} ; + mkPrep : Case -> Str -> Prep = \c,s -> + {s = \\_ => [] ; s2 = s ; c = c ; isPrep = isPrep ; lock_Prep = <>} ; + mkPrep : Str -> Case -> Str -> Prep = \s,c,t -> + {s = \\_ => s ; s2 = t ; c = c ; isPrep = isPrep ; lock_Prep = <>} ; + mkPrep : Str -> Str -> Str -> Str -> Case -> Prep = \s,masc,fem,neutr,c -> + {s = table{GPl => s ; GSg Masc => masc ; GSg Fem => fem ; GSg Neutr => neutr} ; + s2 = [] ; c = c ; isPrep = isPrepDefArt ; lock_Prep = <>} ; + mkPrep : Case -> Prep = \c -> + {s = \\_ => [] ; s2 = [] ; c = c ; isPrep = isCase ; lock_Prep = <>} } ; - accPrep = {s,s2 = [] ; c = accusative ; isPrep = False ; lock_Prep = <>} ; - datPrep = {s,s2 = [] ; c = dative ; isPrep = False ; lock_Prep = <>} ; - genPrep = {s,s2 = [] ; c = genitive ; isPrep = False ; lock_Prep = <>} ; - --von_Prep = mkPrep "von" dative ; - von_Prep = mkPrep [] vonDat_Case ; - zu_Prep = mkPrep [] zuDat_Case ; - anDat_Prep = mkPrep [] anDat_Case ; - inDat_Prep = mkPrep [] inDat_Case ; - inAcc_Prep = mkPrep [] inAcc_Case ; + accPrep = mkPrep accusative ; + datPrep = mkPrep dative ; + genPrep = mkPrep genitive ; + + von_Prep = mkPrep "von" "vom" "von der" "vom" dative ; + zu_Prep = mkPrep "zu" "zum" "zur" "zum" dative ; + bei_Prep = mkPrep "bei" "beim" "bei der" "beim" dative ; + inDat_Prep = mkPrep "in" "im" "in der" "im" dative ; + inAcc_Prep = mkPrep "in" "in den" "in die" "ins" accusative ; + anDat_Prep = mkPrep "an" "am" "an der" "am" dative ; + anAcc_Prep = mkPrep "an" "an den" "an die" "ans" accusative ; + aufAcc_Prep = mkPrep "auf" "auf den" "auf die" "aufs" accusative ; mk6V geben gibt gib gab gaebe gegeben = let @@ -609,7 +643,7 @@ mkV2 : overload { habenV v = v ** {aux = VHaben} ; seinV v = v ** {aux = VSein} ; - reflV v c = v ** {aux = VHaben ; vtype = VRefl (prepC c).c} ; + reflV v c = v ** {aux = VHaben ; vtype = VRefl c} ; no_geV v = let vs = v.s in v ** { s = table { @@ -653,35 +687,34 @@ mkV2 : overload { mkV0 v = v ** {lock_V = <>} ; mkV2V = overload { -- default: object-control - mkV2V : V -> V2V + mkV2V : V -> V2V = \v -> dirV2 v ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ; -- ermahne jmdn, sich zu waschen - mkV2V : V -> Prep -> V2V + mkV2V : V -> Prep -> V2V = \v,p -> prepV2 v p ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ; } ; auxV2V = overload { - auxV2V : V -> V2V + auxV2V : V -> V2V = \v -> dirV2 v ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ; -- lasse jmdn sich waschen - auxV2V : V -> Prep -> V2V + auxV2V : V -> Prep -> V2V = \v,p -> prepV2 v p ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ; } ; subjV2V v = v ** {objCtrl = False} ; mkV2A = overload { - mkV2A : V -> V2A - = \v -> dirV2 v ** {isAux = False ; lock_V2A = <>} ; - mkV2A : V -> Prep -> V2A + mkV2A : V -> V2A = \v -> dirV2 v ** {isAux = False ; lock_V2A = <>} ; + mkV2A : V -> Prep -> V2A = \v,p -> prepV2 v p ** {isAux = False ; lock_V2A = <>} ; } ; mkV2S = overload { mkV2S : V -> V2S = \v -> dirV2 v ** {isAux = False ; lock_V2S = <>} ; - mkV2S : V -> Prep -> V2S + mkV2S : V -> Prep -> V2S = \v,p -> prepV2 v p ** {isAux = False ; lock_V2S = <>} ; } ; mkV2Q = overload { - mkV2Q : V -> V2Q + mkV2Q : V -> V2Q = \v -> dirV2 v ** {isAux = False ; lock_V2Q = <>} ; - mkV2Q : V -> Prep -> V2Q + mkV2Q : V -> Prep -> V2Q = \v,p -> prepV2 v p ** {isAux = False ; lock_V2Q = <>} ; } ; @@ -768,7 +801,9 @@ mkV2 : overload { mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; mkV2 : V -> V2 = dirV2 ; mkV2 : V -> Prep -> V2 = prepV2; - mkV2 : V -> Case -> V2 = \v,c -> prepV2 v (lin Prep {s,s2 = [] ; c = c ; isPrep = False}) ; + mkV2 : V -> Case -> V2 = \v,c -> prepV2 v (mkPrep c) ; } ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/german/PhraseGer.gf b/src/german/PhraseGer.gf index dc49fa3a2..28e03ae27 100644 --- a/src/german/PhraseGer.gf +++ b/src/german/PhraseGer.gf @@ -13,7 +13,7 @@ concrete PhraseGer of Phrase = CatGer ** open Prelude, ResGer in { UttIP ip = {s = ip.s ! Nom} ; --- Acc also UttIAdv iadv = iadv ; - UttNP np = {s = np.s ! NPC Nom ++ bigNP np} ; + UttNP np = {s = np.s ! False ! Nom ++ bigNP np} ; UttVP vp = {s = useInfVP True vp} ; -- without zu UttAdv adv = adv ; UttCN n = {s = n.s ! Strong ! Sg ! Nom ++ n.adv ++ n.ext ++ n.rc ! Sg} ; @@ -25,6 +25,6 @@ concrete PhraseGer of Phrase = CatGer ** open Prelude, ResGer in { PConjConj conj = ss (conj.s2) ; NoVoc = {s = []} ; - VocNP np = {s = "," ++ np.s ! NPC Nom ++ bigNP np} ; + VocNP np = {s = "," ++ np.s ! False ! Nom ++ bigNP np} ; } diff --git a/src/german/QuestionGer.gf b/src/german/QuestionGer.gf index 2f89455fd..547eafda7 100644 --- a/src/german/QuestionGer.gf +++ b/src/german/QuestionGer.gf @@ -13,14 +13,14 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { } } ; - QuestVP qp vp = { - s = \\m,t,a,b,q => - let - cl = (mkClause (qp.s ! Nom) (agrP3 qp.n) vp).s ! m ! t ! a ! b - in - case q of { - QIndir => cl ! Sub ; - _ => cl ! Main + QuestVP ip vp = { + s = \\m,t,a,p => + let + who = appPrep vp.c1 ip.s ; + cl = (mkClause who (agrP3 ip.n) vp).s ! m ! t ! a ! p + in table { + QDir => cl ! Main ; + QIndir => cl ! Sub } } ; @@ -28,7 +28,7 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { s = \\m,t,a,p => let cls = slash.s ! m ! t ! a ! p ; - who = appPrep slash.c2 (\\k => usePrepC k (\c -> ip.s ! c)) ; + who = appPrep slash.c2 ip.s ; in table { QDir => who ++ cls ! Inv ; QIndir => who ++ cls ! Sub @@ -50,8 +50,8 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { s = \\m,t,a,p => let vp = predV sein_V ** {ext = icomp.ext}; - subj = mkSubj np vp.c1 ; - cls = (mkClause subj.p1 subj.p2 vp).s ! m ! t ! a ! p ; + subj = mkSubject np vp.c1 ; + cls = (mkClause subj.s subj.a vp).s ! m ! t ! a ! p ; why = icomp.s ! np.a in table { QDir => why ++ cls ! Inv ; @@ -60,7 +60,7 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { } ; PrepIP p ip = { - s = appPrep p (\\k => usePrepC k (\c -> ip.s ! c)) ; + s = appPrep p ip.s ; } ; AdvIP ip adv = { diff --git a/src/german/RelativeGer.gf b/src/german/RelativeGer.gf index 2a97913bb..48521cbb4 100644 --- a/src/german/RelativeGer.gf +++ b/src/german/RelativeGer.gf @@ -1,4 +1,4 @@ -concrete RelativeGer of Relative = CatGer ** open ResGer in { +concrete RelativeGer of Relative = CatGer ** open ResGer, Prelude in { flags optimize=all_subs ; @@ -18,7 +18,7 @@ concrete RelativeGer of Relative = CatGer ** open ResGer in { } ; agr = case rp.a of { RNoAg => agrP3 (numGenNum gn) ; - RAg n p => Ag Neutr n p + RAg n p => case n of {Sg => AgSgP3 Neutr ; Pl => AgPl p} } ; cl = mkClause (rp.s ! rgn ! Nom) agr vp in @@ -28,13 +28,12 @@ concrete RelativeGer of Relative = CatGer ** open ResGer in { RelSlash rp slash = { s = \\m,t,a,p,gn => - appPrep slash.c2 (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ++ - slash.s ! m ! t ! a ! p ! Sub ; - c = (prepC slash.c2.c).c + appPrep slash.c2 (rp.s ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ; + c = slash.c2.c } ; FunRP p np rp = { - s = \\gn,c => np.s ! NPC c ++ appPrep p (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ; + s = \\gn,c => np.s ! False ! c ++ appPrep p (rp.s ! gn) ; a = RAg (numberAgr np.a) (personAgr np.a) } ; diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index 47eea586c..8273913d3 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -25,7 +25,6 @@ resource ResGer = ParamX ** open Prelude in { param Case = Nom | Acc | Dat | Gen ; Gender = Masc | Fem | Neutr ; - Sex = Male | Female ; -- Complex $CN$s, like adjectives, have strong and weak forms. @@ -36,41 +35,40 @@ resource ResGer = ParamX ** open Prelude in { GenNum = GSg Gender | GPl ; RelGenNum = RGenNum GenNum | RSentence ; --- Agreement of $NP$ has three parts. +-- Agreement of $NP$ has three parts: gender, number and person. - Agr = Ag Gender Number Person ; + -- These 3*2*3 = 18 values can be reduced to 9, since gender is used only + -- in 3rd person singular. To select reflexive and possessive forms for "Sie" + -- in (mkClause str agr vp), add a value AgPlPol, for "man", use AgSgP3 Masc. HL 29.9.2023 --- Case of $NP$ extended to deal with contractions like "zur", "im". - - PCase = NPC Case | NPP CPrep ; - CPrep = CAnDat | CInAcc | CInDat | CZuDat | CVonDat ; - - oper - NPNom : PCase = NPC Nom ; - PrepNom : Preposition = {s,s2 = "" ; isPrep = False ; c = NPNom} ; - - prepC : PCase -> {s : Str ; c : Case} = \cp -> case cp of { - NPC c => {s = [] ; c = c} ; - NPP CAnDat => {s = "an" ; c = Dat} ; - NPP CInAcc => {s = "in" ; c = Acc} ; - NPP CInDat => {s = "in" ; c = Dat} ; - NPP CZuDat => {s = "zu" ; c = Dat} ; - NPP CVonDat => {s = "von" ; c = Dat} - } ; - - usePrepC : PCase -> (Case -> Str) -> Str = \c,fs -> - let sc = prepC c in sc.s ++ fs sc.c ; - - appPrepC : Preposition -> (Case => Str) -> Str = \prep,arg -> - let sc = prepC prep.c - in prep.s ++ sc.s ++ arg ! sc.c ++ prep.s2 ; + Agr = AgSgP1 | AgSgP2 | AgSgP3 Gender | AgPl Person | AgPlPol ; oper - mkAgr : {g : Gender ; n : Number ; p : Person} -> Agr = \r -> - Ag r.g r.n r.p ; - genderAgr : Agr -> Gender = \r -> case r of {Ag g _ _ => g} ; - numberAgr : Agr -> Number = \r -> case r of {Ag _ n _ => n} ; - personAgr : Agr -> Person = \r -> case r of {Ag _ _ p => p} ; + genderAgr : Agr -> Gender = \r -> case r of {AgSgP3 g => g ; _ => Masc} ; + + numberAgr = overload { + numberAgr : Agr -> Number = \r -> case r of { + AgSgP1 | AgSgP2 | AgSgP3 _ => Sg ; + AgPl _ | AgPlPol => Pl + } ; + numberAgr : VAgr -> Number = \r -> case r of {VAg n _ => n} ; + } ; + personAgr = overload { + personAgr : Agr -> Person = \r -> case r of { + AgSgP1 | AgPl P1 => P1 ; + AgSgP2 | AgPl P2 => P2 ; + AgSgP3 _ | AgPl P3 | AgPlPol => P3 + } ; + personAgr : VAgr -> Person = \r -> case r of {VAg _ p => p} + } ; + + conjAgr : Agr -> Agr -> Agr = \a,b -> + let n : Number = conjNumber (numberAgr a) (numberAgr b) ; + p : Person = conjPerson (personAgr a) (personAgr b) + in case of { => AgPl p ; + => AgSgP3 Neutr ; + => AgSgP1 ; + => AgSgP2 } ; -- Pronouns are the worst-case noun phrases, which have both case -- and possessive forms. @@ -78,11 +76,11 @@ resource ResGer = ParamX ** open Prelude in { param NPForm = NPCase Case | NPPoss GenNum Case ; -- Predeterminers sometimes require a case ("ausser mir"), sometimes not ("nur ich"). --- A number is sometimes inherited ("alle Menschen"), --- sometimes forced ("jeder von den Menschen"). +-- A number is sometimes inherited ("alle Menschen"), sometimes forced ("jeder von +-- den Menschen"). param - PredetCase = NoCase | PredCase PCase ; + PredetCase = NoCase | PredCase Case ; PredetAgr = PAg Number | PAgNone ; oper noCase : {p : Str ; k : PredetCase} = {p = [] ; k = NoCase} ; @@ -90,11 +88,11 @@ resource ResGer = ParamX ** open Prelude in { -- Pronominal nps are ordered differently, and light nps come before negation in clauses. -- (To save space, reduce isPron * isLight = 4 values to the following three.) HL 9/19 param - Weight = WPron | WLight | WHeavy ; + Weight = WPron | WLight | WHeavy | WDefArt ; oper - isPron : {w : Weight} -> Bool = \np -> + isPron : {w : Weight} -> Bool = \np -> case np.w of {WPron => True ; _ => False} ; - isLight : {w : Weight} -> Bool = \np -> + isLight : {w : Weight} -> Bool = \np -> case np.w of {WHeavy => False ; _ => True} ; --2 For $Adjective$ @@ -106,6 +104,9 @@ resource ResGer = ParamX ** open Prelude in { --2 For $Verb$ + param VAgr = -- Gender is irrelevant for verb forms, HL 8/2023 + VAg Number Person ; -- except participles + param VForm = VInf Bool -- True = with the particle "zu" | VFin Bool VFormFin -- True = prefix glued to verb @@ -154,8 +155,10 @@ resource ResGer = ParamX ** open Prelude in { oper agrP3 : Number -> Agr = agrgP3 Neutr ; - agrgP3 : Gender -> Number -> Agr = \g,n -> - Ag g n P3 ; + agrgP3 : Gender -> Number -> Agr = \g,n -> case n of { + Sg => AgSgP3 g ; + Pl => AgPl P3 -- no gender in Pl + } ; gennum : Gender -> Number -> GenNum = \g,n -> case n of { @@ -196,10 +199,10 @@ resource ResGer = ParamX ** open Prelude in { _ => Weak } ; - vFin : Bool -> Mood -> Tense -> Agr -> VForm = \b,m,t,a -> + vFin : Bool -> Mood -> Tense -> VAgr -> VForm = \b,m,t,a -> let - an = numberAgr a ; - ap = personAgr a ; + an : Number = numberAgr a ; + ap : Person = personAgr a ; in case of { => VFin b (VPresInd an ap) ; @@ -210,11 +213,15 @@ resource ResGer = ParamX ** open Prelude in { _ => VInf False --# notpresent } ; - conjAgr : Agr -> Agr -> Agr = \a,b -> mkAgr { - g = Neutr ; ---- - n = conjNumber (numberAgr a) (numberAgr b) ; - p = conjPerson (personAgr a) (personAgr b) - } ; + agr2vagr : Agr -> VAgr = \r -> case r of { + AgSgP1 => VAg Sg P1 ; + AgSgP2 => VAg Sg P2 ; + AgSgP3 g => VAg Sg P3 ; + AgPl p => VAg Pl p ; + AgPlPol => VAg Pl P3 + } ; + + vagrP3 : Number -> VAgr = \n -> VAg n P3 ; -------------------------------------------- --TYPE DEFINITIONS + WORST-CASE CONSTRUCTORS @@ -252,12 +259,12 @@ resource ResGer = ParamX ** open Prelude in { g : Gender } ; - NP : Type = { - s : PCase => Str ; + NP : Type = { -- HL 7/22: Bool = True if DefArt is dropped to combine with prep of type isPrepDefArt + s : Bool => Case => Str ; rc : Str ; -- die Frage , [rc die ich gestellt habe] ext : Str ; -- die Frage , [sc wo sie schläft] ; die Regel , [vp kein Fleisch zu essen] | [s dass ...] a : Agr ; - w : Weight } ; -- light NPs come before negation in simple clauses (expensive) + w : Weight } ; -- light NPs come before negation in simple clauses mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun = \Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> { @@ -391,7 +398,7 @@ resource ResGer = ParamX ** open Prelude in { regA : Str -> Adjective = \blau -> let blauest : Str = case blau of { - _ + ("t" | "d" | "s" | "sch" | "z") => blau + "est" ; + _ + ("t" | "d" | "s" | "ß" | "sch" | "z" | "au" | "eu") => blau + "est" ; _ => blau + "st" } in @@ -421,44 +428,77 @@ resource ResGer = ParamX ** open Prelude in { legte ("ge" + legt) [] VHaben ; --- Prepositions for complements indicate the complement case. +-- Prepositions indicate the case of their complement noun phrase. - Preposition : Type = {s : Str ; s2 : Str ; c : PCase ; isPrep : Bool} ; +-- There are three types: (i) cases, (ii) pure pre-, post- and circum-positions, +-- and (iii) prepositions glued with definite article in singular (using s!(GSg g)). - -- HL 7/19: German has very few circumpositions: um (Gen) Willen, von (Adv) an|ab|aus - -- ? bis (Adv) hin|her. So maybe we should skip s2 (and save readings with empty preps). + param + PrepType = isCase | isPrep | isPrepDefArt ; -- HL 7/2022 + + oper + Preposition : Type = {s : GenNum => Str ; s2:Str ; c : Case ; isPrep : PrepType} ; + + isaCase : Preposition -> Bool = \p -> case p.isPrep of {isCase => True ; _ => False} ; + isaPrep : Preposition -> Bool = \p -> case p.isPrep of {isPrep => True ; _ => False} ; + isaPrepDefArt : Preposition -> Bool = \p -> case p.isPrep of {isPrepDefArt => True ; _ => False} ; -- To apply a preposition to a complement. - appPrep : Preposition -> (PCase => Str) -> Str = \prep,arg -> - prep.s ++ arg ! prep.c ++ prep.s2 ; + appPrep : Preposition -> (Case => Str) -> Str = \prep,arg -> + prep.s ! GPl ++ arg ! prep.c ++ prep.s2 ; appPrepNP : Preposition -> NP -> Str = \prep,np -> - prep.s ++ np.s ! prep.c ++ bigNP np ++ prep.s2 ; - -- revised appPrep for discontinuous NPs + let + g : Gender = genderAgr np.a ; + n : Number = numberAgr np.a ; + glues = case of { => True ; _ => False} ; + nps = np.s ! glues ! prep.c + in + case of { + => -- e.g. "zum Hof|zur Tür|zum Fenster herein" + prep.s ! (GSg g) ++ nps ++ np.ext ++ prep.s2 ++ np.rc ; + _ => prep.s ! GPl ++ nps ++ np.ext ++ prep.s2 ++ np.rc + } ; + +{- -- Simplify to test the effect on grammar compilation complexity (without SlashV2VNP): + -- with glues = False: 27096 msec, 3,2M VerbGer.gfo, 854 SentenceGer.gfo + -- and SlashV2VNP:102597 msec, 16 M VerbGer.gfo, 854 SentenceGer.gfo (good!) + appPrepNP : Preposition -> NP -> Str = \prep,np -> + let + glues = False ; + nps = np.s ! glues ! prep.c + in prep.s ! GPl ++ nps ++ np.ext ++ prep.s2 ++ np.rc ; +-} bigNP : NP -> Str = \np -> np.ext ++ np.rc ; -- To build a preposition from just a case. -- HL 9/19: no longer used in RGL noPreposition : Case -> Preposition = \c -> - {s,s2 = [] ; c = NPC c ; isPrep = False} ; + {s = \\_ => [] ; s2 = [] ; c = c ; isPrep = isCase} ; + +-- To build a preposition from just a case. -- HL 9/19: moved to mkPrep in ParadigmsGer + + PrepNom : Preposition = {s = \\_ => []; isPrep = isCase ; c = Nom ; s2 = []} ; + + vonDat : Preposition = {s=table{GPl => "von" ; GSg Fem => "von der"; _ => "vom"}; + s2=[]; c=Dat; isPrep=isPrepDefArt} ; -- To build passive: accusative object -> nom subject; others -> same case or prep subjPrep : Preposition -> Preposition = \prep -> case of { - => prep ** {c = NPC Nom} ; + => prep ** {c = Nom} ; _ => prep } ; -- Pronouns and articles -- Here we define personal and relative pronouns. --- All personal pronouns, except "ihr", conform to the simple --- pattern $mkPronPers$. +-- All personal pronouns, except "ihr", conform to the simple pattern $mkPronPers$. - mkPronPers : (x1,_,_,_,x5 : Str) -> Gender -> Number -> Person -> - {s : NPForm => Str ; a : Agr} = + mkPronPers : (x1,_,_,_,x5 : Str) -> Gender -> Number -> Person -> + {s : NPForm => Str ; a : Agr} = \ich,mich,mir,meiner,mein,g,n,p -> { s = table { NPCase c => caselist ich mich mir meiner ! c ; @@ -470,7 +510,12 @@ resource ResGer = ParamX ** open Prelude in { } } } ; - a = Ag g n p + a = case of { + <_,Pl,p > => AgPl p ; + => AgSgP3 g ; + <_,Sg,P1> => AgSgP1 ; + <_,Sg,P2> => AgSgP2 -- for "man", "Sie", set in StructuralGer HL + } } ; pronEnding : GenNum => Case => Str = table { @@ -487,32 +532,14 @@ resource ResGer = ParamX ** open Prelude in { GPl => caselist "die" "die" "den" "der" } ; - artDefContr : GenNum -> PCase -> Str = \gn,np -> case np of { - NPC c => artDef ! gn ! c ; - NPP p => case of { - => "am" ; - => "ins" ; - => "im" ; - => "zum" ; - => "zum" ; - => "zur" ; - => "vom" ; - _ => let sp = prepC np in sp.s ++ artDef ! gn ! sp.c - } - } ; - - -- This is used when forming determiners that are like adjectives. - appAdj : Adjective -> Number => Gender => PCase => Str = \adj -> + appAdj : Adjective -> Number => Gender => Case => Str = \adj -> let ad : GenNum -> Case -> Str = \gn,c -> adj.s ! Posit ! AMod gn c in - \\n,g,c => usePrepC c (\k -> case n of { - Sg => ad (GSg g) k ; - _ => ad GPl k - }) ; + \\n,g,c => case n of {Sg => ad (GSg g) c ; _ => ad GPl c} ; -- This auxiliary gives the forms in each degree of adjectives. @@ -545,7 +572,7 @@ resource ResGer = ParamX ** open Prelude in { -- For $Verb$. VPC : Type = { - s : Bool => Agr => VPForm => { -- True = prefix glued to verb + s : Bool => VAgr => VPForm => { -- True = prefix glued to verb fin : Str ; -- wird inf, inf2 : Str -- lesen,[] | gelesen,haben | können,haben (= gekonnt,haben) } -- HL 11/6/2019 Fut Anter: lesen gekonnt haben => haben lesen können @@ -574,26 +601,26 @@ resource ResGer = ParamX ** open Prelude in { let isAux = vp.isAux ; verb = vp.s ; - vfin : Bool -> Mood -> Tense -> Agr -> Str = \b,m,t,a -> + vfin : Bool -> Mood -> Tense -> VAgr -> Str = \b,m,t,a -> verb.s ! vFin b m t a ; vinf = verb.s ! VInf False ; vpart = if_then_Str isAux vinf (verb.s ! VPastPart APred) ; vHaben = auxPerfect verb ; - hat : Mood -> Tense -> Agr -> Str = \m,t,a -> + hat : Mood -> Tense -> VAgr -> Str = \m,t,a -> vHaben ! vFin False m t a ; haben : Str = vHaben ! VInf False ; - wird : Mood -> Agr -> Str = \m,a -> + wird : Mood -> VAgr -> Str = \m,a -> let - an = numberAgr a ; - ap = personAgr a ; + an : Number = numberAgr a ; + ap : Person = personAgr a ; in case m of { - MIndic => werden_V.s ! VFin False (VPresInd an ap) ; + MIndic => werden_V.s ! VFin False (VPresInd an ap) ; MConjunct => werden_V.s ! VFin False (VPresSubj an ap) - } ; - wuerde : Agr -> Str = \a -> --# notpresent + } ; + wuerde : VAgr -> Str = \a -> --# notpresent werden_V.s ! VFin False (VImpfSubj (numberAgr a) (personAgr a)) ; --# notpresent auf = verb.prefix ; @@ -626,7 +653,7 @@ resource ResGer = ParamX ** open Prelude in { predV : Verb -> VP = predVGen False ; - predVc : Verb ** {c2 : Preposition} -> VPSlash = \v -> + predVc : Verb ** {c2 : Preposition} -> VPSlash = \v -> predV v ** {c2 = v.c2 ; objCtrl = False} ; predVGen : Bool -> Verb -> VP = \isAux, verb -> { @@ -716,14 +743,19 @@ resource ResGer = ParamX ** open Prelude in { insertObj obj vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl } ; insertObjNP : NP -> Preposition -> VPSlash -> VPSlash = \np,prep,vp -> - let c = case prep.c of { NPC cc => cc ; _ => Nom } ; - obj = appPrepNP prep np ; - in vp ** { + let obj = appPrepNP prep np ; + b : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; + w = np.w ; + c = prep.c + in insertObj' obj b w c vp ; + + insertObj' : Str -> Bool -> Weight -> Case -> VPSlash -> VPSlash = \obj,isPrep,w,c,vp -> + vp ** { nn = \\a => let vpnn = vp.nn ! a in -- HL 11/6/19: rough object NP order (expensive): -- vfin < accPron < refl < (gen|dat)Pron < lightNP < neg < heavyNP|PP < vinf|comp - case of { -- 2 * 3 * 4 = 24 cases + case of { -- 2 * 3 * 4 = 24 cases => -- ; => -- @@ -733,24 +765,23 @@ resource ResGer = ParamX ** open Prelude in { => -- (assuming v.c2=acc) nonPron: dat < acc|gen -- ; - => -- - ; => -- ; - => -- + => -- + ; + => -- } } ; -- the ordering of objects of v:V3 (and v:V4) is also determined by Slash?V3 (and Slash?V4) insertObjRefl : VPSlash -> VPSlash = \vp -> -- HL 6/2019, to order reflPron < neg < prep+reflPron let prep = vp.c2 ; - c = case prep.c of { NPC cc => cc ; _ => Acc } ; - obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! c ; -- HL: to test ReflVP: reflPronSelf + obj : Agr => Str = \\a => prep.s ! GPl ++ reflPron ! a ! prep.c ++ prep.s2 in vp ** { nn = \\a => let vpnn = vp.nn ! a in case prep.isPrep of { - False => ; - True => } + isCase => ; + _ => } } ; insertAdV : Str -> VP -> VP = \adv,vp -> vp ** { -- not used in Ger, so VP.a1 can be skipped @@ -819,14 +850,15 @@ resource ResGer = ParamX ** open Prelude in { } ; mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> - let vps = useVP vp in { + let vagr = agr2vagr agr ; + vps = useVP vp in { s = \\m,t,a,b,o => let ord = case o of { Sub => True ; -- glue prefix to verb _ => False } ; - verb = vps.s ! ord ! agr ! VPFinite m t a ; + verb = vps.s ! ord ! vagr ! VPFinite m t a ; haben = verb.inf2 ; neg = negation ! b ; obj1 = (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ; -- refl ++ pronouns ++ light nps @@ -894,7 +926,7 @@ resource ResGer = ParamX ** open Prelude in { in < \\agr => (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 ++ vp.a2, - vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit Simul).inf, -- vp.a1 ! Pos + vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! vagrP3 Sg ! VPInfinit Simul).inf, -- vp.a1 ! Pos vp.inf.inpl.p2, -- ! HL infExt ++ vp.ext > ; @@ -905,7 +937,7 @@ resource ResGer = ParamX ** open Prelude in { { objs = \\agr => (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ++ negation ! pol ++ (vp.nn ! agr).p3 ++ vp.a2 ++ (vp.nn ! agr).p4 ; -- objects + predicative A|CN|NP - pred = vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit ant).inf ; + pred = vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! vagrP3 Sg ! VPInfinit ant).inf ; -- inplace and extracted parts of vp.inf: inpl = vp.inf.inpl ; extr = vp.inf.extr @@ -916,7 +948,7 @@ resource ResGer = ParamX ** open Prelude in { \isAux, ant, pol, vp -> let vps = useVP vp in { objs = \\agr => (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ++ negation ! pol ++ (vp.nn ! agr).p3 ++ vp.a2 ++ (vp.nn ! agr).p4 ; -- objects + predicative A|CN|NP - pred = vp.inf.inpl.p2 ++ vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit ant).inf ; + pred = vp.inf.inpl.p2 ++ vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! vagrP3 Sg ! VPInfinit ant).inf ; -- inplace and extracted parts of vp.inf: inpl = ; -- move the predicate part to pred extr = vp.inf.extr @@ -927,55 +959,67 @@ resource ResGer = ParamX ** open Prelude in { -- let vpi = infVP isAux vp in -- vpi.p1 ! agrP3 Sg ++ vpi.p3 ++ vpi.p2 ++ vpi.p4 ; let vpi = infVP isAux Simul Pos vp ; -- HL 3/2022 - agr : Agr = (Ag Masc Sg P3) ; - glue : (Agr => Str)*Str -> Str = \i -> i.p1!agr ++ i.p2 + agr = agrP3 Sg ; + glue : (Agr => Str)*Str -> Str = \i -> i.p1 ! agr ++ i.p2 in glue (embedInf vpi.inpl ) ++ vpi.extr!agr ++ vp.ext ; -- The nominative case is not used as reflexive, but defined here -- so that we can reuse this in personal pronouns. - reflPron : Agr => Case => Str = table { - Ag _ Sg P1 => caselist "ich" "mich" "mir" "meiner" ; - Ag _ Sg P2 => caselist "du" "dich" "dir" "deiner" ; - Ag Masc Sg P3 => caselist "er" "sich" "sich" "seiner" ; - Ag Fem Sg P3 => caselist "sie" "sich" "sich" "ihrer" ; - Ag Neutr Sg P3 => caselist "es" "sich" "sich" "seiner" ; - Ag _ Pl P1 => caselist "wir" "uns" "uns" "unser" ; - Ag _ Pl P2 => caselist "ihr" "euch" "euch" "euer" ; - Ag _ Pl P3 => caselist "sie" "sich" "sich" "ihrer" + reflPron : Agr => Case => Str = table { -- with persPron nominative + AgSgP1 => caselist "ich" "mich" "mir" "meiner" ; + AgSgP2 => caselist "du" "dich" "dir" "deiner" ; + AgSgP3 Masc => caselist "er" "sich" "sich" "seiner" ; + AgSgP3 Fem => caselist "sie" "sich" "sich" "ihrer" ; + AgSgP3 Neutr => caselist "es" "sich" "sich" "seiner" ; + AgPl P1 => caselist "wir" "uns" "uns" "unser" ; + AgPl P2 => caselist "ihr" "euch" "euch" "euer" ; + AgPl P3 => caselist "sie" "sich" "sich" "ihrer" ; + AgPlPol => caselist "Sie" "sich" "sich" "Ihrer" -- HL 8/2023 + -- AgSgP3Gen => caselist "man selbst" "sich" "sich" "seiner" ; -- älter als man selbst sein + -- ; AgPlReci => caselist "man" "einander" "einander" "einander" -- reciPron ? } ; possPron : Agr -> Number -> Gender -> Case -> Str = \a,n,g,c -> case of { - => caselist "mein" "meinen" "meinem" "meines" ! c ; - => caselist "meine" "meine" "meiner" "meiner" ! c ; - => caselist "mein" "mein" "meinem" "meines" ! c ; - => caselist "meine" "meine" "meinen" "meiner" ! c ; - => caselist "dein" "deinen" "deinem" "deines" ! c ; - => caselist "deine" "deine" "deiner" "deiner" ! c ; - => caselist "dein" "dein" "deinem" "deines" ! c ; - => caselist "deine" "deine" "deinen" "deiner" ! c ; - - => caselist "sein" "seinen" "seinem" "seines" ! c ; - => caselist "seine" "seine" "seiner" "seiner" ! c ; - => caselist "sein" "sein" "seinem" "seines" ! c ; - => caselist "seine" "seine" "seinen" "seiner" ! c ; + => caselist "mein" "meinen" "meinem" "meines" ! c ; + => caselist "meine" "meine" "meiner" "meiner" ! c ; + => caselist "mein" "mein" "meinem" "meines" ! c ; + => caselist "meine" "meine" "meinen" "meiner" ! c ; + => caselist "dein" "deinen" "deinem" "deines" ! c ; + => caselist "deine" "deine" "deiner" "deiner" ! c ; + => caselist "dein" "dein" "deinem" "deines" ! c ; + => caselist "deine" "deine" "deinen" "deiner" ! c ; - => caselist "ihr" "ihren" "ihrem" "ihres" ! c ; - => caselist "ihre" "ihre" "ihrer" "ihrer" ! c ; - => caselist "ihr" "ihr" "ihrem" "ihres" ! c ; - => caselist "ihre" "ihre" "ihren" "ihrer" ! c ; + => caselist "ihr" "ihren" "ihrem" "ihres" ! c ; + => caselist "ihre" "ihre" "ihrer" "ihrer" ! c ; + => caselist "ihr" "ihr" "ihrem" "ihres" ! c ; + => caselist "ihre" "ihre" "ihren" "ihrer" ! c ; - => caselist "unser" "unseren" "unserem" "unseres" ! c ; - => caselist "unsere" "unsere" "unserer" "unserer" ! c ; - => caselist "unser" "unser" "unserem" "unseres" ! c ; - => caselist "unsere" "unsere" "unseren" "unserer" ! c ; - - => caselist "euer" "euren" "eurem" "eures" ! c ; - => caselist "eure" "eure" "eurer" "eurer" ! c ; - => caselist "euer" "euer" "eurem" "eures" ! c ; - => caselist "eure" "eure" "euren" "eurer" ! c - + => caselist "sein" "seinen" "seinem" "seines" ! c ; + => caselist "seine" "seine" "seiner" "seiner" ! c ; + => caselist "sein" "sein" "seinem" "seines" ! c ; + => caselist "seine" "seine" "seinen" "seiner" ! c ; + + => caselist "unser" "unseren" "unserem" "unseres" ! c ; + => caselist "unsere" "unsere" "unserer" "unserer" ! c ; + => caselist "unser" "unser" "unserem" "unseres" ! c ; + => caselist "unsere" "unsere" "unseren" "unserer" ! c ; + + => caselist "euer" "euren" "eurem" "eures" ! c ; + => caselist "eure" "eure" "eurer" "eurer" ! c ; + => caselist "euer" "euer" "eurem" "eures" ! c ; + => caselist "eure" "eure" "euren" "eurer" ! c ; + + => caselist "ihr" "ihren" "ihrem" "ihres" ! c ; + => caselist "ihre" "ihre" "ihrer" "ihrer" ! c ; + => caselist "ihr" "ihr" "ihrem" "ihres" ! c ; + => caselist "ihre" "ihre" "ihren" "ihrer" ! c ; + + => caselist "Ihr" "Ihren" "Ihrem" "Ihres" ! c ; + => caselist "Ihre" "Ihre" "Ihrer" "Ihrer" ! c ; + => caselist "Ihr" "Ihr" "Ihrem" "Ihres" ! c ; + => caselist "Ihre" "Ihre" "Ihren" "Ihrer" ! c } ; conjThat : Str = "dass" ; @@ -987,7 +1031,7 @@ resource ResGer = ParamX ** open Prelude in { infPart : Bool -> Str = \b -> if_then_Str b [] "zu" ; heavyNP : - {s : PCase => Str ; a : Agr} -> {s : PCase => Str ; a : Agr ; w : Weight ; ext,rc : Str} = \np -> + {s : Bool => Case => Str ; a : Agr} -> {s : Bool => Case => Str ; a : Agr ; w : Weight ; ext,rc : Str} = \np -> np ** {w = WHeavy ; ext,rc = []} ; -- this could be wrong relPron : RelGenNum => Case => Str = \\rgn,c => @@ -1004,11 +1048,11 @@ resource ResGer = ParamX ** open Prelude in { } ; -- Function that allows the construction of non-nominative subjects. - mkSubj : NP -> Preposition -> Str * Agr = \np, prep -> - let - agr = case prep.c of { NPC Nom => np.a ; _ => Ag Masc Sg P3 } ; + mkSubject : NP -> Preposition -> {s:Str ; a:Agr} = \np, prep -> + let + agr = case prep.c of { Nom => np.a ; _ => AgSgP3 Masc } ; subj = appPrepNP prep np - in ; + in {s = subj ; a = agr} ; sex2gender : Sex -> Gender = \g -> case g of { diff --git a/src/german/SentenceGer.gf b/src/german/SentenceGer.gf index fa622d251..04247b7b8 100644 --- a/src/german/SentenceGer.gf +++ b/src/german/SentenceGer.gf @@ -5,8 +5,8 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { lin PredVP np vp = - let subj = mkSubj np vp.c1 - in mkClause subj.p1 subj.p2 vp ; + let subj = mkSubject np vp.c1 + in mkClause subj.s subj.a vp ; {- applies verb's subject case to subject ; forces 3rd person sg agreement for any non-nom subjects --> @@ -21,22 +21,36 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { s = \\pol,n => let ps = case n of { - ImpF _ True => ; -- setzen Sie sich - _ => - } ; - agr = Ag Fem (numImp n) ps.p1 ; --- g does not matter - verb = vps.s ! False ! agr ! VPImperat ps.p3 ; + ImpF _ True => ; -- setzen Sie sich Ihren Hut auf + _ => -- but: nimm [ihren | deinen | *Ihren] Hut + } ; -- vp should be reflexive, ComplRSlash + vagr = VAg (numImp n) ps.p1 ; + verb = vps.s ! False ! vagr ! VPImperat ps.p3 ; + agr = case of { + <_, P3,True> => AgPlPol ; -- sich | Ihr- + => AgSgP2 ; -- dich | dein- + => AgPl P2 ; -- euch | euer- + _ => AgSgP1 -- default, does not occur + } ; + neg = negation ! pol ; inf = vp.inf.inpl.p2 ++ verb.inf ; -- HL .s/.inpl.p2 - obj = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 + obj = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 ++ vp.adj in --- verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext - verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ negation ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext - } ; + verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ neg ++ obj ++ vp.a2 ++ inf ++ vp.ext + } ; + + AdvImp adv imp = { + s = \\pol,impform => adv.s ++ imp.s ! pol ! impform + } ; + +-- to save compile time: HL 7/22, comment SlashVP out: +-- + SlashV2VNP 199065600 (46080,240) +-- + SlashVP 414720 (28224,204) SlashVP np vp = - let subj = mkSubj np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent - in mkClause subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; -- reflexives in vp instantiated to np.a - -- cf. tests/german/TestLangGer.gf + let subj = mkSubject np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent + in mkClause subj.s subj.a vp ** { c2 = vp.c2 } ; -- reflexives in vp instantiated to np.a + -- cf. tests/german/TestLangGer.gf AdvSlash slash adv = { s = \\m,t,a,b,o => slash.s ! m ! t ! a ! b ! o ++ adv.s ; c2 = slash.c2 @@ -45,10 +59,9 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { SlashPrep cl prep = cl ** {c2 = prep} ; SlashVS np vs slash = - let subj = mkSubj np PrepNom - in mkClause subj.p1 subj.p2 - (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) ** - {c2 = slash.c2} ; + let subj = mkSubject np PrepNom ; + vp = insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs) + in mkClause subj.s subj.a vp ** {c2 = slash.c2} ; EmbedS s = {s = conjThat ++ s.s ! Sub} ; -- no leading comma, if sentence-initial EmbedQS qs = {s = qs.s ! QIndir} ; diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index 043e26747..2e52ad833 100644 --- a/src/german/StructuralGer.gf +++ b/src/german/StructuralGer.gf @@ -33,10 +33,12 @@ concrete StructuralGer of Structural = CatGer ** during_Prep = mkPrep "während" P.genitive ; --- no variants in the rgl | P.mkPrep P.accusative "über" ; either7or_DConj = sd2 "entweder" "oder" ** {n = Sg} ; everybody_NP = nameNounPhrase Masc {s = caselist "jeder" "jeden" "jedem" "jedes"} ; - every_Det = detUnlikeAdj False Sg "jed" ; + every_Det = let tab = (detUnlikeAdj False Sg "jed").s + in {s,sp = asQuant tab ; n = Sg ; a = Weak ; isDef = False ; hasDefArt = False} ; everything_NP = nameNounPhrase Neutr {s = caselist "alles" "alles" "allem" "alles"} ; everywhere_Adv = ss "überall" ; - few_Det = detLikeAdj False Pl "wenig" ; + few_Det = let tab = (detLikeAdj False Pl "wenig").s + in {s,sp = asQuant tab ; n = Pl ; a = Weak ; isDef = False ; hasDefArt = False} ; ---- first_Ord = {s = (regA "erst").s ! Posit} ; for_Prep = mkPrep "für" P.accusative ; from_Prep = mkPrep "aus" P.dative ; @@ -46,25 +48,26 @@ concrete StructuralGer of Structural = CatGer ** here_Adv = ss "hier" ; how_IAdv = ss "wie" ; how8much_IAdv = ss "wieviel" ; - how8many_IDet = {s = \\g,c => (detUnlikeAdj False Pl "wie viel").s ! g ! NPC c ; n = Pl} ; + how8many_IDet = {s = \\g,c => (detUnlikeAdj False Pl "wie viel").s ! g ! c ; n = Pl} ; if_Subj = ss "wenn" ; --- no variants in the RGL! | ss "falls" ; in8front_Prep = mkPrep "vor" P.dative ; i_Pron = mkPronPers "ich" "mich" "mir" "meiner" "mein" Masc Sg P1 ; - in_Prep = mkPrep [] (NPP CInDat) ; + in_Prep = P.inDat_Prep ; it_Pron = mkPronPers "es" "es" "ihm" "seiner" "sein" Neutr Sg P3 ; less_CAdv = X.mkCAdv "weniger" "als" ; - many_Det = detLikeAdj False Pl "viel" ; + many_Det = let tab = (detLikeAdj False Pl "viel").s + in {s,sp = asQuant tab ; n = Pl ; a = Weak ; isDef = False ; hasDefArt = False} ; more_CAdv = X.mkCAdv "mehr" "als" ; -- most_Predet = {s = appAdj (regA "meist") ; c = noCase ; a = PAgNone} ; most_Predet = { -- HL 5/2022 s = \\n,g,c => let gn = R.gennum g n ; - k = (R.prepC c).c ; adj = (P.mkA "viel" "mehr" "meiste").s ! Superl in - R.usePrepC c (\k -> R.artDef ! gn ! k ++ adj ! (agrAdj g Weak n k)) ; - c = {p = [] ; k = PredCase (NPC Gen)} ; + R.artDef ! gn ! c ++ adj ! (agrAdj g Weak n c) ; + c = {p = [] ; k = PredCase Gen} ; a = PAg Pl} ; - much_Det = {s = \\_,_ => "viel" ; sp = \\_,_ => "vieles" ; n = Sg ; a = Weak ; isDef = False} ; + much_Det = {s = asQuant (\\_,_ => "viel") ; sp = asQuant (\\_,_ => "vieles") ; + n = Sg ; a = Weak ; isDef = False ; hasDefArt = False} ; must_VV = auxVV (mkV "müssen" "muss" "musst" "muss" "müsst" "müss" @@ -78,27 +81,28 @@ concrete StructuralGer of Structural = CatGer ** on_Prep = mkPrep "auf" P.dative ; or_Conj = {s1 = [] ; s2 = "oder" ; n = Sg} ; otherwise_PConj = ss "sonst" ; - part_Prep = P.von_Prep ; -- mkPrep "von" P.dative ; + part_Prep = P.von_Prep ; -- obsolete, better use PartNP cn np please_Voc = ss "bitte" ; - possess_Prep = P.von_Prep ;-- mkPrep "von" P.dative ; + possess_Prep = P.von_Prep ; -- obsolete, better use PossNP cn np quite_Adv = ss "ziemlich" ; she_Pron = mkPronPers "sie" "sie" "ihr" "ihrer" "ihr" Fem Sg P3 ; so_AdA = ss "so" ; somebody_NP = nameNounPhrase Masc {s = caselist "jemand" "jemanden" "jemandem" "jemands"} ; - somePl_Det = detLikeAdj True Pl "einig" ; + somePl_Det = let tab = (detLikeAdj True Pl "einig").s + in {s,sp = asQuant tab ; n = Pl ; a = Weak ; isDef = True ; hasDefArt = False} ; someSg_Det = { - s,sp = \\g,c => - usePrepC c (\k -> "ein" + pronEnding ! GSg g ! k) ; ---- einer,eines + s,sp = asQuant (\\g,c => "ein" + pronEnding ! GSg g ! c) ; ---- einer,eines n = Sg ; a = Strong ; hasNum = True ; isDef = False ; + hasDefArt = False } ; something_NP = nameNounPhrase Neutr {s = \\_ => "etwas"} ; somewhere_Adv = ss "irgendwo" ; that_Quant = let - jener : Number => Gender => PCase => Str = \\n => (detUnlikeAdj True n "jen").s in - {s,sp = \\_ => jener ; a,aPl = Weak} ; + jener : Number => Gender => Case => Str = \\n => (detUnlikeAdj True n "jen").s in + {s,sp = \\_,_ => jener ; a,aPl = Weak ; hasDefArt = False} ; ---b that_NP = nameNounPhrase Neutr {s = caselist "das" "das" "dem" "dessen"} ; ---- there_Adv = ss "da" ; --- no variants in the rgl | ss "dort" ; there7to_Adv = ss "dahin" ; @@ -107,8 +111,8 @@ concrete StructuralGer of Structural = CatGer ** ---b these_NP = {s = caselist "diese" "diese" "diesen" "dieser" ; a = agrP3 Pl} ; they_Pron = mkPronPers "sie" "sie" "ihnen" "ihrer" "ihr" Fem Pl P3 ; this_Quant = let - dieser : Number => Gender => PCase => Str = \\n => (detUnlikeAdj True n "dies").s in - {s,sp = \\_ => dieser ; a,aPl = Weak} ; + dieser : Number => Gender => Case => Str = \\n => (detUnlikeAdj True n "dies").s in + {s,sp = \\_,_ => dieser ; a,aPl = Weak ; hasDefArt = False} ; ---b this_NP = nameNounPhrase Neutr {s = caselist "dies" "dies" "diesem" "dieses"} ; ---- ---b those_NP = {s = caselist "jene" "jene" "jenen" "jener" ; a = agrP3 Pl} ; through_Prep = mkPrep "durch" P.accusative ; @@ -130,7 +134,7 @@ concrete StructuralGer of Structural = CatGer ** when_IAdv = ss "wann" ; when_Subj = ss "wenn" ; where_IAdv = ss "wo" ; - which_IQuant = {s = \\n,g,c => (detUnlikeAdj True n "welch").s ! g ! NPC c} ; + which_IQuant = {s = \\n,g,c => (detUnlikeAdj True n "welch").s ! g ! c} ; whoSg_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Sg} ; whoPl_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Sg} ; -- HL 6/2016 @@ -139,17 +143,17 @@ concrete StructuralGer of Structural = CatGer ** with_Prep = mkPrep "mit" P.dative ; youSg_Pron = mkPronPers "du" "dich" "dir" "deiner" "dein" Fem Sg P2 ; youPl_Pron = mkPronPers "ihr" "euch" "euch" "eurer" "euer" Fem Pl P2 ; ---- poss - youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Fem Pl P3 ; + youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Fem Pl P3 ** {a = AgPlPol} ; yes_Utt = ss "ja" ; not_Predet = {s = \\_,_,_ => "nicht" ; c = noCase ; a = PAgNone} ; no_Quant = let - keiner : Number => Gender => PCase => Str = table { - Sg => \\g,c => usePrepC c (\k -> "kein" + pronEnding ! GSg g ! k) ; + keiner : Number => Gender => Case => Str = table { + Sg => \\g,c => "kein" + pronEnding ! GSg g ! c ; Pl => (detUnlikeAdj False Pl "kein").s } in - {s,sp = \\_ => keiner ; a = Strong ; aPl = Weak} ; ---- sp + {s,sp = \\_,_ => keiner ; a = Strong ; aPl = Weak ; hasDefArt = False} ; ---- sp if_then_Conj = {s1 = "wenn" ; s2 = "dann" ; n = Sg ; lock_Conj = <>} ; nobody_NP = nameNounPhrase Masc {s = caselist "niemand" "niemanden" "niemandem" "niemands"} ; @@ -166,6 +170,13 @@ concrete StructuralGer of Structural = CatGer ** lin language_title_Utt = ss "Deutsch" ; oper - appAdjDegAdjf : Adjective -> Degree -> Adjf -> Number => Gender => PCase => Str = - \adj,deg,adjf -> \\n,g,c => R.usePrepC c (\k -> adj.s ! deg ! (agrAdj g adjf n k)) ; + asQuant : (Gender => Case => Str) -> (Bool => Gender => Case => Str) = + \tab -> \\_,g,c => tab ! g ! c ; + asNum : (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) = + \tab -> \\g,c => {quant = []; num = tab ! g ! c} ; + pairTable : (Gender => Case => Str) -> (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) + = \qt,nt -> \\g,c => {quant = qt ! g ! c; num = nt ! g ! c} ; + appAdjDegAdjf : Adjective -> Degree -> Adjf -> Number => Gender => Case => Str = + \adj,deg,adjf -> \\n,g,c => adj.s ! deg ! (agrAdj g adjf n c) ; + } diff --git a/src/german/SymbolGer.gf b/src/german/SymbolGer.gf index 47f88fc0d..42b224321 100644 --- a/src/german/SymbolGer.gf +++ b/src/german/SymbolGer.gf @@ -9,28 +9,22 @@ lin NumPN i = {s = i.s ! Neutr ; g = Neutr ; n = Sg} ; --- c CNIntNP cn i = { - s = \\c => cn.s ! Weak ! Sg ! Nom ++ i.s ; + s = \\_,c => cn.s ! Weak ! Sg ! Nom ++ i.s ; a = agrP3 Sg ; - -- isPron = False ; - -- isLight = True ; w = WLight ; ext,rc = [] -- added } ; CNSymbNP det cn xs = let g = cn.g in { - s = \\c => det.s ! g ! c ++ - (let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ; + s = \\b,c => det.s ! b ! g ! c ++ cn.s ! adjfCase det.a c ! det.n ! c ++ xs.s ; a = agrP3 det.n ; - -- isPron = False ; - -- isLight = True ; w = WLight ; ext,rc = [] -- added } ; CNNumNP cn i = { - s = \\c => artDefContr (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! (prepC c).c ; - a = agrP3 Sg ; - -- isPron = False ; - -- isLight = True ; - w = WLight ; + s = \\b,c => case b of {True => [] ; False => artDef ! (GSg cn.g) ! c} + ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; + a = agrgP3 cn.g Sg ; -- HL 27.9.2023 + w = WDefArt ; -- im Haus 14 ext,rc = [] -- added } ; diff --git a/src/german/VerbGer.gf b/src/german/VerbGer.gf index ab153cb92..f24dda48a 100644 --- a/src/german/VerbGer.gf +++ b/src/german/VerbGer.gf @@ -4,17 +4,6 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { lin UseV = predV ; -{- - ComplVV v vp = - let - vpi = infVP v.isAux vp ; - vps = predVGen v.isAux v ; - in - insertExtrapos vpi.p4 ( - insertInfExt vpi.p3 ( - insertInf vpi.p2 ( - insertObjc vpi.p1 vps))) ; --} ComplVV v vp = -- HL 3/22: leave inf-complement in-place, extract infzu-complement let @@ -39,18 +28,6 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { insertExtrapos (comma ++ conjThat ++ s.s ! Sub) (predV v) ** {c2 = v.c2; objCtrl = False} ; SlashV2Q v q = insertExtrapos (comma ++ q.s ! QIndir) (predV v) ** {c2 = v.c2; objCtrl = False} ; -{- - SlashV2V v vp = - let - vpi = infVP v.isAux vp ; - vps = predVGen v.isAux v ** {c2 = v.c2} ; - in vps ** - insertExtrapos vpi.p4 ( -- inplace vp; better extract it! - insertInfExt vpi.p3 ( - insertInf vpi.p2 ( - insertObjc vpi.p1 vps))) ; - --} SlashV2V v vp = -- (jmdn) bitten, sich zu waschen | sich waschen lassen HL 7/19 let vps = predVGen v.isAux v ; -- e.g. verspricht|bittet.isAux=False | läßt.isAux=True @@ -69,17 +46,6 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { ** { c2 = vps.c2 ; objCtrl = vps.objCtrl } ; in insertObjNP np vps.c2 vp ; -{- - SlashVV v vp = - let - vpi = infVP v.isAux vp ; - vps = predVGen v.isAux v ** {c2 = vp.c2 } ; - in vps ** - insertExtrapos vpi.p3 ( - insertInf vpi.p2 ( - insertObj vpi.p1 vps)) ; --} - -- SlashVV v vps is like ComplVV v vp, but infinite vps should not be extracted SlashVV v vp = -- HL 3/2022 let @@ -123,9 +89,18 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { -- expensive: + SlashV2VNP 503.884.800 (2880,540), reaches memory limit with SlashVV -- does not work for nested uses: the nn-levels are confused HL 3/22 + -- to save a lot compile time and memory, avoid insertObjNP with glueing of prep+DefArt: + -- + SlashV2VNP 110.592.000 (46080,240) SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 - insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; - + -- insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; + let prep = v.c2 ; + obj = appPrep prep (np.s!False) ; -- simplify: no glueing of prep+DefArt, HL 8/22 + b : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; + c = prep.c ; + w = np.w ; + vps = (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) + in + insertObj' obj b w c vps ; UseComp comp = insertExtrapos comp.ext (insertObj comp.s (predV sein_V)) ; -- agr not used @@ -135,7 +110,7 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { UseCopula = predV sein_V ; CompAP ap = {s = \\_ => ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ; ext = ap.ext} ; - CompNP np = {s = \\_ => np.s ! NPC Nom ++ np.rc ; ext = np.ext} ; + CompNP np = {s = \\_ => np.s ! False ! Nom ++ np.rc ; ext = np.ext} ; CompAdv a = {s = \\_ => a.s ; ext = []} ; CompCN cn = {s = \\a => case numberAgr a of { @@ -153,13 +128,12 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { AdvVPSlash vp adv = vp ** insertAdv adv.s vp ; AdVVPSlash adv vp = vp ** insertAdv adv.s vp ; - -- ReflVP vp = insertObj (\\a => appPrep vp.c2 - -- (\\k => usePrepC k (\c -> reflPron ! a ! c))) vp ; + -- ReflVP vp = insertObj (\\a => appPrep vp.c2 (reflPron ! a)) vp ; ReflVP vp = insertObjRefl vp ; -- HL, 19/06/2019 PassV2 v = -- acc object -> nom subject; all others: same PCase let c = case of { - => NPC Nom ; _ => v.c2.c} + => Nom ; _ => v.c2.c} in insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) ** { c1 = v.c2 ** {c = c} } ; {- HL: The construction VPSlashPrep : VP -> Prep -> VPSlash does not exist diff --git a/src/greek/CatGre.gf b/src/greek/CatGre.gf index 69772dc3c..7b49c7b1d 100644 --- a/src/greek/CatGre.gf +++ b/src/greek/CatGre.gf @@ -68,6 +68,8 @@ concrete CatGre of Cat = CommonGre ** open ResGre, Prelude in { Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number} ; + + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/greek/NounGre.gf b/src/greek/NounGre.gf index 689faff58..58bee5607 100644 --- a/src/greek/NounGre.gf +++ b/src/greek/NounGre.gf @@ -111,6 +111,7 @@ concrete NounGre of Noun = CatGre ** open ResGre, ParadigmsGre, Prelude in { NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; AdNum adn num = {s = \\g,c => adn.s ++ num.s!g!c; n = num.n } ; @@ -244,4 +245,4 @@ concrete NounGre of Noun = CatGre ** open ResGre, ParadigmsGre, Prelude in { -} \ No newline at end of file +} diff --git a/src/greek/NumeralGre.gf b/src/greek/NumeralGre.gf index b898da1c5..1c3eddd1d 100644 --- a/src/greek/NumeralGre.gf +++ b/src/greek/NumeralGre.gf @@ -1,4 +1,4 @@ -concrete NumeralGre of Numeral = CatGre [Numeral,Digits] ** open ResGre,Prelude in { +concrete NumeralGre of Numeral = CatGre [Numeral,Digits,Decimal] ** open ResGre,Prelude in { flags coding= utf8 ; @@ -291,6 +291,20 @@ Xilias : CardOrd -> (CardOrd => Str) -> Number -> Str = \co,d,n -> D_8 = mk2Dig "8" Pl; D_9 = mk2Dig "9" Pl ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Neut Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk3Dig : Str -> Number -> TDigit = \c,n -> { diff --git a/src/greenlandic/NumeralKal.gf b/src/greenlandic/NumeralKal.gf index b5a968449..88bf6bb44 100644 --- a/src/greenlandic/NumeralKal.gf +++ b/src/greenlandic/NumeralKal.gf @@ -89,6 +89,20 @@ lin pot1 d = {s = \\nf => d.s ! NInstr ++ "qulillit"} ; ---- inflection of quli D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/hebrew/CatHeb.gf b/src/hebrew/CatHeb.gf index 83a1b9bf2..256505d08 100644 --- a/src/hebrew/CatHeb.gf +++ b/src/hebrew/CatHeb.gf @@ -34,6 +34,7 @@ concrete CatHeb of Cat = CommonX - [Utt,Tense,Temp] ** open ResHeb, Prelude, Pa A2 = {s : Str} ; Conj = {s : Str} ; Digits = {s : Str} ; +Decimal = {s : Str; hasDot : Bool} ; IComp = {s : Str} ; IDet = {s : Str} ; IP = {s : Str} ; diff --git a/src/hindi/NumeralHin.gf b/src/hindi/NumeralHin.gf index 4818d26a9..8775ebcf2 100644 --- a/src/hindi/NumeralHin.gf +++ b/src/hindi/NumeralHin.gf @@ -2,7 +2,7 @@ -- Modification for Urdu Shafqat Virk -concrete NumeralHin of Numeral = CatHin [Numeral,Digits] ** open ResHin,CommonHindustani,ParamX, Prelude in { +concrete NumeralHin of Numeral = CatHin [Numeral,Digits,Decimal] ** open ResHin,CommonHindustani,ParamX, Prelude in { flags coding=utf8 ; param DForm = unit | ten ; @@ -110,6 +110,7 @@ lin D_8 = { s = "८" ; n = Pl}; lin D_9 = { s = "९" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; oper ekhazar : Str = variants {"हज़ार" ; "एक" ++ "हज़ार"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "हज़ार"} ! sz ; diff --git a/src/hindi/ParseHin.gf b/src/hindi/ParseHin.gf deleted file mode 100644 index e31df6ffd..000000000 --- a/src/hindi/ParseHin.gf +++ /dev/null @@ -1,158 +0,0 @@ ---# -path=.:../abstract:../english:../hindustani:../translator -concrete ParseHin of ParseEngAbs = - TenseX - [AdN,Adv,SC,PPos,PNeg], --- TextX - [AdN,Adv,SC], - CatHin, - NounHin - [PPartNP], - AdjectiveHin, - NumeralHin, - ConjunctionHin, - VerbHin - [SlashV2V, PassV2, UseCopula, ComplVV, VPSlashPrep], - AdverbHin, - PhraseHin, - SentenceHin, - RelativeHin, - QuestionHin, - SymbolHin [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], --- StructuralHin, - IdiomHin [NP, VP, Tense, Cl, ProgrVP, ExistNP], - ExtraHin [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash,Temp,Pol,Conj,VPS,ListVPS,S,Num, CN, - RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP,VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, - VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,ClSlash, RCl, EmptyRelSlash], - DocumentationHin, - DictionaryHin ** -open MorphoHin, ResHin, ParadigmsHin,CommonX, CommonHindustani, Prelude in { - -flags - literal=Symb ; - coding=utf8 ; - -lin - myself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers1 }; - yourselfSg_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers2_Respect }; --regNP "yourself" singular ; - himself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Distant }; --regNP "himself" singular ; - herself_NP = {s = \\_ => kwd ; a = Ag Fem Sg Pers3_Distant }; --regNP "herself" singular ; - itself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Near }; --regNP "itself" singular ; - ourself_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers1 }; --regNP "ourself" plural ; - yourselfPl_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers2_Respect }; --regNP "yourself" plural ; - themselves_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers3_Distant }; --regNP "themself" plural ; - themself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Distant }; --regNP "themself" plural ; - - CompoundCN num noun cn = { - s = \\n,c => num.s ++ cn.s ! n ! c ++ noun.s ! num.n ! Dir; - g = cn.g - } ; - - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! n ! Dir ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; - - GerundN v = { - s = \\n,c => v.cvp ++ v.s ! Inf ; -- v.s ! VF Imperf Pers2_Casual n Masc ++ hwa (Ag Masc n Pers2_Casual) ; --the main verb of compound verbs - g = Masc - } ; - - GerundAP v = { - s = \\n,g,_,_ => v.cvp ++ v.s ! VF Imperf Pers2_Casual n g ++ hwa (Ag g n Pers2_Casual) ; - } ; - - PastPartAP v = { - s = \\n,g,_,_ => v.cvp ++ v.s ! VF Imperf Pers2_Casual n g ; -- the main verb of compound versb needs to be attached here - } ; - - OrdCompar a = {s = a.s ! Sg ! Masc ! Dir ! Compar ; n = Sg } ; - - PositAdVAdj a = {s = a.s ! Sg ! Masc ! Dir ! Posit} ; ---------------- ---SlashV2V v p vp = insertVV (infV2V v.isAux vp) (predV v) vp.embComp ** {c2 = {s = sE ; c = VTrans}}; -- changed from VTransPost -ComplVV v a p vp = insertTrans (insertVV (infVV v.isAux vp) (predV v) vp.embComp ) VTrans; -- changed from VTransPost ---------------- - - - UseQuantPN q pn = {s = \\c => q.s ! Sg ! pn.g ! Dir ++ pn.s ! Dir ; a = agrP3 pn.g Sg} ; - -PredVPosv np vp = mkClause np vp ; --{ -{- s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ vp.ad ++ verb.fin ++ verb.adv ++ verb.inf ; - OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf - } - } ; --} - PredVPovs np vp = mkClause np vp ; --{ -{- s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom ; - OQuest => verb.aux ++ compl ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom - } - } ; --} - -{- - SlashV2V v p vp = insertObjc (\\a => p.s ++ case p.p of {CPos => ""; _ => "not"} ++ - v.c3 ++ - infVP v.typ vp a) - (predVc v) ; - - ComplPredVP np vp = { - s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ; - OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf - } - } ; --} -CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ - infVP False vp a} ; -- check for vp.isAux - - that_RP = { - s = \\_,_ => "कि" ; - a = RNoAg - } ; - --no_RP = { - -- s = \\_,_ => "" ; - -- a = RNoAg - -- } ; - - CompS s = {s = \\_ => "कि" ++ s.s} ; --- CompVP vp = {s = \\a => infVP VVInf vp a} ; - -lin - PPos = {s = [] ; p = Pos} ; - PNeg = {s = [] ; p = Neg} ; - - VPSlashPrep vp p = vp ** {c2 = {s = p.s!Masc ; c = VTrans}} ; - - PastPartRS ant pol vps = { - s = \\agr => (vps.s!VPTense VPPast agr).inf ; - c = Dir - } ; - - PresPartRS ant pol vp = { - s = \\agr => (vp.s!VPTense VPPres agr).inf ; - c = Dir - } ; - - ApposNP np1 np2 = { - s = \\c => np1.s!NPC Dir ++ "," ++ np2.s ! c ; - a = np2.a - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - -} diff --git a/src/hindustani/CatHindustani.gf b/src/hindustani/CatHindustani.gf index b50e5ffb9..22ada04b2 100644 --- a/src/hindustani/CatHindustani.gf +++ b/src/hindustani/CatHindustani.gf @@ -70,6 +70,7 @@ incomplete concrete CatHindustani of Cat = Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; ---- Structural diff --git a/src/hindustani/NounHindustani.gf b/src/hindustani/NounHindustani.gf index d9f951d31..fb6778140 100644 --- a/src/hindustani/NounHindustani.gf +++ b/src/hindustani/NounHindustani.gf @@ -64,6 +64,7 @@ incomplete concrete NounHindustani of Noun = NumCard n = n ** {hasCard = True} ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd; n = n.n} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/hungarian/CatHun.gf b/src/hungarian/CatHun.gf index b4705e3fd..2247e4848 100644 --- a/src/hungarian/CatHun.gf +++ b/src/hungarian/CatHun.gf @@ -79,6 +79,7 @@ concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in { Card = ResHun.Numeral ; Numeral = ResHun.Numeral ; Digits = {s : CardOrd => Str} ; + Decimal = {s : CardOrd => Str; hasDot : Bool} ; diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index 7021a900e..c132d3486 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -137,6 +137,10 @@ concrete NounHun of Noun = CatHun ** open s = \\place => dig.s ! NCard ; } ; + NumDecimal dec = dec ** { + s = \\place => dec.s ! NCard ; + } ; + -- : Numeral -> Card ; NumNumeral num = num ; diff --git a/src/hungarian/NumeralHun.gf b/src/hungarian/NumeralHun.gf index f9c66af18..58405457a 100644 --- a/src/hungarian/NumeralHun.gf +++ b/src/hungarian/NumeralHun.gf @@ -1,4 +1,4 @@ -concrete NumeralHun of Numeral = CatHun [Numeral,Digits] ** +concrete NumeralHun of Numeral = CatHun [Numeral,Digits,Decimal] ** open Prelude, ResHun in { lincat @@ -115,6 +115,13 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecinal d = { + s = \\x => "-" ++ BIND ++ d.s ! x ; + n = numNumber ; + hasDot=False + } ; + oper mkDig : Str -> TDigit = \s -> { s = s ; diff --git a/src/icelandic/CatIce.gf b/src/icelandic/CatIce.gf index 986911b64..063d6b166 100644 --- a/src/icelandic/CatIce.gf +++ b/src/icelandic/CatIce.gf @@ -126,6 +126,7 @@ concrete CatIce of Cat = CommonX ** open ResIce, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; --2 Structural words diff --git a/src/icelandic/NounIce.gf b/src/icelandic/NounIce.gf index d4720a687..a938c16c2 100644 --- a/src/icelandic/NounIce.gf +++ b/src/icelandic/NounIce.gf @@ -86,6 +86,10 @@ concrete NounIce of Noun = CatIce ** open MorphoIce, ResIce, Prelude in { s = \\g,c => d.s ! NCard d.n g c; n = d.n } ; + NumDecimal d = { + s = \\g,c => d.s ! NCard d.n g c; + n = d.n + } ; NumNumeral d = { s = \\g,c => d.s ! NCard Sg g c; diff --git a/src/icelandic/NumeralIce.gf b/src/icelandic/NumeralIce.gf index 43b93c5b9..640e8081a 100644 --- a/src/icelandic/NumeralIce.gf +++ b/src/icelandic/NumeralIce.gf @@ -1,4 +1,4 @@ -concrete NumeralIce of Numeral = CatIce [Numeral,Digits] ** open Prelude, ResIce in { +concrete NumeralIce of Numeral = CatIce [Numeral,Digits,Decimal] ** open Prelude, ResIce in { param DForm = unit | teen | ten ; @@ -203,6 +203,20 @@ concrete NumeralIce of Numeral = CatIce [Numeral,Digits] ** open Prelude, ResIce D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Sg Masc Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ; diff --git a/src/interlingua/CatIna.gf b/src/interlingua/CatIna.gf index 2a463890d..b5bbdecfc 100644 --- a/src/interlingua/CatIna.gf +++ b/src/interlingua/CatIna.gf @@ -55,6 +55,7 @@ concrete CatIna of Cat = CommonX ** open ResIna, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number ; tail : DTail} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/interlingua/NounIna.gf b/src/interlingua/NounIna.gf index a61bca010..c3c8e5cdd 100644 --- a/src/interlingua/NounIna.gf +++ b/src/interlingua/NounIna.gf @@ -61,6 +61,7 @@ concrete NounIna of Noun = CatIna ** open ResIna, Prelude in { NumCard c = c ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd} ; diff --git a/src/interlingua/NumeralIna.gf b/src/interlingua/NumeralIna.gf index dbec5cf30..c486598e9 100644 --- a/src/interlingua/NumeralIna.gf +++ b/src/interlingua/NumeralIna.gf @@ -1,4 +1,4 @@ -concrete NumeralIna of Numeral = CatIna [Numeral,Digits] ** open ResIna,Prelude in { +concrete NumeralIna of Numeral = CatIna [Numeral,Digits,Decimal] ** open ResIna,Prelude in { lincat Digit = {s : DForm => CardOrd => Str} ; @@ -66,6 +66,20 @@ concrete NumeralIna of Numeral = CatIna [Numeral,Digits] ** open ResIna,Prelude D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND++","++BIND ; diff --git a/src/italian/CatIta.gf b/src/italian/CatIta.gf index eb7aa8427..3a2fd8212 100644 --- a/src/italian/CatIta.gf +++ b/src/italian/CatIta.gf @@ -1,4 +1,4 @@ --# -path=.:../romance:../abstract:../common:prelude -concrete CatIta of Cat = CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] ** CatRomance with +concrete CatIta of Cat = CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with (ResRomance = ResIta) ; diff --git a/src/italian/CompatibilityIta.gf b/src/italian/CompatibilityIta.gf index 99714e3e8..31d6dc70b 100644 --- a/src/italian/CompatibilityIta.gf +++ b/src/italian/CompatibilityIta.gf @@ -6,6 +6,6 @@ concrete CompatibilityIta of Compatibility = CatIta ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/italian/DiffIta.gf b/src/italian/DiffIta.gf index 32988d718..2adb90d04 100644 --- a/src/italian/DiffIta.gf +++ b/src/italian/DiffIta.gf @@ -251,4 +251,10 @@ instance DiffIta of DiffRomance - [contractInf] = open CommonRomance, PhonoIta, polNegDirSubj = RPos ; +param + HasArt = NoArt | UseArt ; + +oper + superlCanBePost = True ; + } diff --git a/src/italian/DocumentationItaFunctor.gf b/src/italian/DocumentationItaFunctor.gf index 89afd9074..b8c5ce01b 100644 --- a/src/italian/DocumentationItaFunctor.gf +++ b/src/italian/DocumentationItaFunctor.gf @@ -40,6 +40,42 @@ lin ) } ; + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Prenome" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \gn -> { + t = "pn" ; + s1 = heading1 "Cognome" ; + s2 = gn.s ! Masc + } ; + + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nome Proprio" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nom del Luogo" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; diff --git a/src/italian/ExtendIta.gf b/src/italian/ExtendIta.gf index 45da30608..b50ae1e12 100644 --- a/src/italian/ExtendIta.gf +++ b/src/italian/ExtendIta.gf @@ -16,12 +16,6 @@ concrete ExtendIta of Extend = CatIta ** ExtendRomanceFunctor - ParadigmsIta in { -- put your own definitions here -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; - lin PassVPSlash vps = passVPSlash vps [] ; PassAgentVPSlash vps np = passVPSlash diff --git a/src/italian/ExtraIta.gf b/src/italian/ExtraIta.gf index 40933568a..79eeee9cd 100644 --- a/src/italian/ExtraIta.gf +++ b/src/italian/ExtraIta.gf @@ -39,6 +39,7 @@ concrete ExtraIta of ExtraItaAbs = ExtraRomanceIta ** PossFamQuant p = { s = \\_,n,g,c => case n of {Sg => prepCase c ; _ => possCase g n c} ++ p.poss ! n ! g ; sp = \\ n,g,c => case n of {Sg => prepCase c ; _ => possCase g n c} ++ p.poss ! n ! g ; + spn= \\ c => prepCase c ++ p.poss ! Sg ! Masc ; s2 = [] ; isNeg = False } ; diff --git a/src/italian/GrammarIta.gf b/src/italian/GrammarIta.gf index 7204cbcd3..4870434d2 100644 --- a/src/italian/GrammarIta.gf +++ b/src/italian/GrammarIta.gf @@ -11,10 +11,11 @@ concrete GrammarIta of Grammar = RelativeIta, ConjunctionIta, PhraseIta, - TextX - [SC,Temp,Tense,Pol,PPos,PNeg,TPres,TPast,TFut,TCond], + TextX - [SC,Temp,Tense,Pol,PPos,PNeg,TPres,TPast,TFut,TCond,MU], IdiomIta, StructuralIta, - TenseIta + TenseIta, + NamesIta ** { diff --git a/src/italian/MakeStructuralIta.gf b/src/italian/MakeStructuralIta.gf index 8cd9aa6c8..67600e67e 100644 --- a/src/italian/MakeStructuralIta.gf +++ b/src/italian/MakeStructuralIta.gf @@ -34,6 +34,7 @@ oper in lin Quant { s = \\b => questo ; sp = questo ; + spn= \\c => prepCase c ++ s ; s2 = [] ; isNeg = False } ; @@ -53,6 +54,7 @@ oper in lin Quant { s = \\b => questo ; sp = questo ; + spn= \\c => prepCase c ++ tutto ; s2 = [] ; isNeg = False } ; @@ -62,8 +64,9 @@ oper -- Does not inflect for number mkDet : Str -> Number -> Det = \piu,n -> lin Det { s,sp = \\_,_ => piu ; + spn = \\_ => piu ; n = n ; - s2 = [] ; + s2 = \\g => [] ; isNeg = False } ; -- Inflects for number @@ -72,8 +75,9 @@ oper Masc => \\_ => alcuni ; Fem => \\_ => alcune } ; + spn = \\_ => alcuni ; n = n ; - s2 = [] ; + s2 = \\g => [] ; isNeg = False } ; } ; diff --git a/src/italian/NamesIta.gf b/src/italian/NamesIta.gf new file mode 100644 index 000000000..8cb83371a --- /dev/null +++ b/src/italian/NamesIta.gf @@ -0,0 +1,58 @@ +concrete NamesIta of Names = CatIta ** open ResIta, CommonRomance, Prelude in { + +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ! gn.g ; + g = gn.g + } ; + +lin PlainLN n = heavyNP { + s = \\c => n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin InLN n = { + s = case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + +} diff --git a/src/italian/NumeralIta.gf b/src/italian/NumeralIta.gf index d5e9e8e1e..93a55a2f4 100644 --- a/src/italian/NumeralIta.gf +++ b/src/italian/NumeralIta.gf @@ -1,4 +1,4 @@ -concrete NumeralIta of Numeral = CatIta [Numeral,Digits] ** +concrete NumeralIta of Numeral = CatIta [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoIta, PhonoIta, Prelude in { lincat @@ -137,6 +137,20 @@ param Pred = pred | indip ; D_7 = mkDig "7" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; oper mkDig : Str -> TDigit = \c -> mk2Dig c Pl ; diff --git a/src/italian/ParadigmsIta.gf b/src/italian/ParadigmsIta.gf index 78b09a54d..36165db94 100644 --- a/src/italian/ParadigmsIta.gf +++ b/src/italian/ParadigmsIta.gf @@ -145,7 +145,38 @@ oper mkPN : N -> PN ; -- get gender from noun } ; + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = Masc ; + num = Sg} ; + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = Sg} ; + mkLN : Str -> Gender -> Number -> LN = \s,g,n -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = n} + } ; + + defLN : LN -> LN = \n -> n ** {art = UseArt} ; --2 Adjectives @@ -327,8 +358,8 @@ oper Gender = MorphoIta.Gender ; Number = MorphoIta.Number ; - masculine = Masc ; - feminine = Fem ; + masculine, male = Masc ; + feminine, female = Fem ; singular = Sg ; plural = Pl ; @@ -347,11 +378,11 @@ oper in_Prep = {s = [] ; c = CPrep P_in ; isDir = False ; lock_Prep = <>} ; su_Prep = {s = [] ; c = CPrep P_su ; isDir = False ; lock_Prep = <>} ; - mk2N x y g = mkNounIrreg x y g ** {lock_N = <>} ; - regN x = mkNomReg x ** {lock_N = <>} ; - compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ; - femN x = {s = x.s ; g = feminine ; lock_N = <>} ; - mascN x = {s = x.s ; g = masculine ; lock_N = <>} ; + mk2N x y g = mkNounIrreg x y g ** {relType=NRelPrep P_da; lock_N = <>} ; + regN x = mkNomReg x ** {relType=NRelPrep P_da; lock_N = <>} ; + compN x y = x ** {s = \\n => x.s ! n ++ y} ; + femN x = {s = x.s ; g = feminine ; relType=NRelPrep P_da; lock_N = <>} ; + mascN x = {s = x.s ; g = masculine ; relType=NRelPrep P_da; lock_N = <>} ; mk2N2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ; @@ -487,7 +518,7 @@ oper mkN = overload { mkN : (cane : Str) -> N = regN ; - mkN : (carne : Str) -> Gender -> N = \n,g -> {s = (regN n).s ; g = g ; lock_N = <>} ; + mkN : (carne : Str) -> Gender -> N = \n,g -> (regN n) ** {g = g} ; mkN : (uomo,uomini : Str) -> Gender -> N = mk2N ; mkN : N -> Str -> N = compN } ; @@ -558,4 +589,6 @@ oper mk2V2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False; hasArt=False} ; + } ; diff --git a/src/italian/PhonoIta.gf b/src/italian/PhonoIta.gf index 1330e5b6a..d28d26f50 100644 --- a/src/italian/PhonoIta.gf +++ b/src/italian/PhonoIta.gf @@ -16,12 +16,10 @@ oper "Sb" ; "Sc" ; "Sd" ; "Sf" ; "Sg" ; "Sh" ; "Sl" ; "Sm" ; "Sn" ; "Sp" ; "Sq" ; "Sr" ; "St" ; "Sv" } ; - z : Strs = strs { - "z" ; "Z" - } ; - - x : Strs = strs { - "x" ; "X" + xyz : Strs = strs { + "x" ; "X" ; + "z" ; "Z" ; + "y" ; "Y" } ; gn : Strs = strs { @@ -38,7 +36,7 @@ oper elision : (_,_,_ : Str) -> Str = \il, l', lo -> let ll = case last l' of {"'" => l' ++ Predef.BIND ; _ => l'} in - pre {il ; ll / vocale ; lo / sImpuro ; lo / z ; lo / x ; lo / gn ; lo / pn ; lo / ps } ; + pre {il ; ll / vocale ; lo / sImpuro ; lo / xyz ; lo / gn ; lo / pn ; lo / ps } ; --- pre {vocale => l' ; sImpuro => lo ; _ => il} ; --- doesn't work properly 15/4/2014 } diff --git a/src/italian/StructuralIta.gf b/src/italian/StructuralIta.gf index 257e9ecb6..39c2a6bd9 100644 --- a/src/italian/StructuralIta.gf +++ b/src/italian/StructuralIta.gf @@ -31,10 +31,16 @@ lin during_Prep = mkPrep "durante" ; either7or_DConj = {s1,s2 = "o" ; n = Sg} ; everybody_NP = makeNP ["tutti"] Masc Pl ; - every_Det = {s,sp = \\_,_ => "ogni" ; n = Sg ; s2 = [] ; isNeg = False} ; + every_Det = { + s,sp = \\_,_ => "ogni" ; + spn = \\c => prepCase c ++ "tutto" ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; everything_NP = pn2np (mkPN ["tutto"] Masc) ; everywhere_Adv = ss "dappertutto" ; - few_Det = {s,sp = \\g,c => prepCase c ++ genForms "pochi" "poche" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + few_Det = { + s,sp = \\g,c => prepCase c ++ genForms "pochi" "poche" ! g ; + spn = \\c => prepCase c ++ "pochi" ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; ---- first_Ord = {s = \\ag => (regA "primo").s ! Posit ! AF ag.g ag.n} ; for_Prep = mkPrep "per" ; from_Prep = da_Prep ; @@ -60,11 +66,17 @@ lin "lui" "lo" "gli" "glie" "lui" "suo" "sua" "suoi" "sue" Masc Sg P3 ; less_CAdv = X.mkCAdv "meno" conjThan ; - many_Det = {s,sp = \\g,c => prepCase c ++ genForms "molti" "molte" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + many_Det = { + s,sp = \\g,c => prepCase c ++ genForms "molti" "molte" ! g ; + spn = \\c => prepCase c ++ "molto" ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; more_CAdv = X.mkCAdv "più" conjThan ; most_Predet = {s = \\_,c => prepCase c ++ ["la maggior parte"] ; c = CPrep P_di ; a = PNoAg} ; - much_Det = {s,sp = \\g,c => prepCase c ++ genForms "molto" "molta" ! g ; n = Sg ; s2 = [] ; isNeg = False} ; + much_Det = { + s,sp = \\g,c => prepCase c ++ genForms "molto" "molta" ! g ; + spn = \\c => prepCase c ++ "molto" ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; must_VV = mkVV (verboV (dovere_47 "dovere")) ; no_Utt = ss "no" ; on_Prep = {s = [] ; c = CPrep P_su ; isDir = False} ; @@ -83,8 +95,14 @@ lin Fem Sg P3 ; so_AdA = ss "così" ; somebody_NP = pn2np (mkPN ["qualcuno"] Masc) ; - somePl_Det = {s,sp = \\_,c => prepCase c ++ "qualche" ; n = Pl ; s2 = [] ; isNeg = False} ; - someSg_Det = {s,sp = \\_,c => prepCase c ++ "qualche" ; n = Sg ; s2 = [] ; isNeg = False} ; + somePl_Det = { + s,sp = \\_,c => prepCase c ++ "qualche" ; + spn = \\c => prepCase c ++ "qualche cosa" ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; + someSg_Det = { + s,sp = \\_,c => prepCase c ++ "qualche" ; + spn = \\c => prepCase c ++ "qualche cosa" ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; something_NP = pn2np (mkPN ["qualche cosa"] Masc) ; somewhere_Adv = ss ["qualche parte"] ; that_Quant = let @@ -98,6 +116,7 @@ lin quello (elision "quel" "quell'" "quello") (elision "quei" "quegli" "quegli") ; sp = quello "quello" "quelli" ; + spn= \\c => prepCase c ++ "quello" ; s2 = [] ; isNeg = False } ; @@ -118,6 +137,7 @@ lin in { s = \\_ => questo ; sp = questo ; + spn= \\c => prepCase c ++ "questo" ; s2 = [] ; isNeg = False } ; @@ -169,6 +189,7 @@ lin in { s = \\_ => aucun ; sp = aucun ; + spn= \\c => prepCase c ++ "nessuno" ; s2 = [] ; isNeg = True } ; diff --git a/src/italian/TerminologyIta.gf b/src/italian/TerminologyIta.gf index 448bc9724..9e396c538 100644 --- a/src/italian/TerminologyIta.gf +++ b/src/italian/TerminologyIta.gf @@ -23,27 +23,27 @@ lincat lin noun_Category = mkN "nome" ; - adjective_Category = mkN "addiettivo" ; - verb_Category = mkN "verbe" masculine ; + adjective_Category = mkN "aggettivo" ; + verb_Category = mkN "verbo" ; gender_ParameterType = mkN "genere" masculine ; singular_Parameter = mkN "singolare" ; plural_Parameter = mkN "plurale" ; - masculine_Parameter = mkN "maschio" ; + masculine_Parameter = mkN "maschile" ; feminine_Parameter = mkN "femminile" ; neuter_Parameter = mkN "neutro" ; nominative_Parameter = mkN "nominativo" ; genitive_Parameter = mkN "genitivo" ; dative_Parameter = mkN "dativo" ; - accusative_Parameter = mkN "accusativi" ; + accusative_Parameter = mkN "accusativo" ; imperative_Parameter = mkN "imperativo" ; indicative_Parameter = mkN "indicativo" ; conjunctive_Parameter = mkN "congiuntivo" ; - infinitive_Parameter = mkN "infinitivo" ; + infinitive_Parameter = mkN "infinito" ; present_Parameter = mkN "presente" ; past_Parameter = mkN "passato" ; @@ -59,10 +59,10 @@ lin positive_Parameter = mkN "positivo" ; comparative_Parameter = mkN "comparativo" ; superlative_Parameter = mkN "superlativo" ; - predicative_Parameter = mkN "prédicativo" ; + predicative_Parameter = mkN "predicativo" ; nounHeading n = ss (n.s ! Sg) ; exampleGr_N = mkN "esempio" masculine ; -} \ No newline at end of file +} diff --git a/src/japanese/CatJpn.gf b/src/japanese/CatJpn.gf index 0cf0cc74d..fa667d1fe 100644 --- a/src/japanese/CatJpn.gf +++ b/src/japanese/CatJpn.gf @@ -54,6 +54,7 @@ flags coding = utf8 ; DAP = Det ; Numeral = {s : Str ; n : Number ; tenPlus : Bool} ; Digits = {s : Str ; n : Number ; tenPlus : Bool ; tail : DTail} ; + Decimal = {s : Str ; n : Number ; tenPlus : Bool ; hasDot : Bool} ; Conj = Conjunction ; -- {s : Str ; null : Str ; type : ConjType} ; Subj = Subjunction ; -- {s : Str ; type : SubjType} ; Prep = Preposition ; -- {s : Str ; null : Str} ; diff --git a/src/japanese/NounJpn.gf b/src/japanese/NounJpn.gf index 182181eca..be22c7111 100644 --- a/src/japanese/NounJpn.gf +++ b/src/japanese/NounJpn.gf @@ -134,6 +134,7 @@ flags coding = utf8 ; NumCard card = card ** {inclCard = True} ; NumDigits num = num ** {postpositive = []} ; + NumDecimal num = num ** {postpositive = []} ; NumNumeral num = num ** {postpositive = []} ; diff --git a/src/japanese/NumeralJpn.gf b/src/japanese/NumeralJpn.gf index 90ce9a46c..32c873a69 100644 --- a/src/japanese/NumeralJpn.gf +++ b/src/japanese/NumeralJpn.gf @@ -1,4 +1,4 @@ -concrete NumeralJpn of Numeral = CatJpn [Numeral,Digits] ** open ResJpn, ParadigmsJpn, Prelude in { +concrete NumeralJpn of Numeral = CatJpn [Numeral,Digits,Decimal] ** open ResJpn, ParadigmsJpn, Prelude in { flags coding = utf8 ; @@ -202,7 +202,23 @@ flags coding = utf8 ; D_7 = {s = "7" ; n = Pl ; is0 = False} ; D_8 = {s = "8" ; n = Pl ; is0 = False} ; D_9 = {s = "9" ; n = Pl ; is0 = False} ; - + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + n = Pl ; + tenPlus = d.tenPlus ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + n = Pl ; + tenPlus = d.tenPlus ; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => "," ; diff --git a/src/kikamba/NumeralKam.gf b/src/kikamba/NumeralKam.gf index d66ae9192..030cb1a32 100644 --- a/src/kikamba/NumeralKam.gf +++ b/src/kikamba/NumeralKam.gf @@ -69,6 +69,20 @@ lin pot3plus n m = { s = table { D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o,g => "-" ++ BIND ++ d.s ! o ! g ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o,g => d.s ! NCard ! g ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; diff --git a/src/korean/CatKor.gf b/src/korean/CatKor.gf index af4b862c2..5248a598f 100644 --- a/src/korean/CatKor.gf +++ b/src/korean/CatKor.gf @@ -78,8 +78,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in { Card = ResKor.Num ; Numeral = ResKor.Numeral ; Digits = {s : CardOrd => Str ; n : Number} ; - - + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; --2 Structural words @@ -115,7 +114,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in { N = ResKor.Noun ; N2 = ResKor.Noun2 ; N3 = ResKor.Noun3 ; - GN, SN, PN = ResKor.NounPhrase ; + GN, SN, LN, PN = ResKor.NounPhrase ; linref V, V2, V3 = linVerb ; diff --git a/src/korean/ExtendKor.gf b/src/korean/ExtendKor.gf index 560f6bcea..9e318518a 100644 --- a/src/korean/ExtendKor.gf +++ b/src/korean/ExtendKor.gf @@ -9,10 +9,4 @@ concrete ExtendKor of Extend = CatKor -- : NP -> NP -> NP ApposNP np1 np2 = np1 ** {s = \\nf => np1.s ! nf ++ np2.s ! nf} ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\nf => gn.s ! nf ++ sn.s ! nf ; - p = gn.p - } ; - } ; diff --git a/src/korean/GrammarKor.gf b/src/korean/GrammarKor.gf index 55550ada2..e0fd1c01b 100644 --- a/src/korean/GrammarKor.gf +++ b/src/korean/GrammarKor.gf @@ -12,7 +12,8 @@ concrete GrammarKor of Grammar = TextX, StructuralKor, IdiomKor, - TenseX + TenseX, + NamesKor ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/korean/NamesKor.gf b/src/korean/NamesKor.gf new file mode 100644 index 000000000..f6c6069ab --- /dev/null +++ b/src/korean/NamesKor.gf @@ -0,0 +1,11 @@ +concrete NamesKor of Names = CatKor ** open ResKor in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> n ; +lin FullName gn sn = { + s = \\nf => gn.s ! nf ++ sn.s ! nf ; + p = gn.p + } ; + + UseLN pn = pn ; + +} diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index 327cc8ded..e446fb6c7 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -107,6 +107,12 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { numtype = IsDig } ; + NumDecimal dec = baseNum ** { + s = \\_,_ => dec.s ! NCard ; + n = dec.n ; + numtype = IsDig + } ; + -- : Numeral -> Card ; NumNumeral num = num ; diff --git a/src/korean/NumeralKor.gf b/src/korean/NumeralKor.gf index e8b41c2ce..7b7d979d6 100644 --- a/src/korean/NumeralKor.gf +++ b/src/korean/NumeralKor.gf @@ -1,4 +1,4 @@ -concrete NumeralKor of Numeral = CatKor [Numeral,Digits] ** +concrete NumeralKor of Numeral = CatKor [Numeral,Digits,Decimal] ** open Prelude, ResKor in { lincat @@ -154,6 +154,16 @@ lin D_7 = mkDig "7" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o=>d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + hasDot=True; + n = Pl + } ; oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o numNumber ; diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index aab5f2a59..e3ffd3340 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -198,4 +198,6 @@ oper } ; -------------------------------------------------------------------------------- + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/latin/CatLat.gf b/src/latin/CatLat.gf index b283d8655..8394fe0d4 100644 --- a/src/latin/CatLat.gf +++ b/src/latin/CatLat.gf @@ -63,6 +63,7 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in { -- Numeral = ResLat.TNumeral ; Digits = {s : Str ; unit : Unit} ; + Decimal = {s : Str ; unit : Unit ; hasDot : Bool} ; -- ---- Structural -- diff --git a/src/latin/NumeralLat.gf b/src/latin/NumeralLat.gf index 0ed4fe40e..cb25237a0 100644 --- a/src/latin/NumeralLat.gf +++ b/src/latin/NumeralLat.gf @@ -209,6 +209,8 @@ concrete NumeralLat of Numeral = CatLat, ParamX[Number] ** open ParadigmsLat, Pr D_8 = mkDig "VIII" "XVIII" "LXXX" "DCCC" "(VIII)" "(LXXX)" "(DCCC)" ; D_9 = mkDig "IX" "XIX" "XC" "CM" "(IX)" "(XC)" "(CM)" ; + PosDecimal d = d ** {hasDot=False} ; + oper TDig = { s : Unit => Str diff --git a/src/latvian/CatLav.gf b/src/latvian/CatLav.gf index fda3d86ec..be990f60b 100644 --- a/src/latvian/CatLav.gf +++ b/src/latvian/CatLav.gf @@ -78,6 +78,7 @@ lincat Numeral = {s : CardOrd => Gender => Case => Str ; num : Number} ; Digits = {s : CardOrd => Str ; num : Number} ; + Decimal = {s : CardOrd => Str ; num : Number ; hasDot : Bool} ; -- Structural words diff --git a/src/latvian/NounLav.gf b/src/latvian/NounLav.gf index 4e37d7222..2d82dd2b7 100644 --- a/src/latvian/NounLav.gf +++ b/src/latvian/NounLav.gf @@ -138,6 +138,7 @@ lin -- Digits -> Card -- e.g. '51' NumDigits digits = { s = \\_,_ => digits.s ! NCard ; num = digits.num } ; + NumDecimal dec = { s = \\_,_ => dec.s ! NCard ; num = dec.num } ; -- Numeral -> Card -- e.g. 'fifty-one' diff --git a/src/latvian/NumeralLav.gf b/src/latvian/NumeralLav.gf index c53a5a494..2bcdfa9a2 100644 --- a/src/latvian/NumeralLav.gf +++ b/src/latvian/NumeralLav.gf @@ -1,6 +1,6 @@ --# -path=.:abstract:common:prelude -concrete NumeralLav of Numeral = CatLav [Numeral,Digits] ** open ResLav, ParadigmsLav, Prelude in { +concrete NumeralLav of Numeral = CatLav [Numeral,Digits,Decimal] ** open ResLav, ParadigmsLav, Prelude in { flags coding = utf8 ; @@ -109,6 +109,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + num = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + num = Pl ; + hasDot=True + } ; + oper mkDig : Str -> Dig = \c -> mk2Dig c Pl ; diff --git a/src/latvian/StructuralLav.gf b/src/latvian/StructuralLav.gf index 61f96dfd3..577ff1eff 100644 --- a/src/latvian/StructuralLav.gf +++ b/src/latvian/StructuralLav.gf @@ -266,7 +266,7 @@ lin can8know_VV = mkVV (mkV "varēt" third_conjugation) ; must_VV = mkVV (mkV "vajadzēt" third_conjugation Dat) ; - please_Voc = ss "lūdzu" ; + please_Voc = ss ", lūdzu" ; oper diff --git a/src/lithuanian/CatLit.gf b/src/lithuanian/CatLit.gf index 1951adda6..200568cca 100644 --- a/src/lithuanian/CatLit.gf +++ b/src/lithuanian/CatLit.gf @@ -75,6 +75,7 @@ concrete CatLit of Cat = CommonX - [CAdv, Adv] ** open ResLit, Prelude, (R = Par numAgr:NumComb; nb:Number }; Ord = { s:AForm => Str }; Digits = { s:Str; o:Str; numAgr:NumComb; nb:Number }; + Decimal = { s:Str; o:Str; numAgr:NumComb; nb:Number; hasDot : Bool }; ---- Structural diff --git a/src/lithuanian/NounLit.gf b/src/lithuanian/NounLit.gf index d37f7bebd..4a090181a 100644 --- a/src/lithuanian/NounLit.gf +++ b/src/lithuanian/NounLit.gf @@ -249,6 +249,7 @@ concrete NounLit of Noun = CatLit ** open ResLit, Prelude, MorphoLit, Predef in -- NumDigits : Digits -> Card ; -- 51 NumDigits n = { s=\\_,_ => n.s; numAgr=n.numAgr; nb=n.nb }; + NumDecimal n = { s=\\_,_ => n.s; numAgr=n.numAgr; nb=n.nb }; -- NumCard : Card -> Num ; NumCard c = c ** { hasCard = True }; diff --git a/src/lithuanian/NumeralLit.gf b/src/lithuanian/NumeralLit.gf index 6693535b0..5d1909d0a 100644 --- a/src/lithuanian/NumeralLit.gf +++ b/src/lithuanian/NumeralLit.gf @@ -345,4 +345,21 @@ oper simtas : Case * Number => Str D_8 = { s = "8"; o="8."; nb=Pl; numAgr=AgrComb }; D_9 = { s = "9"; o="9."; nb=Pl; numAgr=AgrComb }; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s; + o = "-" ++ BIND ++ d.o; + nb=Pl; + numAgr=d.numAgr; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + nb = Pl ; + numAgr=d.numAgr; + hasDot=True + } ; + } diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 74b5192c1..089d1a441 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -80,6 +80,7 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { Card = ResMay.CardNum ; Numeral = ResMay.CardOrdNum ; Digits = ResMay.DigNum ; + Decimal = ResMay.DigNum**{hasDot : Bool} ; @@ -132,4 +133,4 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { -- Determiner : Type = Quant ** { -- pr : Str ; -- prefix for numbers -- n : NumType ; -- number as in 5 (noun in singular), Sg or Pl --- } ; \ No newline at end of file +-- } ; diff --git a/src/malay/ConstructionMay.gf b/src/malay/ConstructionMay.gf index 7bd5489f6..eda790f8f 100644 --- a/src/malay/ConstructionMay.gf +++ b/src/malay/ConstructionMay.gf @@ -1,4 +1,4 @@ -concrete ConstructionMay of Construction = CatMay ** open ParadigmsMay in { +concrete ConstructionMay of Construction = CatMay ** open ParadigmsMay, (L=LexiconMay), (G=GrammarMay) in { lincat Timeunit = N ; @@ -6,13 +6,15 @@ lincat Monthday = NP ; Month = N ; Year = NP ; -{- + lin - timeunitAdv n time = - let n_card : Card = n ; - n_hours_NP : NP = mkNP n_card time ; - in SyntaxMay.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ; + has_age_VP card = G.ComplSlash (G.SlashV2a umur_V2) (G.DetCN (G.DetQuant G.IndefArt (G.NumCard card)) (G.UseN L.year_N)) ; + +oper + umur_V2 : V2 = mkV2 (mkV "umur") noPrep ; + +{- weekdayPunctualAdv w = ; -- on Sunday weekdayHabitualAdv w = ; -- on Sundays diff --git a/src/malay/MissingMay.gf b/src/malay/MissingMay.gf index 63c9936aa..ddd653bda 100644 --- a/src/malay/MissingMay.gf +++ b/src/malay/MissingMay.gf @@ -1,7 +1,6 @@ resource MissingMay = open GrammarMay, Prelude in { oper AdAP : AdA -> AP -> AP = notYet "AdAP" ; oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ; -oper AdNum : AdN -> Card -> Card = notYet "AdNum" ; oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ; oper AdVVPSlash : AdV -> VPSlash -> VPSlash = notYet "AdVVPSlash" ; oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ; @@ -54,7 +53,6 @@ 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 OrdDigits : Digits -> Ord = notYet "OrdDigits" ; oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ; oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ; oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ; @@ -113,14 +111,11 @@ oper art_N : N = notYet "art_N" ; oper as_CAdv : CAdv = notYet "as_CAdv" ; oper ashes_N : N = notYet "ashes_N" ; oper ask_V2Q : V2Q = notYet "ask_V2Q" ; -oper at_least_AdN : AdN = notYet "at_least_AdN" ; -oper at_most_AdN : AdN = notYet "at_most_AdN" ; oper baby_N : N = notYet "baby_N" ; oper back_N : N = notYet "back_N" ; oper bad_A : A = notYet "bad_A" ; oper bank_N : N = notYet "bank_N" ; oper bark_N : N = notYet "bark_N" ; -oper because_Subj : Subj = notYet "because_Subj" ; oper become_VA : VA = notYet "become_VA" ; oper beer_N : N = notYet "beer_N" ; oper before_Prep : Prep = notYet "before_Prep" ; diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index b2f665b4d..be459693d 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -101,16 +101,20 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { s = dig.s ! NCard } ; + NumDecimal dec = { + s = dec.s ! NCard + } ; + -- : Numeral -> Card ; NumNumeral num = num ; -{- + -- : AdN -> Card -> Card ; AdNum adn card = card ** { s = adn.s ++ card.s } ; -- : Digits -> Ord ; OrdDigits digs = digs ** { s = digs.s ! NOrd } ; --} + -- : Numeral -> Ord ; OrdNumeral num = { s = num.ord diff --git a/src/malay/NumeralMay.gf b/src/malay/NumeralMay.gf index a0d391937..c835ceddf 100644 --- a/src/malay/NumeralMay.gf +++ b/src/malay/NumeralMay.gf @@ -1,6 +1,6 @@ -- David Wahlstedt 2002 (cardinal numbers) -- Inari Listenmaa 2020 (ordinals + cosmetic changes) -concrete NumeralMay of Numeral = CatMay [Numeral,Digits] ** +concrete NumeralMay of Numeral = CatMay [Numeral,Digits,Decimal] ** open Prelude, ResMay in { lincat @@ -151,6 +151,16 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False} ; + IFrac d i = { + s=\\o=>d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + hasDot=True; + n = Pl + } ; + oper mkDig : Str -> DigNum = \s -> { s = table { diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 3d26332c2..567149fd9 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -3,11 +3,11 @@ concrete StructuralMay of Structural = CatMay ** ------- -- Ad* +lin at_least_AdN = ss "sekurangnya" ; +lin at_most_AdN = ss "paling tua" ; {- lin almost_AdA = mkAdA "" ; lin almost_AdN = ss "" ; -lin at_least_AdN = ss "" ; -lin at_most_AdN = ss "" ; lin so_AdA = ss "" ; lin too_AdA = ss "" ; lin very_AdA = mkAdA "" ; @@ -154,7 +154,7 @@ lin whoSg_IP = mkIP "siapa"; -- Subj -- lin although_Subj = --- lin because_Subj = +lin because_Subj = ss "kerana" ; lin if_Subj = ss "sekiranya" ; lin that_Subj = ss "yang" ; lin when_Subj = ss "kalau" ; diff --git a/src/maltese/CatMlt.gf b/src/maltese/CatMlt.gf index aa8009343..bf77bc9fc 100644 --- a/src/maltese/CatMlt.gf +++ b/src/maltese/CatMlt.gf @@ -98,6 +98,11 @@ concrete CatMlt of Cat = CommonX - [Adv] ** open ResMlt, Prelude in { n : NumForm ; tail : DTail ; } ; + Decimal = { + s : NumCase => Str ; -- No need for CardOrd, i.e. no 1st, 2nd etc in Maltese + n : NumForm ; + hasDot : Bool ; + } ; -- Structural @@ -118,7 +123,7 @@ concrete CatMlt of Cat = CommonX - [Adv] ** open ResMlt, Prelude in { N = Noun ; N2 = Noun ** {c2 : Compl} ; N3 = Noun ** {c2, c3 : Compl} ; - GN, SN, PN = ProperNoun ; + GN, SN, LN, PN = ProperNoun ; -- Overridden from CommonX diff --git a/src/maltese/ExtraMlt.gf b/src/maltese/ExtraMlt.gf index 7b9dab47a..8a9a9c885 100644 --- a/src/maltese/ExtraMlt.gf +++ b/src/maltese/ExtraMlt.gf @@ -24,10 +24,4 @@ concrete ExtraMlt of ExtraMltAbs = CatMlt ** a = p.a ; } ; -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - a = gn.a - } ; - } diff --git a/src/maltese/GrammarMlt.gf b/src/maltese/GrammarMlt.gf index 885e72082..4dbf5e94e 100644 --- a/src/maltese/GrammarMlt.gf +++ b/src/maltese/GrammarMlt.gf @@ -20,7 +20,8 @@ concrete GrammarMlt of Grammar = TextX - [Adv], StructuralMlt, IdiomMlt, - TenseX - [Adv] + TenseX - [Adv], + NamesMlt ** { flags coding=utf8 ; diff --git a/src/maltese/NamesMlt.gf b/src/maltese/NamesMlt.gf new file mode 100644 index 000000000..40ad01efa --- /dev/null +++ b/src/maltese/NamesMlt.gf @@ -0,0 +1,23 @@ +concrete NamesMlt of Names = CatMlt ** open ResMlt, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> { + s = \\c => n.s ; + a = n.a ; + isPron = False ; + isDefn = False + } ; +lin FullName gn sn = { + s = \\c => gn.s ++ sn.s ; + a = gn.a ; + isPron = False ; + isDefn = False + } ; + +lin UseLN pn = { + s = \\c => pn.s ; + a = pn.a ; + isPron = False ; + isDefn = False ; + } ; + +} diff --git a/src/maltese/NounMlt.gf b/src/maltese/NounMlt.gf index c4b388663..408e7aa80 100644 --- a/src/maltese/NounMlt.gf +++ b/src/maltese/NounMlt.gf @@ -189,6 +189,8 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude, Maybe in { -- 51 NumDigits d = {s = d.s ; n = d.n} ; + NumDecimal d = {s = d.s ; n = d.n} ; + -- Digits -> Ord -- 51st OrdDigits d = {s = d.s} ; diff --git a/src/maltese/NumeralMlt.gf b/src/maltese/NumeralMlt.gf index 1d19d1e08..313f3a4de 100644 --- a/src/maltese/NumeralMlt.gf +++ b/src/maltese/NumeralMlt.gf @@ -4,7 +4,7 @@ -- John J. Camilleri 2011 -- 2013 -- Licensed under LGPL -concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt in { +concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits,Decimal] ** open Prelude,ResMlt in { flags coding=utf8 ; @@ -437,4 +437,18 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt tail = inc i.tail } ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = d.n ; + hasDot=False + } ; + IFrac d i = { + s=\\o=>d.s ! NumNom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = d.n; + hasDot=True + } ; + } diff --git a/src/maltese/ParadigmsMlt.gf b/src/maltese/ParadigmsMlt.gf index 78afebc93..88d13a44e 100644 --- a/src/maltese/ParadigmsMlt.gf +++ b/src/maltese/ParadigmsMlt.gf @@ -1423,4 +1423,6 @@ resource ParadigmsMlt = open mkOrd : Str -> Ord = \x -> lin Ord { s = \\c => x }; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/mongolian/CatMon.gf b/src/mongolian/CatMon.gf index 172798e6a..e9cb5082c 100644 --- a/src/mongolian/CatMon.gf +++ b/src/mongolian/CatMon.gf @@ -84,7 +84,8 @@ lincat Num = {s : Str ; sp : RCase => Str ; n : Number ; isNum : Bool} ; Card = {s : Str ; sp : RCase => Str ; n : Number} ; Numeral = {s : CardOrd => Str; n : Number} ; - Digits = {s : CardOrd => Str ; n : Number} ; + Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; -- Structural diff --git a/src/mongolian/NounMon.gf b/src/mongolian/NounMon.gf index 672e84af8..6bedac074 100644 --- a/src/mongolian/NounMon.gf +++ b/src/mongolian/NounMon.gf @@ -109,7 +109,7 @@ lin NumCard n = n ** {isNum = True} ; - NumDigits,NumNumeral = \numeral -> { + NumDigits,NumNumeral,NumDecimal = \numeral -> { s = numeral.s ! NCard ; sp = \\_ => numeral.s ! NCard ; n = numeral.n diff --git a/src/mongolian/NumeralMon.gf b/src/mongolian/NumeralMon.gf index 2c2d941b7..060ad7314 100644 --- a/src/mongolian/NumeralMon.gf +++ b/src/mongolian/NumeralMon.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../prelude -concrete NumeralMon of Numeral = CatMon [Numeral,Digits] ** open ResMon, MorphoMon, Prelude in { +concrete NumeralMon of Numeral = CatMon [Numeral,Digits,Decimal] ** open ResMon, MorphoMon, Prelude in { flags coding=utf8 ; @@ -158,6 +158,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\co => "-" ++ BIND ++ d.s ! co ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\co => d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! co; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "-р") ; diff --git a/src/nepali/CatNep.gf b/src/nepali/CatNep.gf index 9414f783d..53a066f07 100644 --- a/src/nepali/CatNep.gf +++ b/src/nepali/CatNep.gf @@ -68,6 +68,7 @@ concrete CatNep of Cat = CommonX - [Adv] ** open ResNep, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/nepali/NounNep.gf b/src/nepali/NounNep.gf index ccfd710fc..5a278765a 100644 --- a/src/nepali/NounNep.gf +++ b/src/nepali/NounNep.gf @@ -72,6 +72,7 @@ concrete NounNep of Noun = CatNep ** open ResNep, Prelude in { PossPron p = {s = \\_,_ => p.ps } ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd ; n = n.n} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/nepali/NumeralNep.gf b/src/nepali/NumeralNep.gf index b9778f70b..e16dba725 100644 --- a/src/nepali/NumeralNep.gf +++ b/src/nepali/NumeralNep.gf @@ -1,4 +1,4 @@ -concrete NumeralNep of Numeral = CatNep [Numeral,Digits] ** open ResNep, Prelude in { +concrete NumeralNep of Numeral = CatNep [Numeral,Digits,Decimal] ** open ResNep, Prelude in { -- By Harald Hammarstroem -- Modification for Nepali by Dinesh Simkhada and Shafqat Virk - 2011 flags coding=utf8 ; @@ -114,6 +114,16 @@ lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue d.s (dg.s ! df) ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { s = \\df => Prelude.glue "-" (d.s ! df) ; n = Pl ; hasDot=False } ; + IFrac d i = { + s=\\df=>d.s ! df ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + hasDot=True; + n = Pl + } ; + oper ekhazar : Str = variants {"एक" ++ "हजार" ; "हजार"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "हजार"} ! sz ; oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "एक" ++ "सय" ; _ => s ++ "सय"} ! sz ; diff --git a/src/nepali/src/NumeralNep.gf b/src/nepali/src/NumeralNep.gf index d3a2ba718..5a9a53d67 100644 --- a/src/nepali/src/NumeralNep.gf +++ b/src/nepali/src/NumeralNep.gf @@ -114,6 +114,8 @@ lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue d.s (dg.s ! df) ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; + oper ekhazar : Str = variants {"e:k" ++ "hjar" ; "hjar"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "hjar"} ! sz ; oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "e:k" ++ "sy" ; _ => s ++ "sy"} ! sz ; diff --git a/src/norwegian/DiffNor.gf b/src/norwegian/DiffNor.gf index e3f7b771a..0c807c6ac 100644 --- a/src/norwegian/DiffNor.gf +++ b/src/norwegian/DiffNor.gf @@ -10,10 +10,9 @@ instance DiffNor of DiffScand = open CommonScand, Prelude in { param NGenderNor = NUtr Sex | NNeutr ; - Sex = Masc | Fem ; oper - utrum = NUtr Masc ; + utrum = NUtr Male ; neutrum = NNeutr ; detDef : Species = Def ; diff --git a/src/norwegian/MorphoNor.gf b/src/norwegian/MorphoNor.gf index 061ebe478..1a521c4ac 100644 --- a/src/norwegian/MorphoNor.gf +++ b/src/norwegian/MorphoNor.gf @@ -14,8 +14,8 @@ resource MorphoNor = CommonScand, ResNor ** open Prelude, Predef in { -- genders oper - masc = NUtr Masc ; - fem = NUtr Fem ; + masc = NUtr Male ; + fem = NUtr Female ; neutr = NNeutr ; -- type synonyms diff --git a/src/norwegian/NumeralNor.gf b/src/norwegian/NumeralNor.gf index 19074963e..08c315bb0 100644 --- a/src/norwegian/NumeralNor.gf +++ b/src/norwegian/NumeralNor.gf @@ -1,4 +1,4 @@ -concrete NumeralNor of Numeral = CatNor [Numeral,Digits] ** open MorphoNor, Prelude in { +concrete NumeralNor of Numeral = CatNor [Numeral,Digits,Decimal] ** open MorphoNor, Prelude in { flags coding=utf8 ; lincat @@ -68,6 +68,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/norwegian/ParadigmsNor.gf b/src/norwegian/ParadigmsNor.gf index 532448296..a3dc7de9b 100644 --- a/src/norwegian/ParadigmsNor.gf +++ b/src/norwegian/ParadigmsNor.gf @@ -279,8 +279,8 @@ oper Gender = MorphoNor.NGender ; Number = MorphoNor.Number ; Case = MorphoNor.Case ; - masculine = NUtr Masc ; - feminine = NUtr Fem ; + masculine = NUtr Male ; + feminine = NUtr Female ; neutrum = NNeutr ; utrum = masculine ; singular = Sg ; diff --git a/src/nynorsk/DiffNno.gf b/src/nynorsk/DiffNno.gf index 868a2bff9..f0adcc0ba 100644 --- a/src/nynorsk/DiffNno.gf +++ b/src/nynorsk/DiffNno.gf @@ -10,10 +10,9 @@ instance DiffNno of DiffScand = open CommonScand, Prelude in { param NGenderNno = NUtr Sex | NNeutr ; - Sex = Masc | Fem ; oper - utrum = NUtr Masc ; + utrum = NUtr Male ; neutrum = NNeutr ; detDef : Species = Def ; diff --git a/src/nynorsk/MorphoNno.gf b/src/nynorsk/MorphoNno.gf index d38761e70..2b59c14c9 100644 --- a/src/nynorsk/MorphoNno.gf +++ b/src/nynorsk/MorphoNno.gf @@ -14,8 +14,8 @@ resource MorphoNno = CommonScand, ResNno ** open Prelude, Predef in { -- genders oper - masc = NUtr Masc ; - fem = NUtr Fem ; + masc = NUtr Male ; + fem = NUtr Female ; neutr = NNeutr ; -- type synonyms diff --git a/src/nynorsk/NumeralNno.gf b/src/nynorsk/NumeralNno.gf index 35282effc..8334230fa 100644 --- a/src/nynorsk/NumeralNno.gf +++ b/src/nynorsk/NumeralNno.gf @@ -1,4 +1,4 @@ -concrete NumeralNno of Numeral = CatNno [Numeral,Digits] ** open MorphoNno, Prelude in { +concrete NumeralNno of Numeral = CatNno [Numeral,Digits,Decimal] ** open MorphoNno, Prelude in { flags coding=utf8 ; lincat @@ -68,6 +68,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/nynorsk/ParadigmsNno.gf b/src/nynorsk/ParadigmsNno.gf index f94046b4d..145074902 100644 --- a/src/nynorsk/ParadigmsNno.gf +++ b/src/nynorsk/ParadigmsNno.gf @@ -276,8 +276,8 @@ oper Gender = MorphoNno.NGender ; Number = MorphoNno.Number ; Case = MorphoNno.Case ; - masculine = NUtr Masc ; - feminine = NUtr Fem ; + masculine = NUtr Male ; + feminine = NUtr Female ; neutrum = NNeutr ; singular = Sg ; plural = Pl ; diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index 2cc00b129..86b1def46 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -64,7 +64,8 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in { ---- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; - Digits = {s : CardOrd => Str ; n : Number } ; + Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/persian/NounPes.gf b/src/persian/NounPes.gf index c76776b8c..d4db13245 100644 --- a/src/persian/NounPes.gf +++ b/src/persian/NounPes.gf @@ -97,6 +97,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { NumCard n = n ** {isNum = True} ; NumDigits n = n ** {s = n.s ! NCard; isNum = True} ; + NumDecimal n = n ** {s = n.s ! NCard; isNum = True} ; OrdDigits n = n ** {s = n.s ! NOrd ; isNum = True ; isPre=False} ; NumNumeral n = n ** {s = n.s ! NCard; isNum = True} ; diff --git a/src/persian/NumeralPes.gf b/src/persian/NumeralPes.gf index 3e1f767b3..1305364fb 100644 --- a/src/persian/NumeralPes.gf +++ b/src/persian/NumeralPes.gf @@ -1,5 +1,5 @@ --# -path=.:../abstract:../common: -concrete NumeralPes of Numeral = CatPes [Numeral,Digits] ** open ResPes,Prelude in { +concrete NumeralPes of Numeral = CatPes [Numeral,Digits,Decimal] ** open ResPes,Prelude in { flags coding = utf8; @@ -83,7 +83,21 @@ lin pot3plus n m = { D_9 = mkDig "9" ; -- lin IDig d = { s = \\_ => d.s ; n = Sg} ; - lin IIDig d dg = { s = \\df => d.s ! NCard ++ dg.s ! df ; n = Pl}; + IIDig d dg = { s = \\df => d.s ! NCard ++ dg.s ! df ; n = Pl}; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\df => "-" ++ d.s ! df ; + n = Pl ; + hasDot=False + }; + IFrac d i = { + s=\\df=>d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! df; + n = Pl; + hasDot=True + } ; oper commaIf : DTail -> Str = \t -> case t of { diff --git a/src/polish/CatPol.gf b/src/polish/CatPol.gf index 702952fe0..cf29fa914 100644 --- a/src/polish/CatPol.gf +++ b/src/polish/CatPol.gf @@ -75,6 +75,7 @@ concrete CatPol of Cat = CommonX - [CAdv] ** open ResPol, Prelude, (R = ParamX) a:Accom; n:Number }; Ord = { s: AForm => Str }; Digits = { s:Str; o:Str; a:Accom; n:Number }; + Decimal = { s:Str; o:Str; a:Accom; n:Number; hasDot : Bool }; ---- Structural @@ -119,7 +120,7 @@ concrete CatPol of Cat = CommonX - [CAdv] ** open ResPol, Prelude, (R = ParamX) N3 = Noun ** { c1, c2 : Complement } ; - GN, SN, PN = NounPhrase; + GN, SN, LN, PN = NounPhrase; CAdv = {s,p,sn,pn : Str} ; diff --git a/src/polish/DocumentationPol.gf b/src/polish/DocumentationPol.gf index 8eda32b1a..9ac7a0342 100644 --- a/src/polish/DocumentationPol.gf +++ b/src/polish/DocumentationPol.gf @@ -52,6 +52,25 @@ lin ) } ; + InflectionLN = \pn -> { + t = "im" ; + s1 = heading1 ("Imię" ++ case pn.gn of { + MascPersSg|MascAniSg|MascInaniSg|MascPersPl => "(męskorzeczowy)"; + FemSg => "(żeński)"; + NeutSg => "(nijaki)"; + _ => "" + }) ; + s2 = frameTable ( + tr (th "mianownik" ++ td (pn.nom)) ++ + tr (th "dopełniacz" ++ td (pn.dep ! GenPrep)) ++ + tr (th "celownik" ++ td (pn.dep ! DatPrep)) ++ + tr (th "biernik" ++ td (pn.dep ! AccPrep)) ++ + tr (th "narzędnik" ++ td (pn.dep ! InstrC)) ++ + tr (th "miejscownik" ++ td (pn.dep ! LocPrep)) ++ + tr (th "wołacz" ++ td (pn.voc)) + ) + } ; + InflectionGN = \pn -> { t = "im" ; s1 = heading1 ("Imię" ++ case pn.gn of { diff --git a/src/polish/ExtendPol.gf b/src/polish/ExtendPol.gf index f787007fe..afa4f84cf 100644 --- a/src/polish/ExtendPol.gf +++ b/src/polish/ExtendPol.gf @@ -40,13 +40,4 @@ oper -- KA: PassVPSlash is derived from PassV2. Objects might be ignored lin PassVPSlash vps = setImienne vps True; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - nom = gn.nom ++ sn.nom ; - voc = gn.nom ++ sn.voc ; - dep = \\c => gn.nom ++ sn.dep ! c ; - gn = gn.gn ; - p = gn.p - } ; - } diff --git a/src/polish/GrammarPol.gf b/src/polish/GrammarPol.gf index 6393ceee8..85172e1d0 100644 --- a/src/polish/GrammarPol.gf +++ b/src/polish/GrammarPol.gf @@ -15,6 +15,7 @@ concrete GrammarPol of Grammar = PhrasePol, TenseX - [CAdv], TextX - [CAdv], + NamesPol, StructuralPol, IdiomPol ** { flags startcat = Phr ; unlexer = text ; lexer = text ;} ; diff --git a/src/polish/NamesPol.gf b/src/polish/NamesPol.gf new file mode 100644 index 000000000..a8d060db7 --- /dev/null +++ b/src/polish/NamesPol.gf @@ -0,0 +1,14 @@ +concrete NamesPol of Names = CatPol ** { + +lin GivenName, MaleSurname, FemaleSurname = \n -> n ; +lin FullName gn sn = { + nom = gn.nom ++ sn.nom ; + voc = gn.nom ++ sn.voc ; + dep = \\c => gn.nom ++ sn.dep ! c ; + gn = gn.gn ; + p = gn.p + } ; + +lin UseLN n = n; + +} diff --git a/src/polish/NounPol.gf b/src/polish/NounPol.gf index e6678b236..36c82e92b 100644 --- a/src/polish/NounPol.gf +++ b/src/polish/NounPol.gf @@ -163,6 +163,8 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor -- NumDigits : Digits -> Card ; -- 51 NumDigits n = { s=\\_,_ => n.s; a=n.a; n=n.n }; + + NumDecimal n = { s=\\_,_ => n.s; a=n.a; n=n.n }; -- NumCard : Card -> Num ; NumCard c = c ** { hasCard = True }; @@ -208,4 +210,11 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor DetDAP d = d ; + QuantityNP n m = { + nom,voc = preOrPost m.isPre m.s n.s; + dep = \\cc => preOrPost m.isPre m.s n.s ; + gn = OthersPl; + p = P3 + } ; + } diff --git a/src/polish/NumeralPol.gf b/src/polish/NumeralPol.gf index 92a8e1c3c..60ec87840 100644 --- a/src/polish/NumeralPol.gf +++ b/src/polish/NumeralPol.gf @@ -2,7 +2,7 @@ -- Adam Slaski, 2009, 2010 -concrete NumeralPol of Numeral = CatPol [Numeral,Digits] ** open ResPol,Prelude, AdjectiveMorphoPol in { +concrete NumeralPol of Numeral = CatPol [Numeral,Digits,Decimal] ** open ResPol,Prelude, AdjectiveMorphoPol in { flags coding=utf8 ; @@ -553,4 +553,24 @@ oper tysiac = table { D_8 = { s = "8"; o="8."; n=Pl; a=PiecA }; D_9 = { s = "9"; o="9."; n=Pl; a=PiecA }; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s; + o = "-" ++ BIND ++ d.o; + n=Pl; + a=d.a; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + o = d.o ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.o; + n=Pl; + a=d.a; + hasDot=True + } ; + } diff --git a/src/polish/ParadigmsPol.gf b/src/polish/ParadigmsPol.gf index daea8a45c..062ff07d3 100644 --- a/src/polish/ParadigmsPol.gf +++ b/src/polish/ParadigmsPol.gf @@ -4,7 +4,7 @@ -- Inari Listenmaa, 2020 resource ParadigmsPol = open - CatPol, MorphoPol, ResPol, (NM=NounMorphoPol) + CatPol, MorphoPol, ResPol, (NM=NounMorphoPol), Prelude in { flags coding=utf8; @@ -383,4 +383,6 @@ _ => NM.mkNTable0171 sgnom -- Alternatives: mkNTable0000,mkNTable0001,mkNTable0002,mkNTable0003,mkNTable0010,mkNTable0015,mkNTable0028,mkNTable0037,mkNTable0043,mkNTable0044,mkNTable0053,mkNTable0064,mkNTable0067,mkNTable0075,mkNTable0091,mkNTable0096,mkNTable0111,mkNTable0117,mkNTable0118,mkNTable0129,mkNTable0131,mkNTable0168,mkNTable0171,mkNTable0173,mkNTable0176,mkNTable0181,mkNTable0191,mkNTable0197,mkNTable0213,mkNTable0243,mkNTable0244,mkNTable0247,mkNTable0248,mkNTable0271,mkNTable0281,mkNTable0282,mkNTable0286,mkNTable0304,mkNTable0309,mkNTable0312,mkNTable0315,mkNTable0324,mkNTable0333,mkNTable0338,mkNTable0348,mkNTable0350,mkNTable0365,mkNTable0373,mkNTable0375,mkNTable0428,mkNTable0444,mkNTable0467,mkNTable0495,mkNTable0497,mkNTable0500,mkNTable0503,mkNTable0514,mkNTable0516,mkNTable0518,mkNTable0519,mkNTable0523,mkNTable0539,mkNTable0542,mkNTable0550,mkNTable0552,mkNTable0570,mkNTable0578,mkNTable0583,mkNTable0589,mkNTable0648,mkNTable0662,mkNTable0691,mkNTable0696,mkNTable0717,mkNTable0773,mkNTable0803,mkNTable0826,mkNTable0828,mkNTable0859,mkNTable0868,mkNTable0869,mkNTable0944,mkNTable0964,mkNTable0965,mkNTable0966,mkNTable0970,mkNTable0981,mkNTable0991,mkNTable0995 } ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/portuguese/CatPor.gf b/src/portuguese/CatPor.gf index 9c794dfcc..faf439ba9 100644 --- a/src/portuguese/CatPor.gf +++ b/src/portuguese/CatPor.gf @@ -1,5 +1,5 @@ --# -path=.:../romance:../abstract:../common:prelude concrete CatPor of Cat = CommonX - - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] ** CatRomance with + [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with (ResRomance = ResPor) ; diff --git a/src/portuguese/CompatibilityPor.gf b/src/portuguese/CompatibilityPor.gf index a300fbef6..d9bc7265d 100644 --- a/src/portuguese/CompatibilityPor.gf +++ b/src/portuguese/CompatibilityPor.gf @@ -6,6 +6,6 @@ concrete CompatibilityPor of Compatibility = CatPor ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/portuguese/DiffPor.gf b/src/portuguese/DiffPor.gf index 04185d2d3..8290c7feb 100644 --- a/src/portuguese/DiffPor.gf +++ b/src/portuguese/DiffPor.gf @@ -291,4 +291,10 @@ instance DiffPor of DiffRomance - [iAdvQuestionInv,chooseTA,otherInv,partAgr,sta -- make a verb of type haver verboV v = verbBesch v ** {vtyp = VTer ; p = [] } ; +param + HasArt = NoArt | UseArt ; + +oper + superlCanBePost = False ; + } ; diff --git a/src/portuguese/DocumentationPorFunctor.gf b/src/portuguese/DocumentationPorFunctor.gf index d4912ef5b..232916796 100644 --- a/src/portuguese/DocumentationPorFunctor.gf +++ b/src/portuguese/DocumentationPorFunctor.gf @@ -40,6 +40,42 @@ lin ) } ; + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Prenome" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \gn -> { + t = "pn" ; + s1 = heading1 "Sobrenome" ; + s2 = gn.s ! Masc + } ; + + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nome Próprio" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nom do Local" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; diff --git a/src/portuguese/ExtendPor.gf b/src/portuguese/ExtendPor.gf index 68ba4f96c..50a696e6c 100644 --- a/src/portuguese/ExtendPor.gf +++ b/src/portuguese/ExtendPor.gf @@ -67,10 +67,14 @@ concrete ExtendPor of Extend = CatPor ** ExtendRomanceFunctor - lin CompoundN noun noun2 = { -- order is different because that's needed for correct translation from english - s = \\n => noun2.s ! n - ++ variants {"de" ; genForms "do" "da" ! noun.g} - ++ noun.s ! Sg ; - g = noun2.g + s = \\n => noun2.s ! n ++ + case noun2.relType of { + NRelPrep p => artDef True noun.g Sg (CPrep p) ; -- tasa de suicidio + NRelNoPrep => [] -- connessione internet = internet connection + } ++ + noun.s ! Sg ; + g = noun2.g ; + relType = noun2.relType } ; CompoundAP noun adj = { @@ -116,10 +120,4 @@ concrete ExtendPor of Extend = CatPor ** ExtendRomanceFunctor - youPolPlFem_Pron = pronAgr youPolPl_Pron Fem Pl P2 ; theyFem_Pron = mkPronFrom S.they_Pron "elas" "as" "lhes" "elas" Fem Pl P3 ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; - } ; diff --git a/src/portuguese/GrammarPor.gf b/src/portuguese/GrammarPor.gf index 4f28e1ec1..cbdb545d2 100644 --- a/src/portuguese/GrammarPor.gf +++ b/src/portuguese/GrammarPor.gf @@ -11,10 +11,11 @@ concrete GrammarPor of Grammar = RelativePor, ConjunctionPor, PhrasePor, - TextPor - [SC,Temp,Tense,Pol,PPos,PNeg], -- special punctuation + TextPor - [SC,Temp,Tense,Pol,PPos,PNeg,MU], -- special punctuation IdiomPor, StructuralPor, - TensePor + TensePor, + NamesPor ** { diff --git a/src/portuguese/LexiconPor.gf b/src/portuguese/LexiconPor.gf index 63bce8dce..b2de26ebf 100644 --- a/src/portuguese/LexiconPor.gf +++ b/src/portuguese/LexiconPor.gf @@ -13,7 +13,7 @@ lin probable_AS = mkAS (prefixA (mkA "provável")) ; fun_AV = mkAV (mkA "divertido") genitive ; -- A - bad_A = prefixA (mkA (mkA "mau") (mkA "pior")) ; + bad_A = prefixA (mkA (mkA "mau" "má" "maus" "más") (mkA "pior")) ; beautiful_A = prefixA (mkA "belo") ; -- bela big_A = prefixA (mkA "grande") ; black_A = mkA "preto" ; -- preta diff --git a/src/portuguese/MorphoPor.gf b/src/portuguese/MorphoPor.gf index ac95daef5..3ac902560 100644 --- a/src/portuguese/MorphoPor.gf +++ b/src/portuguese/MorphoPor.gf @@ -252,9 +252,10 @@ oper mkOrdinal : A -> Ord = \adj -> lin Ord { s = \\ag => adj.s ! genNum2Aform ag.g ag.n ; + s2 = \\_ => [] } ; - mkQuantifier : (esse,essa,esses,essas : Str) -> Quant = \esse,essa,esses,essas-> + mkQuantifier : (esse,essa,esses,essas,esso : Str) -> Quant = \esse,essa,esses,essas,esso-> let attrforms : Number => Gender => Case => Str = table { Sg => \\g,c => prepCase c ++ genForms esse essa ! g ; @@ -264,14 +265,16 @@ oper s = \\_ => attrforms ; s2 = [] ; sp = attrforms ; -- in spanish it was different + spn= \\c => prepCase c ++ esso ; isNeg = False } ; mkDeterminer : (muito,muita : Str) -> Number -> Bool -> Det = \muito,muita,number,neg -> lin Det { s,sp = \\g,c => prepCase c ++ genForms muito muita ! g ; + spn = \\c => prepCase c ++ muito ; n = number; - s2 = [] ; + s2 = \\g => [] ; isNeg = neg } ; diff --git a/src/portuguese/NamesPor.gf b/src/portuguese/NamesPor.gf new file mode 100644 index 000000000..b3ccdfc3a --- /dev/null +++ b/src/portuguese/NamesPor.gf @@ -0,0 +1,58 @@ +concrete NamesPor of Names = CatPor ** open ResPor, CommonRomance, Prelude in { + +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ! gn.g ; + g = gn.g + } ; + +lin PlainLN n = heavyNP { + s = \\c => n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin InLN n = { + s = case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + +} diff --git a/src/portuguese/NumeralPor.gf b/src/portuguese/NumeralPor.gf index 5006a5ec8..b1ddce787 100644 --- a/src/portuguese/NumeralPor.gf +++ b/src/portuguese/NumeralPor.gf @@ -1,4 +1,4 @@ -concrete NumeralPor of Numeral = CatPor [Numeral,Digits] ** +concrete NumeralPor of Numeral = CatPor [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoPor, Prelude, Predef in { flags coding=utf8 ; @@ -207,6 +207,20 @@ concrete NumeralPor of Numeral = CatPor [Numeral,Digits] ** D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper mk4Dig : Str -> Str -> Str -> Number -> TDigit = \c,o,a,n -> { s = table { diff --git a/src/portuguese/ParadigmsPor.gf b/src/portuguese/ParadigmsPor.gf index a3472920c..fe1fbd934 100644 --- a/src/portuguese/ParadigmsPor.gf +++ b/src/portuguese/ParadigmsPor.gf @@ -49,11 +49,11 @@ oper Gender : Type ; Gender = MorphoPor.Gender ; - masculine : Gender ; - masculine = Masc ; + masculine, male : Gender ; + masculine, male = Masc ; - feminine : Gender ; - feminine = Fem ; + feminine, female : Gender ; + feminine, female = Fem ; -- To abstract over number names, we define the following. @@ -102,7 +102,7 @@ oper --2 Nouns regN : Str -> N ; --% - regN x = lin N (mkNomReg x) ; + regN x = lin N (mkNomReg x ** {relType=NRelPrep P_de}) ; femN : N -> N ; --% femN n = n ** {g = feminine} ; @@ -111,7 +111,7 @@ oper mascN n = n ** {g = masculine} ; mk2N : (bastão, bastões : Str) -> Gender -> N ; --% - mk2N x y g = lin N (mkNounIrreg x y g) ; + mk2N x y g = lin N (mkNounIrreg x y g ** {relType=NRelPrep P_de}) ; -- The regular function takes the singular form and the gender, and -- computes the plural and the gender by a heuristic (see MorphoPor @@ -206,6 +206,40 @@ oper = \n -> lin PN {s = n.s ! Sg ; g = n.g} ; } ; + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = Masc ; + num = Sg} ; + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = Sg} ; + + mkLN : Str -> Gender -> Number -> LN = \s,g,num -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = num} ; + } ; + + defLN : LN -> LN = \n -> n ** {art = UseArt} ; + --2 Adjectives compADeg : Adj -> A ; --% compADeg a = lin A @@ -564,5 +598,7 @@ oper reflVerboV : Verbum -> V = \ve -> reflV (lin V (verboV ve)) ; --% + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False; hasArt=False} ; + } ; diff --git a/src/portuguese/StructuralPor.gf b/src/portuguese/StructuralPor.gf index 953bfe7a6..782e19640 100644 --- a/src/portuguese/StructuralPor.gf +++ b/src/portuguese/StructuralPor.gf @@ -102,6 +102,7 @@ concrete StructuralPor of Structural = CatPor ** in { s = \\_ => nenhum ; sp = nenhum ; + spn= \\c => prepCase c ++ "nada" ; s2 = [] ; isNeg = True } ; no_Utt = ss "não" ; @@ -124,13 +125,13 @@ concrete StructuralPor of Structural = CatPor ** someSg_Det = mkDeterminer "algum" "alguma" Sg False ; something_NP = pn2np (mkPN "algo" Masc) ; somewhere_Adv = ss ["em algum lugar"] ; - that_Quant = mkQuantifier "esse" "essa" "esses" "essas" ; + that_Quant = mkQuantifier "esse" "essa" "esses" "essas" "isso" ; there_Adv = mkAdv "ali" ; -- lá there7to_Adv = mkAdv ["para lá"] ; there7from_Adv = mkAdv "dali" ; therefore_PConj = ss ["por isso"] ; - this_Quant = mkQuantifier "este" "esta" "estes" "estas" ; + this_Quant = mkQuantifier "este" "esta" "estes" "estas" "isto" ; through_Prep = mkPrep [] ablative ; -- por too_AdA = ss "demasiado" ; -- o certo seria demais como postfix to_Prep = complDat ; diff --git a/src/punjabi/CatPnb.gf b/src/punjabi/CatPnb.gf index fdccd81c2..5410a10f6 100644 --- a/src/punjabi/CatPnb.gf +++ b/src/punjabi/CatPnb.gf @@ -61,7 +61,8 @@ concrete CatPnb of Cat = CommonX - [Adv] ** open ResPnb, Prelude in { ---- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; - Digits = {s : CardOrd => Str ; n : Number } ; + Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/punjabi/NounPnb.gf b/src/punjabi/NounPnb.gf index 1231e9aaa..959e8772f 100644 --- a/src/punjabi/NounPnb.gf +++ b/src/punjabi/NounPnb.gf @@ -64,6 +64,8 @@ concrete NounPnb of Noun = CatPnb ** open ResPnb, Prelude in { NumDigits n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; + NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; OrdNumeral numeral = {s = numeral.s ! NOrd ; n = numeral.n} ; diff --git a/src/punjabi/NumeralPnb.gf b/src/punjabi/NumeralPnb.gf index 8dcdb71f2..ceba5005d 100644 --- a/src/punjabi/NumeralPnb.gf +++ b/src/punjabi/NumeralPnb.gf @@ -1,4 +1,4 @@ -concrete NumeralPnb of Numeral = CatPnb [Numeral,Digits] ** open ResPnb, Prelude in { +concrete NumeralPnb of Numeral = CatPnb [Numeral,Digits,Decimal] ** open ResPnb, Prelude in { -- By Harald Hammarstroem -- Modification for Punjabi by Shafqat Virk flags coding=utf8 ; @@ -119,6 +119,19 @@ lin D_8 = { s = "۸" ; n = Pl}; lin D_9 = { s = "۹" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; +lin IFrac d i = { + s = \\o => d.s ! o ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + n = Pl ; + hasDot=True + } ; oper ekhazar : Str = variants {"ہزار" ; "اك" ++ "ہزار"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ہزار"} ! sz ; diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index 3b52a1038..dc56e066c 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -1,4 +1,4 @@ -incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] +incomplete concrete CatRomance of Cat = CommonX - [SC,Pol,MU] ** open Prelude, CommonRomance, ResRomance, (R = ParamX) in { flags optimize=all_subs ; @@ -65,14 +65,16 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] Det,DAP = { s : Gender => Case => Str ; n : Number ; - s2 : Str ; -- -ci + s2 : Gender => Str ; -- -ci sp : Gender => Case => Str ; -- substantival: mien, mienne + spn: Case => Str ; isNeg : Bool -- negative element, e.g. aucun } ; Quant = { s : Bool => Number => Gender => Case => Str ; s2 : Str ; sp : Number => Gender => Case => Str ; + spn: Case => Str ; -- neutral Spa: esto, eso, Por: isto, isso isNeg : Bool -- negative element, e.g. aucun } ; Predet = { @@ -82,12 +84,13 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] } ; Num = {s : Gender => Str ; isNum : Bool ; n : Number} ; Card = {s : Gender => Str ; n : Number} ; - Ord = {s : AAgr => Str} ; + Ord = {s, s2 : AAgr => Str} ; -- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural @@ -107,10 +110,17 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] A = {s : AForm => Str ; compar : ComparAgr => Str ; isPre : Bool ; copTyp : CopulaType ; isDeg : Bool} ; A2 = {s : AForm => Str ; compar : ComparAgr => Str ; c2 : Compl ; copTyp : CopulaType ; isDeg : Bool} ; - N = Noun ; - N2 = Noun ** {c2 : Compl} ; - N3 = Noun ** {c2,c3 : Compl} ; - GN, SN, PN = {s : Str ; g : Gender} ; + N = Noun ** {relType : NRelType}; + N2 = Noun ** {relType : NRelType; c2 : Compl} ; + N3 = Noun ** {relType : NRelType; c2,c3 : Compl} ; + GN, PN = {s : Str ; g : Gender} ; + SN = {s : Gender => Str ; pl : Str} ; + LN = {s : Str; + onPrep : Bool; + art : HasArt; + g : Gender; + num : Number; + } ; -- tense augmented with passé simple lincat @@ -136,7 +146,14 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] A = \a -> a.s ! genNum2Aform Masc Sg ; A2 = \a -> a.s ! genNum2Aform Masc Sg ++ a.c2.s ; + Det = \d -> d.s ! Masc ! Nom ++ d.s2 ! Masc ; + Ord = \o -> o.s ! aagr Masc Sg ++ o.s2 ! aagr Masc Sg ; + N = \n -> n.s ! Sg ; N2 = \n -> n.s ! Sg ++ n.c2.s ; N3 = \n -> n.s ! Sg ++ n.c2.s ++ n.c3.s ; + + lincat MU = {s : Str ; isPre : Bool ; hasArt : Bool} ; + + } diff --git a/src/romance/DiffRomance.gf b/src/romance/DiffRomance.gf index 93fd0eef3..d04d280f6 100644 --- a/src/romance/DiffRomance.gf +++ b/src/romance/DiffRomance.gf @@ -64,7 +64,7 @@ interface DiffRomance = open CommonRomance, Prelude in { -- e.g. un bon amic (Cat), una gran parte (Spa) vs. predicative bo/bona, grande oper AForm : PType ; oper Adj : Type = {s : AForm => Str} ; - oper mkOrd : Adj -> {s : AAgr => Str} = \x -> {s = \\ag => x.s ! aagr2aform ag} ; + oper mkOrd : Adj -> {s,s2 : AAgr => Str} = \x -> {s = \\ag => x.s ! aagr2aform ag; s2 = \\_ => []} ; oper aform2aagr : AForm -> AAgr ; oper aform2gender : AForm -> Gender = \af -> (aform2aagr af).g ; @@ -140,6 +140,8 @@ interface DiffRomance = open CommonRomance, Prelude in { param Case = Nom | Acc | CPrep Prepos ; + NRelType = NRelPrep Prepos | NRelNoPrep ; -- How do build a compound noun + oper Verb = {s : VF => Str ; vtyp : VType ; p : Str} ; @@ -218,4 +220,9 @@ oper stare_V : Verb ; stare_V = essere_V ; + param HasArt ; + + oper + superlCanBePost : Bool ; + } ; diff --git a/src/romance/ExtendRomanceFunctor.gf b/src/romance/ExtendRomanceFunctor.gf index fc4f206ef..257780709 100644 --- a/src/romance/ExtendRomanceFunctor.gf +++ b/src/romance/ExtendRomanceFunctor.gf @@ -2,8 +2,7 @@ incomplete concrete ExtendRomanceFunctor of Extend = Cat ** open Grammar, ResRomance in { lincat - RNP = Grammar.NP ; - RNPList = Grammar.ListNP ; + RNP = {s : Agr => Case => Str} ; ---- these come from ExtraRomance: how to avoid the repetition? ---- can't seem to be able to use two functors @@ -27,6 +26,7 @@ incomplete concrete ExtendRomanceFunctor of Extend = let denp = (np.s ! ResRomance.genitive).ton in { s = \\_,_,_,_ => [] ; sp = \\_,_,_ => denp ; + spn= \\_ => denp ; s2 = denp ; isNeg = False ; } ; @@ -126,7 +126,7 @@ incomplete concrete ExtendRomanceFunctor of Extend = ExistPluralCN cn = ExistNP (DetCN (DetQuant IndefArt NumPl) cn) ; AdvIsNP adv np = mkClause adv.s False False np.a (UseComp_estar (CompNP np)) ; AdvIsNPAP adv np ap = -- está - let emptyN : N = lin N {s = \\_ => [] ; g = np.a.g} ; -- To match the gender of the N + let emptyN : N = lin N {s = \\_ => [] ; relType = NRelNoPrep ; g = np.a.g} ; -- To match the gender of the N indef : Quant = IndefArt ** {s = \\b,n,g,c => []} ; det : Det = case np.a.n of {Sg => DetQuant indef NumSg ; Pl => DetQuant indef NumPl} ; apAsNP : NP = DetCN det (AdjCN ap (UseN emptyN)) ; -- NP where the string comes only from AP @@ -152,8 +152,17 @@ incomplete concrete ExtendRomanceFunctor of Extend = } ; lin - ReflRNP = variants {} ; -- VPSlash -> RNP -> VP ; -- love my family and myself - ReflPron = variants {} ; -- RNP ; -- myself + ReflRNP v rnp = -- VPSlash -> RNP -> VP ; -- love my family and myself + case v.c2.isDir of { + True => insertRefl v ; + False => insertComplement + (\\a => let agr = verbAgr a in v.c2.s ++ rnp.s ! agr ! v.c2.c) v + } ; + + ReflPron = { -- RNP ; -- myself + s = \\agr,c => reflPron agr.n agr.p c + } ; + ReflPoss = variants {} ; -- Num -> CN -> RNP ; -- my car(s) PredetRNP = variants {} ; -- Predet -> RNP -> RNP ; -- all my brothers ConjRNP = variants {} ; -- Conj -> RNPList -> RNP ; -- my family, John and myself @@ -165,7 +174,16 @@ incomplete concrete ExtendRomanceFunctor of Extend = ComplGenVV = variants {} ; -- VV -> Ant -> Pol -> VP -> VP ; -- want not to have slept ComplSlashPartLast = ComplSlash ; - CompoundN a b = lin N {s = \\n => b.s ! n ++ a.s ! Sg ; g = b.g} ; -- connessione internet = internet connection + CompoundN a b = lin N { + s = \\n => b.s ! n ++ + case b.relType of { + NRelPrep p => prepCase (CPrep p) ; -- tasa de suicidio + NRelNoPrep => [] -- connessione internet = internet connection + } ++ + a.s ! Sg ; + g = b.g ; + relType = b.relType + } ; CompoundAP = variants {} ; -- N -> A -> AP ; -- language independent / language-independent lin @@ -240,7 +258,16 @@ incomplete concrete ExtendRomanceFunctor of Extend = } ; - UseDAP, UseDAPMasc = \dap -> + UseDAP = \dap -> + let + g = Masc ; + n = dap.n + in heavyNPpol dap.isNeg { + s = dap.spn ; + a = agrP3 g n ; + hasClit = False + } ; + UseDAPMasc = \dap -> let g = Masc ; n = dap.n @@ -278,6 +305,8 @@ incomplete concrete ExtendRomanceFunctor of Extend = UttDatIP ip = UttAccIP (lin IP ip) ; -- whom (dative) ; DEFAULT who UttVPShort = UttVP ; + TPastSimple = {s = []} ** {t = RPasse} ; --# notpresent + oper quoted : Str -> Str = \s -> "\"" ++ s ++ "\"" ; ---- TODO bind ; move to Prelude? @@ -302,7 +331,7 @@ incomplete concrete ExtendRomanceFunctor of Extend = vps ** { s = auxvp.s ; agr = auxvp.agr ; - comp = \\a => vps.comp ! a ++ (let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) ++ agent ; + comp = \\a => (let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) ++ vps.comp ! a ++ agent ; } ; } ; diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index 5b2c3cc11..502753ba6 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -9,7 +9,7 @@ incomplete concrete NounRomance of Noun = g = cn.g ; n = det.n in heavyNPpol det.isNeg { - s = \\c => det.s ! g ! c ++ cn.s ! n ++ det.s2 ; + s = \\c => det.s ! g ! c ++ cn.s ! n ++ det.s2 ! g ; a = agrP3 g n ; hasClit = False } ; @@ -53,9 +53,13 @@ incomplete concrete NounRomance of Noun = } ; DetQuantOrd quant num ord = { - s,sp = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ++ + s = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ++ ord.s ! aagr g num.n ; - s2 = quant.s2 ; + s2 = \\g => quant.s2 ++ ord.s2 ! aagr g num.n ; + sp = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ++ + ord.s ! aagr g num.n ++ ord.s2 ! aagr g num.n ; + spn = \\c => quant.s ! num.isNum ! num.n ! Masc ! c ++ num.s ! Masc ++ + ord.s ! aagr Masc num.n ++ ord.s2 ! aagr Masc num.n ; n = num.n ; isNeg = quant.isNeg } ; @@ -66,7 +70,11 @@ incomplete concrete NounRomance of Noun = True => quant.s ! True ! num.n ! g ! c ++ num.s ! g ; False => quant.sp ! num.n ! g ! c ++ num.s ! g } ; - s2 = quant.s2 ; + spn= \\c => case num.isNum of { + True => quant.s ! True ! num.n ! Masc ! c ++ num.s ! Masc ; + False => quant.spn ! c ++ num.s ! Masc + } ; + s2 = \\_ => quant.s2 ; n = num.n ; isNeg = quant.isNeg } ; @@ -84,6 +92,7 @@ incomplete concrete NounRomance of Noun = PossPron p = { s = \\_,n,g,c => possCase g n c ++ p.poss ! n ! g ; ---- il mio! sp = \\ n,g,c => possCase g n c ++ p.poss ! n ! g ; ---- not for Fre + spn= \\ c => possCase Masc Sg c ++ p.poss ! Sg ! Masc ; ---- not for Fre s2 = [] ; isNeg = False } ; @@ -94,27 +103,45 @@ incomplete concrete NounRomance of Noun = NumCard n = n ** {isNum = True} ; NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; - OrdDigits nu = {s = \\a => nu.s ! NOrd a.g a.n} ; + OrdDigits nu = {s = \\a => nu.s ! NOrd a.g a.n ; s2 = \\_ => []} ; + + NumDecimal nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; - OrdNumeral nu = {s = \\a => nu.s ! NOrd a.g a.n} ; + OrdNumeral nu = {s = \\a => nu.s ! NOrd a.g a.n ; s2 = \\_ => []} ; AdNum adn num = {s = \\a => adn.s ++ num.s ! a ; isNum = num.isNum ; n = num.n} ; - OrdSuperl adj = { - s = \\a => case adj.isDeg of { - True => adj.compar ! aagr2compar a ; - False => piuComp ++ adj.s ! genNum2Aform a.g a.n } + OrdSuperl adj = + case of { + => { s = \\a => adj.compar ! aagr2compar a ; + s2 = \\_ => [] + } ; + => { s = \\_ => [] ; + s2 = \\a => piuComp ++ adj.s ! genNum2Aform a.g a.n + } ; + => { s = \\a => piuComp ++ adj.s ! genNum2Aform a.g a.n ; + s2 = \\_ => [] + } } ; OrdNumeralSuperl num adj = - let ordSuperl : Ord = OrdSuperl adj - in {s = \\a => num.s ! NOrd a.g a.n ++ ordSuperl.s ! a} ; -- la terza più grande - ---- could be discontinuous: la terza città più grande + case of { + => { s = \\a => num.s ! NOrd a.g a.n ++ adj.compar ! aagr2compar a ; + s2 = \\_ => [] + } ; + => { s = \\a => num.s ! NOrd a.g a.n ; + s2 = \\a => piuComp ++ adj.s ! genNum2Aform a.g a.n + } ; + => { s = \\a => num.s ! NOrd a.g a.n ++ piuComp ++ adj.s ! genNum2Aform a.g a.n ; + s2 = \\_ => [] + } + } ; DefArt = { s = \\_,n,g,c => artDef False g n c ; sp = \\n,g,c => artDef True g n c ; + spn= \\c => artDef True Masc Sg c ; s2 = [] ; isNeg = False } ; @@ -122,6 +149,7 @@ incomplete concrete NounRomance of Noun = IndefArt = { s = \\b,n,g,c => if_then_Str b (prepCase c) (artIndef False g n c) ; sp = \\n,g,c => artIndef True g n c ; + spn= \\c => artIndef True Masc Sg c ; s2 = [] ; isNeg = False } ; @@ -147,11 +175,13 @@ incomplete concrete NounRomance of Noun = ComplN2 f x = { s = \\n => f.s ! n ++ appCompl f.c2 x ; g = f.g ; + relType = f.relType } ; ComplN3 f x = { s = \\n => f.s ! n ++ appCompl f.c2 x ; g = f.g ; + relType = f.relType ; c2 = f.c3 } ; @@ -200,9 +230,18 @@ incomplete concrete NounRomance of Noun = n = det.n ; s2 = det.s2 ; -- -ci sp = \\g,c => det.s ! g ! c ++ ap.s ! genNum2Aform g det.n ; + spn= \\c => det.s ! Masc ! c ++ ap.s ! genNum2Aform Masc det.n ; isNeg = det.isNeg } ; DetDAP det = det ; -} + QuantityNP n m = heavyNPpol False { + s = \\c => case of { + | => artDef False Masc Sg c ++ preOrPost m.isPre m.s (n.s ! NCard Masc); + c => prepCase c.p1 ++ preOrPost m.isPre m.s (n.s ! NCard Masc)}; + a = agrP3 Masc n.n ; + hasClit = False + } ; + } + diff --git a/src/romance/PhraseRomance.gf b/src/romance/PhraseRomance.gf index 5dab82094..45c7866fd 100644 --- a/src/romance/PhraseRomance.gf +++ b/src/romance/PhraseRomance.gf @@ -26,6 +26,6 @@ incomplete concrete PhraseRomance of Phrase = PConjConj conj = {s = conj.s2} ; NoVoc = {s = []} ; - VocNP np = {s = "," ++ (np.s ! Nom).ton} ; + VocNP np = {s = SOFT_BIND ++ "," ++ (np.s ! Nom).ton} ; } diff --git a/src/romance/SentenceRomance.gf b/src/romance/SentenceRomance.gf index 9d3fa8a97..19127bd0a 100644 --- a/src/romance/SentenceRomance.gf +++ b/src/romance/SentenceRomance.gf @@ -175,12 +175,12 @@ incomplete concrete SentenceRomance of Sentence = } ; AdvS a s = {s = \\o => a.s ++ s.s ! o} ; - ExtAdvS a s = {s = \\o => a.s ++ "," ++ s.s ! o} ; + ExtAdvS a s = {s = \\o => a.s ++ SOFT_BIND ++ "," ++ s.s ! o} ; SSubjS a s b = {s = \\m => a.s ! m ++ s.s ++ b.s ! s.m} ; RelS s r = { - s = \\o => s.s ! o ++ "," ++ partQIndir ++ r.s ! Indic ! agrP3 Masc Sg + s = \\o => s.s ! o ++ SOFT_BIND ++ "," ++ partQIndir ++ r.s ! Indic ! agrP3 Masc Sg } ; } diff --git a/src/romance/SymbolRomance.gf b/src/romance/SymbolRomance.gf index 8c56c624e..ae1157ef9 100644 --- a/src/romance/SymbolRomance.gf +++ b/src/romance/SymbolRomance.gf @@ -25,7 +25,7 @@ lin SymbS sy = {s = \\_ => sy.s} ; SymbNum n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - SymbOrd n = {s = \\_ => n.s ++ BIND ++ "º"} ; -- feminine variant ª, also variants 1.º and 1.ª + SymbOrd n = {s = \\_ => n.s ++ BIND ++ "º"; s2 = \\_ => []} ; -- feminine variant ª, also variants 1.º and 1.ª lincat diff --git a/src/romanian/CatRon.gf b/src/romanian/CatRon.gf index 094a6ed9b..f55a135e4 100644 --- a/src/romanian/CatRon.gf +++ b/src/romanian/CatRon.gf @@ -80,6 +80,7 @@ concrete CatRon of Cat = sp : ACase => CardOrd => NumF => Str ; size : Size } ; Digits = {s : CardOrd => Str ; n : Size ; isDig : Bool} ; + Decimal = {s : CardOrd => Str ; n : Size ; isDig : Bool; hasDot : Bool} ; Num = {s : Gender => Str ; sp : Gender => Str ; isNum : Bool ; n : Number; size : Str } ; @@ -131,7 +132,7 @@ concrete CatRon of Cat = N3 = Noun ** {c2,c3 : Compl} ; - GN, SN, PN = {s : NCase => Str ; g : Gender ; n : Number; a : Animacy} ; + GN, SN, LN, PN = {s : NCase => Str ; g : Gender ; n : Number; a : Animacy} ; Comp = {s : Agr => Str} ; diff --git a/src/romanian/ExtendRon.gf b/src/romanian/ExtendRon.gf index 340538bf0..a70d332b2 100644 --- a/src/romanian/ExtendRon.gf +++ b/src/romanian/ExtendRon.gf @@ -1,7 +1,7 @@ --# -path=.:../common:../abstract concrete ExtendRon of Extend = - CatRon ** ExtendFunctor - [PassVPSlash, GivenName, MaleSurname, FemaleSurname, FullName] + CatRon ** ExtendFunctor - [PassVPSlash] with (Grammar = GrammarRon) ** open ResRon in { @@ -17,12 +17,4 @@ lin iFem_Pron = mkPronoun "eu" "mine" "mie" [] [] "meu" "mea" "mei" "mele" Fem S -- KA: derived from PassV2, objects are ignored lin PassVPSlash vps = insertSimpObj (\\a => vps.s ! PPasse a.g a.n Indef ANomAcc) auxPassive ** {lock_VP = <>}; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { -- KA: guessed - s = \\c => gn.s ! No ++ sn.s ! c ; - g = gn.g ; - n = gn.n ; - a = gn.a - } ; - } diff --git a/src/romanian/GrammarRon.gf b/src/romanian/GrammarRon.gf index f929ac573..8b4883322 100644 --- a/src/romanian/GrammarRon.gf +++ b/src/romanian/GrammarRon.gf @@ -15,7 +15,8 @@ concrete GrammarRon of Grammar = TextX - [CAdv,Temp,Tense], -- Prelude, MorphoRon, Coordination, StructuralRon, - TenseRon + TenseRon, + NamesRon ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/romanian/NamesRon.gf b/src/romanian/NamesRon.gf new file mode 100644 index 000000000..951d90016 --- /dev/null +++ b/src/romanian/NamesRon.gf @@ -0,0 +1,49 @@ +concrete NamesRon of Names = CatRon ** open ResRon, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname = \pn -> -- KA: guessed + let + g = pn.g ; + n = pn.n ; + ag = agrP3 g n ; + hc = getClit pn.a + in { + s = \\c => {comp = pn.s ! c ; + clit = \\cs => if_then_Str hc ((genCliticsCase ag c).s ! cs) [] } ; + + a = ag; + nForm = if_then_else NForm hc HasClit (HasRef False) ; + isPronoun = False ; isPol = False; + indForm = pn.s ! No + } ; + +lin FullName gn sn = -- KA: guessed + let + g = gn.g ; + n = gn.n ; + ag = agrP3 g n ; + hc = getClit gn.a + in { + s = \\c => {comp = gn.s ! No ++ sn.s ! c ; + clit = \\cs => if_then_Str hc ((genCliticsCase ag c).s ! cs) [] } ; + a = ag; + nForm = if_then_else NForm hc HasClit (HasRef False) ; + isPronoun = False ; isPol = False; + indForm = gn.s ! No ++ sn.s ! No + } ; + +lin UseLN pn = let + g = pn.g ; + n = pn.n ; + ag = agrP3 g n ; + hc = getClit pn.a + in { + s = \\c => {comp = pn.s ! c ; + clit = \\cs => if_then_Str hc ((genCliticsCase ag c).s ! cs) [] } ; + + a = ag; + nForm = if_then_else NForm hc HasClit (HasRef False) ; + isPronoun = False ; isPol = False; + indForm = pn.s ! No + } ; + +} diff --git a/src/romanian/NounRon.gf b/src/romanian/NounRon.gf index c812610da..f879288b6 100644 --- a/src/romanian/NounRon.gf +++ b/src/romanian/NounRon.gf @@ -172,6 +172,9 @@ in { isPre = True }; + NumDecimal nu = {s,sp = \\g => nu.s ! NCard g ; + size = nu.n; n = getNumber nu.n }; + NumNumeral nu = {s = \\g => nu.s ! ANomAcc ! (NCard g) ! Formal ; sp = \\g => nu.sp ! ANomAcc ! (NCard g) ! Formal ; n = getNumber nu.size ; size = nu.size }; @@ -305,5 +308,4 @@ in { isComp = True } ; - -}; \ No newline at end of file +}; diff --git a/src/romanian/NumeralRon.gf b/src/romanian/NumeralRon.gf index 2370af48d..a76809230 100644 --- a/src/romanian/NumeralRon.gf +++ b/src/romanian/NumeralRon.gf @@ -1,4 +1,4 @@ -concrete NumeralRon of Numeral = CatRon [Numeral,Digits] ** +concrete NumeralRon of Numeral = CatRon [Numeral,Digits,Decimal] ** open MorphoRon, CatRon, Prelude in { flags coding = utf8 ; @@ -247,6 +247,21 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = pl; + isDig = False ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = pl ; + isDig = False ; + hasDot=True + } ; oper mkDig : Str -> Dig = \c -> mk3Dig c (c + "lea") (c + "a") less20 ; diff --git a/src/romanian/ParadigmsRon.gf b/src/romanian/ParadigmsRon.gf index ad1407dbe..186671d55 100644 --- a/src/romanian/ParadigmsRon.gf +++ b/src/romanian/ParadigmsRon.gf @@ -559,6 +559,7 @@ mkPronoun :(_,_,_,_,_,_,_,_,_ : Str) -> Gender -> Number -> Person -> Pron =\eu, -- in this case we add a case to the complement, so that the right gender is chosen. + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } ; diff --git a/src/rukiga/CatCgg.gf b/src/rukiga/CatCgg.gf index 419b3dd72..286c754db 100644 --- a/src/rukiga/CatCgg.gf +++ b/src/rukiga/CatCgg.gf @@ -90,6 +90,7 @@ lincat } ; Numeral = {s : Res.CardOrd=>Res.Agreement=> Str ; g : Res.Gender; n: Res.Number} ; Digits = {s : Res.CardOrd => Res.Agreement=>Str ; n : Res.Number ; tail : Px.DTail} ; + Decimal = {s : Res.CardOrd => Res.Agreement=>Str ; n : Res.Number; hasDot : Bool} ; Ord = {s :Res.Agreement=>Str; position:Res.Position} ; Card = {s :Res.Agreement=>Str; n : Res.Number} ; A2 = Res.Adjective ** { c2 : Str ; isPre : Bool} ; diff --git a/src/rukiga/NounCgg.gf b/src/rukiga/NounCgg.gf index 41aa22b87..09af39a4e 100644 --- a/src/rukiga/NounCgg.gf +++ b/src/rukiga/NounCgg.gf @@ -116,6 +116,7 @@ lin --NumDigits : Digits -> Card ; -- 51 NumDigits dig = {s = dig.s!NCard ; n=dig.n}; + NumDecimal dec = {s = dec.s!NCard ; n=dec.n}; --NumNumeral : Numeral -> Card ; -- fifty-one NumNumeral numeral = {s=numeral.s!NCard; n=numeral.n}; --OrdDigits : Digits -> Ord ; -- 51st diff --git a/src/rukiga/NumeralCgg.gf b/src/rukiga/NumeralCgg.gf index 1af171626..be0e1961e 100644 --- a/src/rukiga/NumeralCgg.gf +++ b/src/rukiga/NumeralCgg.gf @@ -1,6 +1,6 @@ --# -path=.:../prelude:../abstract:../common -concrete NumeralCgg of Numeral = CatCgg [Numeral,Digits] ** +concrete NumeralCgg of Numeral = CatCgg [Numeral,Digits,Decimal] ** open ResCgg, Prelude in { lincat @@ -100,6 +100,16 @@ lin pot3plus n m = let D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o,a=>"-" ++ BIND ++ d.s ! o ! a; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o,a=>d.s ! NCard ! a ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! a ; + hasDot=True; + n = Pl + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND ++ "," ++ BIND ; diff --git a/src/russian/CatRus.gf b/src/russian/CatRus.gf index 0c0a01482..9aa05bf64 100644 --- a/src/russian/CatRus.gf +++ b/src/russian/CatRus.gf @@ -1,7 +1,22 @@ concrete CatRus of Cat = CommonX ** open ResRus, Prelude in { flags coding=utf8 ; optimize=all ; lincat - N, GN, SN, PN = ResRus.NounForms ; + N, PN = ResRus.NounForms ; + GN = { + s : Case => Str ; + g : Sex ; + } ; + SN = { + s : Sex => Case => Str ; + p : Case => Str ; + } ; + LN = { + s : Case => Str ; + c : ResRus.ComplementCase ; + g : Gender ; + n : Number ; + anim : Animacy + } ; N2 = ResRus.Noun2Forms ; N3 = ResRus.Noun3Forms ; @@ -68,6 +83,7 @@ lincat Num = NumDet ; Card = NumDet ; Digits = {s : Str ; size: NumSize} ; + Decimal = {s : Str ; size: NumSize; hasDot : Bool} ; QS = {s : QForm => Str} ; QCl = { @@ -105,6 +121,7 @@ lincat linref N = \s -> s.snom ; PN = \s -> s.snom ; + LN = \s -> s.s ! Nom ; Pron = \s -> s.nom ; N2 = \s -> s.snom ++ s.c2.s ; N3 = \s -> s.snom ++ s.c2.s ++ s.c3.s ; diff --git a/src/russian/ConjunctionRus.gf b/src/russian/ConjunctionRus.gf index e934b95a3..0084d82fc 100644 --- a/src/russian/ConjunctionRus.gf +++ b/src/russian/ConjunctionRus.gf @@ -169,8 +169,10 @@ concrete ConjunctionRus of Conjunction = -- : Conj -> ListNP -> NP ; -- she or we ConjNP conj xs = { s = \\c => conj.s1 ++ xs.s1 ! c ++ conj.s2 ++ xs.s2 ! c ; - --prep = \\c => conj.s1 ++ xs.prep1 ! c ++ conj.s2 ++ xs.prep2 ! c ; - a = xs.a ; -- TODO: dep. on conj as well? + a = case conj.n of { + Sg => xs.a ; + Pl => case xs.a of {Ag gn p => Ag GPl p} + } ; pron = xs.pron ; anim = xs.anim } ; diff --git a/src/russian/DocumentationRusFunctor.gf b/src/russian/DocumentationRusFunctor.gf index 694c69eee..397651cd3 100644 --- a/src/russian/DocumentationRusFunctor.gf +++ b/src/russian/DocumentationRusFunctor.gf @@ -26,13 +26,97 @@ oper lin InflectionN, InflectionN2, InflectionN3 = \noun -> { - t = "s" ; - s1 = heading1 (heading noun_Category) ; + t = "сущ." ; + s1 = heading1 (heading noun_Category ++ + case noun.g of { + Masc => "(м.р.)" ; + Fem => "(ж.р.)" ; + Neut => "(ср.р.)" + }) ; s2 = inflNoun noun } ; + InflectionPN = \pn -> { + t = "сущ.с." ; + s1 = heading1 ("Существительное Собственное" ++ + case pn.g of { + Masc => "(м.р.)" ; + Fem => "(ж.р.)" ; + Neut => "(ср.р.)" + }) ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (pn.snom)) ++ + tr (th (heading genitive_Parameter) ++ td (pn.sgen)) ++ + tr (th (heading dative_Parameter) ++ td (pn.sdat)) ++ + tr (th (heading accusative_Parameter) ++ td (pn.sacc)) ++ + tr (th ("творительный") ++ td (pn.sins)) ++ + tr (th ("предложный") ++ td (pn.sprep)) ++ + tr (th (heading partitive_Parameter) ++ td (pn.sptv)) ++ + tr (th ("местный") ++ td (pn.sloc)) ++ + tr (th ("звательный") ++ td (pn.svoc)) + ) ; + } ; + + InflectionGN = \gn -> { + t = "сущ.с." ; + s1 = heading1 (case gn.g of { + Male => "Мужское Личное Имя" ; + Female => "Женское Личное Имя" + }); + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (gn.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (gn.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (gn.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (gn.s ! Acc)) ++ + tr (th ("творительный") ++ td (gn.s ! Ins)) ++ + tr (th ("предложный") ++ td (gn.s ! Pre)) ++ + tr (th (heading partitive_Parameter) ++ td (gn.s ! Ptv)) ++ + tr (th ("местный") ++ td (gn.s ! Loc)) ++ + tr (th ("звательный") ++ td (gn.s ! VocRus)) + ) + } ; + + InflectionSN = \sn -> { + t = "сущ.с." ; + s1 = heading1 "Фамилия" ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (sn.s ! Male ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (sn.s ! Male ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (sn.s ! Male ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (sn.s ! Male ! Acc)) ++ + tr (th ("творительный") ++ td (sn.s ! Male ! Ins)) ++ + tr (th ("предложный") ++ td (sn.s ! Male ! Pre)) ++ + tr (th (heading partitive_Parameter) ++ td (sn.s ! Male ! Ptv)) ++ + tr (th ("местный") ++ td (sn.s ! Male ! Loc)) ++ + tr (th ("звательный") ++ td (sn.s ! Male ! VocRus)) + ) + } ; + + InflectionLN = \ln -> { + t = "сущ.с." ; + s1 = heading1 ("Название Местоположения" ++ + case ln.g of { + Masc => "(м.р.)" ; + Fem => "(ж.р.)" ; + Neut => "(ср.р.)" + }) ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (ln.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (ln.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (ln.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (ln.s ! Acc)) ++ + tr (th ("творительный") ++ td (ln.s ! Ins)) ++ + tr (th ("предложный") ++ td (ln.s ! Pre)) ++ + tr (th (heading partitive_Parameter) ++ td (ln.s ! Ptv)) ++ + tr (th ("местный") ++ td (ln.s ! Loc)) ++ + tr (th ("звательный") ++ td (ln.s ! VocRus)) + ) ++ + heading2 (heading adverb_Category) ++ + paragraph (ln.c.s ++ ln.s ! ln.c.c) + } ; + InflectionA, InflectionA2 = \adj -> { - t = "a" ; + t = "пр" ; s1 = heading1 (heading adjective_Category) ; s2 = heading2 (heading feminine_Parameter) ++ inflNoun (makeNFFromAF adj Fem Inanimate) ++ @@ -45,89 +129,100 @@ lin } ; InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> { - t = "adv" ; + t = "нар" ; s1 = heading1 (heading adverb_Category) ; s2 = paragraph adv.s } ; InflectionPrep p = { - t = "prep" ; + t = "пред" ; s1 = heading1 (heading preposition_Category) ; - s2 = paragraph ((S.mkAdv (lin Prep p) S.it_NP).s ++ ";" ++ (S.mkAdv (lin Prep p) S.we_NP).s) + s2 = paragraph (p.s ++ "+" ++ + case p.c of { + Nom => "именительный" ; + Gen => "родительный" ; + Dat => "дательный" ; + Acc => "винительный" ; + Ins => "творительный" ; + Pre => "предложный" ; + Ptv => "разделительный" ; + Loc => "местный" ; + VocRus=>"звательный" + }) } ; InflectionV v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v)) ; s2 = inflVerb v } ; InflectionV2 v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.something_NP)) ; s2 = inflVerb v } ; InflectionV3 v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.something_NP S.something_NP)) ; s2 = inflVerb v } ; InflectionV2V v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (S.mkVP (L.sleep_V)))) ; s2 = inflVerb v } ; InflectionV2S v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin S {s : Mood=>Str = \\m=>"..."}))) ; s2 = inflVerb v } ; InflectionV2Q v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin QS {s: QForm=>Str = \\m=>"..."}))) ; s2 = inflVerb v } ; InflectionV2A v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP L.beautiful_A)) ; s2 = inflVerb v } ; InflectionVV vv = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP vv (S.mkVP (L.sleep_V)))) ; s2 = inflVerb vv.v } ; InflectionVS v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v (lin S {s : Mood=>Str = \\m=>"..."}))) ; s2 = inflVerb v } ; InflectionVQ v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v (lin QS {s : Mood=>Str = \\m=>"..."}))) ; s2 = inflVerb v } ; InflectionVA v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v L.beautiful_A)) ; s2 = inflVerb v diff --git a/src/russian/ExtendRus.gf b/src/russian/ExtendRus.gf index 4d9692cca..5c97b8e50 100644 --- a/src/russian/ExtendRus.gf +++ b/src/russian/ExtendRus.gf @@ -23,6 +23,9 @@ concrete ExtendRus of Extend = --ConjRNP, Cons_nr_RNP, Cons_rr_RNP, DetNPMasc, DetNPFem, + UseDAP, + UseDAPMasc, + UseDAPFem, -- EmbedPresPart, EmptyRelSlash, ExistsNP, -- ExistCN, ExistMassCN, ExistPluralCN, @@ -214,29 +217,42 @@ lin a=Ag (gennum g (numSizeNumber det.size)) P3 } ; + UseDAP det = + let g = det.g in { + s=case det.type of { + EmptyIndef => \\cas => a_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + EmptyDef => \\cas => the_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + _ => \\cas => det.s ! g ! Inanimate ! cas + } ; + pron=False ; + a=Ag (gennum g (numSizeNumber det.size)) P3 + } ; + + -- : DAP -> NP ; + UseDAPFem det = + let g = Fem in { + s=case det.type of { + EmptyIndef => \\cas => a_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + EmptyDef => \\cas => the_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + _ => \\cas => det.s ! g ! Inanimate ! cas + } ; + pron=False ; + a=Ag (gennum g (numSizeNumber det.size)) P3 + } ; + + -- : Det -> NP ; + UseDAPMasc det = + let g = Masc in { + s=case det.type of { + EmptyIndef => \\cas => a_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + EmptyDef => \\cas => the_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + _ => \\cas => det.s ! g ! Inanimate ! cas + } ; + pron=False ; + a=Ag (gennum g (numSizeNumber det.size)) P3 + } ; + oper rus_quoted : Str -> Str = \s -> "«" ++ s ++ "»" ; ---- TODO bind ; move to Prelude? -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - snom = gn.snom ++ sn.snom ; - sgen = gn.snom ++ sn.sgen ; - sdat = gn.snom ++ sn.sdat ; - sacc = gn.snom ++ sn.sacc ; - sins = gn.snom ++ sn.sins ; - sprep = gn.snom ++ sn.sprep ; - sloc = gn.snom ++ sn.sloc ; - sptv = gn.snom ++ sn.sptv ; - svoc = gn.snom ++ sn.svoc ; - pnom = gn.snom ++ sn.pnom ; - pgen = gn.snom ++ sn.pgen ; - pdat = gn.snom ++ sn.pdat ; - pacc = gn.snom ++ sn.pacc ; - pins = gn.snom ++ sn.pins ; - pprep = gn.snom ++ sn.pprep ; - g = gn.g ; - mayben = gn.mayben ; - anim = gn.anim - } ; - } ; diff --git a/src/russian/GrammarRus.gf b/src/russian/GrammarRus.gf index 2973754cc..1090a3016 100644 --- a/src/russian/GrammarRus.gf +++ b/src/russian/GrammarRus.gf @@ -14,5 +14,6 @@ concrete GrammarRus of Grammar = TextX, StructuralRus, IdiomRus, - TenseRus - ** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ;} ; \ No newline at end of file + TenseRus, + NamesRus + ** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ;} ; diff --git a/src/russian/NamesRus.gf b/src/russian/NamesRus.gf new file mode 100644 index 000000000..720543bea --- /dev/null +++ b/src/russian/NamesRus.gf @@ -0,0 +1,54 @@ +concrete NamesRus of Names = CatRus ** open ResRus, MorphoRus, Prelude in { + +lin GivenName gn = + { s=gn.s ; + pron=False; + a=let g = case gn.g of { + Male => Masc ; + Female => Fem + } + in Ag (gennum g Sg) P3 + } ; -- Does NP need animacy? +lin MaleSurname sn = + { s=\\cas => sn.s ! Male ! cas ; + pron=False; + a=Ag (GSg Masc) P3 + } ; -- Does NP need animacy? +lin FemaleSurname sn = + { s=\\cas => sn.s ! Female ! cas ; + pron=False; + a=Ag (GSg Fem) P3 + } ; -- Does NP need animacy? +lin PlSurname sn = + { s=sn.p ; + pron=False; + a=Ag GPl P3 + } ; -- Does NP need animacy? + +lin FullName gn sn = + { s=\\cas => gn.s ! Nom ++ sn.s ! gn.g ! cas ; + pron=False; + a=let g = case gn.g of { + Male => Masc ; + Female => Fem + } + in Ag (GSg g) P3 + } ; + + UseLN, PlainLN = \ln -> { + s=\\cas => ln.s ! cas ; + pron=False; + a=Ag (gennum ln.g ln.n) P3 + } ; -- Does NP need animacy? + + InLN ln = ss (applyPrep ln.c { + s=ln.s ; + pron=False; + a=Ag (gennum ln.g ln.n) P3 + }) ; -- Does NP need animacy? + + AdjLN ap ln = ln ** { + s=\\cas => preOrPost (notB ap.isPost) (ap.s ! (gennum ln.g ln.n) ! ln.anim ! cas) (ln.s ! cas) + } ; + +} diff --git a/src/russian/NounRus.gf b/src/russian/NounRus.gf index a704a0d35..83cbc3ffe 100644 --- a/src/russian/NounRus.gf +++ b/src/russian/NounRus.gf @@ -87,6 +87,8 @@ lin -- : Digits -> Card ; -- 51 NumDigits n = {s = \\_,_,_ => n.s ; size = n.size } ; + NumDecimal n = {s = \\_,_,_ => n.s ; size = n.size } ; + -- : Quant -> Num -> Det ; -- these five DetQuant quant num = { s=\\g,anim,cas => quant.s ! (gennum g (numSizeNumber num.size)) ! anim ! cas ++ num.s ! g ! anim ! cas ; @@ -239,4 +241,10 @@ lin preferShort=PreferFull } ; + QuantityNP n m = { + s = \\cas => preOrPost m.isPre m.s n.s; + pron=False ; + a=Ag (gennum Masc (numSizeNumber n.size)) P3 + } ; + } diff --git a/src/russian/NumeralRus.gf b/src/russian/NumeralRus.gf index 889212e3a..cc4836027 100644 --- a/src/russian/NumeralRus.gf +++ b/src/russian/NumeralRus.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../../prelude -concrete NumeralRus of Numeral = CatRus [Numeral,Digits] ** open ResRus, InflectionRus, Prelude in { +concrete NumeralRus of Numeral = CatRus [Numeral,Digits,Decimal] ** open ResRus, InflectionRus, Prelude in { flags coding=utf8 ; @@ -431,6 +431,22 @@ lin D_7 = mk2Dig "7" Num5 ; D_8 = mk2Dig "8" Num5 ; D_9 = mk2Dig "9" Num5 ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + n = Pl ; + size = d.size ; + hasDot=False + } ; + IFrac d i = { + s=d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + n = Pl ; + size = d.size ; + hasDot=True + } ; oper mk3Dig : Str -> Str -> NumSize -> TDigit = \c,o,size -> mk4Dig c o Pl size ; diff --git a/src/russian/ParadigmsRus.gf b/src/russian/ParadigmsRus.gf index 922410169..8284b133d 100644 --- a/src/russian/ParadigmsRus.gf +++ b/src/russian/ParadigmsRus.gf @@ -1,6 +1,6 @@ --1 Russian Lexical Paradigms -resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=InflectionRus), Prelude, Maybe in { +resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=InflectionRus), Prelude, Maybe, MorphoRus in { --2 Parameters -- @@ -14,6 +14,11 @@ oper neuter : Gender = Neut ; + male : Sex + = Male ; + female : Sex + = Female ; + -- Abstracting numbers. Number is a parameter for mkPN, mkConj singular : Number = Sg ; @@ -380,6 +385,144 @@ oper = \word, g, anim, zi -> lin PN (noMinorCases (Z.makeNoun word g anim (Z.parseIndex zi))) ; } ; + mkGN = overload { + mkGN : Str -> GN + = \nom -> let nf = guessNounForms nom + in lin GN { + s = (nounFormsNoun nf).s ! Sg ; + g = case nf.g of { + Fem => Female ; + _ => Male + } + } ; + mkGN : Str -> Sex -> GN + = \nom, sex -> + let g = case sex of { + Male => Masc ; + Female => Fem + } ; + nf = guessLessNounForms nom g Animate + in lin GN { + s = (nounFormsNoun nf).s ! Sg ; + g = sex + } ; + mkGN : Str -> Sex -> Z.ZNIndex -> GN + = \nom, sex, z -> + let g = case sex of { + Male => Masc ; + Female => Fem + } ; + nf = noMinorCases (Z.makeNoun nom g Animate z) + in lin GN { + s = (nounFormsNoun nf).s ! Sg ; + g = sex + } ; + mkGN : Str -> Sex -> Str -> GN + = \nom, sex, zi -> + let g = case sex of { + Male => Masc ; + Female => Fem + } ; + nf = noMinorCases (Z.makeNoun nom g Animate (Z.parseIndex zi)) + in lin GN { + s = (nounFormsNoun nf).s ! Sg ; + g = sex + } ; + } ; + + mkSN = overload { + mkSN : Str -> SN + = \nom -> lin SN { + s = table { + Male => (nounFormsNoun (guessLessNounForms nom Masc Animate)).s ! Sg ; + Female => (nounFormsNoun (guessLessNounForms nom Fem Animate)).s ! Sg + } ; + p = (nounFormsNoun (guessLessNounForms nom Masc Animate)).s ! Pl ; + } ; + mkSN : Str -> Str -> SN + = \male,female -> lin SN { + s = table { + Male => (nounFormsNoun (guessLessNounForms male Masc Animate)).s ! Sg ; + Female => (nounFormsNoun (guessLessNounForms female Fem Animate)).s ! Sg + } ; + p = (nounFormsNoun (guessLessNounForms male Masc Animate)).s ! Pl ; + } ; + mkSN : Str -> Z.ZNIndex -> Str -> Z.ZNIndex -> SN + = \male,zm,female,zf -> lin SN { + s = table { + Male => (nounFormsNoun (noMinorCases (Z.makeNoun male Masc Animate zm))).s ! Sg ; + Female => (nounFormsNoun (noMinorCases (Z.makeNoun female Masc Animate zf))).s ! Sg + } ; + p = (nounFormsNoun (noMinorCases (Z.makeNoun male Masc Animate zm))).s ! Pl ; + } ; + } ; + + mkLN = overload { + mkLN : Str -> LN + = \nom -> let nf = guessNounForms nom + in lin LN { + s = (nounFormsNoun nf).s ! Sg ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = Sg + } ; + mkLN : Str -> Gender -> LN + = \nom, g -> + let nf = guessLessNounForms nom g Animate + in lin LN { + s = (nounFormsNoun nf).s ! Sg ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = Sg + } ; + mkLN : Str -> Gender -> Number -> LN + = \nom, g, n -> + let nf = guessLessNounForms nom g Animate + in lin LN { + s = (nounFormsNoun nf).s ! n ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = n + } ; + mkLN : Str -> Gender -> Number -> Z.ZNIndex -> LN + = \nom, g, n, z -> + let nf = noMinorCases (Z.makeNoun nom g Animate z) + in lin LN { + s = (nounFormsNoun nf).s ! n ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = n + } ; + mkLN : Str -> Gender -> Number -> Str -> LN + = \nom, g, n, zi -> + let nf = noMinorCases (Z.makeNoun nom g Animate (Z.parseIndex zi)) + in lin LN { + s = (nounFormsNoun nf).s ! n ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = n + } ; + mkLN : A -> LN -> LN + = \a, ln -> ln ** { + s = \\cas => (adjFormsAdjective a).s ! (gennum ln.g ln.n) ! ln.anim ! cas ++ ln.s ! cas + } ; + } ; + + invarLN : Str -> Gender -> Number -> LN + = \s, g, n -> + lin LN { + s = \\c => s ; + anim = Inanimate ; + c = mkPrep v_prep_mod Loc ; + g = g ; + n = n + } ; + --------------------- -- Adjectives @@ -597,4 +740,7 @@ oper Second | SecondA => (Z.sg1StemFromVerb sg1) + "ит" ; _ => (Z.sg1StemFromVerb sg1) + "ет" } in (guessVerbForms asp Transitive inf sg1 sg3) ** {lock_V=<>} ; + + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/russian/v1/NumeralRus.gf b/src/russian/v1/NumeralRus.gf index 298098c4e..ffa54c6a5 100644 --- a/src/russian/v1/NumeralRus.gf +++ b/src/russian/v1/NumeralRus.gf @@ -252,6 +252,8 @@ lin pot3plus n m = D_8 = mk2Dig "8" plg ; D_9 = mk2Dig "9" plg ; + PosDecimal d = d ** {hasDot=False} ; + oper mk3Dig : Str -> Str -> Size -> TDigit = \c,o,size -> mk4Dig c o Pl size ; mk2Dig : Str -> Size -> TDigit = \c,size -> mk3Dig c (c + "o") size ; diff --git a/src/scandinavian/CatScand.gf b/src/scandinavian/CatScand.gf index 454d6e762..56572e927 100644 --- a/src/scandinavian/CatScand.gf +++ b/src/scandinavian/CatScand.gf @@ -87,6 +87,7 @@ incomplete concrete CatScand of Cat = Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural @@ -108,8 +109,10 @@ incomplete concrete CatScand of Cat = -- {s : Number => Species => Case => Str ; g : Gender} ; N2 = Noun ** {c2 : Complement} ; N3 = Noun ** {c2,c3 : Complement} ; - GN, SN, PN = {s : Case => Str ; g : Gender} ; - + PN = {s : Case => Str ; g : Gender} ; + LN = {s : Case => Str ; g : Gender ; n : Number} ; + GN = {s : Case => Str ; g : Sex} ; + SN = {s : Sex => Case => Str; pl : Case => Str} ; lincat diff --git a/src/scandinavian/NounScand.gf b/src/scandinavian/NounScand.gf index 450afbbce..2f034c054 100644 --- a/src/scandinavian/NounScand.gf +++ b/src/scandinavian/NounScand.gf @@ -110,6 +110,8 @@ incomplete concrete NounScand of Noun = NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdDigits nu = {s = nu.s ! NOrd SupWeak} ; + NumDecimal dec = {s = \\g => dec.s ! NCard g ; n = dec.n} ; + NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdNumeral nu = {s = nu.s ! NOrd SupWeak} ; @@ -261,4 +263,10 @@ incomplete concrete NounScand of Noun = DetDAP d = d ; + QuantityNP n m = { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard neutrum); + a = agrP3 Utr n.n ; + isPron = False + } ; + } diff --git a/src/sindhi/CatSnd.gf b/src/sindhi/CatSnd.gf index 9431d5c34..d0c37a961 100644 --- a/src/sindhi/CatSnd.gf +++ b/src/sindhi/CatSnd.gf @@ -71,6 +71,7 @@ concrete CatSnd of Cat = CommonX - [Adv] ** open ResSnd, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/sindhi/NounSnd.gf b/src/sindhi/NounSnd.gf index 1cfffd487..2679e3ee4 100644 --- a/src/sindhi/NounSnd.gf +++ b/src/sindhi/NounSnd.gf @@ -62,6 +62,7 @@ concrete NounSnd of Noun = CatSnd ** open ResSnd, Prelude in { NumCard n = n ** {hasCard = True} ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd; n = n.n} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/sindhi/NumeralSnd.gf b/src/sindhi/NumeralSnd.gf index 0a1201a50..81fa19028 100644 --- a/src/sindhi/NumeralSnd.gf +++ b/src/sindhi/NumeralSnd.gf @@ -1,4 +1,4 @@ -concrete NumeralSnd of Numeral = CatSnd [Numeral,Digits] ** open ResSnd, Prelude in { +concrete NumeralSnd of Numeral = CatSnd [Numeral,Digits,Decimal] ** open ResSnd, Prelude in { -- By Harald Hammarstroem -- Modification for Punjabi by Shafqat Virk flags coding=utf8 ; @@ -119,6 +119,7 @@ lin D_8 = { s = "۸" ; n = Pl}; lin D_9 = { s = "۹" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; oper ekhazar : Str = variants {"ھزار" ; "ھڪ" ++ "ھزار"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ھزار"} ! sz ; diff --git a/src/slovak/CatSlo.gf b/src/slovak/CatSlo.gf index bc5b6be9b..afcc325a5 100644 --- a/src/slovak/CatSlo.gf +++ b/src/slovak/CatSlo.gf @@ -66,6 +66,7 @@ concrete CatSlo of Cat = lincat Numeral = Determiner ; ---- TODO: should contain Ord as well lincat Digits = {s:Str ; size : NumSize} ; + lincat Decimal = {s:Str ; size : NumSize; hasDot : Bool} ; } diff --git a/src/slovak/ExtendSlo.gf b/src/slovak/ExtendSlo.gf index c5ff3c5fb..4c85232cb 100644 --- a/src/slovak/ExtendSlo.gf +++ b/src/slovak/ExtendSlo.gf @@ -25,6 +25,9 @@ concrete ExtendSlo of Extend = CatSlo ** ,ComplBareVS ,CompIQuant ,CompBareCN + ,PiedPipingQuestSlash + ,PiedPipingRelSlash + ,TPastSimple ] with (Grammar = GrammarSlo) ** @@ -35,4 +38,4 @@ in { lin ReflPossPron = justDemPronFormsAdjective reflPossessivePron ; -} \ No newline at end of file +} diff --git a/src/slovak/NounSlo.gf b/src/slovak/NounSlo.gf index a1af7b10a..fef689f1d 100644 --- a/src/slovak/NounSlo.gf +++ b/src/slovak/NounSlo.gf @@ -95,6 +95,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumDecimal ds = ds ** {s = \\_,_ => ds.s} ; NumNumeral nu = nu ; diff --git a/src/slovak/NumeralSlo.gf b/src/slovak/NumeralSlo.gf index ece83a787..b44e11b7e 100644 --- a/src/slovak/NumeralSlo.gf +++ b/src/slovak/NumeralSlo.gf @@ -1,6 +1,6 @@ concrete NumeralSlo of Numeral = - CatSlo [Numeral,Digits] ** + CatSlo [Numeral,Digits,Decimal] ** open ResSlo, @@ -122,4 +122,18 @@ oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ; D_8 = { s = "8" ; size = Num5} ; D_9 = { s = "9" ; size = Num5} ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + size = d.size ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + size = d.size ; + hasDot=True + } ; + } diff --git a/src/slovenian/CatSlv.gf b/src/slovenian/CatSlv.gf index c5994727b..41285bb57 100644 --- a/src/slovenian/CatSlv.gf +++ b/src/slovenian/CatSlv.gf @@ -31,6 +31,8 @@ lincat -- Numeral Numeral = {s : Gender => Case => Str ; n : NumAgr} ; + Digits = {s : Str ; n : NumAgr} ; + Decimal = {s : Str ; n : NumAgr ; hasDot : Bool} ; -- Structural Conj = {s : Str; n : Number} ; @@ -56,9 +58,10 @@ lincat N2 = {s : Case => Number => Str; g : AGender; c : Prep} ; N3 = {s : Case => Number => Str; g : AGender; c : Prep} ; - GN = {s : Case => Str; g : Sex}; - SN = {s : Sex => Case => Str}; PN = {s : Case => Str; g : AGender; n : Number}; + LN = {s : Case => Str; g : AGender; n : Number}; + GN = {s : Case => Str; g : P.Sex}; + SN = {s : P.Sex => Case => Str}; linref V, VA, VS, V2, V3, V2A, V2S, V2Q, V2V = \v -> v.s ! VInf ++ v.refl ++ v.p; diff --git a/src/slovenian/DocumentationSlv.gf b/src/slovenian/DocumentationSlv.gf index 1812ce198..373d49351 100644 --- a/src/slovenian/DocumentationSlv.gf +++ b/src/slovenian/DocumentationSlv.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common concrete DocumentationSlv of Documentation = CatSlv ** open - ResSlv, + ResSlv, (P=ParamX), HTML in { flags coding=utf8 ; @@ -31,6 +31,74 @@ lin ) } ; + InflectionPN = \n -> { + t = "li" ; + s1= heading1 ("Lastno Ime"++ + case n.g of { + AMasc Animate => "(m.s.ž.)" ; + AMasc Inanimate => "(m.s.)" ; + AFem => "(ž.s.)" ; + ANeut => "(s.s.)" + }) ; + s2= frameTable ( + tr (th "imen." ++ td (n.s!Nom))++ + tr (th "rod." ++ td (n.s!Gen))++ + tr (th "daj." ++ td (n.s!Dat))++ + tr (th "tož." ++ td (n.s!Acc))++ + tr (th "mest." ++ td (n.s!Loc))++ + tr (th "orod."++td (n.s!Instr)) + ) + } ; + + InflectionLN = \n -> { + t = "li" ; + s1= heading1 ("Ime Lokacije"++ + case n.g of { + AMasc Animate => "(m.s.ž.)" ; + AMasc Inanimate => "(m.s.)" ; + AFem => "(ž.s.)" ; + ANeut => "(s.s.)" + }) ; + s2= frameTable ( + tr (th "imen." ++ td (n.s!Nom))++ + tr (th "rod." ++ td (n.s!Gen))++ + tr (th "daj." ++ td (n.s!Dat))++ + tr (th "tož." ++ td (n.s!Acc))++ + tr (th "mest." ++ td (n.s!Loc))++ + tr (th "orod."++td (n.s!Instr)) + ) + } ; + + InflectionGN = \n -> { + t = "li" ; + s1= heading1 ("Dano Ime"++ + case n.g of { + P.Male => "(moški)" ; + P.Female => "(ženski)" + }) ; + s2= frameTable ( + tr (th "imen." ++ td (n.s!Nom))++ + tr (th "rod." ++ td (n.s!Gen))++ + tr (th "daj." ++ td (n.s!Dat))++ + tr (th "tož." ++ td (n.s!Acc))++ + tr (th "mest." ++ td (n.s!Loc))++ + tr (th "orod."++td (n.s!Instr)) + ) + } ; + + InflectionSN = \n -> { + t = "li" ; + s1= heading1 "Družinsko Ime" ; + s2= frameTable ( + tr (th "imen." ++ td (n.s!P.Male!Nom))++ + tr (th "rod." ++ td (n.s!P.Male!Gen))++ + tr (th "daj." ++ td (n.s!P.Male!Dat))++ + tr (th "tož." ++ td (n.s!P.Male!Acc))++ + tr (th "mest." ++ td (n.s!P.Male!Loc))++ + tr (th "orod."++td (n.s!P.Male!Instr)) + ) + } ; + InflectionA, InflectionA2 = \a -> { t = "pr" ; s1= heading1 ("Pridevnik") ; diff --git a/src/slovenian/ExtendSlv.gf b/src/slovenian/ExtendSlv.gf index 0e95985f6..c03f7ae15 100644 --- a/src/slovenian/ExtendSlv.gf +++ b/src/slovenian/ExtendSlv.gf @@ -57,14 +57,5 @@ lin youPolPl_Pron = youPol_Pron ; youPolPlFem_Pron = youPlFem_Pron ; -lin GivenName = \n -> {s = n.s; g = sex2agender n.g; n = Sg} ; -lin MaleSurname = \n -> {s = n.s ! Male; g = AMasc Animate; n = Sg} ; -lin FemaleSurname = \n -> {s = n.s ! Female; g = AFem; n = Sg} ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! c ; - g = sex2agender gn.g ; - n = Sg - } ; - } diff --git a/src/slovenian/GrammarSlv.gf b/src/slovenian/GrammarSlv.gf index f8650ba29..660891af6 100644 --- a/src/slovenian/GrammarSlv.gf +++ b/src/slovenian/GrammarSlv.gf @@ -14,7 +14,8 @@ concrete GrammarSlv of Grammar = TextX - [Pol,PPos,PNeg], StructuralSlv, IdiomSlv, ----AR - TenseX + TenseX, + NamesSlv ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/slovenian/NamesSlv.gf b/src/slovenian/NamesSlv.gf new file mode 100644 index 000000000..874930391 --- /dev/null +++ b/src/slovenian/NamesSlv.gf @@ -0,0 +1,34 @@ +concrete NamesSlv of Names = CatSlv ** open ResSlv, (P=ParamX), Prelude in { + +lin GivenName = \n -> { + s = n.s; + a = {g=agender2gender (sex2agender n.g); n=Sg; p=P3}; + isPron = False + } ; +lin MaleSurname = \n -> { + s = n.s ! P.Male; + a = {g=Masc; n=Sg; p=P3}; + isPron = False + } ; +lin FemaleSurname = \n -> { + s = n.s ! P.Female; + a = {g=Fem; n=Sg; p=P3}; + isPron = False + } ; +lin FullName gn sn = { + s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! c ; + a = {g=agender2gender (sex2agender gn.g); n=Sg; p=P3}; + isPron = False + } ; + +lin UseLN, PlainLN = \ln -> { + s = ln.s; + a = {g=agender2gender ln.g; n=ln.n; p=P3}; + isPron = False + } ; + +lin InLN ln = { + s = "v" ++ ln.s ! Loc + } ; + +} diff --git a/src/slovenian/NounSlv.gf b/src/slovenian/NounSlv.gf index 02aef9808..c9e992aa6 100644 --- a/src/slovenian/NounSlv.gf +++ b/src/slovenian/NounSlv.gf @@ -58,7 +58,15 @@ concrete NounSlv of Noun = CatSlv ** open ResSlv,Prelude in { NumCard n = n ; - NumNumeral numeral = {s = numeral.s; n = numeral.n} ; + NumNumeral numeral = numeral ; + NumDigits digits = { + s = \\g,c => digits.s; + n = digits.n + } ; + NumDecimal decimal = { + s = \\g,c => decimal.s; + n = decimal.n + } ; DefArt = { s = \\_,_,_ => "" ; diff --git a/src/slovenian/NumeralSlv.gf b/src/slovenian/NumeralSlv.gf index 6dc79d5f9..c805aeaea 100644 --- a/src/slovenian/NumeralSlv.gf +++ b/src/slovenian/NumeralSlv.gf @@ -1,4 +1,4 @@ -concrete NumeralSlv of Numeral = CatSlv [Numeral,Digits] ** open Prelude, ResSlv in { +concrete NumeralSlv of Numeral = CatSlv [Numeral,Digits,Decimal] ** open Prelude, ResSlv in { lincat Digit = {s : DForm => Case => Str; n : NumAgr} ; @@ -200,12 +200,12 @@ oper mkDigit2 : (_,_,_,_,_,_ : Str) -> Gender => Case => Str; Dig = TDigit ; lin - IDig d = d ; + IDig d = d ** {n=UseNum d.n}; IIDig d i = { s = d.s ++ BIND ++ i.s ; ---- s = \\o => d.s ! NCard Masc ++ BIND ++ i.s ! o ; - n = Pl + n = UseNum Pl } ; D_0 = mkDig "0" ; @@ -219,6 +219,20 @@ oper mkDigit2 : (_,_,_,_,_,_ : Str) -> Gender => Case => Str; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + n = UseNum Pl ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + n = UseNum Pl ; + hasDot=True + } ; + oper mkDig : Str -> TDigit = \c -> mk2Dig c Pl ; diff --git a/src/slovenian/ParadigmsSlv.gf b/src/slovenian/ParadigmsSlv.gf index 6773b767e..7cb1a45a3 100644 --- a/src/slovenian/ParadigmsSlv.gf +++ b/src/slovenian/ParadigmsSlv.gf @@ -1,4 +1,4 @@ -resource ParadigmsSlv = open CatSlv, ResSlv, Prelude, Predef in { +resource ParadigmsSlv = open CatSlv, ResSlv, (P=ParamX), Prelude, Predef in { oper nominative : Case = Nom ; @@ -16,12 +16,12 @@ oper feminine = AFem; neuter = ANeut; - male = Male ; - female = Female ; + male = P.Male ; + female = P.Female ; - singular : Number = Sg ; - dual : Number = Dl ; - plural : Number = Pl ; + singular : ResSlv.Number = ResSlv.Sg ; + dual : ResSlv.Number = Dl ; + plural : ResSlv.Number = ResSlv.Pl ; definite : Species = Def ; indefinite : Species = Indef ; @@ -34,6 +34,10 @@ oper mkN : (_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> AGender -> N = worstN ; } ; + compoundN = overload { + compoundN : N -> Str -> N = \noun,adv -> noun ** {s = \\c,n => noun.s ! c ! n ++ adv} ; + } ; + mkN2 : N -> Prep -> N2 = \n,c -> n ** {c=c} ; --All masculine forms (except those with long pluralstem) are formed here. @@ -41,7 +45,7 @@ oper --In case the genitive singular has an extra vowel in the end, it is dropped before coming here. mascAll : (_,_ : Str) -> Animacy -> N = \oce,ocet,anim -> - let accsg = case anim of {Animate => ocet + "a"; _ => oce}; --Special case: Masc Sg Acc Animate + let accsg = case anim of {Animate => ocet + "a"; _ => oce}; --Special case: Masc ResSlv.Sg Acc Animate oceto : Str = case ocet of { _ + ("c"|"j"|"ž"|"š"|"č") => ocet+"e" ; @@ -204,12 +208,12 @@ oper } ; mkGN = overload { - mkGN : Str -> Sex -> GN = + mkGN : Str -> P.Sex -> GN = \s,g -> lin GN { s = \\_ => s ; g = g }; - mkGN : (_,_,_,_,_,_ : Str) -> Sex -> GN = + mkGN : (_,_,_,_,_,_ : Str) -> P.Sex -> GN = \nom,gen,dat,acc,loc,instr,g -> lin GN { s = table { Nom => nom; @@ -241,6 +245,44 @@ oper }; } ; + mkLN = overload { + mkLN : N -> LN = \noun -> lin LN { + s = \\c => noun.s ! c ! Sg ; + g = noun.g ; + n = Sg + }; + mkLN : N -> Number -> LN = \noun,nr -> lin LN { + s = \\c => noun.s ! c ! nr ; + g = noun.g ; + n = nr + }; + mkLN : Str -> LN = + \s -> lin LN { + s = \\_ => s ; + g = AMasc Inanimate ; + n = Sg + }; + mkLN : Str -> AGender -> Number -> LN = + \s,g,n -> lin LN { + s = \\_ => s ; + g = g ; + n = n + }; + mkLN : (_,_,_,_,_,_ : Str) -> AGender -> Number -> LN = + \nom,gen,dat,acc,loc,instr,g,n -> lin LN { + s = table { + Nom => nom; + Gen => gen; + Dat => dat; + Acc => acc; + Loc => loc; + Instr => instr + }; + g = g ; + n = n + }; + } ; + mkV = overload { mkV : (inf : Str) -> V = \v -> regV v (dp 2 v) ; mkV : (inf,stem : Str) -> V = regV ; @@ -850,4 +892,7 @@ oper vowel : pattern Str = #("a"|"e"|"i"|"o"|"u") ; consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"r"|"s"|"t"|"v"|"x"|"z") ; + + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/slovenian/ResSlv.gf b/src/slovenian/ResSlv.gf index 1b3e2446c..7f1c846aa 100644 --- a/src/slovenian/ResSlv.gf +++ b/src/slovenian/ResSlv.gf @@ -4,7 +4,6 @@ param Case = Nom | Gen | Dat | Acc | Loc | Instr; Number = Sg | Dl | Pl ; Gender = Masc | Fem | Neut ; - Sex = Male | Female ; Person = P1 | P2 | P3 ; Species = Indef | Def ; Animacy = Animate | Inanimate ; diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index 404a9369c..3f97933de 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -80,6 +80,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { Card = BaseNum ; Numeral = ResSom.Numeral ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; @@ -118,7 +119,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { N = ResSom.Noun ; N2 = ResSom.Noun2 ; N3 = ResSom.Noun3 ; - GN, SN, PN = ResSom.PNoun ; + GN, SN, LN, PN = ResSom.PNoun ; Adv = ResSom.Adverb ; -- Adposition of an adverbial can merge with obligatory complements of the verb. diff --git a/src/somali/ExtendSom.gf b/src/somali/ExtendSom.gf index dd21115b1..ef59243dd 100644 --- a/src/somali/ExtendSom.gf +++ b/src/somali/ExtendSom.gf @@ -17,10 +17,4 @@ lin -- FocusAdV : AdV -> S -> Utt ; -- never will I sleep -- FocusAP : AP -> NP -> Utt ; -- green was the tree -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - a = gn.a - } ; - } ; diff --git a/src/somali/GrammarSom.gf b/src/somali/GrammarSom.gf index 1b32f79ae..b7b935e07 100644 --- a/src/somali/GrammarSom.gf +++ b/src/somali/GrammarSom.gf @@ -12,7 +12,8 @@ concrete GrammarSom of Grammar = TextX - [Adv,IAdv], StructuralSom, IdiomSom, - TenseX - [Adv,IAdv] + TenseX - [Adv,IAdv], + NamesSom ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/somali/NamesSom.gf b/src/somali/NamesSom.gf new file mode 100644 index 000000000..4cb51d4a7 --- /dev/null +++ b/src/somali/NamesSom.gf @@ -0,0 +1,25 @@ +concrete NamesSom of Names = CatSom ** open ResSom, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> n ** { + s = \\c => n.s ; + isPron = False ; + st = Definite ; + empty = [] ; + }; + +lin FullName gn sn = { + s = \\c => gn.s ++ sn.s ; + a = gn.a ; + isPron = False ; + st = Definite ; + empty = [] ; + } ; + + UseLN pn = pn ** { + s = \\c => pn.s ; + isPron = False ; + st = Definite ; + empty = [] ; + } ; + +} diff --git a/src/somali/NumeralSom.gf b/src/somali/NumeralSom.gf index 51660deeb..32a32dc07 100644 --- a/src/somali/NumeralSom.gf +++ b/src/somali/NumeralSom.gf @@ -1,4 +1,4 @@ -concrete NumeralSom of Numeral = CatSom [Numeral,Digits] ** +concrete NumeralSom of Numeral = CatSom [Numeral,Digits,Decimal] ** open Prelude, ResSom, ParamSom in { oper @@ -161,5 +161,18 @@ lin D_9 = mkDig "9" ; lin IDig dig = dig ; -- : Dig -> Digits -> Digits ; lin IIDig dig digs = digs ** {s = \\co => glue (dig.s ! co) (digs.s ! co) } ; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\co => glue "-" (d.s ! co) ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\co => d.s ! co ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! co; + n = Pl ; + hasDot=True + } ; } diff --git a/src/somali/ParadigmsSom.gf b/src/somali/ParadigmsSom.gf index 490e582b6..deed7226a 100644 --- a/src/somali/ParadigmsSom.gf +++ b/src/somali/ParadigmsSom.gf @@ -286,4 +286,6 @@ oper } ; -------------------------------------------------------------------------------- + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/spanish/CatSpa.gf b/src/spanish/CatSpa.gf index 816909b6c..1f63e5645 100644 --- a/src/spanish/CatSpa.gf +++ b/src/spanish/CatSpa.gf @@ -1,5 +1,5 @@ --# -path=.:../romance:../abstract:../common:prelude concrete CatSpa of Cat = CommonX - - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] ** CatRomance with + [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with (ResRomance = ResSpa) ; diff --git a/src/spanish/CompatibilitySpa.gf b/src/spanish/CompatibilitySpa.gf index d736c363e..eb2ba47d4 100644 --- a/src/spanish/CompatibilitySpa.gf +++ b/src/spanish/CompatibilitySpa.gf @@ -6,6 +6,6 @@ concrete CompatibilitySpa of Compatibility = CatSpa ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/spanish/ConstructionSpa.gf b/src/spanish/ConstructionSpa.gf index d6e0f66f9..f49755d66 100644 --- a/src/spanish/ConstructionSpa.gf +++ b/src/spanish/ConstructionSpa.gf @@ -66,11 +66,11 @@ lin weekdayLastAdv w = SyntaxSpa.mkAdv noPrep (mkNP the_Det (mkCN (mkA "pasado") w)) ; -- il lunedí scorso weekdayNextAdv w = SyntaxSpa.mkAdv noPrep (mkNP the_Det (mkCN (mkA "próximo") w)) ; -- il lunedí prossimo - monthAdv m = lin Adv {s = "en" ++ m.s ! C.Sg} ; -- in mggio + monthAdv m = lin Adv {s = "en" ++ m.s ! C.Sg} ; -- en mayo yearAdv y = SyntaxSpa.mkAdv (mkPrep "en") y ; ---- - dayMonthAdv d m = ParadigmsSpa.mkAdv ("el" ++ (d.s ! R.Nom).comp ++ m.s ! C.Sg) ; -- le 17 mai - monthYearAdv m y = lin Adv {s = "en" ++ m.s ! C.Sg ++ (y.s ! R.Nom).comp} ; -- in maggio 2012 - dayMonthYearAdv d m y = ParadigmsSpa.mkAdv ("el" ++ (d.s ! R.Nom).comp ++ m.s ! C.Sg ++ (y.s ! R.Nom).comp) ; -- il 17 maggio 2013 + dayMonthAdv d m = ParadigmsSpa.mkAdv ("el" ++ (d.s ! R.Nom).comp ++ "de" ++ m.s ! C.Sg) ; -- el 17 de mayo + monthYearAdv m y = lin Adv {s = "en" ++ m.s ! C.Sg ++ "de" ++ (y.s ! R.Nom).comp} ; -- en mayo de 2012 + dayMonthYearAdv d m y = ParadigmsSpa.mkAdv ("el" ++ (d.s ! R.Nom).comp ++ "de" ++ m.s ! C.Sg ++ "de" ++ (y.s ! R.Nom).comp) ; -- el 17 de mayo de 2013 intYear = symb ; intMonthday = symb ; diff --git a/src/spanish/DiffSpa.gf b/src/spanish/DiffSpa.gf index f86ac962d..b9756eb8d 100644 --- a/src/spanish/DiffSpa.gf +++ b/src/spanish/DiffSpa.gf @@ -237,4 +237,10 @@ instance DiffSpa of DiffRomance - [iAdvQuestionInv,otherInv,partAgr,stare_V,vpAg polNegDirSubj = RPos ; +param + HasArt = NoArt | UseArt ; + +oper + superlCanBePost = True ; + } diff --git a/src/spanish/DocumentationSpaFunctor.gf b/src/spanish/DocumentationSpaFunctor.gf index fa09cdca7..a0b04c0a4 100644 --- a/src/spanish/DocumentationSpaFunctor.gf +++ b/src/spanish/DocumentationSpaFunctor.gf @@ -40,6 +40,42 @@ lin ) } ; + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nombre Proprio" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Nombre de Pila" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \sn -> { + t = "sn" ; + s1 = heading1 "Apellido" ; + s2 = sn.s ! Masc + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nombre del Lugar" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; @@ -47,7 +83,15 @@ lin tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ tr (th (heading masculine_Parameter) ++ td (adj.s ! genNum2Aform Masc Sg) ++ td (adj.s ! genNum2Aform Masc Pl)) ++ tr (th (heading feminine_Parameter) ++ td (adj.s ! genNum2Aform Fem Sg) ++ td (adj.s ! genNum2Aform Fem Pl)) - ) + ) ++ + case adj.isDeg of { + True => heading2 (heading comparative_Parameter) ++ + frameTable ( + tr (th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ + tr (td (adj.compar ! Sg) ++ td (adj.compar ! Pl)) + ) ; + False=> [] + } } ; InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> { diff --git a/src/spanish/ExtendSpa.gf b/src/spanish/ExtendSpa.gf index 75292f0c5..dd8bdd95f 100644 --- a/src/spanish/ExtendSpa.gf +++ b/src/spanish/ExtendSpa.gf @@ -73,10 +73,14 @@ concrete ExtendSpa of Extend = CatSpa ** ExtendRomanceFunctor - (predV (mkV "existir"))) ; CompoundN noun noun2 = { -- order is different because that's needed for correct translation from english - s = \\n => noun2.s ! n - ++ variants {"de" ; genForms "del" "de la" ! noun.g} - ++ noun.s ! Sg ; - g = noun2.g + s = \\n => noun2.s ! n ++ + case noun2.relType of { + NRelPrep p => prepCase (CPrep p) ; -- tasa de suicidio + NRelNoPrep => [] -- connessione internet = internet connection + } ++ + noun.s ! Sg ; + g = noun2.g ; + relType = noun2.relType } ; CompoundAP noun adj = { @@ -106,12 +110,6 @@ concrete ExtendSpa of Extend = CatSpa ** ExtendRomanceFunctor - lin UseComp_estar comp = insertComplement comp.s (predV I.estar_V) ; UseComp_ser comp = insertComplement comp.s (predV copula) ; -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; - lin PassVPSlash vps = passVPSlash vps [] ; PassAgentVPSlash vps np = passVPSlash vps (let by = in by.s ++ (np.s ! by.c).ton) ; diff --git a/src/spanish/GrammarSpa.gf b/src/spanish/GrammarSpa.gf index f34515711..bab5b7ead 100644 --- a/src/spanish/GrammarSpa.gf +++ b/src/spanish/GrammarSpa.gf @@ -11,10 +11,11 @@ concrete GrammarSpa of Grammar = RelativeSpa, ConjunctionSpa, PhraseSpa, - TextSpa - [SC,Temp,Tense,Pol,PPos,PNeg], -- special punctuation + TextSpa - [SC,Temp,Tense,Pol,PPos,PNeg,MU], -- special punctuation IdiomSpa, StructuralSpa, - TenseSpa + TenseSpa, + NamesSpa ** { diff --git a/src/spanish/MakeStructuralSpa.gf b/src/spanish/MakeStructuralSpa.gf index bda2f96f5..33e16f4d7 100644 --- a/src/spanish/MakeStructuralSpa.gf +++ b/src/spanish/MakeStructuralSpa.gf @@ -28,11 +28,12 @@ oper in lin Quant { s = \\b => questo ; sp = questo ; + spn= \\c => prepCase c ++ s ; s2 = [] ; isNeg = False } ; -- Inflects for number and gender - mkQuant : Str -> Str -> Str -> Str -> Quant = \tutto,tutta,tutti,tutte -> + mkQuant : Str -> Str -> Str -> Str -> Str -> Quant = \tutto,tutta,tutti,tutte,esto -> let questo : Number => Gender => Case => Str = table { Sg => table { @@ -47,6 +48,7 @@ oper in lin Quant { s = \\b => questo ; sp = questo ; + spn= \\c => prepCase c ++ "esto" ; s2 = [] ; isNeg = False } ; @@ -56,15 +58,17 @@ oper -- Does not inflect for number mkDet : Str -> Number -> Det = \piu,n -> lin Det { s,sp = \\_,c => prepCase c ++ piu ; + spn = \\c => prepCase c ++ piu ; n = n ; - s2 = [] ; + s2 = \\g => [] ; isNeg = False } ; -- Inflects for number mkDet : Str -> Str -> Number -> Det = \alcuni,alcune,n -> lin Det { s,sp = \\g,c => prepCase c ++ genForms alcuni alcune ! g ; + spn = \\c => prepCase c ++ alcuni ; n = n ; - s2 = [] ; + s2 = \\g => [] ; isNeg = False } ; } ; diff --git a/src/spanish/MorphoSpa.gf b/src/spanish/MorphoSpa.gf index fd13665cf..aea78c105 100644 --- a/src/spanish/MorphoSpa.gf +++ b/src/spanish/MorphoSpa.gf @@ -237,33 +237,32 @@ oper mkOrdinal : A -> Ord = \adj-> lin Ord { s = \\ag => adj.s ! genNum2Aform ag.g ag.n ; + s2 = \\_ => [] } ; - mkQuantifier : (ese,esa,esos,esas : Str) -> Quant = \ese,esa,esos,esas-> + mkQuantifier : (ese,esa,esos,esas,eso : Str) -> Quant = \ese,esa,esos,esas,eso-> let - se : Str = Predef.drop 1 ese ; - sa : Str = Predef.drop 1 esa ; - sos : Str = Predef.drop 1 esos ; - sas : Str = Predef.drop 1 esas ; - E : Str = "é" ; attrforms : Number => Gender => Case => Str = table { Sg => \\g,c => prepCase c ++ genForms ese esa ! g ; Pl => \\g,c => prepCase c ++ genForms esos esas ! g ---- } ; npforms : Number => Gender => Case => Str = table { - Sg => \\g,c => prepCase c ++ genForms (E + se) (E + sa) ! g ; - Pl => \\g,c => prepCase c ++ genForms (E + sos) (E + sas) ! g } + Sg => \\g,c => prepCase c ++ genForms ese esa ! g ; + Pl => \\g,c => prepCase c ++ genForms esos esas ! g } in lin Quant { s = \\_ => attrforms ; s2 = [] ; - sp = npforms ; isNeg = False + sp = npforms ; + spn= \\c => prepCase c ++ eso ; + isNeg = False } ; mkDeterminer : (mucho,mucha : Str) -> Number -> Bool -> Det = \mucho,mucha,number,neg -> lin Det { s,sp = \\g,c => prepCase c ++ genForms mucho mucha ! g ; + spn = \\c => prepCase c ++ mucho ; n = number; - s2 = [] ; + s2 = \\c => [] ; isNeg = neg } ; diff --git a/src/spanish/NamesSpa.gf b/src/spanish/NamesSpa.gf new file mode 100644 index 000000000..dba32bee0 --- /dev/null +++ b/src/spanish/NamesSpa.gf @@ -0,0 +1,50 @@ +concrete NamesSpa of Names = CatSpa ** open Prelude, ResSpa, CommonRomance in { + +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ! gn.g ; + g = gn.g + } ; + +lin PlainLN n = heavyNP { + s = \\c => prepCase c ++ n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + UseArt => artDef False n.g n.num c ++ n.s; + NoArt => prepCase c ++ n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + +lin InLN n = { + s = "en" ++ + case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + +} diff --git a/src/spanish/NumeralSpa.gf b/src/spanish/NumeralSpa.gf index 7cf6ecf64..dff595811 100644 --- a/src/spanish/NumeralSpa.gf +++ b/src/spanish/NumeralSpa.gf @@ -1,4 +1,4 @@ -concrete NumeralSpa of Numeral = CatSpa [Numeral,Digits] ** +concrete NumeralSpa of Numeral = CatSpa [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoSpa, Prelude in { flags coding=utf8 ; @@ -132,6 +132,20 @@ param D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":o") ; diff --git a/src/spanish/ParadigmsSpa.gf b/src/spanish/ParadigmsSpa.gf index 56ead98f2..d2ac452d2 100644 --- a/src/spanish/ParadigmsSpa.gf +++ b/src/spanish/ParadigmsSpa.gf @@ -143,6 +143,39 @@ oper mkPN : N -> PN ; -- gender from noun } ; + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = Masc ; + num = Sg} ; + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = Sg} ; + mkLN : Str -> Gender -> Number -> LN = \s,g,num -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = num} ; + } ; + + + defLN : LN -> LN = \n -> n ** {art = UseArt} ; --2 Adjectives @@ -330,8 +363,8 @@ oper Gender = MorphoSpa.Gender ; Number = MorphoSpa.Number ; CopulaType = DiffSpa.CopulaType ; - masculine = Masc ; - feminine = Fem ; + masculine, male = Masc ; + feminine, female = Fem ; singular = Sg ; plural = Pl ; serCopula = DiffSpa.serCopula ; @@ -347,11 +380,11 @@ oper } ; - mk2N x y g = mkNounIrreg x y g ** {lock_N = <>} ; - regN x = mkNomReg x ** {lock_N = <>} ; - compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ; - femN x = {s = x.s ; g = feminine ; lock_N = <>} ; - mascN x = {s = x.s ; g = masculine ; lock_N = <>} ; + mk2N x y g = mkNounIrreg x y g ** {relType=NRelPrep P_de; lock_N = <>} ; + regN x = mkNomReg x ** {relType=NRelPrep P_de; lock_N = <>} ; + compN x y = x ** {s = \\n => x.s ! n ++ y} ; + femN x = {s = x.s ; g = feminine ; relType=NRelPrep P_de; lock_N = <>} ; + mascN x = {s = x.s ; g = masculine ; relType=NRelPrep P_de; lock_N = <>} ; mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ; deN2 n = mkN2 n genitive ; @@ -517,7 +550,7 @@ oper mkN = overload { mkN : (luz : Str) -> N = regN ; - mkN : Str -> Gender -> N = \s,g -> {s = (regN s).s ; g = g ; lock_N = <>}; + mkN : Str -> Gender -> N = \s,g -> (regN s) ** {g = g}; mkN : (baston,bastones : Str) -> Gender -> N = mk2N ; mkN : N -> Str -> N = compN ; } ; @@ -585,4 +618,6 @@ oper mk2V2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False ; hasArt=False} ; + } ; diff --git a/src/spanish/ParseSpa.gf b/src/spanish/ParseSpa.gf deleted file mode 100644 index 7b17e50f1..000000000 --- a/src/spanish/ParseSpa.gf +++ /dev/null @@ -1,158 +0,0 @@ ---# -path=alltenses -concrete ParseSpa of ParseEngAbs = - TenseSpa, --- CatSpa, - NounSpa - [PPartNP], - AdjectiveSpa, - NumeralSpa, - SymbolSpa [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], - ConjunctionSpa, - VerbSpa - [SlashV2V, PassV2, UseCopula, ComplVV], - AdverbSpa, - PhraseSpa, - SentenceSpa, - QuestionSpa, - RelativeSpa, - IdiomSpa [NP, VP, Tense, Cl, ProgrVP, ExistNP], - ExtraSpa [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, - Temp, Pol, Conj, VPS, ListVPS, S, Num, CN, RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP, - VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, - ClSlash, RCl, EmptyRelSlash], - - DictEngSpa ** -open MorphoSpa, ResSpa, ParadigmsSpa, SyntaxSpa, Prelude in { - -flags - literal=Symb ; - coding = utf8 ; - - -lin --- missing from ExtraSpa; should not really be there either - - GenNP np = - let denp = (np.s ! ResSpa.genitive).ton in { - s = \\_,_,_,_ => [] ; - sp = \\_,_,_ => denp ; - s2 = denp ; - isNeg = False ; - } ; - - EmptyRelSlash slash = mkRCl which_RP (lin ClSlash slash) ; - - that_RP = which_RP ; - - UncNeg = negativePol ; - --- lexical entries - - another_Quant = mkQuantifier "otro" "otra" "otros" "otras" ; - some_Quant = mkQuantifier "algún" "alguna" "algunos" "algunas" ; - anySg_Det = mkDeterminer "algún" "alguna" Sg False ; ---- also meaning "whichever" ? - each_Det = SyntaxSpa.every_Det ; - - but_Subj = {s = "pero" ; m = Indic} ; ---- strange to have this as Subj - -{- - myself_NP = regNP "myself" singular ; - yourselfSg_NP = regNP "yourself" singular ; - himself_NP = regNP "himself" singular ; - herself_NP = regNP "herself" singular ; - itself_NP = regNP "itself" singular ; - ourself_NP = regNP "ourself" plural ; - yourselfPl_NP = regNP "yourself" plural ; - themself_NP = regNP "themself" plural ; - themselves_NP = regNP "themselves" plural ; --} - - CompoundCN num noun cn = { - s = \\n => cn.s ! n ++ "de" ++ noun.s ! num.n ; - g = cn.g - } ; - -{- - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! Sg ! Nom ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; - - GerundN v = { - s = \\n,c => v.s ! VPresPart ; - g = Neutr - } ; - - GerundAP v = { - s = \\agr => v.s ! VPresPart ; - isPre = True - } ; --} - - PastPartAP v = { - s = table { - ASg g _ => v.s ! VPart g Sg ; - APl g _ => v.s ! VPart g Pl ; - _ => v.s ! VPart Masc Sg ---- the adverb form - } ; - isPre = True - } ; - -{- - OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ; --} - - PositAdVAdj a = {s = a.s ! Posit ! AA} ; - -{- - UseQuantPN q pn = {s = \\c => q.s ! False ! Sg ++ pn.s ! npcase2case c ; a = agrgP3 Sg pn.g} ; - - SlashV2V v ant p vp = insertObjc (\\a => v.c3 ++ ant.s ++ p.s ++ - infVP v.typ vp ant.a p.p a) - (predVc v) ; - - SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++ - v.c3 ++ - vpi.s ! VVAux ! a) - (predVc v) ; - ComplVV v a p vp = insertObj (\\agr => a.s ++ p.s ++ - infVP v.typ vp a.a p.p agr) - (predVV v) ; --} - ----- TODO: find proper expressions for OSV and OVS in Spa - PredVPosv np vp = mkCl (lin NP np) (lin VP vp) ; - PredVPovs np vp = mkCl (lin NP np) (lin VP vp) ; - - - CompS s = {s = \\_ => "de" ++ "que" ++ s.s ! Indic} ; ---- de ? - -{- - CompQS qs = {s = \\_ => qs.s ! QIndir} ; - CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ - infVP VVInf vp ant.a p.p a} ; - - VPSlashVS vs vp = - insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) ** - {c2 = ""; gapInMiddle = False} ; - - PastPartRS ant pol vps = { - s = \\agr => vps.ad ++ vps.ptp ++ vps.s2 ! agr ; - c = npNom - } ; - - PresPartRS ant pol vp = { - s = \\agr => vp.ad ++ vp.prp ++ vp.s2 ! agr ; - c = npNom - } ; - - ApposNP np1 np2 = { - s = \\c => np1.s ! c ++ "," ++ np2.s ! npNom ; - a = np1.a - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - --} - -} diff --git a/src/spanish/StructuralSpa.gf b/src/spanish/StructuralSpa.gf index 8efabbabd..c617dc8b3 100644 --- a/src/spanish/StructuralSpa.gf +++ b/src/spanish/StructuralSpa.gf @@ -35,7 +35,10 @@ lin during_Prep = mkPrep "durante" ; either7or_DConj = {s1,s2 = "o" ; n = Sg} ; everybody_NP = makeNP ["todos"] Masc Pl ; - every_Det = mkDeterminer "cada" "cada" Sg False ; + every_Det = mkDeterminer "cada" "cada" Sg False ** { + sp = \\g,c => prepCase c ++ genForms "todos" "todas" ! g ; + spn = \\c => prepCase c ++ "todo" + }; everything_NP = pn2np (mkPN ["todo"] Masc) ; everywhere_Adv = ss ["en todas partes"] ; except_Prep = mkPrep "excepto" ; @@ -75,7 +78,8 @@ lin } in { s = \\_ => ningun ; - sp = ningun ; + sp = \\_,_,_ => "nadie" ; + spn= \\c => prepCase c ++ "nada" ; s2 = [] ; isNeg = True } ; no_Utt = ss "no" ; @@ -100,13 +104,13 @@ lin someSg_Det = mkDeterminer "algún" "alguna" Sg False ; something_NP = pn2np (mkPN ["algo"] Masc) ; somewhere_Adv = ss ["en alguna parte"] ; - that_Quant = mkQuantifier "ese" "esa" "esos" "esas" ; + that_Quant = mkQuantifier "ese" "esa" "esos" "esas" "eso" ; there_Adv = mkAdv "allí" ; -- allá there7to_Adv = mkAdv ["para allí"] ; there7from_Adv = mkAdv ["de allí"] ; therefore_PConj = ss ["por eso"] ; they_Pron = agr2pron ! {g=Masc ; n=Pl ; p=P3} ; - this_Quant = mkQuantifier "este" "esta" "estos" "estas" ; + this_Quant = mkQuantifier "este" "esta" "estos" "estas" "esto" ; through_Prep = mkPrep "por" ; too_AdA = ss "demasiado" ; to_Prep = complDat ; diff --git a/src/swahili/GrammarSwa.gf b/src/swahili/GrammarSwa.gf index 023714dab..5e7230e90 100644 --- a/src/swahili/GrammarSwa.gf +++ b/src/swahili/GrammarSwa.gf @@ -14,7 +14,8 @@ concrete GrammarSwa of Grammar = TextX, StructuralSwa, IdiomSwa, - TenseX + TenseX, + NamesSwa ** { flags startcat = Phr ; diff --git a/src/swahili/NamesSwa.gf b/src/swahili/NamesSwa.gf new file mode 100644 index 000000000..580f416a8 --- /dev/null +++ b/src/swahili/NamesSwa.gf @@ -0,0 +1 @@ +concrete NamesSwa of Names = CatSwa ** { } diff --git a/src/swahili/NumeralSwa.gf b/src/swahili/NumeralSwa.gf index 7b6451149..3b3ce8ffc 100644 --- a/src/swahili/NumeralSwa.gf +++ b/src/swahili/NumeralSwa.gf @@ -1,4 +1,4 @@ -concrete NumeralSwa of Numeral = CatSwa [Numeral,Digits] ** +concrete NumeralSwa of Numeral = CatSwa [Numeral,Digits,Decimal] ** open Prelude,DiffSwa,MorphoSwa in { lincat @@ -76,6 +76,16 @@ lin pot4as5 n = n ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o,g=>"-" ++ BIND ++ d.s ! o ! g; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o,g=>d.s ! NCard ! g ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g ; + hasDot=True; + n = Pl + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; diff --git a/src/swahili/ParadigmsSwa.gf b/src/swahili/ParadigmsSwa.gf index e1b780de1..0e53099f3 100644 --- a/src/swahili/ParadigmsSwa.gf +++ b/src/swahili/ParadigmsSwa.gf @@ -431,6 +431,7 @@ mkN2 = overload { regPN : Str ->Gender -> PN ; nounPN : N -> PN ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } diff --git a/src/swedish/DocumentationSwe.gf b/src/swedish/DocumentationSwe.gf index 3c4b551a8..230ba12a0 100644 --- a/src/swedish/DocumentationSwe.gf +++ b/src/swedish/DocumentationSwe.gf @@ -32,23 +32,23 @@ lin ) } ; - InflectionPN = \pn -> { + InflectionLN = \n -> { t = "nm" ; - s1 = heading1 ("Namn" ++ case pn.g of { - Utr => "(utr)" ; - Neutr => "(neutr)" - }) ; + s1 = heading1 ("Platsnamn" ++ case n.g of { + Utr => "(utr)" ; + Neutr => "(neutr)" + }) ; s2 = frameTable ( - tr (th "nom" ++ td (pn.s ! Nom)) ++ - tr (th "gen" ++ td (pn.s ! Gen)) - ) + tr (th "nom" ++ td (n.s ! Nom)) ++ + tr (th "gen" ++ td (n.s ! Gen)) + ) ; } ; InflectionGN = \pn -> { t = "fnm" ; s1 = heading1 ("Förnamn" ++ case pn.g of { - Utr => "(utr)" ; - Neutr => "(neutr)" + Male => "(man)" ; + Female => "(kvinna)" }) ; s2 = frameTable ( tr (th "nom" ++ td (pn.s ! Nom)) ++ @@ -58,13 +58,10 @@ lin InflectionSN = \pn -> { t = "enm" ; - s1 = heading1 ("Efternamn" ++ case pn.g of { - Utr => "(utr)" ; - Neutr => "(neutr)" - }) ; + s1 = heading1 "Efternamn" ; s2 = frameTable ( - tr (th "nom" ++ td (pn.s ! Nom)) ++ - tr (th "gen" ++ td (pn.s ! Gen)) + tr (th "nom" ++ td (pn.s ! Male ! Nom)) ++ + tr (th "gen" ++ td (pn.s ! Male ! Gen)) ) } ; diff --git a/src/swedish/ExtendSwe.gf b/src/swedish/ExtendSwe.gf index f895b7a45..c16898456 100644 --- a/src/swedish/ExtendSwe.gf +++ b/src/swedish/ExtendSwe.gf @@ -392,11 +392,5 @@ lin UseDAPMasc, UseDAPFem = \dap -> lin CardCNCard card cn = {s = \\g => card.s ! cn.g ++ cn.s ! card.n ! DIndef ! Nom ; n = Pl} ; - -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c ; - g = gn.g - } ; } diff --git a/src/swedish/GrammarSwe.gf b/src/swedish/GrammarSwe.gf index 2bfe758a8..6a9172611 100644 --- a/src/swedish/GrammarSwe.gf +++ b/src/swedish/GrammarSwe.gf @@ -14,7 +14,8 @@ concrete GrammarSwe of Grammar = TextX -[Tense,Temp], IdiomSwe, StructuralSwe, - TenseSwe + TenseSwe, + NamesSwe ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/swedish/NamesSwe.gf b/src/swedish/NamesSwe.gf new file mode 100644 index 000000000..89ae35e46 --- /dev/null +++ b/src/swedish/NamesSwe.gf @@ -0,0 +1,43 @@ +concrete NamesSwe of Names = CatSwe ** open CommonScand, ResSwe, Prelude in { + +lin GivenName = \pn -> { + s = \\c => pn.s ! caseNP c ; + a = agrP3 Utr Sg ; + isPron = False + } ; +lin MaleSurname = \pn -> { + s = \\c => pn.s ! Male ! caseNP c ; + a = agrP3 Utr Sg ; + isPron = False + } ; +lin FemaleSurname = \pn -> { + s = \\c => pn.s ! Female ! caseNP c ; + a = agrP3 Utr Sg ; + isPron = False + } ; +lin PlSurname = \pn -> { + s = \\c => pn.pl ! caseNP c ; + a = agrP3 Utr Pl ; + isPron = False + } ; +lin FullName gn sn = { + s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! caseNP c ; + a = agrP3 Utr Sg ; + isPron = False + } ; + + UseLN, PlainLN = \n -> { + s = \\c => n.s ! caseNP c ; + a = agrP3 n.g n.n ; + isPron = False + } ; + + AdjLN ap ln = ln ** { + s = \\c => preOrPost ap.isPre + (ap.s ! agrAdj (gennum (ngen2gen ln.g) ln.n) (DDef Def)) + (ln.s ! c) ; + } ; + + InLN n = {s = "i" ++ n.s ! caseNP accusative} ; + +} diff --git a/src/swedish/NumeralSwe.gf b/src/swedish/NumeralSwe.gf index 6e4c60ef8..7e1d5e2e1 100644 --- a/src/swedish/NumeralSwe.gf +++ b/src/swedish/NumeralSwe.gf @@ -1,4 +1,4 @@ -concrete NumeralSwe of Numeral = CatSwe [Numeral,Digits] ** open ResSwe, MorphoSwe, Prelude in { +concrete NumeralSwe of Numeral = CatSwe [Numeral,Digits,Decimal] ** open ResSwe, MorphoSwe, Prelude in { flags coding=utf8 ; lincat @@ -52,20 +52,30 @@ lin pot41 = numPl (cardOrd "miljon" "miljonde") ; pot4 n = - numPl (\\g => n.s ! NCard Utr ++ cardOrd "miljon" "miljonde" ! g) ; + numPl (\\g => n.s ! NCard Utr ++ + cardOrd (case n.n of { + Sg => "miljon" ; + Pl => "miljoner" + }) + "miljonde" ! g) ; pot4plus n m = {s = \\g => n.s ! NCard Utr ++ BIND ++ "miljon" ++ m.s ! g ; n = Pl} ; pot4as5 n = n ; - pot4float f = - numPl (\\g => f.s ++ cardOrd "miljoner" "miljonde" ! g) ; + pot4decimal d = + numPl (\\g => d.s ! NCard Utr ++ cardOrd "miljoner" "miljonde" ! g) ; pot51 = numPl (cardOrd "miljard" "miljarde") ; pot5 n = - numPl (\\g => n.s ! NCard Utr ++ cardOrd "miljard" "miljarde" ! g) ; + numPl (\\g => n.s ! NCard Utr ++ + cardOrd (case n.n of { + Sg => "miljard" ; + Pl => "miljarder" + }) + "miljarde" ! g) ; pot5plus n m = {s = \\g => n.s ! NCard Utr ++ BIND ++ "miljard" ++ m.s ! g ; n = Pl} ; - pot5float f = - numPl (\\g => f.s ++ cardOrd "miljarder" "miljarde" ! g) ; + pot5decimal d = + numPl (\\g => d.s ! NCard Utr ++ cardOrd "miljarder" "miljarde" ! g) ; lincat Dig = TDigit ; @@ -89,6 +99,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/swedish/ParadigmsSwe.gf b/src/swedish/ParadigmsSwe.gf index 5528442e8..f87a6f58e 100644 --- a/src/swedish/ParadigmsSwe.gf +++ b/src/swedish/ParadigmsSwe.gf @@ -154,6 +154,26 @@ oper geoPN : Str -> PN ; -- neuter, with identical genitive if ends in a vowel + mkLN = overload { + mkLN : Str -> LN = \s -> lin LN (regPN s) ** {n=Sg}; -- default gender utrum + mkLN : Str -> Gender -> LN = \s,g -> lin LN (regGenPN s g) ** {n=Sg} ; -- set other gender + mkLN : Str -> Gender -> Number -> LN = \s,g,n -> lin LN (regGenPN s g) ** {n=n} ; -- set other gender and number + } ; + + mkGN = overload { + mkGN : Str -> GN = \s -> lin GN {s = \\c => mkCase c s ; g = Male}; -- default gender utrum + mkGN : Str -> Sex -> GN = \s,g -> lin GN {s = \\c => mkCase c s ; g = g} ; -- set other gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_,c => mkCase c s; pl = \\c => mkCase c s}; -- default gender utrum + mkSN : Str -> Str -> Str -> SN = + \male,female,pl -> lin SN {s = table {Male => \\c => mkCase c male; + Female => \\c => mkCase c female} ; + pl = \\c => mkCase c pl + } ; + } ; + --2 Adjectives -- Adjectives need one to seven forms. @@ -351,6 +371,8 @@ oper utrum = Utr ; neutrum = Neutr ; neuter = Neutr ; + male = Male ; + female = Female ; singular = Sg ; plural = Pl ; nominative = Nom ; @@ -821,5 +843,6 @@ oper dirV2 : V -> V2 ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } ; diff --git a/src/thai/CatTha.gf b/src/thai/CatTha.gf index ecab4fbd1..b35c4e224 100644 --- a/src/thai/CatTha.gf +++ b/src/thai/CatTha.gf @@ -51,6 +51,7 @@ concrete CatTha of Cat = CommonX ** open ResTha, Prelude in { -- Numeral Numeral, Card, Digits = {s : Str} ; + Decimal = {s : Str; hasDot : Bool} ; -- Structural @@ -71,6 +72,6 @@ concrete CatTha of Cat = CommonX ** open ResTha, Prelude in { N = ResTha.Noun ; N2 = ResTha.Noun ** {c2 : Str} ; N3 = ResTha.Noun ** {c2,c3 : Str} ; - GN, SN, PN = ResTha.NP ; + GN, SN, LN, PN = ResTha.NP ; } diff --git a/src/thai/GrammarTha.gf b/src/thai/GrammarTha.gf index a338635c7..3ed12b024 100644 --- a/src/thai/GrammarTha.gf +++ b/src/thai/GrammarTha.gf @@ -14,7 +14,8 @@ concrete GrammarTha of Grammar = TextTha, StructuralTha, IdiomTha, - TenseX + TenseX, + NamesTha ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/thai/NamesTha.gf b/src/thai/NamesTha.gf new file mode 100644 index 000000000..3d009d959 --- /dev/null +++ b/src/thai/NamesTha.gf @@ -0,0 +1 @@ +concrete NamesTha of Names = CatTha ** { } diff --git a/src/thai/NounTha.gf b/src/thai/NounTha.gf index 6cc9c2323..914ca2d89 100644 --- a/src/thai/NounTha.gf +++ b/src/thai/NounTha.gf @@ -38,6 +38,7 @@ concrete NounTha of Noun = CatTha ** open StringsTha, ResTha, Prelude in { NumCard n = n ** {hasC = True} ; NumDigits d = d ; + NumDecimal d = d ; OrdDigits d = {s = thbind thii_s d.s} ; NumNumeral numeral = numeral ** {hasC = True} ; diff --git a/src/thai/NumeralTha.gf b/src/thai/NumeralTha.gf index 347006a14..23fa6c643 100644 --- a/src/thai/NumeralTha.gf +++ b/src/thai/NumeralTha.gf @@ -89,4 +89,6 @@ oper D_8 = ss "๘" ; D_9 = ss "๙" ; + PosDecimal d = d ** {hasDot=False} ; + } diff --git a/src/thai/ParadigmsTha.gf b/src/thai/ParadigmsTha.gf index be48d67eb..a5d0cd9be 100644 --- a/src/thai/ParadigmsTha.gf +++ b/src/thai/ParadigmsTha.gf @@ -100,5 +100,6 @@ oper mkPrep : Str -> Prep = \s -> lin Prep (ss s) ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } diff --git a/src/turkish/CatTur.gf b/src/turkish/CatTur.gf index 83199fbb4..c81ce41cd 100644 --- a/src/turkish/CatTur.gf +++ b/src/turkish/CatTur.gf @@ -30,6 +30,7 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, HarmonyTur, Prelud Numeral = {s : CardOrd => Number => Case => Str ; n : Number} ; Digits = {s : CardOrd => Number => Case => Str ; n : Number; tail : DTail} ; + Decimal = {s : CardOrd => Number => Case => Str ; n : Number; hasDot : Bool} ; -- Adjective AP = {s : Number => Case => Str; h : Harmony} ; @@ -49,7 +50,7 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, HarmonyTur, Prelud N = Noun ; N2 = Noun ** {c : Prep} ; N3 = Noun ** {c1,c2 : Prep} ; - GN, SN, PN = { + GN, SN, LN, PN = { s : Case => Str ; h : Harmony ; n : Number diff --git a/src/turkish/ExtendTur.gf b/src/turkish/ExtendTur.gf index dc45b9e78..775457b77 100644 --- a/src/turkish/ExtendTur.gf +++ b/src/turkish/ExtendTur.gf @@ -7,12 +7,4 @@ concrete ExtendTur of Extend = CatTur ** open ResTur in { a = {n=num.n; p=P3} ; } ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ** {n = Sg}; -lin PlSurname = \n -> n ** {n = Pl}; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c ; - h = sn.h ; - n = Sg - } ; - } diff --git a/src/turkish/GrammarTur.gf b/src/turkish/GrammarTur.gf index 72c0c357c..c1f3322a2 100644 --- a/src/turkish/GrammarTur.gf +++ b/src/turkish/GrammarTur.gf @@ -14,7 +14,8 @@ concrete GrammarTur of Grammar = StructuralTur, PhraseTur, IdiomTur, - TenseX - [CAdv, AdN] + TenseX - [CAdv, AdN], + NamesTur ** { flags startcat = Phr ; diff --git a/src/turkish/NamesTur.gf b/src/turkish/NamesTur.gf new file mode 100644 index 000000000..a03a12d4f --- /dev/null +++ b/src/turkish/NamesTur.gf @@ -0,0 +1,25 @@ +concrete NamesTur of Names = CatTur ** open ResTur in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> { + s = \\c => n.s ! c; + h = n.h; + a = {n = Sg; p = P3} + } ; +lin PlSurname = \n -> { + s = \\c => n.s ! c; + h = n.h; + a = {n = Pl; p = P3} + } ; +lin FullName gn sn = { + s = \\c => gn.s ! Nom ++ sn.s ! c; + h = sn.h; + a = {n = Sg; p = P3} + } ; + +lin UsePN pn = { + s = \\c => pn.s ! c; + h = pn.h; + a = {n = pn.n; p = P3} + } ; + +} diff --git a/src/turkish/NounTur.gf b/src/turkish/NounTur.gf index 92ce1db8e..1f23ac08b 100644 --- a/src/turkish/NounTur.gf +++ b/src/turkish/NounTur.gf @@ -176,6 +176,10 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude s = n.s ! NCard ; n = n.n } ; + NumDecimal n = { + s = n.s ! NCard ; n = n.n + } ; + OrdNumeralSuperl n a = { s = \\num,cs => (n.s ! NOrd ! Sg ! cs) ++ a.s ! Sg ! cs } ; diff --git a/src/turkish/NumeralTur.gf b/src/turkish/NumeralTur.gf index 710ea0c55..5f833aae7 100644 --- a/src/turkish/NumeralTur.gf +++ b/src/turkish/NumeralTur.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../../prelude -concrete NumeralTur of Numeral = CatTur [Numeral,Digits] ** open Prelude, ResTur, ParadigmsTur in { +concrete NumeralTur of Numeral = CatTur [Numeral,Digits,Decimal] ** open Prelude, ResTur, ParadigmsTur in { flags coding = utf8 ; @@ -72,6 +72,21 @@ lin D_7 = mkDig "7" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\t,num,c => "-" ++ BIND ++ d.s ! t ! num ! c; + n = Pl; + hasDot=False + } ; + IFrac d i = { + s=\\t,num,c => d.s ! NCard ! Sg ! Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! t ! num ! c; + n = Pl ; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND++","++BIND ; diff --git a/src/turkish/ParadigmsTur.gf b/src/turkish/ParadigmsTur.gf index 9b9ad2c8a..b8dd6ba8c 100644 --- a/src/turkish/ParadigmsTur.gf +++ b/src/turkish/ParadigmsTur.gf @@ -632,4 +632,7 @@ resource ParadigmsTur = open -- kal-, ol-, öl-, var-, ver-, vur-, san- ) | SgSylConReg ; -- one syllable ending with consonant, takes -er + oper + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/urdu/NumeralUrd.gf b/src/urdu/NumeralUrd.gf index a4e6cfc02..d51264053 100644 --- a/src/urdu/NumeralUrd.gf +++ b/src/urdu/NumeralUrd.gf @@ -2,7 +2,7 @@ -- Modification for Urdu Shafqat Virk -concrete NumeralUrd of Numeral = CatUrd [Numeral,Digits] ** open ResUrd,CommonHindustani,ParamX, Prelude in { +concrete NumeralUrd of Numeral = CatUrd [Numeral,Digits,Decimal] ** open ResUrd,CommonHindustani,ParamX, Prelude in { flags coding=utf8 ; param DForm = unit | ten ; @@ -110,6 +110,19 @@ lin D_8 = { s = "۸" ; n = Pl}; lin D_9 = { s = "۹" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\df => Prelude.glue "-" (d.s ! df) ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\df => d.s!df ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + n = Pl ; + hasDot=True + } ; oper ekhazar : Str = variants {"ہزار" ; "ایک" ++ "ہزار"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ہزار"} ! sz ; diff --git a/src/urdu/ParseUrd.gf b/src/urdu/ParseUrd.gf deleted file mode 100644 index 5c4c33478..000000000 --- a/src/urdu/ParseUrd.gf +++ /dev/null @@ -1,161 +0,0 @@ ---# -path=.:../abstract:../english:../hindustani -concrete ParseUrd of ParseEngAbs = - TenseX - [AdN,Adv,SC,PPos,PNeg], --- TextX - [AdN,Adv,SC], - CatUrd, - NounUrd - [PPartNP], - AdjectiveUrd, - NumeralUrd, - ConjunctionUrd, - VerbUrd - [PassV2,ComplVV], - AdverbUrd, - PhraseUrd, - SentenceUrd, - RelativeUrd, - QuestionUrd, - SymbolUrd [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], --- StructuralUrd, - IdiomUrd [NP, VP, Tense, Cl, ProgrVP, ExistNP], - ExtraUrd [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash,Temp,Pol,Conj,VPS,ListVPS,S,Num, CN, - RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP,VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, - VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,ClSlash, RCl, EmptyRelSlash], - DictEngUrd ** --- UNDictUrd ** -open MorphoUrd, ResUrd, ParadigmsUrd,CommonX, CommonHindustani, Prelude in { - -flags - literal=Symb ; - coding=utf8 ; - -lin - myself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers1 }; - yourselfSg_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers2_Respect }; --regNP "yourself" singular ; - himself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Distant }; --regNP "himself" singular ; - herself_NP = {s = \\_ => kwd ; a = Ag Fem Sg Pers3_Distant }; --regNP "herself" singular ; - itself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Near }; --regNP "itself" singular ; - ourself_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers1 }; --regNP "ourself" plural ; - yourselfPl_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers2_Respect }; --regNP "yourself" plural ; - themselves_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers3_Distant }; --regNP "themself" plural ; - themself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Distant }; --regNP "themself" plural ; - - CompoundCN num noun cn = { - s = \\n,c => num.s ++ cn.s ! n ! c ++ noun.s ! num.n ! Dir; - g = cn.g - } ; - - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! n ! Dir ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; - - GerundN v = { - s = \\n,c => v.cvp ++ v.s ! Inf ; -- v.s ! VF Imperf Pers2_Casual n Masc ++ hwa (Ag Masc n Pers2_Casual) ; --the main verb of compound verbs - g = Masc - } ; - - GerundAP v = { - s = \\n,g,_,_ => v.cvp ++ v.s ! VF Imperf Pers2_Casual n g ++ hwa (Ag g n Pers2_Casual) ; - } ; - - PastPartAP v = { - s = \\n,g,_,_ => v.cvp ++ v.s ! VF Imperf Pers2_Casual n g ; -- the main verb of compound versb needs to be attached here - } ; - --- OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ; - - PositAdVAdj a = {s = a.s ! Sg ! Masc ! Dir ! Posit} ; ---------------- ---SlashV2V v p vp = insertVV (infV2V v.isAux vp) (predV v) vp.embComp ** {c2 = {s = sE ; c = VTrans}}; -- changed from VTransPost -ComplVV v a p vp = insertTrans (insertVV (infVV v.isAux vp) (predV v) vp.embComp ) VTrans; -- changed from VTransPost ---------------- - - - UseQuantPN q pn = {s = \\c => q.s ! Sg ! pn.g ! Dir ++ pn.s ! Dir ; a = agrP3 pn.g Sg} ; - -PredVPosv np vp = mkClause np vp ; --{ -{- s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ vp.ad ++ verb.fin ++ verb.adv ++ verb.inf ; - OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf - } - } ; --} - PredVPovs np vp = mkClause np vp ; --{ -{- s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom ; - OQuest => verb.aux ++ compl ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom - } - } ; --} - -{- - SlashV2V v p vp = insertObjc (\\a => p.s ++ case p.p of {CPos => ""; _ => "not"} ++ - v.c3 ++ - infVP v.typ vp a) - (predVc v) ; - - ComplPredVP np vp = { - s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ; - OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf - } - } ; --} -CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ - infVP False vp a} ; -- check for vp.isAux - - that_RP = { - s = \\_,_ => "کہ" ; - a = RNoAg - } ; - --no_RP = { - -- s = \\_,_ => "" ; - -- a = RNoAg - -- } ; - - CompS s = {s = \\_ => "کہ" ++ s.s} ; --- CompVP vp = {s = \\a => infVP VVInf vp a} ; - -lin - PPos = {s = [] ; p = Pos} ; - PNeg = {s = [] ; p = Neg} ; -- contracted: don't - UncNeg = {s = [] ; p = Neg} ; - - --VPSlashPrep vp p = vp ** {c2 = {s = p.s!Masc ; c = VTrans}} ; - - PastPartRS ant pol vps = { - s = \\agr => (vps.s!VPTense VPPast agr).inf ; - c = Dir - } ; - - PresPartRS ant pol vp = { - s = \\agr => (vp.s!VPTense VPPres agr).inf ; - c = Dir - } ; - - ApposNP np1 np2 = { - s = \\c => np1.s!NPC Dir ++ "," ++ np2.s ! c ; - a = np2.a - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - - CompQS qs = {s = \\_ => qs.s ! QIndir} ; - -} diff --git a/src/zulu/AllZul.gf b/src/zulu/AllZul.gf new file mode 100644 index 000000000..c80d00a60 --- /dev/null +++ b/src/zulu/AllZul.gf @@ -0,0 +1,5 @@ +--# -path=.:../abstract:../common:../zulu/abstract_ext + +concrete AllZul of AllZulAbs = + LangZul ** { +} diff --git a/src/zulu/AllZulAbs.gf b/src/zulu/AllZulAbs.gf new file mode 100644 index 000000000..a120b25b6 --- /dev/null +++ b/src/zulu/AllZulAbs.gf @@ -0,0 +1,5 @@ +--# -path=.:../abstract:../common:../api + +abstract AllZulAbs = + Lang ** { +} diff --git a/src/zulu/CatZul.gf b/src/zulu/CatZul.gf index 82cfd8bf0..c0541362c 100755 --- a/src/zulu/CatZul.gf +++ b/src/zulu/CatZul.gf @@ -128,7 +128,8 @@ concrete CatZul of Cat = CommonX - [Temp,Tense,Adv,IAdv] ** -- Numeral -- Numeral = {s : Bool => CardOrd => Case => Str ; n : Number} ; --- Digits = {s : CardOrd => Case => Str ; n : Number ; tail : DTail} ; + Digits = {s : Str} ; + Decimal = {s : Str; hasDot : Bool} ; -- Structural diff --git a/src/zulu/DocumentationZul.gf b/src/zulu/DocumentationZul.gf index b5483e15a..a94998082 100755 --- a/src/zulu/DocumentationZul.gf +++ b/src/zulu/DocumentationZul.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common concrete DocumentationZul of Documentation = CatZul ** open - ResZul, + ResZul,ParamX,Prelude, HTML in { lincat @@ -9,21 +9,32 @@ lincat Document = {s : Str} ; Tag = {s : Str} ; --- lin --- InflectionN, InflectionN2, InflectionN3 = \noun -> { --- t = "n" ; --- s1 = heading1 ("Noun" ++ case noun.g of { --- Neutr => ""; --- Masc => "(masc)"; --- Fem => "(fem)" --- }) ; --- s2 = frameTable ( --- tr (th "" ++ th "nom" ++ th "gen") ++ --- tr (th "sg" ++ td (noun.s ! Sg ! Nom) ++ td (noun.s ! Sg ! Gen)) ++ --- tr (th "pl" ++ td (noun.s ! Pl ! Nom) ++ td (noun.s ! Pl ! Gen)) --- ) --- } ; --- +lin + InflectionN, InflectionN2, InflectionN3 = \noun -> { + t = "n" ; + s1 = heading1 ("Noun (class" ++ + case noun.c of { + C1_2 => "1/2"; + C1a_2a => "1a/2a"; + C3_4 => "3/4"; + C5_6 => "5/6"; + C7_8 => "7/8"; + C9_10 => "9/10"; + C11_10 => "11/10"; + C9_6 => "9/6"; + C14 => "14"; + C15 => "15"; + C17 => "17" + } ++ BIND ++ ")") ; + s2 = frameTable ( + tr (th "" ++ th "sg" ++ th "pl") ++ + tr (th "full" ++ td (noun.s ! Sg ! NFull) ++ td (noun.s ! Pl ! NFull)) ++ + tr (th "reduced" ++ td (noun.s ! Sg ! NReduced) ++ td (noun.s ! Pl ! NReduced)) ++ + tr (th "poss" ++ td (noun.s ! Sg ! NPoss) ++ td (noun.s ! Pl ! NPoss)) ++ + tr (th "loc" ++ td (noun.s ! Sg ! NLoc) ++ td (noun.s ! Pl ! NLoc)) + ) + } ; + -- InflectionA, InflectionA2 = \adj -> { -- t = "a" ; -- s1 = heading1 "Adjective" ; @@ -178,13 +189,13 @@ lincat -- -- pp : Str -> Str = \s -> "<"+s+">"; -- --- lin --- NoDefinition t = {s=t.s}; --- MkDefinition t d = {s="

Definition:"++t.s++d.s++"

"}; --- MkDefinitionEx t d e = {s="

Definition:"++t.s++d.s++"

Example:"++e.s++"

"}; --- --- lin --- MkDocument d i e = {s = i.s1 ++ d.s ++ i.s2 ++ paragraph e.s} ; --- MkTag i = {s = i.t} ; +lin + NoDefinition t = {s=t.s}; + MkDefinition t d = {s="

Definition:"++t.s++d.s++"

"}; + MkDefinitionEx t d e = {s="

Definition:"++t.s++d.s++"

Example:"++e.s++"

"}; + +lin + MkDocument d i e = {s = i.s1 ++ d.s ++ i.s2 ++ paragraph e.s} ; + MkTag i = {s = i.t} ; } diff --git a/src/zulu/GrammarZul.gf b/src/zulu/GrammarZul.gf index 4acef21b1..0a8a8bc3d 100755 --- a/src/zulu/GrammarZul.gf +++ b/src/zulu/GrammarZul.gf @@ -9,7 +9,7 @@ concrete GrammarZul of Grammar = SentenceZul, QuestionZul, RelativeZul, - ConjunctionZul, +-- ConjunctionZul, PhraseZul, TextX - [Temp,Adv,IAdv], StructuralZul, diff --git a/src/zulu/LangZul.gf b/src/zulu/LangZul.gf index 3ff15f495..63fa54c50 100755 --- a/src/zulu/LangZul.gf +++ b/src/zulu/LangZul.gf @@ -4,7 +4,7 @@ concrete LangZul of Lang = GrammarZul, LexiconZul -- ,ConstructionZul - -- ,DocumentationZul --# notpresent + ,DocumentationZul --# notpresent -- ,MarkupZul - [stringMark] ** { diff --git a/src/zulu/NumeralZul.gf b/src/zulu/NumeralZul.gf index 1f4348753..1f6f0522c 100755 --- a/src/zulu/NumeralZul.gf +++ b/src/zulu/NumeralZul.gf @@ -1,4 +1,4 @@ -concrete NumeralZul of Numeral = CatZul [Numeral,Digits] ** open Prelude, ResZul in { +concrete NumeralZul of Numeral = CatZul [Numeral,Digits,Decimal] ** open Prelude, ResZul in { -- lincat -- Digit = {s : DForm => CardOrd => Case => Str} ; @@ -42,54 +42,35 @@ concrete NumeralZul of Numeral = CatZul [Numeral,Digits] ** open Prelude, ResZul -- lin pot3plus n m = { -- s = \\d,o,c => n.s ! d ! NCard ! Nom ++ "thousand" ++ m.s ! False ! o ! c; n = Pl} ; -- --- -- numerals as sequences of digits --- --- lincat --- Dig = TDigit ; --- --- lin --- IDig d = d ** {tail = T1} ; --- --- IIDig d i = { --- s = \\o,c => d.s ! NCard ! Nom ++ commaIf i.tail ++ i.s ! o ! c ; --- n = Pl ; --- tail = inc i.tail --- } ; --- --- D_0 = mkDig "0" ; --- D_1 = mk3Dig "1" "1st" Sg ; --- D_2 = mk2Dig "2" "2nd" ; --- D_3 = mk2Dig "3" "3rd" ; --- D_4 = mkDig "4" ; --- D_5 = mkDig "5" ; --- D_6 = mkDig "6" ; --- D_7 = mkDig "7" ; --- D_8 = mkDig "8" ; --- D_9 = mkDig "9" ; --- --- oper --- commaIf : DTail -> Str = \t -> case t of { --- T3 => BIND ++ "," ++ BIND ; --- _ => BIND --- } ; --- --- inc : DTail -> DTail = \t -> case t of { --- T1 => T2 ; --- T2 => T3 ; --- T3 => T1 --- } ; --- --- mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; --- mkDig : Str -> TDigit = \c -> mk2Dig c (c + "th") ; --- --- mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { --- s = table {NCard => regGenitiveS c ; NOrd => regGenitiveS o} ; --- n = n --- } ; --- --- TDigit = { --- n : Number ; --- s : CardOrd => Case => Str --- } ; +-- numerals as sequences of digits +lincat Dig = {s:Str} ; + +lin + IDig d = d ; + + IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s} ; + + D_0 = { s = "0"} ; + D_1 = { s = "1"} ; + D_2 = { s = "2"} ; + D_3 = { s = "3"} ; + D_4 = { s = "4"} ; + D_5 = { s = "5"} ; + D_6 = { s = "6"} ; + D_7 = { s = "7"} ; + D_8 = { s = "8"} ; + D_9 = { s = "9"} ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + hasDot=True + } ; } diff --git a/src/zulu/ParadigmsZul.gf b/src/zulu/ParadigmsZul.gf index 9dec01fd4..09ef28d19 100755 --- a/src/zulu/ParadigmsZul.gf +++ b/src/zulu/ParadigmsZul.gf @@ -127,24 +127,31 @@ oper } ; mkV3 = overload { - mkV3 : (phuz : Str) -> V3 = \phuz -> lin V3 (regVerb phuz) ; - -- mkV2 : (phathw : Str) -> Voice -> V2 = \phathw,voice -> lin V2 (passiveVerb phathw voice) ; + mkV3 : (hamb : Str) -> V3 = \hamb -> lin V3 (regVerb hamb) ; + mkV3 : (th,thi : Str) -> V3 = \th,thi -> lin V3 (th_Verb th thi) ; + mkV3 : (guqubal,guqubala,guqubele : Str) -> V3 = \guqubal,guqubala,guqubele -> lin V3 (three_Verb guqubal guqubala guqubele) ; + mkV3 : (guqubal,guqubala,guqubele,guqubele_2 : Str) -> V3 = \guqubal,guqubala,guqubele,guqubele_2 -> lin V3 (four_Verb guqubal guqubala guqubele guqubele_2) ; } ; +-- mkV2V = overload { +-- mkV2V : (hamb : Str) -> V2V = \hamb -> lin V2V (regVerb hamb) ; +-- mkV2V : (th,thi : Str) -> V2V = \th,thi -> lin V2V (th_Verb th thi) ; +-- mkV2V : (guqubal,guqubala,guqubele : Str) -> V2V = \guqubal,guqubala,guqubele -> lin V2V (three_Verb guqubal guqubala guqubele) ; +-- mkV2V : (guqubal,guqubala,guqubele,guqubele_2 : Str) -> V2V = \guqubal,guqubala,guqubele,guqubele_2 -> lin V2V (four_Verb guqubal guqubala guqubele guqubele_2) ; +-- } ; + mkVA = overload { mkVA : (b : Str) -> VA = \b -> lin VA (regVerb b) ; } ; - mkVS = overload { - mkVS : (cel : Str) -> VS = \cel -> lin VS (regVerb cel) ; + mkVV = overload { + mkVV : (f : Str) -> VV = \f -> lin VV (regVerb f) } ; - mkVAux = overload { - mkVAux : (hlale : Str) -> VAux = \hlale -> lin VAux { - s = hlale ; - at = PartAux - } - } ; + -- mkVS = overload { + -- mkVS : (cel : Str) -> SType -> VS = \cel,st -> lin VS ((regVerb cel) ** { s_type = st } ) ; + -- mkVS : (az,azi : Str) -> SType -> VS = \az,azi,st -> lin VS ((th_Verb az azi) ** { s_type = st } ) ; + -- } ; -- yourPl_Det = overload { -- yourPl_Det : Det = lin Det { s = "jou" ; n = Pl ; p = TPos } ; diff --git a/tests/german/TestLangGer.gf b/tests/german/TestLangGer.gf index 74d1012c8..52213c976 100644 --- a/tests/german/TestLangGer.gf +++ b/tests/german/TestLangGer.gf @@ -31,29 +31,37 @@ concrete TestLangGer of TestLang = (insertObjRefl (predVc v3) ** {c2 = v3.c3}); PassV2Q v q = - let vp = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) - ** { c1 = subjPrep v.c2 } + let c = case of { + => Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject + vp = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) + ** { c1 = v.c2 ** {c = c} } in insertExtrapos (bindComma ++ q.s ! QIndir) vp ; PassV2S v s = - let vp = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) - ** { c1 = subjPrep v.c2 } + let c = case of { + => Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject + vp = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) + ** { c1 = v.c2 ** {c = c} } in insertExtrapos (bindComma ++ conjThat ++ s.s ! Sub) vp ; PassV2V v vp = - let -- ok for v.isAux=False, - inf = mkInf v.isAux Simul Pos vp ; -- v.c2.c=Acc, v.objCtrl=True HL 3/22 + let + inf = mkInf v.isAux Simul Pos vp ; -- ok for v.isAux=False, v.c2.c=Acc + c = case of { -- v.objCtrl=True HL 3/22 + => Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject vp2 = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) ** { c1 = subjPrep v.c2 } ; in insertInf inf vp2 ; -- v=lassen needs in-place inf instead - PassVPSlash vp = -- less correct in ExtraGer.gf with inserting - let -- (\\_ => (PastPartAP vp).s ! APred) - ctrl = case vp.objCtrl of { True => False ; _ => True } -- always False? - in - insertObj (\\_ => vp.a2 ++ vp.adj ++ vp.s.s ! (VPastPart APred)) - (predV werdenPass ** {nn = vp.nn ; c1 = subjPrep vp.c2}) - ** {ext = vp.ext ; inf = vp.inf ; c2 = vp.c2 ; objCtrl = ctrl } ; -- c2 ? + PassVPSlash vp = + let c = case of { + => Nom ; _ => vp.c2.c} ; + ctrl = case vp.objCtrl of { True => False ; _ => True } -- always False? + in -- insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass ** {c1 = vp.c2 ** {c = c}}) + insertObj (\\_ => vp.s.s ! (VPastPart APred)) + (predV werdenPass ** {nn = vp.nn ; c1 = vp.c2 ** {c = c}}) + ** {ext = vp.ext ; inf = vp.inf ; c2 =vp.c2 ; objCtrl = ctrl } ; -- c2 ? + -- Scharolta: passivised object: acc object -> nom subject; all others: same case/prep -- HL: does not work for vp = (Slash2V3 v np): uns wird *den Beweis erklärt -- 3/22 works for vp = (SlashV2V v2v reflVP): wir werden gebeten, uns zu waschen @@ -159,16 +167,16 @@ gr -tr (PredVP (UsePron ?) (ComplSlash (SlashV2V lassen_V2V (ReflVP (SlashV2a wa } ; lin - +{- too expensive 60% memory, then killed: SlashVP np vp = - let subj = mkSubj np vp.c1 - in mkClSlash subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; - + let subj = mkSubject np vp.c1 + in mkClSlash subj.s subj.a vp ** { c2 = vp.c2 } ; +-} RelSlash rp cls = lin RCl { s = \\m,t,a,p,gn => - appPrepC cls.c2 (rp.s ! gn) ++ - cls.s ! m ! t ! a ! p ! Sub ! gn ; - c = (prepC cls.c2.c).c + appPrep cls.c2 (rp.s ! gn) ++ + cls.s ! m ! t ! a ! p ! Sub ! gn ; + c = cls.c2.c } ; QuestSlash ip slash = let gn : GenNum = case ip.n of {Sg => GSg Masc ; _ => GPl} in { @@ -227,7 +235,7 @@ gr -tr (PredVP (UsePron ?) (ComplSlash (SlashV2V lassen_V2V (ReflVP (SlashV2a wa obj2 = (vp.nn ! ag).p3 ; -- pp-objects and heavy nps obj3 = (vp.nn ! ag).p4 ++ vp.adj ++ vp.a2 ; -- pred.AP|CN|Adv, via useComp HL 6/2019 compl : Str = obj1 ++ obj2 ++ neg ++ obj3 ; - infObjs = (vp.inf.inpl.p1) ! ag ; + infObjs = vp.inf.inpl.p1 ! ag ; infPred = vp.inf.inpl.p2 ; infCompl : Str = case of { => [] ; _ => infObjs ++ infPred } ;