mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Noun syntax in exper once again
This commit is contained in:
@@ -30,6 +30,7 @@ fun
|
||||
|
||||
NumInt : Int -> Num ; -- 51
|
||||
OrdInt : Int -> Ord ; -- 51st (DEPRECATED)
|
||||
NoOrd : Ord ;
|
||||
|
||||
-- 20/4
|
||||
DetSg : Quant -> Ord -> Det ; -- the best man
|
||||
|
||||
@@ -80,7 +80,9 @@ abstract Cat = Common ** {
|
||||
Det ; -- determiner phrase e.g. "those seven"
|
||||
Predet ; -- predeterminer (prefixed Quant) e.g. "all"
|
||||
Quant ; -- quantifier ('nucleus' of Det) e.g. "this/these"
|
||||
Num ; -- cardinal number (used with QuantPl) e.g. "seven"
|
||||
Art ; -- article e.g. "the"
|
||||
Num ; -- number determining element e.g. "seven"
|
||||
Card ; -- cardinal number e.g. "seven"
|
||||
Ord ; -- ordinal number (used in Det) e.g. "seventh"
|
||||
|
||||
--2 Numerals
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
abstract Noun = Cat ** {
|
||||
|
||||
|
||||
--2 Noun phrases
|
||||
|
||||
-- The three main types of noun phrases are
|
||||
@@ -28,77 +29,75 @@ abstract Noun = Cat ** {
|
||||
AdvNP : NP -> Adv -> NP ; -- Paris at midnight
|
||||
RelNP : NP -> RS -> NP ; -- Paris, which is in Europe
|
||||
|
||||
-- Determiners can form noun phrases directly.
|
||||
|
||||
DetNP : Det -> NP ; -- these five
|
||||
|
||||
|
||||
--2 Determiners
|
||||
|
||||
-- The determiner has a fine-grained structure, in which a 'nucleus'
|
||||
-- quantifier and two optional parts can be discerned.
|
||||
-- The cardinal numeral is only available for plural determiners.
|
||||
-- (This is modified from CLE by further dividing their $Num$ into
|
||||
-- cardinal and ordinal.)
|
||||
-- quantifier and two optional parts can be discerned: a cardinal and
|
||||
-- an ordinal numeral.
|
||||
|
||||
DetQuant : Quant -> Num -> Ord -> Det ; -- the five best men
|
||||
DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best men
|
||||
DetQuant : Quant -> Num -> Det ; -- these five best men
|
||||
|
||||
-- Notice that $DetPl$ can still result in a singular determiner, because
|
||||
-- "one" is a numeral: "this one man".
|
||||
|
||||
-- Quantifiers can form noun phrases directly.
|
||||
|
||||
DetNP : Quant -> Num -> Ord -> NP ; -- these five
|
||||
|
||||
-- Pronouns have possessive forms. Genitives of other kinds
|
||||
-- of noun phrases are not given here, since they are not possible
|
||||
-- in e.g. Romance languages. They can be found in
|
||||
-- [``Extra`` ../abstract/Extra.gf].
|
||||
|
||||
PossPron : Pron -> Quant ; -- my (house)
|
||||
-- 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 numbers.
|
||||
-- the inherent number.
|
||||
|
||||
NumSg : Num ;
|
||||
NumPl : Num ;
|
||||
NoOrd : Ord ;
|
||||
NumSg : Card ;
|
||||
NumPl : Card ;
|
||||
NumCard : Card -> Num ;
|
||||
|
||||
-- $Num$ consists of either digits or numeral words.
|
||||
-- $Card$ consists of either digits or numeral words.
|
||||
|
||||
NumDigits : Digits -> Num ; -- 51
|
||||
NumNumeral : Numeral -> Num ; -- fifty-one
|
||||
NumDigits : Digits -> Card ; -- 51
|
||||
NumNumeral : Numeral -> Card ; -- fifty-one
|
||||
|
||||
-- The construction of numerals is defined in [Numeral Numeral.html].
|
||||
|
||||
-- $Num$ can be modified by certain adverbs.
|
||||
|
||||
AdNum : AdN -> Num -> Num ; -- almost 51
|
||||
AdNum : AdN -> Card -> Card ; -- almost 51
|
||||
|
||||
-- $Ord$ consists of either digits or numeral words.
|
||||
-- Also superlative forms of adjectives behave syntactically like ordinals.
|
||||
|
||||
OrdDigits : Digits -> Ord ; -- 51st
|
||||
OrdNumeral : Numeral -> Ord ; -- fifty-first
|
||||
|
||||
-- Superlative forms of adjectives behave syntactically in the same way as
|
||||
-- ordinals.
|
||||
|
||||
OrdSuperl : A -> Ord ; -- largest
|
||||
|
||||
-- Ordinals and cardinals can be used as noun phrases alone.
|
||||
|
||||
OrdSuperlNP : Num -> A -> NP ; -- the five best
|
||||
OrdNumeralNP : Numeral -> NP ; -- the fiftieth
|
||||
NumNumeralNP : Numeral -> NP ; -- fifty
|
||||
OrdDigits : Digits -> Ord ; -- 51st
|
||||
OrdNumeral : Numeral -> Ord ; -- fifty-first
|
||||
OrdSuperl : A -> Ord ; -- largest
|
||||
|
||||
-- Definite and indefinite noun phrases are sometimes realized as
|
||||
-- neatly distinct words (Spanish "un, unos ; el, los") but also without
|
||||
-- any particular word (Finnish; Swedish definites).
|
||||
|
||||
DefNP : Num -> Ord -> CN -> NP ; -- the (house), the (houses)
|
||||
IndefNP : Num -> Ord -> CN -> NP ; -- a (house), (houses)
|
||||
DetArtOrd : Art -> Num -> Ord -> Det ; -- the (five) best
|
||||
DetArtCard : Art -> Card -> Det ; -- the five
|
||||
|
||||
IndefArt : Art ;
|
||||
DefArt : Art ;
|
||||
|
||||
-- Articles cannot alone form noun phrases, but need a noun.
|
||||
|
||||
DetArtSg : Art -> CN -> NP ; -- the man
|
||||
DetArtPl : Art -> CN -> NP ; -- the men
|
||||
|
||||
-- Nouns can be used without an article as mass nouns. The resource does
|
||||
-- not distinguish mass nouns from other common nouns, which can result
|
||||
-- in semantically odd expressions.
|
||||
|
||||
MassNP : CN -> NP ; -- (beer)
|
||||
MassNP : CN -> NP ; -- (beer)
|
||||
|
||||
-- Pronouns have possessive forms. Genitives of other kinds
|
||||
-- of noun phrases are not given here, since they are not possible
|
||||
-- in e.g. Romance languages. They can be found in $Extra$ modules.
|
||||
|
||||
PossPron : Pron -> Quant ; -- my (house)
|
||||
|
||||
-- Other determiners are defined in [Structural Structural.html].
|
||||
|
||||
|
||||
@@ -51,8 +51,10 @@ concrete CatEng of Cat = CommonX ** open ResEng, Prelude in {
|
||||
NP, Pron = {s : Case => Str ; a : Agr} ;
|
||||
Det = {s : Str ; n : Number} ;
|
||||
Predet, Ord = {s : Str} ;
|
||||
Num = {s : Str; n : Number ; isNum : Bool} ;
|
||||
Num = {s : Str; n : Number ; hasCard : Bool} ;
|
||||
Card = {s : Str; n : Number} ;
|
||||
Quant = {s : Number => Str} ;
|
||||
Art = {s : Bool => Number => Str} ;
|
||||
|
||||
-- Numeral
|
||||
|
||||
|
||||
@@ -31,60 +31,65 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
|
||||
a = np.a
|
||||
} ;
|
||||
|
||||
DetQuant quant num ord = {
|
||||
DetQuantOrd quant num ord = {
|
||||
s = quant.s ! num.n ++ num.s ++ ord.s ;
|
||||
n = num.n
|
||||
} ;
|
||||
|
||||
DetNP quant num ord = {
|
||||
s = \\c => quant.s ! num.n ++ num.s ++ ord.s ; ---- case
|
||||
a = agrP3 num.n
|
||||
DetQuant quant num = {
|
||||
s = quant.s ! num.n ++ num.s ;
|
||||
n = num.n
|
||||
} ;
|
||||
|
||||
DetNP det = {
|
||||
s = \\c => det.s ; ---- case
|
||||
a = agrP3 det.n
|
||||
} ;
|
||||
|
||||
PossPron p = {s = \\_ => p.s ! Gen} ;
|
||||
|
||||
NumSg = {s = []; n = Sg ; isNum = False} ;
|
||||
NumPl = {s = []; n = Pl ; isNum = False} ;
|
||||
NoOrd = {s = []} ;
|
||||
NumSg = {s = []; n = Sg ; hasCard = False} ;
|
||||
NumPl = {s = []; n = Pl ; hasCard = False} ;
|
||||
---b NoOrd = {s = []} ;
|
||||
|
||||
NumDigits n = {s = n.s ! NCard ; n = n.n ; isNum = True} ;
|
||||
NumCard n = n ** {hasCard = True} ;
|
||||
|
||||
NumDigits n = {s = n.s ! NCard ; n = n.n} ;
|
||||
OrdDigits n = {s = n.s ! NOrd} ;
|
||||
|
||||
NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n ; isNum = True} ;
|
||||
NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ;
|
||||
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
|
||||
|
||||
AdNum adn num = {s = adn.s ++ num.s ; n = num.n ; isNum = True} ; ----
|
||||
AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ;
|
||||
|
||||
OrdSuperl a = {s = a.s ! AAdj Superl} ;
|
||||
|
||||
NumNumeralNP num = {
|
||||
s = \\c => num.s ! NCard ; ---- case
|
||||
a = agrP3 num.n
|
||||
DetArtOrd art num ord = {
|
||||
s = art.s ! num.hasCard ! num.n ++ num.s ++ ord.s ;
|
||||
n = num.n
|
||||
} ;
|
||||
|
||||
OrdNumeralNP ord = {
|
||||
s = \\c => "the" ++ ord.s ! NOrd ; ---- case
|
||||
DetArtCard art card = {
|
||||
s = art.s ! True ! card.n ++ card.s ;
|
||||
n = card.n
|
||||
} ;
|
||||
|
||||
DetArtSg art cn = {
|
||||
s = \\c => art.s ! False ! Sg ++ cn.s ! Sg ! c ;
|
||||
a = agrP3 Sg
|
||||
} ;
|
||||
|
||||
OrdSuperlNP n a = {
|
||||
s = \\c => "the" ++ n.s ++ a.s ! AAdj Superl ; ---- case
|
||||
a = agrP3 n.n
|
||||
DetArtPl art cn = {
|
||||
s = \\c => art.s ! False ! Pl ++ cn.s ! Pl ! c ;
|
||||
a = agrP3 Pl
|
||||
} ;
|
||||
|
||||
DefNP num ord cn = {
|
||||
s = \\c => artDef ++ num.s ++ ord.s ++ cn.s ! num.n ! c ;
|
||||
a = agrP3 num.n
|
||||
} ;
|
||||
DefArt = {s = \\c,n => artDef} ;
|
||||
|
||||
IndefNP num ord cn =
|
||||
let an = case <num.n,num.isNum> of {
|
||||
IndefArt = {s = \\c,n => case <n,c> of {
|
||||
<Sg,False> => artIndef ;
|
||||
_ => []
|
||||
}
|
||||
in {
|
||||
s = \\c => an ++ num.s ++ ord.s ++ cn.s ! num.n ! c ;
|
||||
a = agrP3 num.n
|
||||
} ;
|
||||
|
||||
MassNP cn = {
|
||||
|
||||
Reference in New Issue
Block a user