1
0
forked from GitHub/gf-rgl

Merge branch 'GrammaticalFramework:master' into master

This commit is contained in:
Meowyam
2023-12-11 12:32:33 +08:00
committed by GitHub
414 changed files with 10330 additions and 2342 deletions

View File

@@ -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.

View File

@@ -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.
}

39
src/TEMPLATE/AdverbTMP.gf Normal file
View File

@@ -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 = ;
-}
}

6
src/TEMPLATE/AllTMP.gf Normal file
View File

@@ -0,0 +1,6 @@
--# -path=.:../abstract:../common:../prelude
concrete AllTMP of AllTMPAbs =
LangTMP,
ExtendTMP
;

View File

@@ -0,0 +1,5 @@
--# -path=.:../abstract:../common:prelude
abstract AllTMPAbs =
Lang,
Extend ;

121
src/TEMPLATE/CatTMP.gf Normal file
View File

@@ -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 ;
}

View File

@@ -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 =
-}
}

View File

@@ -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" ;
-}
}

35
src/TEMPLATE/ExtendTMP.gf Normal file
View File

@@ -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) ;

View File

@@ -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
;

56
src/TEMPLATE/IdiomTMP.gf Normal file
View File

@@ -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)
-}
}

5
src/TEMPLATE/LangTMP.gf Normal file
View File

@@ -0,0 +1,5 @@
--# -path=.:../abstract:../common:../prelude:../api
concrete LangTMP of Lang =
GrammarTMP,
LexiconTMP,
ConstructionTMP ;

419
src/TEMPLATE/LexiconTMP.gf Normal file
View File

@@ -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 "" ;
-}
}

313
src/TEMPLATE/MissingTMP.gf Normal file
View File

@@ -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" ;
}

36
src/TEMPLATE/NamesTMP.gf Normal file
View File

@@ -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 =
-}
}

210
src/TEMPLATE/NounTMP.gf Normal file
View File

@@ -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 ;
-}
}

115
src/TEMPLATE/NumeralTMP.gf Normal file
View File

@@ -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
} ;
}

View File

@@ -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 -> …
} ;
-}
--------------------------------------------------------------------------------
}

27
src/TEMPLATE/PhraseTMP.gf Normal file
View File

@@ -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 ! … } ;
}

105
src/TEMPLATE/QuestionTMP.gf Normal file
View File

@@ -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 =
-}
}

391
src/TEMPLATE/README.md Normal file
View File

@@ -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 worryjust 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.
###

View File

@@ -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 =
-}
}

296
src/TEMPLATE/ResTMP.gf Normal file
View File

@@ -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 ;
}

View File

@@ -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 =
-}
}

View File

@@ -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 "" ;
-}
}

73
src/TEMPLATE/SymbolTMP.gf Normal file
View File

@@ -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 "," ;
}

114
src/TEMPLATE/VerbTMP.gf Normal file
View File

@@ -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 =
-}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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", "%"
}

View File

@@ -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 ;

View File

@@ -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 ;
}

View File

@@ -19,6 +19,6 @@ abstract Grammar =
Structural,
Idiom,
Tense,
Names,
Transfer
;

14
src/abstract/Names.gf Normal file
View File

@@ -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 ;
}

View File

@@ -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 ;
}

View File

@@ -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
}

View File

@@ -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} ;
}

View File

@@ -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 ->

View File

@@ -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 ;
} ;
}

View File

@@ -14,4 +14,5 @@ concrete GrammarAfr of Grammar =
TextX,
IdiomAfr,
StructuralAfr,
TenseX ;
TenseX,
NamesAfr ;

40
src/afrikaans/NamesAfr.gf Normal file
View File

@@ -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) ;
} ;
}

View File

@@ -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
} ;
}

View File

@@ -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") ;

View File

@@ -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} ;
}

View File

@@ -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} ;

View File

@@ -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} ;

View File

@@ -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 ;

View File

@@ -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} ;

View File

@@ -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

View File

@@ -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} ;

View File

@@ -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

View File

@@ -1,4 +1,4 @@
--# -path=.:alltenses:prelude
--# -path=../abstract:.:alltenses:prelude:
instance SyntaxGer of Syntax = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ;

View File

@@ -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

View File

@@ -14,7 +14,8 @@ concrete GrammarAra of Grammar =
TextX - [Utt],
StructuralAra,
IdiomAra,
TenseX - [Utt]
TenseX - [Utt],
NamesAra
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -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)
};
-----------------------------------------------------------------------------

17
src/arabic/NamesAra.gf Normal file
View File

@@ -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} ;
} ;
}

View File

@@ -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 ;

View File

@@ -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

View File

@@ -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 ;
} ;
-}
} ;

View File

@@ -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

View File

@@ -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
} ;
}

View File

@@ -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 الزولو
}

View File

@@ -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 <MorphoDictAra.gf | python3 arabic_utilities.py from >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)

View File

@@ -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)

View File

@@ -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('}')

View File

@@ -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

View File

@@ -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} ;

View File

@@ -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} ;

View File

@@ -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" ;
}
}

View File

@@ -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
} ;
}

View File

@@ -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

View File

@@ -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= ""

View File

@@ -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 <rnp.isPron, slash.c2.c> of {
<True, Acc | Dat> => [] ;
_ => rnp.s ! RObj slash.c2.c
} ++
slash.compl2 ! agrP3 rnp.gn ;
vtype = case <rnp.isPron, slash.c2.c> of {
<True, Acc | Dat> => 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 =
<GPl, _> => they_Pron
} ;
lin TPastSimple = {s = []} ** {t = VPastSimple} ; --# notpresent
}

View File

@@ -15,7 +15,8 @@ concrete GrammarBul of Grammar =
TextBul,
StructuralBul,
IdiomBul,
TenseX - [CAdv,IAdv,AdV,SC]
TenseBul,
NamesBul
** {
flags coding=utf8 ;

View File

@@ -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 <t,a> of {
<Pres,Simul> => {aux1=[]; aux2=[]; main=present}
<VPresent,Simul> => {aux1=[]; aux2=[]; main=present}
; --# notpresent
<Pres,Anter> => {aux1=[]; aux2=auxPres; main=perfect} ; --# notpresent
<Past,Simul> => {aux1=[]; aux2=[]; main=aorist} ; --# notpresent
<Past,Anter> => {aux1=[]; aux2=auxAorist; main=perfect} ; --# notpresent
<Fut, Simul> => {aux1="ще"; aux2=[]; main=present} ; --# notpresent
<Fut, Anter> => {aux1="ще"++auxPres; aux2=[]; main=perfect} ; --# notpresent
<Cond,_> => {aux1=auxCondS; aux2=[]; main=perfect} --# notpresent
<VPresent,Anter> => {aux1=[]; aux2=auxPres; main=perfect} ; --# notpresent
<VPastSimple,Simul> => {aux1=[]; aux2=[]; main=aorist} ; --# notpresent
<VPastSimple,Anter> => {aux1=[]; aux2=auxAorist; main=perfect} ; --# notpresent
<VPastImperfect,Simul> => {aux1=[]; aux2=[]; main=imperfect} ; --# notpresent
<VPastImperfect,Anter> => {aux1=[]; aux2=auxAorist; main=perfect} ; --# notpresent
<VFut, Simul> => {aux1="ще"; aux2=[]; main=present} ; --# notpresent
<VFut, Anter> => {aux1="ще"++auxPres; aux2=[]; main=perfect} ; --# notpresent
<VCond,_> => {aux1=auxCondS; aux2=[]; main=perfect} --# notpresent
} ;
in case o of {

View File

@@ -165,6 +165,7 @@ oper
NF Sg Indef => sg ;
NF Sg Def => case sg of {
_+"а"=>sg+"та" ;
_+"ю"=>sg+"та" ;
_+"я"=>sg+"та" ;
_+"о"=>sg+"то" ;
_+"у"=>sg+"то" ;

View File

@@ -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
--

77
src/bulgarian/NamesBul.gf Normal file
View File

@@ -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 <ap.isPre,n.hasArt> of {
<True,True > => ap.s ! aform n.gn sp RSubj ! P3 ++ n.s ! Indef ;
<True,False> => ap.s ! aform n.gn Indef RSubj ! P3 ++ n.s ! Indef ;
<False,_> => n.s ! sp ++ ap.s ! aform n.gn Indef RSubj ! P3
} ;
defNom = case <ap.isPre,n.hasArt> of {
<True,True > => ap.s ! ASgMascDefNom ! P3 ++ n.s ! Indef ;
<True,False> => ap.s ! aform n.gn Indef RSubj ! P3 ++ n.s ! Indef ;
<False,_> => n.defNom ++ ap.s ! aform n.gn Indef RSubj ! P3
} ;
} ;
}

View File

@@ -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
} ;
}

View File

@@ -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
} ;

View File

@@ -2116,4 +2116,7 @@ oper
adjAdv : A -> Str -> A =
\a,adv -> a ** {adv = adv} ;
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
}

View File

@@ -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 <t,a> of {
<Pres,Simul> => {aux=vf2 clitic.s; main=presentImperf}
<VPresent,Simul> => {aux=vf2 clitic.s; main=presentImperf}
; --# notpresent
<Pres,Anter> => {aux=vf1 clitic.s; main=perfect} ; --# notpresent
<Past,Simul> => {aux=vf2 clitic.s; main=aorist} ; --# notpresent
<Past,Anter> => {aux=vf4 auxAorist; main=perfect} ; --# notpresent
<Fut, Simul> => {aux=vf3 clitic.s; main=present} ; --# notpresent
<Fut, Anter> => {aux=vf3 (apc []); main=perfect} ; --# notpresent
<Cond,_ > => {aux=vf4 auxCondS; main=perfect} --# notpresent
<VPresent,Anter> => {aux=vf1 clitic.s; main=perfect} ; --# notpresent
<VPastSimple,Simul> => {aux=vf2 clitic.s; main=aorist} ; --# notpresent
<VPastSimple,Anter> => {aux=vf4 auxAorist; main=perfect} ; --# notpresent
<VPastImperfect,Simul> => {aux=vf2 clitic.s; main=imperfect} ; --# notpresent
<VPastImperfect,Anter> => {aux=vf4 auxImperf; main=perfect} ; --# notpresent
<VFut, Simul> => {aux=vf3 clitic.s; main=present} ; --# notpresent
<VFut, Anter> => {aux=vf3 (apc []); main=perfect} ; --# notpresent
<VCond,_ > => {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 {"в" ; "ф" ; "В" ; "Ф"}
} ;
}

View File

@@ -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 "много" ;

View File

@@ -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
}

View File

@@ -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) ;

View File

@@ -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 = \\_ => []} ; ---
}

View File

@@ -225,4 +225,10 @@ oper
polNegDirSubj = RPos ;
param
HasArt = NoArt | UseArt ;
oper
superlCanBePost = False ;
}

View File

@@ -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 ;

View File

@@ -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
} ;
} ;

View File

@@ -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
** {

View File

@@ -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

41
src/catalan/NamesCat.gf Normal file
View File

@@ -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 ;
} ;
}

View File

@@ -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") ;

View File

@@ -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} ;
} ;

View File

@@ -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ú") ;

View File

@@ -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

View File

@@ -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
} ;

View File

@@ -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 <lin V vq : V>)
(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
} ;
};

View File

@@ -14,7 +14,8 @@ concrete GrammarChi of Grammar =
TextChi,
StructuralChi,
IdiomChi,
TenseChi
TenseChi,
NamesChi
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

Some files were not shown because too many files have changed in this diff Show More