mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-26 19:28:54 -06:00
modified Det structure; integrated scand definites.
This commit is contained in:
@@ -56,14 +56,19 @@ incomplete concrete CatScand of Cat =
|
||||
|
||||
-- Noun
|
||||
|
||||
CN = {s : Number => DetSpecies => Case => Str ; g : Gender} ;
|
||||
-- The fields $isMod$ and $isDet$, and the boolean parameter of
|
||||
-- determiners, are a hack (the simples possible we found) that
|
||||
-- permits treating definite articles "huset - de fem husen - det gamla huset"
|
||||
-- as $Quant$.
|
||||
|
||||
CN = {s : Number => DetSpecies => Case => Str ; g : Gender ; isMod : Bool} ;
|
||||
NP,Pron = {s : NPForm => Str ; a : Agr} ;
|
||||
Det = {s : Gender => Str ; n : Number ; det : DetSpecies} ;
|
||||
QuantSg = {s : Gender => Str ; det : DetSpecies} ;
|
||||
QuantPl = {s : Gender => Str ; det : DetSpecies} ;
|
||||
Det = {s : Bool => Gender => Str ; n : Number ; det : DetSpecies} ;
|
||||
QuantSg = {s : Bool => Gender => Str ; det : DetSpecies} ;
|
||||
QuantPl = {s : Bool => Gender => Str ; det : DetSpecies} ;
|
||||
Predet = {s : GenNum => Str} ;
|
||||
Num = {s : Gender => Str} ;
|
||||
Ord = {s : Str} ;
|
||||
Num = {s : Gender => Str ; isDet : Bool} ;
|
||||
Ord = {s : Str ; isDet : Bool} ;
|
||||
|
||||
-- Adverb
|
||||
|
||||
|
||||
@@ -3,11 +3,18 @@ incomplete concrete NounScand of Noun =
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
-- The rule defines $Det Quant Num Ord CN$ where $Det$ is empty if
|
||||
-- it is the definite article ($DefSg$ or $DefPl$) and both $Num$ and
|
||||
-- $Ord$ are empty and $CN$ is not adjectivally modified
|
||||
-- ($AdjCN$). Thus we get $huset$ but $de fem husen$, $det gamla huset$.
|
||||
|
||||
lin
|
||||
DetCN det cn = let g = cn.g in {
|
||||
s = \\c => det.s ! g ++ cn.s ! det.n ! det.det ! caseNP c ;
|
||||
s = \\c => det.s ! cn.isMod ! g ++
|
||||
cn.s ! det.n ! det.det ! caseNP c ;
|
||||
a = agrP3 g det.n
|
||||
} ;
|
||||
|
||||
UsePN pn = {
|
||||
s = \\c => pn.s ! caseNP c ;
|
||||
a = agrP3 pn.g Sg
|
||||
@@ -15,80 +22,99 @@ incomplete concrete NounScand of Noun =
|
||||
|
||||
UsePron p = p ;
|
||||
|
||||
DetSg pred quant ord = {
|
||||
s = \\g => pred.s ! gennum g Sg ++ quant.s ! g ++ ord.s ;
|
||||
PredetNP pred np = {
|
||||
s = \\c => pred.s ! np.a.gn ++ np.s ! c ;
|
||||
a = np.a
|
||||
} ;
|
||||
|
||||
DetSg quant ord = {
|
||||
s = \\b,g => quant.s ! (orB b ord.isDet) ! g ++ ord.s ;
|
||||
n = Sg ;
|
||||
det = quant.det
|
||||
} ;
|
||||
DetPl pred quant num ord = {
|
||||
s = \\g => pred.s ! gennum g Pl ++ quant.s ! g ++ num.s ! g ++ ord.s ;
|
||||
DetPl quant num ord = {
|
||||
s = \\b,g => quant.s ! (orB b (orB num.isDet ord.isDet)) ! g ++ ord.s ;
|
||||
n = Pl ;
|
||||
det = quant.det
|
||||
} ;
|
||||
|
||||
PossSg p = {
|
||||
s = \\g => p.s ! NPPoss (gennum g Sg) ;
|
||||
s = \\_,g => p.s ! NPPoss (gennum g Sg) ;
|
||||
n = Sg ;
|
||||
det = DDef Indef
|
||||
} ;
|
||||
PossPl p = {
|
||||
s = \\_ => p.s ! NPPoss Plg ;
|
||||
s = \\_,_ => p.s ! NPPoss Plg ;
|
||||
n = Pl ;
|
||||
det = DDef Indef
|
||||
} ;
|
||||
|
||||
NoPredet, NoNum = {s = \\_ => []} ; -- these get different types!
|
||||
NoOrd = {s = []} ;
|
||||
NoNum = {s = \\_ => [] ; isDet = False} ;
|
||||
NoOrd = {s = [] ; isDet = False} ;
|
||||
|
||||
NumInt n = {s = \\_ => n.s} ;
|
||||
OrdInt n = {s = n.s ++ ":e"} ; ---
|
||||
NumInt n = {s = \\_ => n.s ; isDet = True} ;
|
||||
OrdInt n = {s = n.s ++ ":e" ; isDet = True} ; ---
|
||||
|
||||
NumNumeral numeral = {s = \\g => numeral.s ! NCard g} ;
|
||||
OrdNumeral numeral = {s = numeral.s ! NOrd SupWeak} ;
|
||||
NumNumeral numeral = {s = \\g => numeral.s ! NCard g ; isDet = True} ;
|
||||
OrdNumeral numeral = {s = numeral.s ! NOrd SupWeak ; isDet = True} ;
|
||||
|
||||
AdNum adn num = {s = \\g => adn.s ++ num.s ! g} ;
|
||||
AdNum adn num = {s = \\g => adn.s ++ num.s ! g ; isDet = True} ;
|
||||
|
||||
OrdSuperl a = {s = a.s ! AF (ASuperl SupWeak) Nom} ;
|
||||
OrdSuperl a = {s = a.s ! AF (ASuperl SupWeak) Nom ; isDet = True} ;
|
||||
|
||||
DefSg = {s = \\g => artDef (gennum g Sg) ; n = Sg ; det = DDef detDef} ;
|
||||
DefPl = {s = \\_ => artDef Plg ; n = Pl ; det = DDef detDef} ;
|
||||
DefSg = {
|
||||
s = \\b,g => if_then_Str b (artDef (gennum g Sg)) [] ;
|
||||
n = Sg ;
|
||||
det = DDef detDef
|
||||
} ;
|
||||
DefPl = {
|
||||
s = \\b,_ => if_then_Str b (artDef Plg) [] ;
|
||||
n = Pl ;
|
||||
det = DDef detDef
|
||||
} ;
|
||||
|
||||
IndefSg = {s = artIndef ; n = Sg ; det = DIndef} ;
|
||||
IndefPl = {s = \\_ => [] ; n = Pl ; det = DIndef} ;
|
||||
IndefSg = {s = \\_ => artIndef ; n = Sg ; det = DIndef} ;
|
||||
IndefPl = {s = \\_,_ => [] ; n = Pl ; det = DIndef} ;
|
||||
|
||||
MassDet = {s = \\_ => [] ; n = Sg ; det = DIndef} ;
|
||||
MassDet = {s = \\_,_ => [] ; n = Sg ; det = DIndef} ;
|
||||
|
||||
UseN, UseN2, UseN3 = \noun -> {
|
||||
s = \\n,d => noun.s ! n ! specDet d ;
|
||||
g = noun.g
|
||||
g = noun.g ;
|
||||
isMod = False
|
||||
} ;
|
||||
|
||||
-- The genitive of this $NP$ is not correct: "sonen till mig" (not "migs").
|
||||
|
||||
ComplN2 f x = {
|
||||
s = \\n,d,c => f.s ! n ! specDet d ! Nom ++ f.c2 ++ x.s ! accusative ;
|
||||
g = f.g
|
||||
g = f.g ;
|
||||
isMod = False
|
||||
} ;
|
||||
ComplN3 f x = {
|
||||
s = \\n,d,c => f.s ! n ! d ! Nom ++ f.c2 ++ x.s ! accusative ;
|
||||
g = f.g ;
|
||||
c2 = f.c3
|
||||
c2 = f.c3 ;
|
||||
isMod = False
|
||||
} ;
|
||||
|
||||
AdjCN ap cn = let g = cn.g in {
|
||||
s = \\n,d,c => preOrPost ap.isPre
|
||||
(ap.s ! agrAdj (gennum g n) d)
|
||||
(cn.s ! n ! d ! c) ;
|
||||
g = g
|
||||
g = g ;
|
||||
isMod = True
|
||||
} ;
|
||||
|
||||
RelCN cn rs = let g = cn.g in {
|
||||
s = \\n,d,c => cn.s ! n ! d ! c ++ rs.s ! agrP3 g n ;
|
||||
g = g
|
||||
g = g ;
|
||||
isMod = cn.isMod
|
||||
} ;
|
||||
SentCN cn sc = let g = cn.g in {
|
||||
s = \\n,d,c => cn.s ! n ! d ! c ++ sc.s ;
|
||||
g = g
|
||||
g = g ;
|
||||
isMod = cn.isMod
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user