mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-23 01:52:50 -06:00
COnstructors complete
This commit is contained in:
@@ -44,12 +44,15 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
-- also applied to all other rules in which the category appears.
|
-- also applied to all other rules in which the category appears.
|
||||||
-- + The constructors in a group are listed, roughly,
|
-- + The constructors in a group are listed, roughly,
|
||||||
-- *from the most common to the most general*. This does not of course specify
|
-- *from the most common to the most general*. This does not of course specify
|
||||||
-- a total order. Often the most common is also the most general.
|
-- a total order.
|
||||||
|
-- + Optional argument types are marked in parentheses. Although parentheses make no
|
||||||
|
-- difference in the way the GF compiler treats the types, their presence indicates
|
||||||
|
-- to the reader that the corresponding arguments can be left out; internally, the
|
||||||
|
-- library has an overload case for each such combination.
|
||||||
-- + Each constructor case is equipped with an example that is built by that
|
-- + Each constructor case is equipped with an example that is built by that
|
||||||
-- case but could not be built with any other one.
|
-- case but could not be built with any other one.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- *NB* the ones marked with $--%$ are currently not implemented.
|
|
||||||
|
|
||||||
--2 Texts, phrases, and utterances
|
--2 Texts, phrases, and utterances
|
||||||
|
|
||||||
@@ -62,9 +65,7 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
oper
|
oper
|
||||||
mkText : overload {
|
mkText : overload {
|
||||||
mkText : Phr -> Text ; -- John walks.
|
mkText : Phr -> Text ; -- John walks.
|
||||||
mkText : Phr -> Text -> Text ; -- John walks. Yes!
|
mkText : Phr -> (Punct) -> (Text) -> Text ; -- John walks? Yes!
|
||||||
mkText : Phr -> Punct -> Text ; -- John walks!
|
|
||||||
mkText : Phr -> Punct -> Text -> Text ; -- John walks? Yes!
|
|
||||||
|
|
||||||
-- A text can also be directly built from utterances, which in turn can
|
-- A text can also be directly built from utterances, which in turn can
|
||||||
-- be directly built from sentences, present-tense clauses, questions, or
|
-- be directly built from sentences, present-tense clauses, questions, or
|
||||||
@@ -97,19 +98,16 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
|
|
||||||
mkPhr : overload {
|
mkPhr : overload {
|
||||||
mkPhr : Utt -> Phr ; -- why
|
mkPhr : Utt -> Phr ; -- why
|
||||||
mkPhr : Utt -> Voc -> Phr ; --% why John
|
mkPhr : (PConj) -> Utt -> (Voc) -> Phr ; -- but why John
|
||||||
mkPhr : PConj -> Utt -> Phr ; --% but why
|
|
||||||
mkPhr : PConj -> Utt -> Voc -> Phr ; -- but why John
|
|
||||||
|
|
||||||
|
|
||||||
-- A phrase can also be directly built by a sentence, a present-tense
|
-- A phrase can also be directly built by a sentence, a present-tense
|
||||||
-- clause, a question, or an imperative. Imperatives have by default
|
-- clause, a question, or a positive singular imperative.
|
||||||
-- positive polarity.
|
|
||||||
|
|
||||||
mkPhr : S -> Phr ; -- John walked
|
mkPhr : S -> Phr ; -- John walked
|
||||||
mkPhr : Cl -> Phr ; -- John walks
|
mkPhr : Cl -> Phr ; -- John walks
|
||||||
mkPhr : QS -> Phr ; --% Did John walk?
|
mkPhr : QS -> Phr ; -- did John walk
|
||||||
mkPhr : Imp -> Phr --% Walk!
|
mkPhr : Imp -> Phr -- walk
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
--3 PConj, phrasal conjunctions
|
--3 PConj, phrasal conjunctions
|
||||||
@@ -128,27 +126,25 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
|
|
||||||
--3 Utt, utterances
|
--3 Utt, utterances
|
||||||
|
|
||||||
-- Utterances are formed from sentences, questions, and imperatives.
|
-- Utterances are formed from sentences, clauses, questions, and positive singular imperatives.
|
||||||
|
|
||||||
mkUtt : overload {
|
mkUtt : overload {
|
||||||
mkUtt : S -> Utt ; -- John walked
|
mkUtt : S -> Utt ; -- John walked
|
||||||
mkUtt : Cl -> Utt ; -- John walks
|
mkUtt : Cl -> Utt ; -- John walks
|
||||||
mkUtt : QS -> Utt ; -- did John walk
|
mkUtt : QS -> Utt ; -- did John walk
|
||||||
|
mkUtt : Imp -> Utt ; -- help yourself
|
||||||
|
|
||||||
-- Imperatives vary in $ImpForm$ (number/politeness) and
|
-- Imperatives can also vary in $ImpForm$ (number/politeness) and
|
||||||
-- polarity.
|
-- polarity.
|
||||||
|
|
||||||
mkUtt : Imp -> Utt ; -- help yourself
|
mkUtt : (ImpForm) -> (Pol) -> Imp -> Utt ; -- don't help yourselves
|
||||||
mkUtt : Pol -> Imp -> Utt ; -- don't help yourself
|
|
||||||
mkUtt : ImpForm -> Imp -> Utt ; -- help yourselves
|
|
||||||
mkUtt : ImpForm -> Pol -> Imp -> Utt ; -- don't help yourselves
|
|
||||||
|
|
||||||
-- Utterances can also be formed from interrogative phrases and
|
-- Utterances can also be formed from interrogative phrases and
|
||||||
-- interrogative adverbials, noun phrases, adverbs, and verb phrases.
|
-- interrogative adverbials, noun phrases, adverbs, and verb phrases.
|
||||||
|
|
||||||
mkUtt : IP -> Utt ; -- who
|
mkUtt : IP -> Utt ; -- who
|
||||||
mkUtt : IAdv -> Utt ; -- why
|
mkUtt : IAdv -> Utt ; -- why
|
||||||
mkUtt : NP -> Utt ; -- this man
|
mkUtt : NP -> Utt ; -- John
|
||||||
mkUtt : Adv -> Utt ; -- here
|
mkUtt : Adv -> Utt ; -- here
|
||||||
mkUtt : VP -> Utt -- to walk
|
mkUtt : VP -> Utt -- to walk
|
||||||
} ;
|
} ;
|
||||||
@@ -207,13 +203,7 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
|
|
||||||
mkS : overload {
|
mkS : overload {
|
||||||
mkS : Cl -> S ; -- John walks
|
mkS : Cl -> S ; -- John walks
|
||||||
mkS : Pol -> Cl -> S ; -- John doesn't walk
|
mkS : (Tense) -> (Ant) -> (Pol) -> Cl -> S ; -- John wouldn't have walked
|
||||||
mkS : Ant -> Cl -> S ; -- John has walked
|
|
||||||
mkS : Ant -> Pol -> Cl -> S ; -- John hasn't walked
|
|
||||||
mkS : Tense -> Cl -> S ; -- John walked
|
|
||||||
mkS : Tense -> Pol -> Cl -> S ; -- John didn't walk
|
|
||||||
mkS : Tense -> Ant -> Cl -> S ; -- John had walked
|
|
||||||
mkS : Tense -> Ant -> Pol -> Cl -> S ; -- John wouldn't have walked
|
|
||||||
|
|
||||||
-- Sentences can be combined with conjunctions. This can apply to a pair
|
-- Sentences can be combined with conjunctions. This can apply to a pair
|
||||||
-- of sentences, but also to a list of more than two.
|
-- of sentences, but also to a list of more than two.
|
||||||
@@ -237,24 +227,24 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
mkCl : overload {
|
mkCl : overload {
|
||||||
mkCl : NP -> V -> Cl ; -- John walks
|
mkCl : NP -> V -> Cl ; -- John walks
|
||||||
mkCl : NP -> V2 -> NP -> Cl ; -- John loves her
|
mkCl : NP -> V2 -> NP -> Cl ; -- John loves her
|
||||||
mkCl : NP -> V3 -> NP -> NP -> Cl ; --% John sends it to her
|
mkCl : NP -> V3 -> NP -> NP -> Cl ; -- John sends it to her
|
||||||
mkCl : NP -> AP -> Cl ; -- John is nice and warm
|
mkCl : NP -> AP -> Cl ; -- John is nice and warm
|
||||||
mkCl : NP -> A -> Cl ; -- John is nice
|
mkCl : NP -> A -> Cl ; -- John is nice
|
||||||
mkCl : NP -> A -> NP -> Cl ; -- John is nicer than Mary
|
mkCl : NP -> A -> NP -> Cl ; -- John is nicer than Mary
|
||||||
mkCl : NP -> A2 -> NP -> Cl ; -- John is married to Mary
|
mkCl : NP -> A2 -> NP -> Cl ; -- John is married to Mary
|
||||||
mkCl : NP -> NP -> Cl ; -- John is the man
|
mkCl : NP -> NP -> Cl ; -- John is the man
|
||||||
mkCl : NP -> CN -> Cl ; --% John is an old man
|
mkCl : NP -> CN -> Cl ; -- John is an old man
|
||||||
mkCl : NP -> N -> Cl ; --% John is a man
|
mkCl : NP -> N -> Cl ; -- John is a man
|
||||||
mkCl : NP -> Adv -> Cl ; -- John is here
|
mkCl : NP -> Adv -> Cl ; -- John is here
|
||||||
|
|
||||||
-- More generally, clause can be built from a subject noun phrase and
|
-- As the general rule, a clause can be built from a subject noun phrase and
|
||||||
-- a verb phrase.
|
-- a verb phrase.
|
||||||
|
|
||||||
mkCl : NP -> VP -> Cl ; -- John wants to walk
|
mkCl : NP -> VP -> Cl ; -- John wants to walk
|
||||||
|
|
||||||
-- Subjectless verb phrases are used for impersonal actions.
|
-- Subjectless verb phrases are used for impersonal actions.
|
||||||
|
|
||||||
mkCl : V -> Cl ; --% it rains
|
mkCl : V -> Cl ; -- it rains
|
||||||
mkCl : VP -> Cl ; -- it is getting warm
|
mkCl : VP -> Cl ; -- it is getting warm
|
||||||
|
|
||||||
-- Existentials are a special form of clauses.
|
-- Existentials are a special form of clauses.
|
||||||
@@ -268,7 +258,7 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
mkCl : Adv -> S -> Cl -- it is here John walks
|
mkCl : Adv -> S -> Cl -- it is here John walks
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- Generic clauses have an impersonal subject.
|
-- Generic clauses are one with an impersonal subject.
|
||||||
|
|
||||||
genericCl : VP -> Cl ; -- one walks
|
genericCl : VP -> Cl ; -- one walks
|
||||||
|
|
||||||
@@ -292,10 +282,10 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
-- The verb can also be a copula ("be"), and the relevant argument is
|
-- The verb can also be a copula ("be"), and the relevant argument is
|
||||||
-- then the complement adjective or noun phrase.
|
-- then the complement adjective or noun phrase.
|
||||||
|
|
||||||
mkVP : A -> VP ; --% be warm
|
mkVP : A -> VP ; -- be warm
|
||||||
mkVP : AP -> VP ; -- be very warm
|
mkVP : AP -> VP ; -- be very warm
|
||||||
mkVP : N -> VP ; --% be a man
|
mkVP : N -> VP ; -- be a man
|
||||||
mkVP : CN -> VP ; --% be an old man
|
mkVP : CN -> VP ; -- be an old man
|
||||||
mkVP : NP -> VP ; -- be the old man
|
mkVP : NP -> VP ; -- be the old man
|
||||||
mkVP : Adv -> VP ; -- be here
|
mkVP : Adv -> VP ; -- be here
|
||||||
|
|
||||||
@@ -312,8 +302,8 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
-- Two-place verbs can also be used in the passive, with or without an agent.
|
-- Two-place verbs can also be used in the passive, with or without an agent.
|
||||||
|
|
||||||
passiveVP : overload {
|
passiveVP : overload {
|
||||||
passiveVP : V2 -> VP ; --% be loved
|
passiveVP : V2 -> VP ; -- be loved
|
||||||
passiveVP : V2 -> NP -> VP ; --% be loved by her
|
passiveVP : V2 -> NP -> VP ; -- be loved by her
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- A verb phrase can be turned into the progressive form.
|
-- A verb phrase can be turned into the progressive form.
|
||||||
@@ -322,8 +312,8 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
|
|
||||||
--3 Imp, imperatives
|
--3 Imp, imperatives
|
||||||
|
|
||||||
-- Imperatives are formed from verbs and their arguments; in the general
|
-- Imperatives are formed from verbs and their arguments; as the general
|
||||||
-- case, from verb phrases.
|
-- rule, from verb phrases.
|
||||||
|
|
||||||
mkImp : overload {
|
mkImp : overload {
|
||||||
mkImp : V -> Imp ; -- go
|
mkImp : V -> Imp ; -- go
|
||||||
@@ -335,21 +325,42 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
|
|
||||||
--2 Noun phrases and determiners
|
--2 Noun phrases and determiners
|
||||||
|
|
||||||
|
--3 NP, noun phrases
|
||||||
|
|
||||||
|
-- A noun phrases can be built from a determiner and a common noun ($CN$) .
|
||||||
|
-- For determiners, the special cases of quantifiers, numerals, integers,
|
||||||
|
-- and possessive pronouns are provided. For common nouns, the
|
||||||
|
-- special case of a simple common noun ($N$) is always provided.
|
||||||
|
|
||||||
mkNP : overload {
|
mkNP : overload {
|
||||||
mkNP : Det -> CN -> NP ; -- the old man
|
mkNP : Det -> CN -> NP ; -- the first old man
|
||||||
mkNP : Det -> N -> NP ; -- the man
|
mkNP : Det -> N -> NP ; -- the first man
|
||||||
|
mkNP : QuantSg -> CN -> NP ; -- this old man
|
||||||
|
mkNP : QuantSg -> N -> NP ; -- this man
|
||||||
|
mkNP : QuantPl -> CN -> NP ; -- these old men
|
||||||
|
mkNP : QuantPl -> N -> NP ; -- these men
|
||||||
mkNP : Num -> CN -> NP ; -- forty-five old men
|
mkNP : Num -> CN -> NP ; -- forty-five old men
|
||||||
mkNP : Num -> N -> NP ; -- forty-five men
|
mkNP : Num -> N -> NP ; -- forty-five men
|
||||||
mkNP : Int -> CN -> NP ; -- 51 old men
|
mkNP : Int -> CN -> NP ; -- 45 old men
|
||||||
mkNP : Int -> N -> NP ; -- 51 men
|
mkNP : Int -> N -> NP ; -- 45 men
|
||||||
mkNP : Digit -> CN -> NP; -- five old men
|
mkNP : Pron -> CN -> NP; -- my old man
|
||||||
mkNP : Digit -> N -> NP ; -- five men
|
mkNP : Pron -> N -> NP ; -- my man
|
||||||
|
|
||||||
|
-- Proper names and pronouns can be used as noun phrases.
|
||||||
|
|
||||||
mkNP : PN -> NP ; -- John
|
mkNP : PN -> NP ; -- John
|
||||||
mkNP : Pron -> NP ; -- he
|
mkNP : Pron -> NP ; -- he
|
||||||
mkNP : Predet -> NP -> NP ; -- all the men
|
|
||||||
|
-- A noun phrase once formed can be prefixed by a predeterminer and
|
||||||
|
-- suffixed by a past participle or an adverb.
|
||||||
|
|
||||||
|
mkNP : Predet -> NP -> NP ; -- only John
|
||||||
mkNP : NP -> V2 -> NP ; -- the number squared
|
mkNP : NP -> V2 -> NP ; -- the number squared
|
||||||
mkNP : NP -> Adv -> NP ; -- Paris at midnight
|
mkNP : NP -> Adv -> NP ; -- Paris at midnight
|
||||||
|
|
||||||
|
-- A conjunction can be formed both from two noun phrases and a longer
|
||||||
|
-- list of them.
|
||||||
|
|
||||||
mkNP : Conj -> NP -> NP -> NP ; -- John and Mary
|
mkNP : Conj -> NP -> NP -> NP ; -- John and Mary
|
||||||
mkNP : DConj -> NP -> NP -> NP ; -- both John and Mary
|
mkNP : DConj -> NP -> NP -> NP ; -- both John and Mary
|
||||||
mkNP : Conj -> ListNP -> NP ; -- John, Mary, and Bill
|
mkNP : Conj -> ListNP -> NP ; -- John, Mary, and Bill
|
||||||
@@ -357,190 +368,405 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
--3 Det, determiners
|
||||||
|
|
||||||
|
-- A determiner is either a singular or a plural one.
|
||||||
|
-- Both have a quantifier and an optional ordinal; the plural
|
||||||
|
-- determiner also has an optional numeral.
|
||||||
|
|
||||||
mkDet : overload {
|
mkDet : overload {
|
||||||
mkDet : QuantSg -> Ord -> Det ; -- this best
|
|
||||||
mkDet : QuantSg -> Det ; -- this
|
mkDet : QuantSg -> Det ; -- this
|
||||||
mkDet : QuantPl -> Num -> Ord -> Det ; -- these five best
|
mkDet : QuantSg -> (Ord) -> Det ; -- this best
|
||||||
mkDet : QuantPl -> Det ; -- these
|
mkDet : QuantPl -> Det ; -- these
|
||||||
|
mkDet : QuantPl -> (Num) -> (Ord) -> Det ; -- these five best
|
||||||
|
|
||||||
|
-- Quantifiers that have both singular and plural forms are by default used as
|
||||||
|
-- singular determiners. If a numeral is added, the plural form is chosen.
|
||||||
|
|
||||||
mkDet : Quant -> Det ; -- this
|
mkDet : Quant -> Det ; -- this
|
||||||
mkDet : Quant -> Num -> Det ; -- these five
|
mkDet : Quant -> Num -> Det ; -- these five
|
||||||
mkDet : Num -> Det ; -- forty-five
|
|
||||||
|
-- Numerals, their special cases integers and digits, and possessive pronouns can be
|
||||||
|
-- used as determiners.
|
||||||
|
|
||||||
|
mkDet : Num -> Det ; -- almost forty-five
|
||||||
|
mkDet : Numeral -> Det ; -- five
|
||||||
mkDet : Int -> Det ; -- 51
|
mkDet : Int -> Det ; -- 51
|
||||||
mkDet : Digit -> Det ; -- five
|
|
||||||
mkDet : Pron -> Det -- my
|
mkDet : Pron -> Det -- my
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkQuantSg : Quant -> QuantSg ;
|
-- The definite and indefinite articles are commonly used determiners.
|
||||||
|
|
||||||
mkQuantPl : Quant -> QuantPl ;
|
defSgDet : Det ; -- the (house)
|
||||||
|
defPlDet : Det ; -- the (houses)
|
||||||
|
indefSgDet : Det ; -- a (house)
|
||||||
|
indefPlDet : Det ; -- (houses)
|
||||||
|
|
||||||
|
|
||||||
def_Det : Det ; -- the (man)
|
--3 Quant, QuantSg, and QuantPl, quantifiers
|
||||||
indef_Det : Det ; -- a (man)
|
|
||||||
mass_Det : Det ; -- (water)
|
|
||||||
|
|
||||||
-- More determiners are available in the Structural module
|
-- Definite and indefinite articles have both singular and plural forms (even though the
|
||||||
|
-- plural indefinite is empty in most languages).
|
||||||
|
|
||||||
|
defQuant : Quant ; -- the
|
||||||
|
indefQuant : Quant ; -- a
|
||||||
|
|
||||||
|
-- From quantifiers that can have both forms, these constructors build the singular and
|
||||||
|
-- the plural forms.
|
||||||
|
|
||||||
|
mkQuantSg : Quant -> QuantSg ; -- (this)
|
||||||
|
mkQuantPl : Quant -> QuantPl ; -- (these)
|
||||||
|
|
||||||
|
-- The mass noun phrase constructor is treated as a singular quantifier.
|
||||||
|
|
||||||
|
massQuant : QuantSg ; -- (mass terms)
|
||||||
|
|
||||||
|
-- More quantifiers are available in the $Structural$ module
|
||||||
|
|
||||||
|
|
||||||
--2 Numerals - cardinal and ordinal
|
--3 Num, cardinal numerals
|
||||||
|
|
||||||
|
-- Numerals can be formed from number words ($Numeral$), their special case digits,
|
||||||
|
-- and from symbolic integers.
|
||||||
|
|
||||||
mkNum : overload {
|
mkNum : overload {
|
||||||
mkNum : Numeral -> Num ;
|
mkNum : Numeral -> Num ; -- forty-six
|
||||||
mkNum : Digit -> Num ;
|
|
||||||
mkNum : Int -> Num ; -- 51
|
mkNum : Int -> Num ; -- 51
|
||||||
mkNum : AdN -> Num -> Num
|
|
||||||
|
-- A numeral can be modified by an adnumeral.
|
||||||
|
|
||||||
|
mkNum : AdN -> Num -> Num -- almost ten
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
noNum : Num ; -- [no num]
|
--3 Ord, ordinal numerals
|
||||||
|
|
||||||
mkAdN : CAdv -> AdN ; -- more (than five)
|
|
||||||
|
|
||||||
|
-- Just like cardinals, ordinals can be formed from number words ($Numeral$), their special case digits,
|
||||||
|
-- and from symbolic integers.
|
||||||
|
|
||||||
mkOrd : overload {
|
mkOrd : overload {
|
||||||
mkOrd : Numeral -> Ord ;
|
mkOrd : Numeral -> Ord ; -- sixtieth
|
||||||
mkOrd : Digit -> Ord ; -- fifth
|
|
||||||
mkOrd : Int -> Ord ; -- 51st
|
mkOrd : Int -> Ord ; -- 51st
|
||||||
|
|
||||||
|
-- Also adjectives in the superlative form can appear on ordinal positions.
|
||||||
|
|
||||||
mkOrd : A -> Ord -- largest
|
mkOrd : A -> Ord -- largest
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
noOrd : Ord ; -- [no ord]
|
--3 AdN, adnumerals
|
||||||
|
|
||||||
|
-- Comparison adverbs can be used as adnumerals.
|
||||||
|
|
||||||
|
mkAdN : CAdv -> AdN ; -- more (than five)
|
||||||
|
|
||||||
|
--3 Numeral, number words
|
||||||
|
|
||||||
|
-- Digits and some "round" numbers are here given as shorthands.
|
||||||
|
|
||||||
|
n1_Numeral : Numeral ; -- one
|
||||||
|
n2_Numeral : Numeral ; -- two
|
||||||
|
n3_Numeral : Numeral ; -- three
|
||||||
|
n4_Numeral : Numeral ; -- four
|
||||||
|
n5_Numeral : Numeral ; -- five
|
||||||
|
n6_Numeral : Numeral ; -- six
|
||||||
|
n7_Numeral : Numeral ; -- seven
|
||||||
|
n8_Numeral : Numeral ; -- eight
|
||||||
|
n9_Numeral : Numeral ; -- nine
|
||||||
|
n10_Numeral : Numeral ; -- ten
|
||||||
|
n20_Numeral : Numeral ; -- twenty
|
||||||
|
n100_Numeral : Numeral ; -- hundred
|
||||||
|
n1000_Numeral : Numeral ; -- thousand
|
||||||
|
|
||||||
|
-- See $Numeral$ for the full set of constructors, or use $Int$ for other numbers.
|
||||||
|
|
||||||
|
|
||||||
|
--2 Nouns
|
||||||
|
|
||||||
--2 Common nouns
|
--3 CN, common noun phrases
|
||||||
|
|
||||||
mkCN : overload {
|
mkCN : overload {
|
||||||
|
|
||||||
|
-- The most frequent way of forming common noun phrases is from atomic nouns $N$.
|
||||||
|
|
||||||
mkCN : N -> CN ; -- house
|
mkCN : N -> CN ; -- house
|
||||||
|
|
||||||
|
-- Common noun phrases can be formed from relational nouns by providing arguments.
|
||||||
|
|
||||||
mkCN : N2 -> NP -> CN ; -- son of the king
|
mkCN : N2 -> NP -> CN ; -- son of the king
|
||||||
mkCN : N3 -> NP -> NP -> CN ; -- flight from Moscow (to Paris)
|
mkCN : N3 -> NP -> NP -> CN ; -- flight from Moscow to Paris
|
||||||
|
|
||||||
|
-- Relational nouns can also be used without their arguments.
|
||||||
|
|
||||||
mkCN : N2 -> CN ; -- son
|
mkCN : N2 -> CN ; -- son
|
||||||
mkCN : N3 -> CN ; -- flight
|
mkCN : N3 -> CN ; -- flight
|
||||||
mkCN : AP -> CN -> CN ; -- nice and big blue house
|
|
||||||
mkCN : AP -> N -> CN ; -- nice and big house
|
-- A common noun phrase can be modified by adjectival phrase. We give special
|
||||||
mkCN : CN -> AP -> CN ; -- nice and big blue house
|
-- cases of this, where one or both of the arguments are atomic.
|
||||||
mkCN : N -> AP -> CN ; -- nice and big house
|
|
||||||
|
mkCN : AP -> CN -> CN ; -- very big blue house
|
||||||
mkCN : A -> CN -> CN ; -- big blue house
|
mkCN : A -> CN -> CN ; -- big blue house
|
||||||
|
mkCN : AP -> N -> CN ; -- very big house
|
||||||
mkCN : A -> N -> CN ; -- big house
|
mkCN : A -> N -> CN ; -- big house
|
||||||
mkCN : CN -> RS -> CN ; -- house that John owns
|
|
||||||
mkCN : N -> RS -> CN ; -- house that John owns
|
-- A common noun phrase can be modified by a relative clause or an adverb.
|
||||||
mkCN : CN -> Adv -> CN ; -- house on the hill
|
|
||||||
mkCN : N -> Adv -> CN ; -- house on the hill
|
mkCN : CN -> RS -> CN ; -- big house that John loves
|
||||||
mkCN : CN -> S -> CN ; -- fact that John smokes
|
mkCN : N -> RS -> CN ; -- house that John loves
|
||||||
|
mkCN : CN -> Adv -> CN ; -- big house on the mountain
|
||||||
|
mkCN : N -> Adv -> CN ; -- house on the mountain
|
||||||
|
|
||||||
|
-- For some nouns it makes sense to modify them by sentences, questions, or infinitives.
|
||||||
|
|
||||||
|
mkCN : CN -> S -> CN ; -- fact that John walks
|
||||||
mkCN : CN -> QS -> CN ; -- question if John smokes
|
mkCN : CN -> QS -> CN ; -- question if John smokes
|
||||||
mkCN : CN -> VP -> CN ; -- reason to smoke
|
mkCN : CN -> VP -> CN ; -- reason to smoke
|
||||||
mkCN : CN -> NP -> CN ; -- number x, numbers x and y
|
|
||||||
mkCN : N -> NP -> CN -- number x, numbers x and y
|
-- A noun can be used in apposition to a noun phrase, especially a proper name.
|
||||||
|
|
||||||
|
mkCN : CN -> NP -> CN ; -- old king John
|
||||||
|
mkCN : N -> NP -> CN -- king John
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
--2 Adjectival phrases
|
|
||||||
|
--2 Adjectives and adverbs
|
||||||
|
|
||||||
|
--3 AP, adjectival phrases
|
||||||
|
|
||||||
mkAP : overload {
|
mkAP : overload {
|
||||||
mkAP : A -> AP ; -- warm
|
|
||||||
mkAP : A -> NP -> AP ; -- warmer than Spain
|
-- Adjectival phrases can be formed from atomic adjectives by using the positive form or
|
||||||
mkAP : A2 -> NP -> AP ; -- divisible by 2
|
-- the comparative with a complement
|
||||||
mkAP : A2 -> AP ; -- divisible by itself
|
|
||||||
|
mkAP : A -> AP ; -- old
|
||||||
|
mkAP : A -> NP -> AP ; -- older than John
|
||||||
|
|
||||||
|
-- Relational adjectives can be used with a complement or a reflexive
|
||||||
|
|
||||||
|
mkAP : A2 -> NP -> AP ; -- married to her
|
||||||
|
mkAP : A2 -> AP ; -- married to himself
|
||||||
|
|
||||||
|
-- Some adjectival phrases can take as complements sentences, questions, or infinitives.
|
||||||
|
|
||||||
mkAP : AP -> S -> AP ; -- great that she won
|
mkAP : AP -> S -> AP ; -- great that she won
|
||||||
mkAP : AP -> QS -> AP ; -- uncertain if she won
|
mkAP : AP -> QS -> AP ; -- uncertain if she won
|
||||||
mkAP : AP -> VP -> AP ; -- ready to go
|
mkAP : AP -> VP -> AP ; -- ready to go
|
||||||
mkAP : AdA -> AP -> AP ; -- very uncertain
|
|
||||||
mkAP : Conj -> AP -> AP -> AP ; -- warm and nice
|
-- An adjectival phrase can be modified by an adadjective.
|
||||||
mkAP : DConj -> AP -> AP -> AP ;-- both warm and nice
|
|
||||||
mkAP : Conj -> ListAP -> AP ; -- warm, nice, and cheap
|
mkAP : AdA -> AP -> AP ; -- very big
|
||||||
mkAP : DConj -> ListAP -> AP -- both warm, nice, and cheap
|
|
||||||
|
-- Conjunction can be formed from two or more adjectival phrases.
|
||||||
|
|
||||||
|
mkAP : Conj -> AP -> AP -> AP ; -- warm and big
|
||||||
|
mkAP : Conj -> ListAP -> AP ; -- warm, big, and cheap
|
||||||
|
mkAP : DConj -> AP -> AP -> AP ; -- both warm and big
|
||||||
|
mkAP : DConj -> ListAP -> AP -- both warm, big, and cheap
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
--2 Adverbs
|
--3 Adv, adverbial phrases
|
||||||
|
|
||||||
mkAdv : overload {
|
mkAdv : overload {
|
||||||
|
|
||||||
|
-- Adverbs can be formed from adjectives.
|
||||||
|
|
||||||
mkAdv : A -> Adv ; -- quickly
|
mkAdv : A -> Adv ; -- quickly
|
||||||
|
|
||||||
|
-- Prepositional phrases are treated as adverbs.
|
||||||
|
|
||||||
mkAdv : Prep -> NP -> Adv ; -- in the house
|
mkAdv : Prep -> NP -> Adv ; -- in the house
|
||||||
mkAdv : CAdv -> A -> NP -> Adv ; -- more quickly than John
|
|
||||||
mkAdv : CAdv -> A -> S -> Adv ; -- more quickly than he runs
|
-- Subordinate sentences are treated as adverbs.
|
||||||
mkAdv : AdA -> Adv -> Adv ; -- very quickly
|
|
||||||
mkAdv : Subj -> S -> Adv ; -- when he arrives
|
mkAdv : Subj -> S -> Adv ; -- when he arrives
|
||||||
mkAdv : Conj -> Adv -> Adv -> Adv; -- here and now
|
|
||||||
mkAdv : DConj -> Adv -> Adv -> Adv; -- both here and now
|
-- An adjectival adverb can be compared to a noun phrase or a sentence.
|
||||||
|
|
||||||
|
mkAdv : CAdv -> A -> NP -> Adv ; -- more slowly than John
|
||||||
|
mkAdv : CAdv -> A -> S -> Adv ; -- more slowly than he runs
|
||||||
|
|
||||||
|
-- Adverbs can be modified by adadjectives.
|
||||||
|
|
||||||
|
mkAdv : AdA -> Adv -> Adv ; -- very quickly
|
||||||
|
|
||||||
|
-- Conjunction can be formed from two or more adverbial phrases.
|
||||||
|
|
||||||
|
mkAdv : Conj -> Adv -> Adv -> Adv ; -- here and now
|
||||||
mkAdv : Conj -> ListAdv -> Adv ; -- here, now, and with you
|
mkAdv : Conj -> ListAdv -> Adv ; -- here, now, and with you
|
||||||
|
mkAdv : DConj -> Adv -> Adv -> Adv ; -- both here and now
|
||||||
mkAdv : DConj -> ListAdv -> Adv -- both here, now, and with you
|
mkAdv : DConj -> ListAdv -> Adv -- both here, now, and with you
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
--2 Questions and interrogative pronouns
|
--2 Questions and relatives
|
||||||
|
|
||||||
|
--3 QS, question sentences
|
||||||
|
|
||||||
mkQS : overload {
|
mkQS : overload {
|
||||||
mkQS : Tense -> Ant -> Pol -> QCl -> QS ; -- wouldn't John have walked
|
|
||||||
|
-- Just like a sentence $S$ is built from a clause $Cl$, a question sentence $QS$ is built from
|
||||||
|
-- a question clause $QCl$ by fixing tense, anteriority and polarity. Any of these arguments
|
||||||
|
-- can be omitted, which results in the default (present, simultaneous, and positive, respectively).
|
||||||
|
|
||||||
mkQS : QCl -> QS ; -- who walks
|
mkQS : QCl -> QS ; -- who walks
|
||||||
|
mkQS : (Tense) -> (Ant) -> (Pol) -> QCl -> QS ; -- wouldn't John have walked
|
||||||
|
|
||||||
|
-- Since 'yes-no' question clauses can be built from clauses (see below), we give a shortcus
|
||||||
|
-- for building a question sentence directly from a clause, using the defaults
|
||||||
|
-- present, simultaneous, and positive.
|
||||||
|
|
||||||
mkQS : Cl -> QS -- does John walk
|
mkQS : Cl -> QS -- does John walk
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
--3 QCl, question clauses
|
||||||
|
|
||||||
mkQCl : overload {
|
mkQCl : overload {
|
||||||
|
|
||||||
|
-- 'Yes-no' question clauses are built from 'declarative' clauses.
|
||||||
|
|
||||||
mkQCl : Cl -> QCl ; -- does John walk
|
mkQCl : Cl -> QCl ; -- does John walk
|
||||||
|
|
||||||
|
-- 'Wh' questions are built from interrogative pronouns in subject or object position.
|
||||||
|
-- The latter uses the 'slash' category of objectless clauses (see below); we give the
|
||||||
|
-- common special case with a two-place verb.
|
||||||
|
|
||||||
mkQCl : IP -> VP -> QCl ; -- who walks
|
mkQCl : IP -> VP -> QCl ; -- who walks
|
||||||
mkQCl : IP -> Slash -> QCl ; -- who does John love
|
mkQCl : IP -> Slash -> QCl ; -- who does John love
|
||||||
mkQCl : IP -> NP -> V2 -> QCl ; -- who does John love
|
mkQCl : IP -> NP -> V2 -> QCl ; -- who does John love
|
||||||
|
|
||||||
|
-- Adverbial 'wh' questions are built with interrogative adverbials, with the
|
||||||
|
-- special case of prepositional phrases with interrogative pronouns.
|
||||||
|
|
||||||
mkQCl : IAdv -> Cl -> QCl ; -- why does John walk
|
mkQCl : IAdv -> Cl -> QCl ; -- why does John walk
|
||||||
mkQCl : Prep -> IP -> Cl -> QCl ; -- with whom does John walk
|
mkQCl : Prep -> IP -> Cl -> QCl ; -- with whom does John walk
|
||||||
|
|
||||||
|
-- An interrogative adverbial can serve as the complement of a copula.
|
||||||
|
|
||||||
mkQCl : IAdv -> NP -> QCl ; -- where is John
|
mkQCl : IAdv -> NP -> QCl ; -- where is John
|
||||||
|
|
||||||
|
-- Existentials are a special construction.
|
||||||
|
|
||||||
mkQCl : IP -> QCl -- which houses are there
|
mkQCl : IP -> QCl -- which houses are there
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
--3 IP, interrogative pronouns
|
||||||
|
|
||||||
mkIP : overload {
|
mkIP : overload {
|
||||||
mkIP : IDet -> Num -> Ord -> CN -> IP ; -- which five best songs
|
|
||||||
|
-- In addition to the interrogative pronouns defined in the $Structural$ lexicon, they
|
||||||
|
-- can be formed much like noun phrases, by using interrogative determiners.
|
||||||
|
|
||||||
mkIP : IDet -> N -> IP ; -- which song
|
mkIP : IDet -> N -> IP ; -- which song
|
||||||
|
mkIP : IDet -> (Num) -> (Ord) -> CN -> IP ; -- which five best songs
|
||||||
|
|
||||||
|
-- An interrogative pronoun can be modified by an adverb.
|
||||||
|
|
||||||
mkIP : IP -> Adv -> IP -- who in Europe
|
mkIP : IP -> Adv -> IP -- who in Europe
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
--3 IAdv, interrogative adverbs.
|
||||||
|
|
||||||
|
-- In addition to the interrogative adverbs defined in the $Structural$ lexicon, they
|
||||||
|
-- can be formed as prepositional phrases from interrogative pronouns.
|
||||||
|
|
||||||
mkIAdv : Prep -> IP -> IAdv ; -- in which city
|
mkIAdv : Prep -> IP -> IAdv ; -- in which city
|
||||||
|
|
||||||
--2 Relative clauses and relative pronouns
|
|
||||||
|
--3 RS, relative sentences
|
||||||
|
|
||||||
|
-- Just like a sentence $S$ is built from a clause $Cl$, a relative sentence $RS$ is built from
|
||||||
|
-- a relative clause $RCl$ by fixing the tense, anteriority and polarity. Any of these arguments
|
||||||
|
-- can be omitted, which results in the default (present, simultaneous, and positive, respectively).
|
||||||
|
|
||||||
mkRS : overload {
|
mkRS : overload {
|
||||||
mkRS : Tense -> Ant -> Pol -> RCl -> RS ; -- who wouldn't have walked
|
mkRS : RCl -> RS ; -- who walks
|
||||||
mkRS : RCl -> RS -- who walks
|
mkRS : (Tense) -> (Ant) -> (Pol) -> RCl -> RS -- who wouldn't have walked
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
--3 RCl, relative clauses
|
||||||
|
|
||||||
mkRCl : overload {
|
mkRCl : overload {
|
||||||
mkRCl : Cl -> RCl ; -- such that John loves her
|
|
||||||
|
-- Relative clauses are built from relative pronouns in subject or object position.
|
||||||
|
-- The latter uses the 'slash' category of objectless clauses (see below); we give the
|
||||||
|
-- common special case with a two-place verb.
|
||||||
|
|
||||||
mkRCl : RP -> VP -> RCl ; -- who loves John
|
mkRCl : RP -> VP -> RCl ; -- who loves John
|
||||||
|
mkRCl : RP -> NP -> V2 -> RCl ; -- whom John loves
|
||||||
mkRCl : RP -> Slash -> RCl ; -- whom John wants to love
|
mkRCl : RP -> Slash -> RCl ; -- whom John wants to love
|
||||||
mkRCl : RP -> NP -> V2 -> RCl -- whom John loves
|
|
||||||
|
-- There is a simple 'such that' construction for forming relative clauses from clauses.
|
||||||
|
|
||||||
|
mkRCl : Cl -> RCl -- such that John loves her
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkRP : overload {
|
--3 RP, relative pronouns
|
||||||
mkRP : RP ; -- which
|
|
||||||
mkRP : Prep -> NP -> RP -> RP -- all the roots of which
|
|
||||||
} ;
|
|
||||||
|
|
||||||
--2 Objectless sentences and sentence complements
|
-- There is an atomic relative pronoun
|
||||||
|
|
||||||
|
which_RP : RP ; -- which
|
||||||
|
|
||||||
|
-- A relative pronoun can be made into a kind of a prepositional phrase.
|
||||||
|
|
||||||
|
mkRP : Prep -> NP -> RP -> RP ; -- all the houses in which
|
||||||
|
|
||||||
|
|
||||||
|
--3 Slash, objectless sentences
|
||||||
|
|
||||||
mkSlash : overload {
|
mkSlash : overload {
|
||||||
|
|
||||||
|
-- Objectless sentences are used in questions and relative clauses.
|
||||||
|
-- The most common way of constructing them is by using a two-place verb
|
||||||
|
-- with a subject but without an object.
|
||||||
|
|
||||||
mkSlash : NP -> V2 -> Slash ; -- (whom) he sees
|
mkSlash : NP -> V2 -> Slash ; -- (whom) he sees
|
||||||
|
|
||||||
|
-- The two-place verb can be separated from the subject by a verb-complement verb.
|
||||||
|
|
||||||
mkSlash : NP -> VV -> V2 -> Slash ; -- (whom) he wants to see
|
mkSlash : NP -> VV -> V2 -> Slash ; -- (whom) he wants to see
|
||||||
mkSlash : Slash -> Adv -> Slash ; -- (whom) he sees tomorrow
|
|
||||||
mkSlash : Cl -> Prep -> Slash -- (with whom) he walks
|
-- The missing object can also be the noun phrase in a prepositional phrase.
|
||||||
|
|
||||||
|
mkSlash : Cl -> Prep -> Slash ; -- (with whom) he walks
|
||||||
|
|
||||||
|
-- An objectless sentence can be modified by an adverb.
|
||||||
|
|
||||||
|
mkSlash : Slash -> Adv -> Slash -- (whom) he sees tomorrow
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
--2 Lists for coordination
|
--2 Lists for coordination
|
||||||
|
|
||||||
|
-- The rules in this section are very uniform: a list can be built from two or more
|
||||||
|
-- expressions of the same category.
|
||||||
|
|
||||||
|
--3 ListS, sentence lists
|
||||||
|
|
||||||
mkListS : overload {
|
mkListS : overload {
|
||||||
mkListS : S -> S -> ListS ;
|
mkListS : S -> S -> ListS ; -- he walks, she runs
|
||||||
mkListS : S -> ListS -> ListS
|
mkListS : S -> ListS -> ListS -- I sleep, he walks, she runs
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
--3 ListAdv, adverb lists
|
||||||
|
|
||||||
mkListAdv : overload {
|
mkListAdv : overload {
|
||||||
mkListAdv : Adv -> Adv -> ListAdv ;
|
mkListAdv : Adv -> Adv -> ListAdv ; -- here, now
|
||||||
mkListAdv : Adv -> ListAdv -> ListAdv
|
mkListAdv : Adv -> ListAdv -> ListAdv -- to me, here, now
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
--3 ListAP, adjectival phrase lists
|
||||||
|
|
||||||
mkListAP : overload {
|
mkListAP : overload {
|
||||||
mkListAP : AP -> AP -> ListAP ;
|
mkListAP : AP -> AP -> ListAP ; -- big, old
|
||||||
mkListAP : AP -> ListAP -> ListAP
|
mkListAP : AP -> ListAP -> ListAP -- warm, big, old
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
--3 ListNP, noun phrase lists
|
||||||
|
|
||||||
mkListNP : overload {
|
mkListNP : overload {
|
||||||
mkListNP : NP -> NP -> ListNP ;
|
mkListNP : NP -> NP -> ListNP ; -- John, Mary
|
||||||
mkListNP : NP -> ListNP -> ListNP
|
mkListNP : NP -> ListNP -> ListNP -- you, John, Mary
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
@@ -606,6 +832,8 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
= \s,v -> PredVP s (UseV v);
|
= \s,v -> PredVP s (UseV v);
|
||||||
mkCl : NP -> V2 -> NP -> Cl -- John uses it
|
mkCl : NP -> V2 -> NP -> Cl -- John uses it
|
||||||
= \s,v,o -> PredVP s (ComplV2 v o);
|
= \s,v,o -> PredVP s (ComplV2 v o);
|
||||||
|
mkCl : NP -> V3 -> NP -> NP -> Cl
|
||||||
|
= \s,v,o,i -> PredVP s (ComplV3 v o i);
|
||||||
mkCl : VP -> Cl -- it rains
|
mkCl : VP -> Cl -- it rains
|
||||||
= ImpersCl ;
|
= ImpersCl ;
|
||||||
mkCl : NP -> RS -> Cl -- it is you who did it
|
mkCl : NP -> RS -> Cl -- it is you who did it
|
||||||
@@ -622,10 +850,16 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
= \x,y,z -> PredVP x (UseComp (CompAP (ComparA y z))) ;
|
= \x,y,z -> PredVP x (UseComp (CompAP (ComparA y z))) ;
|
||||||
mkCl : NP -> A2 -> NP -> Cl -- John is married to Mary
|
mkCl : NP -> A2 -> NP -> Cl -- John is married to Mary
|
||||||
= \x,y,z -> PredVP x (UseComp (CompAP (ComplA2 y z))) ;
|
= \x,y,z -> PredVP x (UseComp (CompAP (ComplA2 y z))) ;
|
||||||
mkCl : NP -> NP -> Cl -- John is a man
|
mkCl : NP -> NP -> Cl -- John is the man
|
||||||
= \x,y -> PredVP x (UseComp (CompNP y)) ;
|
= \x,y -> PredVP x (UseComp (CompNP y)) ;
|
||||||
|
mkCl : NP -> CN -> Cl -- John is a man
|
||||||
|
= \x,y -> PredVP x (UseComp (CompNP (DetCN (DetSg (SgQuant IndefArt) NoOrd) y))) ;
|
||||||
|
mkCl : NP -> N -> Cl -- John is a man
|
||||||
|
= \x,y -> PredVP x (UseComp (CompNP (DetCN (DetSg (SgQuant IndefArt) NoOrd) (UseN y)))) ;
|
||||||
mkCl : NP -> Adv -> Cl -- John is here
|
mkCl : NP -> Adv -> Cl -- John is here
|
||||||
= \x,y -> PredVP x (UseComp (CompAdv y))
|
= \x,y -> PredVP x (UseComp (CompAdv y)) ;
|
||||||
|
mkCl : V -> Cl -- it rains
|
||||||
|
= \v -> ImpersCl (UseV v)
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
genericCl : VP -> Cl = GenericCl ;
|
genericCl : VP -> Cl = GenericCl ;
|
||||||
@@ -639,14 +873,26 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
= \d,n -> DetCN (DetPl (PlQuant IndefArt) d NoOrd) n ;
|
= \d,n -> DetCN (DetPl (PlQuant IndefArt) d NoOrd) n ;
|
||||||
mkNP : Num -> N -> NP -- forty-five men
|
mkNP : Num -> N -> NP -- forty-five men
|
||||||
= \d,n -> DetCN (DetPl (PlQuant IndefArt) d NoOrd) (UseN n) ;
|
= \d,n -> DetCN (DetPl (PlQuant IndefArt) d NoOrd) (UseN n) ;
|
||||||
|
|
||||||
|
mkNP : QuantSg -> CN -> NP = \q,n -> DetCN (DetSg q NoOrd) n ;
|
||||||
|
mkNP : QuantSg -> N -> NP = \q,n -> DetCN (DetSg q NoOrd) (UseN n) ;
|
||||||
|
mkNP : QuantPl -> CN -> NP = \q,n -> DetCN (DetPl q NoNum NoOrd) n ;
|
||||||
|
mkNP : QuantPl -> N -> NP = \q,n -> DetCN (DetPl q NoNum NoOrd) (UseN n) ;
|
||||||
|
|
||||||
|
mkNP : Pron -> CN -> NP = \p,n -> DetCN (DetSg (SgQuant (PossPron p)) NoOrd) n ;
|
||||||
|
mkNP : Pron -> N -> NP = \p,n -> DetCN (DetSg (SgQuant (PossPron p)) NoOrd) (UseN n) ;
|
||||||
|
|
||||||
mkNP : Int -> CN -> NP -- 51 old men
|
mkNP : Int -> CN -> NP -- 51 old men
|
||||||
= \d,n -> DetCN (DetPl (PlQuant IndefArt) (NumInt d) NoOrd) n ;
|
= \d,n -> DetCN (DetPl (PlQuant IndefArt) (NumInt d) NoOrd) n ;
|
||||||
mkNP : Int -> N -> NP -- 51 men
|
mkNP : Int -> N -> NP -- 51 men
|
||||||
= \d,n -> DetCN (DetPl (PlQuant IndefArt) (NumInt d) NoOrd) (UseN n) ;
|
= \d,n -> DetCN (DetPl (PlQuant IndefArt) (NumInt d) NoOrd) (UseN n) ;
|
||||||
mkNP : Digit -> CN -> NP -- five old men
|
mkNP : Digit -> CN -> NP ---- obsol
|
||||||
= \d,n -> DetCN (DetPl (PlQuant IndefArt) (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 d)))))) NoOrd) n ;
|
= \d,n -> DetCN (DetPl (PlQuant IndefArt) (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 d)))))) NoOrd) n ;
|
||||||
mkNP : Digit -> N -> NP -- five men
|
mkNP : Digit -> N -> NP ---- obsol
|
||||||
= \d,n -> DetCN (DetPl (PlQuant IndefArt) (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 d)))))) NoOrd) (UseN n) ;
|
= \d,n -> DetCN (DetPl (PlQuant IndefArt) (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 d)))))) NoOrd) (UseN n) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mkNP : PN -> NP -- John
|
mkNP : PN -> NP -- John
|
||||||
= UsePN ;
|
= UsePN ;
|
||||||
mkNP : Pron -> NP -- he
|
mkNP : Pron -> NP -- he
|
||||||
@@ -684,21 +930,35 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
= \n -> DetPl (PlQuant IndefArt) n NoOrd ;
|
= \n -> DetPl (PlQuant IndefArt) n NoOrd ;
|
||||||
mkDet : Int -> Det -- 51 (men)
|
mkDet : Int -> Det -- 51 (men)
|
||||||
= \n -> DetPl (PlQuant IndefArt) (NumInt n) NoOrd ;
|
= \n -> DetPl (PlQuant IndefArt) (NumInt n) NoOrd ;
|
||||||
mkDet : Digit -> Det -- five (men)
|
mkDet : Digit -> Det ---- obsol
|
||||||
= \d -> DetPl (PlQuant IndefArt) (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 d)))))) NoOrd ;
|
= \d -> DetPl (PlQuant IndefArt) (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 d)))))) NoOrd ;
|
||||||
|
mkDet : Numeral -> Det --
|
||||||
|
= \d -> DetPl (PlQuant IndefArt) (NumNumeral d) NoOrd ;
|
||||||
|
|
||||||
mkDet : Pron -> Det -- my (house)
|
mkDet : Pron -> Det -- my (house)
|
||||||
= \p -> DetSg (SgQuant (PossPron p)) NoOrd
|
= \p -> DetSg (SgQuant (PossPron p)) NoOrd
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkQuantSg : Quant -> QuantSg = SgQuant ;
|
|
||||||
mkQuantPl : Quant -> QuantPl = PlQuant ;
|
|
||||||
|
|
||||||
|
defSgDet : Det = DetSg (SgQuant DefArt) NoOrd ; -- the (man)
|
||||||
|
defPlDet : Det = DetPl (PlQuant DefArt) NoNum NoOrd ; -- the (man)
|
||||||
|
indefSgDet : Det = DetSg (SgQuant IndefArt) NoOrd ; -- the (man)
|
||||||
|
indefPlDet : Det = DetPl (PlQuant IndefArt) NoNum NoOrd ; -- the (man)
|
||||||
|
|
||||||
|
---- obsol
|
||||||
def_Det : Det = DetSg (SgQuant DefArt) NoOrd ; -- the (man)
|
def_Det : Det = DetSg (SgQuant DefArt) NoOrd ; -- the (man)
|
||||||
indef_Det : Det = DetSg (SgQuant IndefArt) NoOrd ; -- a (man)
|
indef_Det : Det = DetSg (SgQuant IndefArt) NoOrd ; -- a (man)
|
||||||
mass_Det : Det = DetSg MassDet NoOrd; -- (water)
|
mass_Det : Det = DetSg MassDet NoOrd; -- (water)
|
||||||
|
|
||||||
|
mkQuantSg : Quant -> QuantSg = SgQuant ;
|
||||||
|
mkQuantPl : Quant -> QuantPl = PlQuant ;
|
||||||
|
|
||||||
|
defQuant = DefArt ;
|
||||||
|
indefQuant = IndefArt ;
|
||||||
|
|
||||||
|
massQuant : QuantSg = MassDet ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mkNum = overload {
|
mkNum = overload {
|
||||||
mkNum : Numeral -> Num = NumNumeral ;
|
mkNum : Numeral -> Num = NumNumeral ;
|
||||||
@@ -714,6 +974,21 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
noNum : Num -- [no num]
|
noNum : Num -- [no num]
|
||||||
= NoNum ;
|
= NoNum ;
|
||||||
|
|
||||||
|
n1_Numeral = num (pot2as3 (pot1as2 (pot0as1 pot01))) ;
|
||||||
|
n2_Numeral = num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))) ;
|
||||||
|
n3_Numeral = num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))) ;
|
||||||
|
n4_Numeral = num (pot2as3 (pot1as2 (pot0as1 (pot0 n4)))) ;
|
||||||
|
n5_Numeral = num (pot2as3 (pot1as2 (pot0as1 (pot0 n5)))) ;
|
||||||
|
n6_Numeral = num (pot2as3 (pot1as2 (pot0as1 (pot0 n6)))) ;
|
||||||
|
n7_Numeral = num (pot2as3 (pot1as2 (pot0as1 (pot0 n7)))) ;
|
||||||
|
n8_Numeral = num (pot2as3 (pot1as2 (pot0as1 (pot0 n8)))) ;
|
||||||
|
n9_Numeral = num (pot2as3 (pot1as2 (pot0as1 (pot0 n9)))) ;
|
||||||
|
n10_Numeral = num (pot2as3 (pot1as2 pot110)) ;
|
||||||
|
n20_Numeral = num (pot2as3 (pot1as2 (pot1 n2))) ;
|
||||||
|
n100_Numeral = num (pot2as3 (pot2 pot01)) ;
|
||||||
|
n1000_Numeral = num (pot3 (pot1as2 (pot0as1 pot01))) ;
|
||||||
|
|
||||||
|
|
||||||
mkAdN : CAdv -> AdN = AdnCAdv ; -- more (than five)
|
mkAdN : CAdv -> AdN = AdnCAdv ; -- more (than five)
|
||||||
|
|
||||||
mkOrd = overload {
|
mkOrd = overload {
|
||||||
@@ -781,7 +1056,12 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
mkPhr : Utt -> Phr -- Go home
|
mkPhr : Utt -> Phr -- Go home
|
||||||
= \u -> PhrUtt NoPConj u NoVoc ;
|
= \u -> PhrUtt NoPConj u NoVoc ;
|
||||||
mkPhr : S -> Phr -- I go home
|
mkPhr : S -> Phr -- I go home
|
||||||
= \s -> PhrUtt NoPConj (UttS s) NoVoc
|
= \s -> PhrUtt NoPConj (UttS s) NoVoc ;
|
||||||
|
mkPhr : QS -> Phr -- I go home
|
||||||
|
= \s -> PhrUtt NoPConj (UttQS s) NoVoc ;
|
||||||
|
mkPhr : Imp -> Phr -- I go home
|
||||||
|
= \s -> PhrUtt NoPConj (UttImpSg PPos s) NoVoc
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkPConj : Conj -> PConj = PConjConj ;
|
mkPConj : Conj -> PConj = PConjConj ;
|
||||||
@@ -867,6 +1147,10 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
mkIP = overload {
|
mkIP = overload {
|
||||||
mkIP : IDet -> Num -> Ord -> CN -> IP -- which five best songs
|
mkIP : IDet -> Num -> Ord -> CN -> IP -- which five best songs
|
||||||
= IDetCN ;
|
= IDetCN ;
|
||||||
|
mkIP : IDet -> Ord -> CN -> IP -- which five best songs
|
||||||
|
= \i -> IDetCN i NoNum ;
|
||||||
|
mkIP : IDet -> Num -> CN -> IP -- which five best songs
|
||||||
|
= \i,n -> IDetCN i n NoOrd ;
|
||||||
mkIP : IDet -> N -> IP -- which song
|
mkIP : IDet -> N -> IP -- which song
|
||||||
= \i,n -> IDetCN i NoNum NoOrd (UseN n) ;
|
= \i,n -> IDetCN i NoNum NoOrd (UseN n) ;
|
||||||
mkIP : IP -> Adv -> IP -- who in Europe
|
mkIP : IP -> Adv -> IP -- who in Europe
|
||||||
@@ -886,12 +1170,11 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
= \rp,np,v2 -> RelSlash rp (SlashV2 np v2)
|
= \rp,np,v2 -> RelSlash rp (SlashV2 np v2)
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkRP = overload {
|
which_RP : RP -- which
|
||||||
mkRP : RP -- which
|
|
||||||
= IdRP ;
|
= IdRP ;
|
||||||
mkRP : Prep -> NP -> RP -> RP -- all the roots of which
|
mkRP : Prep -> NP -> RP -> RP -- all the roots of which
|
||||||
= FunRP
|
= FunRP
|
||||||
} ;
|
;
|
||||||
|
|
||||||
mkSlash = overload {
|
mkSlash = overload {
|
||||||
mkSlash : NP -> V2 -> Slash -- (whom) he sees
|
mkSlash : NP -> V2 -> Slash -- (whom) he sees
|
||||||
@@ -944,19 +1227,46 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkQS = overload {
|
mkQS = overload {
|
||||||
mkQS : Tense -> Ant -> Pol -> QCl -> QS
|
|
||||||
= UseQCl ;
|
|
||||||
mkQS : QCl -> QS
|
mkQS : QCl -> QS
|
||||||
= UseQCl TPres ASimul PPos ;
|
= UseQCl TPres ASimul PPos ;
|
||||||
|
mkQS : Tense -> QCl -> QS
|
||||||
|
= \t -> UseQCl t ASimul PPos ;
|
||||||
|
mkQS : Ant -> QCl -> QS
|
||||||
|
= \a -> UseQCl TPres a PPos ;
|
||||||
|
mkQS : Pol -> QCl -> QS
|
||||||
|
= \p -> UseQCl TPres ASimul p ;
|
||||||
|
mkQS : Tense -> Ant -> QCl -> QS
|
||||||
|
= \t,a -> UseQCl t a PPos ;
|
||||||
|
mkQS : Tense -> Pol -> QCl -> QS
|
||||||
|
= \t,p -> UseQCl t ASimul p ;
|
||||||
|
mkQS : Ant -> Pol -> QCl -> QS
|
||||||
|
= \a,p -> UseQCl TPres a p ;
|
||||||
|
mkQS : Tense -> Ant -> Pol -> QCl -> QS
|
||||||
|
= UseQCl ;
|
||||||
mkQS : Cl -> QS
|
mkQS : Cl -> QS
|
||||||
= \x -> UseQCl TPres ASimul PPos (QuestCl x)
|
= \x -> UseQCl TPres ASimul PPos (QuestCl x)
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
mkRS = overload {
|
mkRS = overload {
|
||||||
mkRS : Tense -> Ant -> Pol -> RCl -> RS
|
|
||||||
= UseRCl ;
|
|
||||||
mkRS : RCl -> RS
|
mkRS : RCl -> RS
|
||||||
= UseRCl TPres ASimul PPos
|
= UseRCl TPres ASimul PPos ;
|
||||||
|
mkRS : Tense -> RCl -> RS
|
||||||
|
= \t -> UseRCl t ASimul PPos ;
|
||||||
|
mkRS : Ant -> RCl -> RS
|
||||||
|
= \a -> UseRCl TPres a PPos ;
|
||||||
|
mkRS : Pol -> RCl -> RS
|
||||||
|
= \p -> UseRCl TPres ASimul p ;
|
||||||
|
mkRS : Tense -> Ant -> RCl -> RS
|
||||||
|
= \t,a -> UseRCl t a PPos ;
|
||||||
|
mkRS : Tense -> Pol -> RCl -> RS
|
||||||
|
= \t,p -> UseRCl t ASimul p ;
|
||||||
|
mkRS : Ant -> Pol -> RCl -> RS
|
||||||
|
= \a,p -> UseRCl TPres a p ;
|
||||||
|
mkRS : Tense -> Ant -> Pol -> RCl -> RS
|
||||||
|
= UseRCl
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
param Punct = PFullStop | PExclMark | PQuestMark ;
|
param Punct = PFullStop | PExclMark | PQuestMark ;
|
||||||
@@ -1019,10 +1329,16 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
= ComplVA ;
|
= ComplVA ;
|
||||||
mkVP : V2A -> NP -> AP -> VP -- paint the house red
|
mkVP : V2A -> NP -> AP -> VP -- paint the house red
|
||||||
= ComplV2A ;
|
= ComplV2A ;
|
||||||
|
mkVP : A -> VP -- be warm
|
||||||
|
= \a -> UseComp (CompAP (PositA a)) ;
|
||||||
mkVP : AP -> VP -- be warm
|
mkVP : AP -> VP -- be warm
|
||||||
= \a -> UseComp (CompAP a) ;
|
= \a -> UseComp (CompAP a) ;
|
||||||
mkVP : NP -> VP -- be a man
|
mkVP : NP -> VP -- be a man
|
||||||
= \a -> UseComp (CompNP a) ;
|
= \a -> UseComp (CompNP a) ;
|
||||||
|
mkVP : CN -> VP -- be a man
|
||||||
|
= \y -> (UseComp (CompNP (DetCN (DetSg (SgQuant IndefArt) NoOrd) y))) ;
|
||||||
|
mkVP : N -> VP -- be a man
|
||||||
|
= \y -> (UseComp (CompNP (DetCN (DetSg (SgQuant IndefArt) NoOrd) (UseN y)))) ;
|
||||||
mkVP : Adv -> VP -- be here
|
mkVP : Adv -> VP -- be here
|
||||||
= \a -> UseComp (CompAdv a) ;
|
= \a -> UseComp (CompAdv a) ;
|
||||||
mkVP : VP -> Adv -> VP -- sleep here
|
mkVP : VP -> Adv -> VP -- sleep here
|
||||||
@@ -1032,7 +1348,11 @@ incomplete resource Constructors = open Grammar in {
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
reflexiveVP : V2 -> VP = ReflV2 ;
|
reflexiveVP : V2 -> VP = ReflV2 ;
|
||||||
|
passiveVP = overload {
|
||||||
passiveVP : V2 -> VP = PassV2 ;
|
passiveVP : V2 -> VP = PassV2 ;
|
||||||
|
passiveVP : V2 -> NP -> VP = \v,np ->
|
||||||
|
(AdvVP (PassV2 v) (PrepNP by8agent_Prep np))
|
||||||
|
} ;
|
||||||
progressiveVP : VP -> VP = ProgrVP ;
|
progressiveVP : VP -> VP = ProgrVP ;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user