mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-30 02:58:35 -06:00
extend the names API
This commit is contained in:
@@ -39,6 +39,9 @@ oper
|
||||
feminine : Gender ;
|
||||
neuter : Gender ;
|
||||
|
||||
male : Sex ;
|
||||
female : Sex ;
|
||||
|
||||
-- To abstract over case names, we define the following.
|
||||
|
||||
Case : Type ;
|
||||
@@ -144,6 +147,24 @@ mkN : overload {
|
||||
|
||||
} ;
|
||||
|
||||
mkGN : overload {
|
||||
mkGN : Str -> Sex -> GN ; -- regular name with genitive in "s"
|
||||
mkGN : (nom,gen : Str) -> Sex -> GN ; -- name with other genitive
|
||||
mkGN : (nom,acc,dat,gen : Str) -> Sex -> GN ; -- name with all case forms
|
||||
} ;
|
||||
|
||||
mkSN : overload {
|
||||
mkSN : Str -> GN ; -- regular name with genitive in "s", masculine
|
||||
|
||||
-- If only the genitive differs, two strings are needed.
|
||||
|
||||
mkSN : (nom,gen : Str) -> GN ; -- name with other genitive
|
||||
|
||||
-- In the worst case, all four forms are needed.
|
||||
|
||||
mkSN : (nom,acc,dat,gen : Str) -> GN ; -- name with all case forms
|
||||
} ;
|
||||
|
||||
-- To extract the number of a noun phrase
|
||||
|
||||
ifPluralNP : NP -> Bool
|
||||
@@ -370,6 +391,8 @@ mkV2 : overload {
|
||||
masculine = Masc ;
|
||||
feminine = Fem ;
|
||||
neuter = Neutr ;
|
||||
male = Male ;
|
||||
female = Female ;
|
||||
nominative = NPC Nom ;
|
||||
accusative = NPC Acc ;
|
||||
dative = NPC Dat ;
|
||||
@@ -484,6 +507,27 @@ mkV2 : overload {
|
||||
regPN : (Johann : Str) -> Gender -> PN ;
|
||||
-- Johann, Johanns ; Johannes, Johannes
|
||||
|
||||
mkGN = overload {
|
||||
mkGN : Str -> Sex -> GN = \nom,g -> lin GN {s = (regPN nom (sex2gender g)).s; g = g} ; -- regular name with genitive in "s"
|
||||
mkGN : (nom,gen : Str) -> Sex -> GN = \nom,gen,g -> lin GN {s = (mk2PN nom gen (sex2gender g)).s; g = g} ; -- name with other genitive
|
||||
mkGN : (nom,acc,dat,gen : Str) -> Sex -> GN = \nom,acc,dat,gen,g ->
|
||||
{s = table {Nom => nom ; Acc => acc ; Dat => dat ; Gen => gen} ;
|
||||
g = g ; lock_GN = <>}
|
||||
} ;
|
||||
|
||||
mkSN = overload {
|
||||
mkSN : Str -> SN = \s -> lin SN {s = \\_ => (regPN s Masc).s} ; -- regular name with genitive in "s", masculine
|
||||
|
||||
-- If only the genitive differs, two strings are needed.
|
||||
|
||||
mkSN : (nom,gen : Str) -> SN = \nom,gen -> lin SN {s = \\_ => (mk2PN nom gen Masc).s} ; -- name with other genitive
|
||||
|
||||
-- In the worst case, all four forms are needed.
|
||||
|
||||
mkSN : (nom,acc,dat,gen : Str) -> SN = \nom,acc,dat,gen ->
|
||||
{s = \\_ => table {Nom => nom ; Acc => acc ; Dat => dat ; Gen => gen} ;
|
||||
lock_SN = <>}
|
||||
} ;
|
||||
|
||||
mk3A : (gut,besser,beste : Str) -> A = \a,b,c ->
|
||||
let aa : Str = case a of {
|
||||
|
||||
Reference in New Issue
Block a user