mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
Resource with extended API
This commit is contained in:
@@ -35,9 +35,9 @@ lin
|
|||||||
|
|
||||||
Individual = UsePN ;
|
Individual = UsePN ;
|
||||||
|
|
||||||
AllN = DetNP AllDet ;
|
AllN = DetNP (AllsDet NoNum) ;
|
||||||
MostN = DetNP MostDet ;
|
MostN = DetNP MostsDet ;
|
||||||
EveryN = DetNP EveryDet ;
|
EveryN = DetNP EveryDet ;
|
||||||
Any = DetNP AnysDet ;
|
Any = DetNP (AnysDet NoNum) ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ cat
|
|||||||
Det ; -- determiner, e.g. "every", "all"
|
Det ; -- determiner, e.g. "every", "all"
|
||||||
Fun ; -- function word, e.g. "mother (of)"
|
Fun ; -- function word, e.g. "mother (of)"
|
||||||
Fun2 ; -- two-place function, e.g. "flight (from) (to)"
|
Fun2 ; -- two-place function, e.g. "flight (from) (to)"
|
||||||
|
Num ; -- numeral, e.g. "three", "879"
|
||||||
|
|
||||||
--3 Adjectives and adjectival phrases
|
--3 Adjectives and adjectival phrases
|
||||||
--
|
--
|
||||||
@@ -64,6 +65,7 @@ cat
|
|||||||
TV ; -- two-place verb, e.g. "love", "wait (for)", "switch on"
|
TV ; -- two-place verb, e.g. "love", "wait (for)", "switch on"
|
||||||
V3 ; -- three-place verb, e.g. "give", "prefer (stg) (to stg)"
|
V3 ; -- three-place verb, e.g. "give", "prefer (stg) (to stg)"
|
||||||
VS ; -- sentence-compl. verb, e.g. "say", "prove"
|
VS ; -- sentence-compl. verb, e.g. "say", "prove"
|
||||||
|
--- VV ; -- verb-compl. verb, e.g. "can", "want"
|
||||||
VP ; -- verb phrase, e.g. "switch the light on"
|
VP ; -- verb phrase, e.g. "switch the light on"
|
||||||
|
|
||||||
--3 Adverbials
|
--3 Adverbials
|
||||||
@@ -124,16 +126,19 @@ fun
|
|||||||
ModAdj : AP -> CN -> CN ; -- "red car"
|
ModAdj : AP -> CN -> CN ; -- "red car"
|
||||||
DetNP : Det -> CN -> NP ; -- "every car"
|
DetNP : Det -> CN -> NP ; -- "every car"
|
||||||
MassNP : CN -> NP ; -- "wine"
|
MassNP : CN -> NP ; -- "wine"
|
||||||
IntNP : Int -> CN -> NP ; -- "86 houses" --- assumes i > 1
|
IndefOneNP : CN -> NP ; -- "a car", "cars"
|
||||||
DefIntNP : Int -> CN -> NP ; -- "the 86 houses" --- assumes i > 1
|
IndefManyNP : Num -> CN -> NP ; -- "houses", "86 houses"
|
||||||
IndefOneNP, IndefManyNP : CN -> NP ; -- "a car", "cars"
|
DefOneNP : CN -> NP ; -- "the car"
|
||||||
DefOneNP, DefManyNP : CN -> NP ; -- "the car", "the cars"
|
DefManyNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
|
||||||
ModGenOne, ModGenMany : NP -> CN -> NP ; -- "John's car", "John's cars"
|
ModGenOne : NP -> CN -> NP ; -- "John's car"
|
||||||
|
ModGenMany : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
|
||||||
UsePN : PN -> NP ; -- "John"
|
UsePN : PN -> NP ; -- "John"
|
||||||
UseFun : Fun -> CN ; -- "successor"
|
UseFun : Fun -> CN ; -- "successor"
|
||||||
AppFun : Fun -> NP -> CN ; -- "successor of zero"
|
AppFun : Fun -> NP -> CN ; -- "successor of zero"
|
||||||
AppFun2 : Fun2 -> NP -> Fun ; -- "flight from Paris"
|
AppFun2 : Fun2 -> NP -> Fun ; -- "flight from Paris"
|
||||||
CNthatS : CN -> S -> CN ; -- "idea that the Earth is flat"
|
CNthatS : CN -> S -> CN ; -- "idea that the Earth is flat"
|
||||||
|
UseInt : Int -> Num ; -- "32" --- assumes i > 1
|
||||||
|
NoNum : Num ; -- no numeral modifier
|
||||||
|
|
||||||
--3 Adjectives and adjectival phrases
|
--3 Adjectives and adjectival phrases
|
||||||
--
|
--
|
||||||
@@ -153,17 +158,21 @@ fun
|
|||||||
PosTV, NegTV : TV -> NP -> VP ; -- "sees John", "doesn't see John"
|
PosTV, NegTV : TV -> NP -> VP ; -- "sees John", "doesn't see John"
|
||||||
PosPassV, NegPassV : V -> VP ; -- "is seen", "is not seen"
|
PosPassV, NegPassV : V -> VP ; -- "is seen", "is not seen"
|
||||||
PosNP, NegNP : NP -> VP ; -- "is John", "is not John"
|
PosNP, NegNP : NP -> VP ; -- "is John", "is not John"
|
||||||
|
PosAdV, NegAdV : AdV -> VP ; -- "is everywhere", "is not in France"
|
||||||
PosVS, NegVS : VS -> S -> VP ; -- "says that I run", "doesn't say..."
|
PosVS, NegVS : VS -> S -> VP ; -- "says that I run", "doesn't say..."
|
||||||
|
--- PosVV, NegVV : VV -> VP -> VP ; -- "can run", "can't run", "tries to run"
|
||||||
PosV3, NegV3 : V3 -> NP -> NP -> VP ; -- "prefers wine to beer"
|
PosV3, NegV3 : V3 -> NP -> NP -> VP ; -- "prefers wine to beer"
|
||||||
VTrans : TV -> V ; -- "loves"
|
VTrans : TV -> V ; -- "loves"
|
||||||
|
|
||||||
--3 Adverbials
|
--3 Adverbials
|
||||||
--
|
--
|
||||||
|
-- Here is how complex adverbials can be formed and used.
|
||||||
|
|
||||||
|
AdjAdv : AP -> AdV ; -- "freely", "more consciously than you"
|
||||||
|
PrepNP : Prep -> NP -> AdV ; -- "in London", "after the war"
|
||||||
|
|
||||||
AdvVP : VP -> AdV -> VP ; -- "always walks", "walks in the park"
|
AdvVP : VP -> AdV -> VP ; -- "always walks", "walks in the park"
|
||||||
PrepNP : Prep -> NP -> AdV ; -- "in London", "after the war"
|
|
||||||
AdvCN : CN -> AdV -> CN ; -- "house in London", "house today"
|
AdvCN : CN -> AdV -> CN ; -- "house in London", "house today"
|
||||||
|
|
||||||
AdvAP : AdA -> AP -> AP ; -- "very good"
|
AdvAP : AdA -> AP -> AP ; -- "very good"
|
||||||
|
|
||||||
|
|
||||||
@@ -173,7 +182,8 @@ fun
|
|||||||
PredVP : NP -> VP -> S ; -- "John walks"
|
PredVP : NP -> VP -> S ; -- "John walks"
|
||||||
PosSlashTV, NegSlashTV : NP -> TV -> Slash ; -- "John sees", "John doesn's see"
|
PosSlashTV, NegSlashTV : NP -> TV -> Slash ; -- "John sees", "John doesn's see"
|
||||||
OneVP : VP -> S ; -- "one walks"
|
OneVP : VP -> S ; -- "one walks"
|
||||||
ThereIsCN, ThereAreCN : CN -> S ; -- "there is a car", "there are cars"
|
ThereIsCN : CN -> S ; -- "there is a bar"
|
||||||
|
ThereAreCN : Num -> CN -> S ; -- "there are 86 bars"
|
||||||
|
|
||||||
IdRP : RP ; -- "which"
|
IdRP : RP ; -- "which"
|
||||||
FunRP : Fun -> RP -> RP ; -- "the successor of which"
|
FunRP : Fun -> RP -> RP ; -- "the successor of which"
|
||||||
@@ -194,7 +204,8 @@ fun
|
|||||||
IntVP : IP -> VP -> Qu ; -- "who walks"
|
IntVP : IP -> VP -> Qu ; -- "who walks"
|
||||||
IntSlash : IP -> Slash -> Qu ; -- "whom does John see"
|
IntSlash : IP -> Slash -> Qu ; -- "whom does John see"
|
||||||
QuestAdv : IAdv -> NP -> VP -> Qu ; -- "why do you walk"
|
QuestAdv : IAdv -> NP -> VP -> Qu ; -- "why do you walk"
|
||||||
IsThereCN, AreThereCN : CN -> Qu ; -- "is there a bar", "are there bars"
|
IsThereCN : CN -> Qu ; -- "is there a bar"
|
||||||
|
AreThereCN : Num -> CN -> Qu ; -- "are there (86) bars"
|
||||||
|
|
||||||
ImperVP : VP -> Imp ; -- "be a man"
|
ImperVP : VP -> Imp ; -- "be a man"
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,26 @@
|
|||||||
abstract Structural = Combinations ** {
|
abstract Structural = Combinations ** {
|
||||||
|
|
||||||
fun
|
fun
|
||||||
EveryDet, AllDet, WhichDet, MostDet : Det ; -- every, all, which, most
|
EveryDet, WhichDet, AllDet, -- every, sg which, sg all
|
||||||
SomeDet, SomesDet, AnyDet, AnysDet, NoDet, -- sg/pl some, any, no
|
SomeDet, AnyDet, NoDet, -- sg some, any, no
|
||||||
NosDet, ManyDet, MuchDet : Det ; -- many, much
|
MostDet, MostsDet, ManyDet, MuchDet : Det ; -- sg most, pl most, many, much
|
||||||
ThisDet, TheseDet, ThatDet, ThoseDet : Det ;-- (this, these, that, those) car(s)
|
ThisDet, ThatDet : Det ; -- this, that
|
||||||
ThisNP, TheseNP, ThatNP, ThoseNP : NP ; -- this, these, that, those
|
|
||||||
|
-- Many plural determiners can take a numeral modifier.
|
||||||
|
|
||||||
|
AllsDet, WhichsDet, -- pl all, which (86)
|
||||||
|
SomesDet, AnysDet, NosDet, -- pl some, any, no
|
||||||
|
TheseDet, ThoseDet : Num -> Det ; -- these, those (86)
|
||||||
|
ThisNP, ThatNP : NP ; -- this, that
|
||||||
|
TheseNP, ThoseNP : Num -> NP ; -- these, those (86)
|
||||||
INP, ThouNP, HeNP, SheNP, ItNP : NP ; -- personal pronouns in singular
|
INP, ThouNP, HeNP, SheNP, ItNP : NP ; -- personal pronouns in singular
|
||||||
WeNP, YeNP, TheyNP : NP ; -- personal pronouns in plural
|
WeNP, YeNP : Num -> NP ; -- these pronouns can take numeral
|
||||||
|
TheyNP : NP ; -- personal pronouns in plural
|
||||||
YouNP : NP ; -- the polite you
|
YouNP : NP ; -- the polite you
|
||||||
EverybodyNP, SomebodyNP, NobodyNP, -- everybody, somebody, nobody
|
EverybodyNP, SomebodyNP, NobodyNP, -- everybody, somebody, nobody
|
||||||
EverythingNP, SomethingNP, NothingNP : NP ; -- everything, something, nothing
|
EverythingNP, SomethingNP, NothingNP : NP ; -- everything, something, nothing
|
||||||
|
--- CanVV, CanKnowVV, MustVV : VV ; -- can (pouvoir/savoir), must
|
||||||
|
--- WantVV : VV ; -- want (to do)
|
||||||
WhenIAdv,WhereIAdv,WhyIAdv,HowIAdv : IAdv ; -- when, where, why, how
|
WhenIAdv,WhereIAdv,WhyIAdv,HowIAdv : IAdv ; -- when, where, why, how
|
||||||
EverywhereNP, SomewhereNP, NowhereNP : AdV ;-- everywhere, somewhere, nowhere
|
EverywhereNP, SomewhereNP, NowhereNP : AdV ;-- everywhere, somewhere, nowhere
|
||||||
AndConj, OrConj : Conj ; -- and, or
|
AndConj, OrConj : Conj ; -- and, or
|
||||||
@@ -32,5 +42,6 @@ fun
|
|||||||
InFrontPrep, BehindPrep, BetweenPrep : Prep ;
|
InFrontPrep, BehindPrep, BetweenPrep : Prep ;
|
||||||
BeforePrep, DuringPrep, AfterPrep : Prep ; -- temporal relations
|
BeforePrep, DuringPrep, AfterPrep : Prep ; -- temporal relations
|
||||||
WithPrep, WithoutPrep, ByMeansPrep : Prep ; -- some other relations
|
WithPrep, WithoutPrep, ByMeansPrep : Prep ; -- some other relations
|
||||||
|
PartPrep : Prep ; -- partitive "of" ("bottle of wine")
|
||||||
AgentPrep : Prep ; -- agent "by" in passive constructions
|
AgentPrep : Prep ; -- agent "by" in passive constructions
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ abstract TestResource = Structural ** {
|
|||||||
-- a random sample of lexicon to test resource grammar with
|
-- a random sample of lexicon to test resource grammar with
|
||||||
|
|
||||||
fun
|
fun
|
||||||
Big, Small, Old, Young : AdjDeg ;
|
Big, Happy, Small, Old, Young : AdjDeg ;
|
||||||
American, Finnish : Adj1 ;
|
American, Finnish : Adj1 ;
|
||||||
Married : Adj2 ;
|
Married : Adj2 ;
|
||||||
Man, Woman, Car, House, Light : N ;
|
Man, Woman, Car, House, Light, Bar, Bottle, Wine : N ;
|
||||||
Walk, Run : V ;
|
Walk, Run : V ;
|
||||||
Send, Wait, Love, SwitchOn, SwitchOff : TV ;
|
Send, Wait, Love, Drink, SwitchOn, SwitchOff : TV ;
|
||||||
Give, Prefer : V3 ;
|
Give, Prefer : V3 ;
|
||||||
Say, Prove : VS ;
|
Say, Prove : VS ;
|
||||||
Mother, Uncle : Fun ;
|
Mother, Uncle : Fun ;
|
||||||
|
|||||||
@@ -2,58 +2,82 @@
|
|||||||
|
|
||||||
-- Combinations.gf
|
-- Combinations.gf
|
||||||
cat
|
cat
|
||||||
Prep ; -- pre/postposition and/or case
|
Prep ; -- pre/postposition and/or case e.g.
|
||||||
|
Num ; -- numeral, e.g. "three", "879"
|
||||||
|
--- VV ; -- verb-compl. verb, e.g. "can", "want"
|
||||||
|
|
||||||
fun
|
fun
|
||||||
ThereIsCN, ThereAreCN : CN -> S ; -- "there is a bar", "there are bars"
|
ThereIsCN : CN -> S ; -- "there is a bar", "there are bars"
|
||||||
|
ThereAreCN : Num -> CN -> S ; -- "there are 86 bars"
|
||||||
PrepNP : Prep -> NP -> AdV ; -- "in London", "after the war" (replace LocNP)
|
PrepNP : Prep -> NP -> AdV ; -- "in London", "after the war" (replace LocNP)
|
||||||
MassNP : CN -> NP ; -- "wine"
|
MassNP : CN -> NP ; -- "wine"
|
||||||
IntNP : Int -> CN -> NP ; -- "86 houses" --- assumes i > 1
|
--- PosVV, NegVV : VV -> VP -> VP ; -- "can run", "can't run", "tries to run"
|
||||||
DefIntNP : Int -> CN -> NP ; -- "the 86 houses" --- assumes i > 1
|
PosAdV, NegAdV : AdV -> VP ; -- "is everywhere", "is not in France"
|
||||||
|
AdjAdv : AP -> AdV ; -- "freely", "more consciously than you"
|
||||||
IsThereCN, AreThereCN : CN -> Qu ;-- "is there a bar", "are there bars"
|
IsThereCN, AreThereCN : CN -> Qu ;-- "is there a bar", "are there bars"
|
||||||
|
|
||||||
Warning: no linearization of AdvAP
|
|
||||||
checking module ResFra
|
-- changed type signatures: added Num
|
||||||
Warning: no linearization of AdvS
|
IndefManyNP : Num -> CN -> NP ; -- "houses", "86 houses"
|
||||||
checking module ResFra
|
DefManyNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
|
||||||
Warning: no linearization of AppFun2
|
ModGenMany : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
|
||||||
checking module ResFra
|
|
||||||
Warning: no linearization of CNthatS
|
UseInt : Int -> Num ; -- "32" --- assumes i > 1
|
||||||
checking module ResFra
|
NoNum : Num ; -- no numeral modifier
|
||||||
Warning: no linearization of ConsPhr
|
|
||||||
checking module ResFra
|
IsThereCN, AreThereCN : CN -> Qu ;-- "is there a bar", "are there bars"
|
||||||
Warning: no linearization of ItNP
|
|
||||||
checking module ResFra
|
-- from Hajo's work
|
||||||
Warning: no linearization of NegPassV
|
|
||||||
checking module ResFra
|
AdvAP
|
||||||
Warning: no linearization of NegV3
|
|
||||||
checking module ResFra
|
AdvS
|
||||||
Warning: no linearization of OnePhr
|
|
||||||
checking module ResFra
|
AppFun2
|
||||||
Warning: no linearization of OneVP
|
|
||||||
checking module ResFra
|
CNthatS
|
||||||
Warning: no linearization of OtherwiseAdv
|
|
||||||
checking module ResFra
|
ConsPhr
|
||||||
Warning: no linearization of PosPassV
|
|
||||||
checking module ResFra
|
ItNP
|
||||||
Warning: no linearization of PosV3
|
|
||||||
checking module ResFra
|
NegPassV
|
||||||
Warning: no linearization of SubjVP
|
|
||||||
checking module ResFra
|
NegV3
|
||||||
Warning: no linearization of ThereforeAdv
|
|
||||||
checking module ResFra
|
OnePhr
|
||||||
Warning: no linearization of TooAdv
|
|
||||||
checking module ResFra
|
OneVP
|
||||||
Warning: no linearization of VTrans
|
|
||||||
checking module ResFra
|
OtherwiseAdv
|
||||||
Warning: no linearization of VeryAdv
|
|
||||||
|
PosPassV
|
||||||
|
|
||||||
|
PosV3
|
||||||
|
|
||||||
|
SubjVP
|
||||||
|
|
||||||
|
ThereforeAdv
|
||||||
|
|
||||||
|
TooAdv
|
||||||
|
|
||||||
|
VTrans
|
||||||
|
|
||||||
|
VeryAdv
|
||||||
|
|
||||||
|
|
||||||
-- Structural.gf
|
-- Structural.gf
|
||||||
|
|
||||||
SomeDet, SomesDet, AnyDet, AnysDet, NoDet, -- sg/pl some, any, no
|
-- Some of these are just changes to Num -> Det|NP.
|
||||||
NosDet, ManyDet, MuchDet : Det ; -- many, much
|
AllDet : Det ; -- sg all
|
||||||
ThisDet, TheseDet, ThatDet, ThoseDet : Det ;-- this, these, that, those
|
AllsDet, WhichsDet, -- pl all, which (86)
|
||||||
ThisNP, TheseNP, ThatNP, ThoseNP : NP ; -- this, these, that, those
|
SomesDet, AnysDet, NosDet, -- pl some, any, no
|
||||||
|
TheseDet, ThoseDet : Num -> Det ; -- these, those (86)
|
||||||
|
ThisNP, TheseNP : NP ; -- this, that
|
||||||
|
TheseNP, ThoseNP : Num -> NP ; -- these, those (86)
|
||||||
|
INP, ThouNP, HeNP, SheNP, ItNP : NP ; -- personal pronouns in singular
|
||||||
|
WeNP, YeNP : Num -> NP ; -- these pronouns can take numeral
|
||||||
|
|
||||||
EverybodyNP, SomebodyNP, NobodyNP, -- everybody, somebody, nobody
|
EverybodyNP, SomebodyNP, NobodyNP, -- everybody, somebody, nobody
|
||||||
EverythingNP, SomethingNP, NothingNP : NP ; -- everything, something, nothing
|
EverythingNP, SomethingNP, NothingNP : NP ; -- everything, something, nothing
|
||||||
EverywhereNP, SomewhereNP, NowhereNP : Adv ;-- everywhere, somewhere, nowhere
|
EverywhereNP, SomewhereNP, NowhereNP : Adv ;-- everywhere, somewhere, nowhere
|
||||||
@@ -64,18 +88,20 @@ Warning: no linearization of VeryAdv
|
|||||||
InFrontPrep, BehindPrep, BetweenPrep : Prep ;
|
InFrontPrep, BehindPrep, BetweenPrep : Prep ;
|
||||||
BeforePrep, DuringPrep, AfterPrep : Prep ; -- temporal relations
|
BeforePrep, DuringPrep, AfterPrep : Prep ; -- temporal relations
|
||||||
WithPrep, WithoutPrep, ByMeansPrep : Prep ; -- some other relations
|
WithPrep, WithoutPrep, ByMeansPrep : Prep ; -- some other relations
|
||||||
|
PartPrep : Prep ; -- partitive "of" ("bottle of wine")
|
||||||
AgentPrep : Prep ; -- agent "by" in passive constructions
|
AgentPrep : Prep ; -- agent "by" in passive constructions
|
||||||
|
|
||||||
|
|
||||||
checking module TestFra
|
|
||||||
Warning: no linearization of American
|
American
|
||||||
checking module TestFra
|
|
||||||
Warning: no linearization of Connection
|
Connection
|
||||||
checking module TestFra
|
|
||||||
Warning: no linearization of Finnish
|
Finnish
|
||||||
checking module TestFra
|
|
||||||
Warning: no linearization of Give
|
Give
|
||||||
checking module TestFra
|
|
||||||
Warning: no linearization of Married
|
Married
|
||||||
checking module TestFra
|
|
||||||
Warning: no linearization of Prefer
|
Prefer
|
||||||
|
|
||||||
|
|||||||
@@ -37,11 +37,12 @@ lincat
|
|||||||
Fun = Function ;
|
Fun = Function ;
|
||||||
-- = CommNounPhrase ** {s2 : Preposition} ;
|
-- = CommNounPhrase ** {s2 : Preposition} ;
|
||||||
Fun2 = Function ** {s3 : Preposition} ;
|
Fun2 = Function ** {s3 : Preposition} ;
|
||||||
|
Num = {s : Case => Str} ;
|
||||||
|
|
||||||
Adj1 = Adjective ;
|
Adj1 = Adjective ;
|
||||||
-- = {s : Str}
|
-- = {s : AForm => Str}
|
||||||
Adj2 = Adjective ** {s2 : Preposition} ;
|
Adj2 = Adjective ** {s2 : Preposition} ;
|
||||||
AdjDeg = {s : Degree => Str} ;
|
AdjDeg = {s : Degree => AForm => Str} ;
|
||||||
AP = Adjective ** {p : Bool} ;
|
AP = Adjective ** {p : Bool} ;
|
||||||
|
|
||||||
V = Verb ;
|
V = Verb ;
|
||||||
@@ -51,6 +52,7 @@ lincat
|
|||||||
-- = Verb ** {s3 : Preposition} ;
|
-- = Verb ** {s3 : Preposition} ;
|
||||||
V3 = TransVerb ** {s4 : Preposition} ;
|
V3 = TransVerb ** {s4 : Preposition} ;
|
||||||
VS = Verb ;
|
VS = Verb ;
|
||||||
|
VV = Verb ** {isAux : Bool} ;
|
||||||
|
|
||||||
AdV = {s : Str ; p : Bool} ;
|
AdV = {s : Str ; p : Bool} ;
|
||||||
|
|
||||||
@@ -69,7 +71,7 @@ lincat
|
|||||||
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
|
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
|
||||||
|
|
||||||
ListS = {s1 : Str ; s2 : Str} ;
|
ListS = {s1 : Str ; s2 : Str} ;
|
||||||
ListAP = {s1 : Str ; s2 : Str ; p : Bool} ;
|
ListAP = {s1,s2 : AForm => Str ; p : Bool} ;
|
||||||
ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : Person} ;
|
ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : Person} ;
|
||||||
|
|
||||||
--.
|
--.
|
||||||
@@ -77,7 +79,7 @@ lincat
|
|||||||
lin
|
lin
|
||||||
UseN = noun2CommNounPhrase ;
|
UseN = noun2CommNounPhrase ;
|
||||||
ModAdj = modCommNounPhrase ;
|
ModAdj = modCommNounPhrase ;
|
||||||
ModGenOne = npGenDet singular ;
|
ModGenOne = npGenDet singular noNum ;
|
||||||
ModGenMany = npGenDet plural ;
|
ModGenMany = npGenDet plural ;
|
||||||
UsePN = nameNounPhrase ;
|
UsePN = nameNounPhrase ;
|
||||||
UseFun = funAsCommNounPhrase ;
|
UseFun = funAsCommNounPhrase ;
|
||||||
@@ -91,14 +93,14 @@ lin
|
|||||||
|
|
||||||
DetNP = detNounPhrase ;
|
DetNP = detNounPhrase ;
|
||||||
IndefOneNP = indefNounPhrase singular ;
|
IndefOneNP = indefNounPhrase singular ;
|
||||||
IndefManyNP = indefNounPhrase plural ;
|
IndefManyNP = indefNounPhraseNum plural ;
|
||||||
DefOneNP = defNounPhrase singular ;
|
DefOneNP = defNounPhrase singular ;
|
||||||
DefManyNP = defNounPhrase plural ;
|
DefManyNP = defNounPhraseNum plural ;
|
||||||
MassNP = detNounPhrase (mkDeterminer Sg []) ;
|
MassNP = detNounPhrase (mkDeterminer Sg []) ;
|
||||||
IntNP n = detNounPhrase (mkDeterminer Pl n.s) ;
|
|
||||||
DefIntNP n = detNounPhrase (mkDeterminer Pl ("the" ++ n.s)) ;
|
|
||||||
|
|
||||||
CNthatS = nounThatSentence ;
|
CNthatS = nounThatSentence ;
|
||||||
|
UseInt i = {s = table {Nom => i.s ; Gen => i.s ++ "'s"}} ; ---
|
||||||
|
NoNum = noNum ;
|
||||||
|
|
||||||
PredVP = predVerbPhrase ;
|
PredVP = predVerbPhrase ;
|
||||||
PosV = predVerb True ;
|
PosV = predVerb True ;
|
||||||
@@ -115,12 +117,17 @@ lin
|
|||||||
NegPassV = passVerb False ;
|
NegPassV = passVerb False ;
|
||||||
PosNP = predNounPhrase True ;
|
PosNP = predNounPhrase True ;
|
||||||
NegNP = predNounPhrase False ;
|
NegNP = predNounPhrase False ;
|
||||||
|
PosAdV = predAdverb True ;
|
||||||
|
NegAdV = predAdverb False ;
|
||||||
PosVS = complSentVerb True ;
|
PosVS = complSentVerb True ;
|
||||||
NegVS = complSentVerb False ;
|
NegVS = complSentVerb False ;
|
||||||
|
--- PosVV = complVerbVerb True ;
|
||||||
|
--- NegVV = complVerbVerb False ;
|
||||||
VTrans = transAsVerb ;
|
VTrans = transAsVerb ;
|
||||||
|
|
||||||
AdvVP = adVerbPhrase ;
|
AdjAdv a = advPost (a.s ! AAdv) ;
|
||||||
PrepNP p = prepPhrase p.s ; ---
|
PrepNP p = prepPhrase p.s ; ---
|
||||||
|
AdvVP = adVerbPhrase ;
|
||||||
AdvCN = advCommNounPhrase ;
|
AdvCN = advCommNounPhrase ;
|
||||||
AdvAP = advAdjPhrase ;
|
AdvAP = advAdjPhrase ;
|
||||||
|
|
||||||
@@ -129,8 +136,8 @@ lin
|
|||||||
OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ;
|
OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ;
|
||||||
ThereIsCN A = prefixSS ["there is"] ---
|
ThereIsCN A = prefixSS ["there is"] ---
|
||||||
(defaultNounPhrase (indefNounPhrase singular A)) ;
|
(defaultNounPhrase (indefNounPhrase singular A)) ;
|
||||||
ThereAreCN A = prefixSS ["there are"]
|
ThereAreCN n A = prefixSS ["there are"]
|
||||||
(defaultNounPhrase (indefNounPhrase plural A)) ;
|
(defaultNounPhrase (indefNounPhraseNum plural n A)) ;
|
||||||
|
|
||||||
IdRP = identRelPron ;
|
IdRP = identRelPron ;
|
||||||
FunRP = funRelPron ;
|
FunRP = funRelPron ;
|
||||||
@@ -151,7 +158,7 @@ lin
|
|||||||
IntVP = intVerbPhrase ;
|
IntVP = intVerbPhrase ;
|
||||||
IntSlash = intSlash ;
|
IntSlash = intSlash ;
|
||||||
QuestAdv = questAdverbial ;
|
QuestAdv = questAdverbial ;
|
||||||
IsThereCN = isThere singular ;
|
IsThereCN = isThere singular noNum ;
|
||||||
AreThereCN = isThere plural ;
|
AreThereCN = isThere plural ;
|
||||||
|
|
||||||
ImperVP = imperVerbPhrase ;
|
ImperVP = imperVerbPhrase ;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
--# -path=.:../../prelude
|
||||||
|
|
||||||
--1 A Simple English Resource Morphology
|
--1 A Simple English Resource Morphology
|
||||||
--
|
--
|
||||||
-- Aarne Ranta 2002
|
-- Aarne Ranta 2002
|
||||||
@@ -7,7 +9,7 @@
|
|||||||
--
|
--
|
||||||
-- We use the parameter types and word classes defined in $Types.gf$.
|
-- We use the parameter types and word classes defined in $Types.gf$.
|
||||||
|
|
||||||
resource MorphoEng = TypesEng ** open Prelude in {
|
resource MorphoEng = TypesEng ** open Prelude, (Predef=Predef) in {
|
||||||
|
|
||||||
--2 Nouns
|
--2 Nouns
|
||||||
--
|
--
|
||||||
@@ -90,25 +92,58 @@ oper
|
|||||||
|
|
||||||
--2 Adjectives
|
--2 Adjectives
|
||||||
--
|
--
|
||||||
-- For the comparison of adjectives, three forms are needed in the worst case.
|
-- To form the adjectival and the adverbial forms, two strings are needed
|
||||||
|
-- in the worst case.
|
||||||
|
|
||||||
mkAdjDegr : (_,_,_ : Str) -> AdjDegr = \good,better,best ->
|
mkAdjective : Str -> Str -> Adjective = \free,freely -> {
|
||||||
{s = table {Pos => good ; Comp => better ; Sup => best}} ;
|
s = table {
|
||||||
|
AAdj => free ;
|
||||||
|
AAdv => freely
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- However, the ending "iy" is sufficient for most cases. This function
|
||||||
|
-- automatically changes the word-final "y" to "i" ("happy" - "happily").
|
||||||
|
-- N.B. this is not correct for "shy", but $mkAdjective$ has to be used.
|
||||||
|
|
||||||
adjDegrReg : Str -> AdjDegr = \long ->
|
regAdjective : Str -> Adjective = \free ->
|
||||||
mkAdjDegr long (long + "er") (long + "est") ;
|
let
|
||||||
|
y = Predef.dp 1 free
|
||||||
|
in mkAdjective
|
||||||
|
free
|
||||||
|
(ifTok Str y "y" (Predef.tk 1 free + ("ily")) (free + "ly")) ;
|
||||||
|
|
||||||
adjDegrY : Str -> AdjDegr = \lovel ->
|
-- For the comparison of adjectives, six forms are needed to cover all cases.
|
||||||
mkAdjDegr (lovel + "y") (lovel + "ier") (lovel + "iest") ;
|
-- But there is no adjective that actually needs all these.
|
||||||
|
|
||||||
|
mkAdjDegrWorst : (_,_,_,_,_,_ : Str) -> AdjDegr =
|
||||||
|
\good,well,better,betterly,best,bestly ->
|
||||||
|
{s = table {
|
||||||
|
Pos => (mkAdjective good well).s ;
|
||||||
|
Comp => (mkAdjective better betterly).s ;
|
||||||
|
Sup => (mkAdjective best bestly).s
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- What is usually needed for irregular comparisons are just three forms,
|
||||||
|
-- since the adverbial form is the same (in comparative or superlative)
|
||||||
|
-- or formed in the regular way (positive).
|
||||||
|
|
||||||
|
adjDegrIrreg : (_,_,_ : Str) -> AdjDegr = \bad,worse,worst ->
|
||||||
|
let badly = (regAdjective bad).s ! AAdv
|
||||||
|
in mkAdjDegrWorst bad badly worse worse worst worst ;
|
||||||
|
|
||||||
|
-- Like above, the regular formation takes account of final "y".
|
||||||
|
|
||||||
|
adjDegrReg : Str -> AdjDegr = \happy ->
|
||||||
|
let happi = ifTok Str (Predef.dp 1 happy) "y" (Predef.tk 1 happy + "i") happy
|
||||||
|
in adjDegrIrreg happy (happi + "er") (happi + "est") ;
|
||||||
|
|
||||||
-- Many adjectives are 'inflected' by adding a comparison word.
|
-- Many adjectives are 'inflected' by adding a comparison word.
|
||||||
|
|
||||||
adjDegrLong : Str -> AdjDegr = \ridiculous ->
|
adjDegrLong : Str -> AdjDegr = \ridiculous ->
|
||||||
mkAdjDegr ridiculous ("more" ++ ridiculous) ("most" ++ ridiculous) ;
|
adjDegrIrreg ridiculous ("more" ++ ridiculous) ("most" ++ ridiculous) ;
|
||||||
|
|
||||||
-- simple adjectives are just strings
|
|
||||||
|
|
||||||
simpleAdj : Str -> Adjective = ss ;
|
|
||||||
|
|
||||||
--3 Verbs
|
--3 Verbs
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -92,12 +92,12 @@ oper
|
|||||||
mkAdj2 : (divisible, by : Str) -> Adj2 ;
|
mkAdj2 : (divisible, by : Str) -> Adj2 ;
|
||||||
|
|
||||||
-- Comparison adjectives have three forms. The common irregular
|
-- Comparison adjectives have three forms. The common irregular
|
||||||
-- cases are ones ending with "y" and a consonant that is duplicated.
|
-- cases are ones ending with "y" and a consonant that is duplicated;
|
||||||
|
-- the "y" ending is recognized by the function $aReg$.
|
||||||
|
|
||||||
mkAdjDeg : (good,better,best : Str) -> AdjDeg ;
|
mkAdjDeg : (good,better,best : Str) -> AdjDeg ;
|
||||||
|
|
||||||
aReg : (long : Str) -> AdjDeg ; -- long, longer, longest
|
aReg : (long : Str) -> AdjDeg ; -- long, longer, longest
|
||||||
aHappy : (happy : Str) -> AdjDeg ; -- happy, happier, happiest
|
|
||||||
aFat : (fat : Str) -> AdjDeg ; -- fat, fatter, fattest
|
aFat : (fat : Str) -> AdjDeg ; -- fat, fatter, fattest
|
||||||
aRidiculous : (ridiculous : Str) -> AdjDeg ; -- -/more/most ridiculous
|
aRidiculous : (ridiculous : Str) -> AdjDeg ; -- -/more/most ridiculous
|
||||||
|
|
||||||
@@ -197,11 +197,10 @@ oper
|
|||||||
addGenN : (Str -> CommonNoun) -> Str -> Gender -> N = \f ->
|
addGenN : (Str -> CommonNoun) -> Str -> Gender -> N = \f ->
|
||||||
\s,g -> f s ** {g = g ; lock_N = <>} ;
|
\s,g -> f s ** {g = g ; lock_N = <>} ;
|
||||||
|
|
||||||
mkAdj1 a = simpleAdj a ** {lock_Adj1 = <>} ;
|
mkAdj1 a = regAdjective a ** {lock_Adj1 = <>} ;
|
||||||
mkAdj2 = \s,p -> simpleAdj s ** {s2 = p} ** {lock_Adj2 = <>} ;
|
mkAdj2 = \s,p -> regAdjective s ** {s2 = p} ** {lock_Adj2 = <>} ;
|
||||||
mkAdjDeg a b c = mkAdjDegr a b c ** {lock_AdjDeg = <>} ;
|
mkAdjDeg a b c = adjDegrIrreg a b c ** {lock_AdjDeg = <>} ;
|
||||||
aReg a = adjDegrReg a ** {lock_AdjDeg = <>} ;
|
aReg a = adjDegrReg a ** {lock_AdjDeg = <>} ;
|
||||||
aHappy = \happy -> adjDegrY (Predef.tk 1 happy) ** {lock_AdjDeg = <>} ;
|
|
||||||
aFat = \fat -> let {fatt = fat + Predef.dp 1 fat} in
|
aFat = \fat -> let {fatt = fat + Predef.dp 1 fat} in
|
||||||
mkAdjDeg fat (fatt + "er") (fatt + "est") ;
|
mkAdjDeg fat (fatt + "er") (fatt + "est") ;
|
||||||
aRidiculous a = adjDegrLong a ** {lock_AdjDeg = <>} ;
|
aRidiculous a = adjDegrLong a ** {lock_AdjDeg = <>} ;
|
||||||
|
|||||||
@@ -12,32 +12,35 @@ concrete StructuralEng of Structural =
|
|||||||
HeNP = pronHe ;
|
HeNP = pronHe ;
|
||||||
SheNP = pronShe ;
|
SheNP = pronShe ;
|
||||||
ItNP = pronIt ;
|
ItNP = pronIt ;
|
||||||
WeNP = pronWe ;
|
WeNP = pronWithNum pronWe ;
|
||||||
YeNP = pronYouPl ;
|
YeNP = pronWithNum pronYouPl ;
|
||||||
YouNP = pronYouSg ;
|
YouNP = pronYouSg ;
|
||||||
TheyNP = pronThey ;
|
TheyNP = pronThey ;
|
||||||
|
|
||||||
EveryDet = everyDet ;
|
EveryDet = everyDet ;
|
||||||
AllDet = allDet ;
|
AllDet = mkDeterminer Sg "all" ; --- all the missing
|
||||||
|
AllsDet = mkDeterminerNum Pl "all" ;
|
||||||
WhichDet = whichDet ;
|
WhichDet = whichDet ;
|
||||||
MostDet = mostDet ;
|
WhichsDet = mkDeterminerNum Pl "which" ;
|
||||||
|
MostsDet = mostDet ;
|
||||||
|
MostDet = mkDeterminer Sg "most" ;
|
||||||
SomeDet = mkDeterminer Sg "some" ;
|
SomeDet = mkDeterminer Sg "some" ;
|
||||||
SomesDet = mkDeterminer Pl "some" ;
|
SomesDet = mkDeterminerNum Pl "some" ;
|
||||||
AnyDet = mkDeterminer Sg "any" ;
|
AnyDet = mkDeterminer Sg "any" ;
|
||||||
AnysDet = mkDeterminer Pl "any" ;
|
AnysDet = mkDeterminerNum Pl "any" ;
|
||||||
NoDet = mkDeterminer Sg "no" ;
|
NoDet = mkDeterminer Sg "no" ;
|
||||||
NosDet = mkDeterminer Pl "no" ;
|
NosDet = mkDeterminerNum Pl "no" ;
|
||||||
ManyDet = mkDeterminer Sg "many" ;
|
ManyDet = mkDeterminer Sg "many" ;
|
||||||
MuchDet = mkDeterminer Sg ["a lot of"] ; ---
|
MuchDet = mkDeterminer Sg ["a lot of"] ; ---
|
||||||
ThisDet = mkDeterminer Sg "this" ;
|
ThisDet = mkDeterminer Sg "this" ;
|
||||||
TheseDet = mkDeterminer Pl "these" ;
|
TheseDet = mkDeterminerNum Pl "these" ;
|
||||||
ThatDet = mkDeterminer Sg "that" ;
|
ThatDet = mkDeterminer Sg "that" ;
|
||||||
ThoseDet = mkDeterminer Pl "those" ;
|
ThoseDet = mkDeterminerNum Pl "those" ;
|
||||||
|
|
||||||
ThisNP = nameNounPhrase (nameReg "this") ;
|
ThisNP = nameNounPhrase (nameReg "this") ;
|
||||||
TheseNP = nameNounPhrase (nameReg "these") ;
|
|
||||||
ThatNP = nameNounPhrase (nameReg "that") ;
|
ThatNP = nameNounPhrase (nameReg "that") ;
|
||||||
ThoseNP = nameNounPhrase (nameReg "those") ;
|
TheseNP n = nameNounPhrase {s = \\c => "these" ++ n.s ! c} ;
|
||||||
|
ThoseNP n = nameNounPhrase {s = \\c => "those" ++ n.s ! c} ;
|
||||||
|
|
||||||
EverybodyNP = nameNounPhrase (nameReg "everybody") ;
|
EverybodyNP = nameNounPhrase (nameReg "everybody") ;
|
||||||
SomebodyNP = nameNounPhrase (nameReg "somebody") ;
|
SomebodyNP = nameNounPhrase (nameReg "somebody") ;
|
||||||
@@ -46,6 +49,11 @@ concrete StructuralEng of Structural =
|
|||||||
SomethingNP = nameNounPhrase (nameReg "something") ;
|
SomethingNP = nameNounPhrase (nameReg "something") ;
|
||||||
NothingNP = nameNounPhrase (nameReg "nothing") ;
|
NothingNP = nameNounPhrase (nameReg "nothing") ;
|
||||||
|
|
||||||
|
--- CanVV = vvCan ;
|
||||||
|
--- CanKnowVV = vvCan ;
|
||||||
|
--- MustVV = vvMust ;
|
||||||
|
--- WantVV = verbNoPart (regVerbP3 "want") ** {isAux = False} ;
|
||||||
|
|
||||||
HowIAdv = ss "how" ;
|
HowIAdv = ss "how" ;
|
||||||
WhenIAdv = ss "when" ;
|
WhenIAdv = ss "when" ;
|
||||||
WhereIAdv = ss "where" ;
|
WhereIAdv = ss "where" ;
|
||||||
@@ -89,6 +97,7 @@ concrete StructuralEng of Structural =
|
|||||||
WithPrep = ss "with" ;
|
WithPrep = ss "with" ;
|
||||||
WithoutPrep = ss "without" ;
|
WithoutPrep = ss "without" ;
|
||||||
ByMeansPrep = ss "by" ;
|
ByMeansPrep = ss "by" ;
|
||||||
|
PartPrep = ss "of" ;
|
||||||
AgentPrep = ss "by" ;
|
AgentPrep = ss "by" ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
--# -path=.:../../prelude
|
||||||
|
|
||||||
--1 A Small English Resource Syntax
|
--1 A Small English Resource Syntax
|
||||||
--
|
--
|
||||||
-- Aarne Ranta 2002
|
-- Aarne Ranta 2002
|
||||||
@@ -45,10 +47,21 @@ oper
|
|||||||
nameNounPhrase : ProperName -> NounPhrase = \john ->
|
nameNounPhrase : ProperName -> NounPhrase = \john ->
|
||||||
{s = \\c => john.s ! toCase c ; n = Sg ; p = P3} ;
|
{s = \\c => john.s ! toCase c ; n = Sg ; p = P3} ;
|
||||||
|
|
||||||
|
-- The following construction has to be refined for genitive forms:
|
||||||
|
-- "we two", "us two" are OK, but "our two" is not.
|
||||||
|
|
||||||
|
Numeral : Type = {s : Case => Str} ;
|
||||||
|
|
||||||
|
pronWithNum : Pronoun -> Numeral -> Pronoun = \we,two ->
|
||||||
|
{s = \\c => we.s ! c ++ two.s ! toCase c ; n = we.n ; p = we.p} ;
|
||||||
|
|
||||||
|
noNum : Numeral = {s = \\_ => []} ;
|
||||||
|
|
||||||
--2 Determiners
|
--2 Determiners
|
||||||
--
|
--
|
||||||
-- Determiners are inflected according to the nouns they determine.
|
-- Determiners are inflected according to the nouns they determine.
|
||||||
-- The determiner is not inflected.
|
-- The determiner is not inflected.
|
||||||
|
|
||||||
Determiner : Type = {s : Str ; n : Number} ;
|
Determiner : Type = {s : Str ; n : Number} ;
|
||||||
|
|
||||||
detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \every, man ->
|
detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \every, man ->
|
||||||
@@ -57,50 +70,63 @@ oper
|
|||||||
p = P3
|
p = P3
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkDeterminer : Number -> Str -> Determiner = \n,det ->
|
mkDeterminer : Number -> Str -> Determiner = \n,the ->
|
||||||
{s = det ;
|
mkDeterminerNum n the noNum ;
|
||||||
|
|
||||||
|
mkDeterminerNum : Number -> Str -> Numeral -> Determiner = \n,det,two ->
|
||||||
|
{s = det ++ two.s ! Nom ;
|
||||||
n = n
|
n = n
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
everyDet = mkDeterminer Sg "every" ;
|
everyDet = mkDeterminer Sg "every" ;
|
||||||
allDet = mkDeterminer Pl "all" ;
|
allDet = mkDeterminerNum Pl "all" ;
|
||||||
mostDet = mkDeterminer Pl "most" ;
|
mostDet = mkDeterminer Pl "most" ;
|
||||||
aDet = mkDeterminer Sg artIndef ;
|
aDet = mkDeterminer Sg artIndef ;
|
||||||
plDet = mkDeterminer Pl [] ;
|
plDet = mkDeterminerNum Pl [] ;
|
||||||
theSgDet = mkDeterminer Sg "the" ;
|
theSgDet = mkDeterminer Sg "the" ;
|
||||||
thePlDet = mkDeterminer Pl "the" ;
|
thePlDet = mkDeterminerNum Pl "the" ;
|
||||||
anySgDet = mkDeterminer Sg "any" ;
|
anySgDet = mkDeterminer Sg "any" ;
|
||||||
anyPlDet = mkDeterminer Pl "any" ;
|
anyPlDet = mkDeterminerNum Pl "any" ;
|
||||||
|
|
||||||
whichSgDet = mkDeterminer Sg "which" ;
|
whichSgDet = mkDeterminer Sg "which" ;
|
||||||
whichPlDet = mkDeterminer Pl "which" ;
|
whichPlDet = mkDeterminerNum Pl "which" ;
|
||||||
|
|
||||||
whichDet = whichSgDet ; --- API
|
whichDet = whichSgDet ; --- API
|
||||||
|
|
||||||
indefNoun : Number -> CommNoun -> Str = \n,man ->
|
indefNoun : Number -> CommNoun -> Str = \n,man ->
|
||||||
(indefNounPhrase n man).s ! NomP ;
|
(indefNounPhrase n man).s ! NomP ;
|
||||||
|
|
||||||
indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,man ->
|
indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n ->
|
||||||
|
indefNounPhraseNum n noNum ;
|
||||||
|
|
||||||
|
indefNounPhraseNum : Number -> Numeral ->CommNounPhrase -> NounPhrase =
|
||||||
|
\n,two,man ->
|
||||||
{s = \\c => case n of {
|
{s = \\c => case n of {
|
||||||
Sg => artIndef ++ man.s ! n ! toCase c ;
|
Sg => artIndef ++ two.s ! Nom ++ man.s ! n ! toCase c ;
|
||||||
Pl => man.s ! n ! toCase c
|
Pl => two.s ! Nom ++ man.s ! n ! toCase c
|
||||||
} ;
|
} ;
|
||||||
n = n ; p = P3
|
n = n ; p = P3
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,car ->
|
defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n ->
|
||||||
{s = \\c => artDef ++ car.s ! n ! toCase c ; n = n ; p = P3} ;
|
defNounPhraseNum n noNum ;
|
||||||
|
defNounPhraseNum : Number -> Numeral -> CommNounPhrase -> NounPhrase =
|
||||||
|
\n,two,car ->
|
||||||
|
{s = \\c => artDef ++ two.s ! Nom ++ car.s ! n ! toCase c ;
|
||||||
|
n = n ;
|
||||||
|
p = P3
|
||||||
|
} ;
|
||||||
|
|
||||||
-- Genitives of noun phrases can be used like determiners, to build noun phrases.
|
-- Genitives of noun phrases can be used like determiners, to build noun phrases.
|
||||||
-- The number argument makes the difference between "my house" - "my houses".
|
-- The number argument makes the difference between "my house" - "my houses".
|
||||||
--
|
--
|
||||||
-- We have the variation "the car of John / the car of John's / John's car"
|
-- We have the variation "the car of John / the car of John's / John's car"
|
||||||
|
|
||||||
npGenDet : Number -> NounPhrase -> CommNounPhrase -> NounPhrase =
|
npGenDet : Number -> Numeral -> NounPhrase -> CommNounPhrase -> NounPhrase =
|
||||||
\n,john,car ->
|
\n,two,john,car ->
|
||||||
{s = \\c => variants {
|
{s = \\c => variants {
|
||||||
artDef ++ car.s ! n ! Nom ++ "of" ++ john.s ! GenSP ;
|
artDef ++ two.s ! Nom ++ car.s ! n ! Nom ++ "of" ++ john.s ! GenSP ;
|
||||||
john.s ! GenP ++ car.s ! n ! toCase c
|
john.s ! GenP ++ two.s ! Nom ++ car.s ! n ! toCase c
|
||||||
} ;
|
} ;
|
||||||
n = n ;
|
n = n ;
|
||||||
p = P3
|
p = P3
|
||||||
@@ -134,7 +160,7 @@ oper
|
|||||||
adj2adjPhrase : Adjective -> AdjPhrase = \new -> new ** {p = True} ;
|
adj2adjPhrase : Adjective -> AdjPhrase = \new -> new ** {p = True} ;
|
||||||
|
|
||||||
simpleAdjPhrase : Str -> AdjPhrase = \French ->
|
simpleAdjPhrase : Str -> AdjPhrase = \French ->
|
||||||
adj2adjPhrase (simpleAdj French) ;
|
adj2adjPhrase (regAdjective French) ;
|
||||||
|
|
||||||
|
|
||||||
--3 Comparison adjectives
|
--3 Comparison adjectives
|
||||||
@@ -144,13 +170,13 @@ oper
|
|||||||
-- Positive forms are used alone, as adjectival phrases ("big").
|
-- Positive forms are used alone, as adjectival phrases ("big").
|
||||||
|
|
||||||
positAdjPhrase : AdjDegr -> AdjPhrase = \big ->
|
positAdjPhrase : AdjDegr -> AdjPhrase = \big ->
|
||||||
adj2adjPhrase (ss (big.s ! Pos)) ;
|
adj2adjPhrase {s = big.s ! Pos} ;
|
||||||
|
|
||||||
-- Comparative forms are used with an object of comparison, as
|
-- Comparative forms are used with an object of comparison, as
|
||||||
-- adjectival phrases ("bigger then you").
|
-- adjectival phrases ("bigger then you").
|
||||||
|
|
||||||
comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \big, you ->
|
comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \big, you ->
|
||||||
{s = big.s ! Comp ++ "than" ++ you.s ! NomP ;
|
{s = \\a => big.s ! Comp ! a ++ "than" ++ you.s ! NomP ;
|
||||||
p = False
|
p = False
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -158,7 +184,7 @@ oper
|
|||||||
-- maximal representative of a domain ("the biggest house").
|
-- maximal representative of a domain ("the biggest house").
|
||||||
|
|
||||||
superlNounPhrase : AdjDegr -> CommNoun -> NounPhrase = \big, house ->
|
superlNounPhrase : AdjDegr -> CommNoun -> NounPhrase = \big, house ->
|
||||||
{s = \\c => "the" ++ big.s ! Sup ++ house.s ! Sg ! toCase c ;
|
{s = \\c => "the" ++ big.s ! Sup ! AAdj ++ house.s ! Sg ! toCase c ;
|
||||||
n = Sg ;
|
n = Sg ;
|
||||||
p = P3
|
p = P3
|
||||||
} ;
|
} ;
|
||||||
@@ -174,7 +200,7 @@ oper
|
|||||||
AdjCompl = Adjective ** {s2 : Preposition} ;
|
AdjCompl = Adjective ** {s2 : Preposition} ;
|
||||||
|
|
||||||
complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \related,john ->
|
complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \related,john ->
|
||||||
{s = related.s ++ related.s2 ++ john.s ! AccP ;
|
{s = \\a => related.s ! a ++ related.s2 ++ john.s ! AccP ;
|
||||||
p = False
|
p = False
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -190,8 +216,8 @@ oper
|
|||||||
|
|
||||||
modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \big, car ->
|
modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \big, car ->
|
||||||
{s = \\n => if_then_else (Case => Str) big.p
|
{s = \\n => if_then_else (Case => Str) big.p
|
||||||
(\\c => big.s ++ car.s ! n ! c)
|
(\\c => big.s ! AAdj ++ car.s ! n ! c)
|
||||||
(table {Nom => car.s ! n ! Nom ++ big.s ; Gen => variants {}}) ;
|
(table {Nom => car.s ! n ! Nom ++ big.s ! AAdj ; Gen => variants {}}) ;
|
||||||
g = car.g
|
g = car.g
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -234,7 +260,7 @@ oper
|
|||||||
let {n = john.n ; nf = if_then_else Number coll Sg n} in
|
let {n = john.n ; nf = if_then_else Number coll Sg n} in
|
||||||
variants {
|
variants {
|
||||||
defNounPhrase nf (appFunComm mother john) ;
|
defNounPhrase nf (appFunComm mother john) ;
|
||||||
npGenDet nf john mother
|
npGenDet nf noNum john mother
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- The commonest case is functions with the preposition "of".
|
-- The commonest case is functions with the preposition "of".
|
||||||
@@ -305,7 +331,7 @@ oper
|
|||||||
|
|
||||||
predAdjective : Bool -> Adjective -> VerbPhrase = \b,old ->
|
predAdjective : Bool -> Adjective -> VerbPhrase = \b,old ->
|
||||||
{s = beOrNotBe b ;
|
{s = beOrNotBe b ;
|
||||||
s2 = \\_ => old.s ;
|
s2 = \\_ => old.s ! AAdj ;
|
||||||
isAux = True
|
isAux = True
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -321,6 +347,12 @@ oper
|
|||||||
isAux = True
|
isAux = True
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
predAdverb : Bool -> Adverb -> VerbPhrase = \b,elsewhere ->
|
||||||
|
{s = beOrNotBe b ;
|
||||||
|
s2 = \\_ => elsewhere.s ;
|
||||||
|
isAux = True
|
||||||
|
} ;
|
||||||
|
|
||||||
-- We use an auxiliary giving all forms of "be".
|
-- We use an auxiliary giving all forms of "be".
|
||||||
|
|
||||||
beOrNotBe : Bool -> (VForm => Str) = \b ->
|
beOrNotBe : Bool -> (VForm => Str) = \b ->
|
||||||
@@ -376,7 +408,7 @@ oper
|
|||||||
-- The syntax is the same as for adjectival predication.
|
-- The syntax is the same as for adjectival predication.
|
||||||
|
|
||||||
passVerb : Bool -> Verb -> VerbPhrase = \b,love ->
|
passVerb : Bool -> Verb -> VerbPhrase = \b,love ->
|
||||||
predAdjective b (adj2adjPhrase (ss (love.s ! PPart))) ;
|
predAdjective b (adj2adjPhrase (regAdjective (love.s ! PPart))) ;
|
||||||
|
|
||||||
-- Transitive verbs can be used elliptically as verbs. The semantics
|
-- Transitive verbs can be used elliptically as verbs. The semantics
|
||||||
-- is left to applications. The definition is trivial, due to record
|
-- is left to applications. The definition is trivial, due to record
|
||||||
@@ -434,7 +466,7 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
advAdjPhrase : SS -> AdjPhrase -> AdjPhrase = \very, good ->
|
advAdjPhrase : SS -> AdjPhrase -> AdjPhrase = \very, good ->
|
||||||
{s = very.s ++ good.s ;
|
{s = \\a => very.s ++ good.s ! a ;
|
||||||
p = good.p
|
p = good.p
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -504,6 +536,50 @@ oper
|
|||||||
s2 = \\_ => say.s ! InfImp ++ thatjohnruns ;
|
s2 = \\_ => say.s ! InfImp ++ thatjohnruns ;
|
||||||
isAux = True} ;
|
isAux = True} ;
|
||||||
|
|
||||||
|
--3 Verb-complement verbs
|
||||||
|
--
|
||||||
|
-- Sentence-complement verbs take verb phrases as complements.
|
||||||
|
-- They can be auxiliaries ("can", "must") or ordinary verbs
|
||||||
|
-- ("try"); this distinction cannot be done in the multilingual
|
||||||
|
-- API and leads to some anomalies in English, such as the necessity
|
||||||
|
-- to create the infinitive form "to be able to" for "can" so that
|
||||||
|
-- the construction can be iterated, and the corresponding complication
|
||||||
|
-- in the parameter structure.
|
||||||
|
|
||||||
|
VerbVerb : Type = Verb ** {isAux : Bool} ;
|
||||||
|
|
||||||
|
-- To generate "can walk"/"can't walk"; "tries to walk"/"does not try to walk":
|
||||||
|
-- The contraction of "not" is not provided, since it would require changing
|
||||||
|
-- the verb parameter type.
|
||||||
|
|
||||||
|
complVerbVerb : Bool -> VerbVerb -> VerbPhrase -> VerbPhrase = \b,try,run ->
|
||||||
|
let to = if_then_else Str try.isAux [] "to"
|
||||||
|
in
|
||||||
|
if_then_else VerbPhrase b
|
||||||
|
{s = \\v => try.s ! v ++ try.s1 ++ to ++ run.s ! InfImp ;
|
||||||
|
s2 = run.s2 ;
|
||||||
|
isAux = try.isAux
|
||||||
|
}
|
||||||
|
{s = \\v => try.s ! v ++ "not" ;
|
||||||
|
s2 = \\n => run.s ! InfImp ++ run.s2 ! n ;
|
||||||
|
isAux = True
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- The three most important example auxiliaries.
|
||||||
|
|
||||||
|
mkVerbAux : (_,_,_,_: Str) -> VerbVerb = \beable, can, could, beenable ->
|
||||||
|
{s = table {
|
||||||
|
InfImp => beable ;
|
||||||
|
Indic _ => can ;
|
||||||
|
Past _ => could ;
|
||||||
|
PPart => beenable
|
||||||
|
} ;
|
||||||
|
s1 = [] ;
|
||||||
|
isAux = True
|
||||||
|
} ;
|
||||||
|
|
||||||
|
vvCan : VerbVerb = mkVerbAux ["be able to"] "can" "could" ["been able to"] ;
|
||||||
|
vvMust : VerbVerb = mkVerbAux ["have to"] "must" ["had to"] ["had to"] ;
|
||||||
|
|
||||||
--2 Sentences missing noun phrases
|
--2 Sentences missing noun phrases
|
||||||
--
|
--
|
||||||
@@ -687,13 +763,13 @@ oper
|
|||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
isThere : Number -> CommNounPhrase -> Question = \n,bar ->
|
isThere : Number -> Numeral -> CommNounPhrase -> Question = \n,num,bar ->
|
||||||
questVerbPhrase
|
questVerbPhrase
|
||||||
(case n of {
|
(case n of {
|
||||||
Sg => nameNounPhrase (nameReg "there") ;
|
Sg => nameNounPhrase (nameReg "there") ;
|
||||||
Pl => {s = \\_ => "there" ; n = Pl ; p = P3}
|
Pl => {s = \\_ => "there" ; n = Pl ; p = P3}
|
||||||
})
|
})
|
||||||
(predNounPhrase True (indefNounPhrase n bar)) ;
|
(predNounPhrase True (indefNounPhraseNum n num bar)) ;
|
||||||
|
|
||||||
|
|
||||||
--3 Wh-questions
|
--3 Wh-questions
|
||||||
@@ -815,20 +891,20 @@ oper
|
|||||||
-- The structure is the same as for sentences. The result is a prefix adjective
|
-- The structure is the same as for sentences. The result is a prefix adjective
|
||||||
-- if and only if all elements are prefix.
|
-- if and only if all elements are prefix.
|
||||||
|
|
||||||
ListAdjPhrase : Type = SD2 ** {p : Bool} ;
|
ListAdjPhrase : Type = {s1,s2 : AForm => Str ; p : Bool} ;
|
||||||
|
|
||||||
twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y ->
|
twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y ->
|
||||||
CO.twoStr x.s y.s ** {p = andB x.p y.p} ;
|
CO.twoTable AForm x y ** {p = andB x.p y.p} ;
|
||||||
|
|
||||||
consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x ->
|
consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x ->
|
||||||
CO.consStr CO.comma xs x.s ** {p = andB xs.p x.p} ;
|
CO.consTable AForm CO.comma xs x ** {p = andB xs.p x.p} ;
|
||||||
|
|
||||||
conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs ->
|
conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs ->
|
||||||
ss (CO.conjunctX c xs) ** {p = xs.p} ;
|
CO.conjunctTable AForm c xs ** {p = xs.p} ;
|
||||||
|
|
||||||
conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase =
|
conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase =
|
||||||
\c,xs ->
|
\c,xs ->
|
||||||
ss (CO.conjunctDistrX c xs) ** {p = xs.p} ;
|
CO.conjunctDistrTable AForm c xs ** {p = xs.p} ;
|
||||||
|
|
||||||
|
|
||||||
--3 Coordinating noun phrases
|
--3 Coordinating noun phrases
|
||||||
|
|||||||
@@ -8,18 +8,22 @@ flags startcat=Phr ; lexer=literals ; parser=chart ; unlexer=text ;
|
|||||||
-- a random sample from the lexicon
|
-- a random sample from the lexicon
|
||||||
|
|
||||||
lin
|
lin
|
||||||
Big = mkAdjDegr "big" "bigger" "biggest";
|
Big = adjDegrIrreg "big" "bigger" "biggest";
|
||||||
|
Happy = adjDegrReg "happy" ;
|
||||||
Small = adjDegrReg "small" ;
|
Small = adjDegrReg "small" ;
|
||||||
Old = adjDegrReg "old" ;
|
Old = adjDegrReg "old" ;
|
||||||
Young = adjDegrReg "young" ;
|
Young = adjDegrReg "young" ;
|
||||||
American = simpleAdj "American" ;
|
American = regAdjective "American" ;
|
||||||
Finnish = simpleAdj "Finnish" ;
|
Finnish = regAdjective "Finnish" ;
|
||||||
Married = simpleAdj "married" ** {s2 = "to"} ;
|
Married = regAdjective "married" ** {s2 = "to"} ;
|
||||||
Man = cnHum (mkNoun "man" "men" "man's" "men's") ;
|
Man = cnHum (mkNoun "man" "men" "man's" "men's") ;
|
||||||
Woman = cnHum (mkNoun "woman" "women" "woman's" "women's") ;
|
Woman = cnHum (mkNoun "woman" "women" "woman's" "women's") ;
|
||||||
Car = cnNoHum (nounReg "car") ;
|
Car = cnNoHum (nounReg "car") ;
|
||||||
House = cnNoHum (nounReg "house") ;
|
House = cnNoHum (nounReg "house") ;
|
||||||
Light = cnNoHum (nounReg "light") ;
|
Light = cnNoHum (nounReg "light") ;
|
||||||
|
Bar = cnNoHum (nounReg "bar") ;
|
||||||
|
Bottle = cnNoHum (nounReg "bottle") ;
|
||||||
|
Wine = cnNoHum (nounReg "wine") ;
|
||||||
Walk = verbNoPart (regVerbP3 "walk") ;
|
Walk = verbNoPart (regVerbP3 "walk") ;
|
||||||
Run = verbNoPart (mkVerb "run" "ran" "run") ;
|
Run = verbNoPart (mkVerb "run" "ran" "run") ;
|
||||||
Say = verbNoPart (mkVerb "say" "said" "said") ;
|
Say = verbNoPart (mkVerb "say" "said" "said") ;
|
||||||
@@ -27,6 +31,7 @@ lin
|
|||||||
Send = mkTransVerbDir (verbNoPart (mkVerb "send" "sent" "sent")) ;
|
Send = mkTransVerbDir (verbNoPart (mkVerb "send" "sent" "sent")) ;
|
||||||
Love = mkTransVerbDir (verbNoPart (verbP3e "love")) ;
|
Love = mkTransVerbDir (verbNoPart (verbP3e "love")) ;
|
||||||
Wait = mkTransVerb (verbNoPart (regVerbP3 "wait")) "for" ;
|
Wait = mkTransVerb (verbNoPart (regVerbP3 "wait")) "for" ;
|
||||||
|
Drink = mkTransVerbDir (verbNoPart (mkVerb "drink" "drank" "drunk")) ;
|
||||||
Give = mkDitransVerb (verbNoPart (mkVerb "give" "gave" "given")) [] [] ;
|
Give = mkDitransVerb (verbNoPart (mkVerb "give" "gave" "given")) [] [] ;
|
||||||
Prefer = mkDitransVerb
|
Prefer = mkDitransVerb
|
||||||
(verbNoPart (mkVerb "prefer" "preferred" "preferred")) [] "to" ;
|
(verbNoPart (mkVerb "prefer" "preferred" "preferred")) [] "to" ;
|
||||||
|
|||||||
@@ -48,10 +48,13 @@ oper
|
|||||||
--
|
--
|
||||||
-- The major division is between the comparison degrees, but it
|
-- The major division is between the comparison degrees, but it
|
||||||
-- is also good to leave room for adjectives that cannon be compared.
|
-- is also good to leave room for adjectives that cannon be compared.
|
||||||
-- Such adjectives are simply strings.
|
-- It is, however, productive to form an adverbial from any adjective.
|
||||||
|
|
||||||
Adjective : Type = SS ;
|
param AForm = AAdj | AAdv ;
|
||||||
AdjDegr = SS1 Degree ;
|
|
||||||
|
oper
|
||||||
|
Adjective : Type = SS1 AForm ;
|
||||||
|
AdjDegr = {s : Degree => AForm => Str} ;
|
||||||
|
|
||||||
--3 Verbs
|
--3 Verbs
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ oper
|
|||||||
oper
|
oper
|
||||||
verbVara = extVerb Act vara_1200 ;
|
verbVara = extVerb Act vara_1200 ;
|
||||||
verbHava = extVerb Act hava_1198 ;
|
verbHava = extVerb Act hava_1198 ;
|
||||||
|
verbFinnas = mkVerb "finnas" "finns" "finns" ;
|
||||||
|
|
||||||
-- A simplified conjugation takes three forms in the worst case.
|
-- A simplified conjugation takes three forms in the worst case.
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,25 @@ oper
|
|||||||
pronNounPhrase : ProPN -> NounPhrase = \jag ->
|
pronNounPhrase : ProPN -> NounPhrase = \jag ->
|
||||||
{s = jag.s ; g = jag.h1 ; n = jag.h2} ;
|
{s = jag.s ; g = jag.h1 ; n = jag.h2} ;
|
||||||
|
|
||||||
|
-- The following construction has to be refined for genitive forms:
|
||||||
|
-- "vi tre", "oss tre" are OK, but "vår tres" is not.
|
||||||
|
|
||||||
|
Numeral : Type = {s : Case => Str} ;
|
||||||
|
|
||||||
|
pronWithNum : ProPN -> Numeral -> ProPN = \we,two ->
|
||||||
|
{s = \\c => we.s ! c ++ two.s ! npCase c ;
|
||||||
|
h1 = we.h1 ;
|
||||||
|
h2 = we.h2 ;
|
||||||
|
h3 = we.h3
|
||||||
|
} ;
|
||||||
|
|
||||||
|
noNum : Numeral = {s = \\_ => []} ;
|
||||||
|
|
||||||
|
-- Formal subjects
|
||||||
|
|
||||||
|
npMan = nameNounPhrase (mkProperName "man" Utr Masc) ;
|
||||||
|
npDet = nameNounPhrase (mkProperName "det" Neutr NoMasc) ;
|
||||||
|
|
||||||
--2 Determiners
|
--2 Determiners
|
||||||
--
|
--
|
||||||
-- Determiners are inflected according to noun in gender and sex.
|
-- Determiners are inflected according to noun in gender and sex.
|
||||||
@@ -110,8 +129,14 @@ oper
|
|||||||
mkDeterminerSg : DetSg -> SpeciesP -> Determiner = \en, b ->
|
mkDeterminerSg : DetSg -> SpeciesP -> Determiner = \en, b ->
|
||||||
{s = en ; n = Sg ; b = b} ;
|
{s = en ; n = Sg ; b = b} ;
|
||||||
|
|
||||||
mkDeterminerPl : DetPl -> SpeciesP -> Determiner = \alla, b ->
|
mkDeterminerPl : DetPl -> SpeciesP -> Determiner = \alla ->
|
||||||
{s = table {_ => table {_ => alla}} ; n = Pl ; b = b} ;
|
mkDeterminerPlNum alla noNum ;
|
||||||
|
|
||||||
|
mkDeterminerPlNum : DetPl -> Numeral -> SpeciesP -> Determiner = \alla,n,b ->
|
||||||
|
{s = \\_,_ => alla ++ n.s ! Nom ;
|
||||||
|
n = Pl ;
|
||||||
|
b = b
|
||||||
|
} ;
|
||||||
|
|
||||||
detSgInvar : Str -> DetSg = \varje -> table {_ => table {_ => varje}} ;
|
detSgInvar : Str -> DetSg = \varje -> table {_ => table {_ => varje}} ;
|
||||||
|
|
||||||
@@ -147,12 +172,12 @@ oper
|
|||||||
-- Genitives of noun phrases can be used like determiners, to build noun phrases.
|
-- Genitives of noun phrases can be used like determiners, to build noun phrases.
|
||||||
-- The number argument makes the difference between "min bil" - "mina bilar".
|
-- The number argument makes the difference between "min bil" - "mina bilar".
|
||||||
|
|
||||||
npGenDet : Number -> NounPhrase -> CommNounPhrase -> NounPhrase =
|
npGenDet : Number -> Numeral -> NounPhrase -> CommNounPhrase -> NounPhrase =
|
||||||
\n,huset,vin -> {
|
\n,tre,huset,vin -> {
|
||||||
s = \\c => case n of {
|
s = \\c => case n of {
|
||||||
Sg => huset.s ! PGen (ASg vin.g) ++
|
Sg => huset.s ! PGen (ASg vin.g) ++
|
||||||
vin.s ! Sg ! DefP Indef ! npCase c ;
|
vin.s ! Sg ! DefP Indef ! npCase c ;
|
||||||
Pl => huset.s ! PGen APl ++
|
Pl => huset.s ! PGen APl ++ tre.s ! Nom ++
|
||||||
vin.s ! Pl ! DefP Indef ! npCase c
|
vin.s ! Pl ! DefP Indef ! npCase c
|
||||||
} ;
|
} ;
|
||||||
g = vin.g ;
|
g = vin.g ;
|
||||||
@@ -160,10 +185,12 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- *Bare plural noun phrases* like "män", "goda vänner", are built without a
|
-- *Bare plural noun phrases* like "män", "goda vänner", are built without a
|
||||||
-- determiner word.
|
-- determiner word. But a $Numeral$ may occur.
|
||||||
|
|
||||||
plurDet : CommNounPhrase -> NounPhrase = \cn ->
|
plurDet : CommNounPhrase -> NounPhrase = plurDetNum noNum ;
|
||||||
{s = \\c => cn.s ! Pl ! IndefP ! npCase c ;
|
|
||||||
|
plurDetNum : Numeral -> CommNounPhrase -> NounPhrase = \num,cn ->
|
||||||
|
{s = \\c => num.s ! Nom ++ cn.s ! Pl ! IndefP ! npCase c ;
|
||||||
g = cn.g ;
|
g = cn.g ;
|
||||||
n = Pl
|
n = Pl
|
||||||
} ;
|
} ;
|
||||||
@@ -174,21 +201,30 @@ oper
|
|||||||
denDet : CommNounPhrase -> NounPhrase = \cn ->
|
denDet : CommNounPhrase -> NounPhrase = \cn ->
|
||||||
detNounPhrase
|
detNounPhrase
|
||||||
(mkDeterminerSgGender (table {g => artDef ! cn.p ! ASg g}) (DefP Def)) cn ;
|
(mkDeterminerSgGender (table {g => artDef ! cn.p ! ASg g}) (DefP Def)) cn ;
|
||||||
deDet : CommNounPhrase -> NounPhrase = \cn ->
|
deDet : Numeral -> CommNounPhrase -> NounPhrase = \n,cn ->
|
||||||
detNounPhrase (mkDeterminerPl (artDef ! cn.p ! APl) (DefP Def)) cn ;
|
detNounPhrase (mkDeterminerPlNum (artDef ! cn.p ! APl) n (DefP Def)) cn ;
|
||||||
|
|
||||||
-- It is useful to have macros for indefinite and definite, singular and plural
|
-- It is useful to have macros for indefinite and definite, singular and plural
|
||||||
-- noun-phrase-like syncategorematic expressions.
|
-- noun-phrase-like syncategorematic expressions.
|
||||||
|
|
||||||
indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,hus -> case n of {
|
indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n ->
|
||||||
Sg => detNounPhrase enDet hus ;
|
indefNounPhraseNum n noNum ;
|
||||||
Pl => plurDet hus
|
|
||||||
} ;
|
|
||||||
|
|
||||||
defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,hus -> case n of {
|
indefNounPhraseNum : Number -> Numeral -> CommNounPhrase -> NounPhrase =
|
||||||
Sg => denDet hus ;
|
\n,num,hus ->
|
||||||
Pl => deDet hus
|
case n of {
|
||||||
} ;
|
Sg => detNounPhrase enDet hus ;
|
||||||
|
Pl => plurDetNum num hus
|
||||||
|
} ;
|
||||||
|
|
||||||
|
defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n ->
|
||||||
|
defNounPhraseNum n noNum ;
|
||||||
|
|
||||||
|
defNounPhraseNum : Number -> Numeral -> CommNounPhrase -> NounPhrase =
|
||||||
|
\n,num,hus -> case n of {
|
||||||
|
Sg => denDet hus ;
|
||||||
|
Pl => deDet num hus
|
||||||
|
} ;
|
||||||
|
|
||||||
indefNoun : Number -> CommNounPhrase -> Str = \n,man -> case n of {
|
indefNoun : Number -> CommNounPhrase -> Str = \n,man -> case n of {
|
||||||
Sg => artIndef ! man.g ++ man.s ! Sg ! IndefP ! Nom ;
|
Sg => artIndef ! man.g ++ man.s ! Sg ! IndefP ! Nom ;
|
||||||
@@ -379,7 +415,7 @@ oper
|
|||||||
let {n = x.n ; nf = if_then_else Number coll Sg n} in
|
let {n = x.n ; nf = if_then_else Number coll Sg n} in
|
||||||
variants {
|
variants {
|
||||||
defNounPhrase nf (appFunComm värde x) ;
|
defNounPhrase nf (appFunComm värde x) ;
|
||||||
npGenDet nf x (noun2CommNounPhrase värde)
|
npGenDet nf noNum x (noun2CommNounPhrase värde)
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- Two-place functions add one argument place.
|
-- Two-place functions add one argument place.
|
||||||
@@ -452,6 +488,12 @@ oper
|
|||||||
s3 = \\_,_ => john.s ! PNom
|
s3 = \\_,_ => john.s ! PNom
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
predAdverb : Bool -> Adverb -> VerbPhrase = \b,ute ->
|
||||||
|
verbVara ** {
|
||||||
|
s2 = negation b ;
|
||||||
|
s3 = \\_,_ => ute.s
|
||||||
|
} ;
|
||||||
|
|
||||||
--3 Transitive verbs
|
--3 Transitive verbs
|
||||||
--
|
--
|
||||||
-- Transitive verbs are verbs with a preposition for the complement,
|
-- Transitive verbs are verbs with a preposition for the complement,
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ param
|
|||||||
oper
|
oper
|
||||||
Adj : Type = {s : AdjForm => Str} ;
|
Adj : Type = {s : AdjForm => Str} ;
|
||||||
|
|
||||||
|
adverbForm : AdjFormPos = Strong (ASg Neutr) ;
|
||||||
|
|
||||||
--3 Verbs
|
--3 Verbs
|
||||||
--
|
--
|
||||||
-- Verbs have 9 finite forms and as many as 18 infinite forms; the large number
|
-- Verbs have 9 finite forms and as many as 18 infinite forms; the large number
|
||||||
|
|||||||
Reference in New Issue
Block a user