mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 16:42:51 -06:00
tuning resource API
This commit is contained in:
@@ -15,6 +15,7 @@ lincat
|
||||
-- = {s : NPForm => Str ; g : Gender ; n : Number ; p : Person} ;
|
||||
PN = {s : Case => Str ; g : NounGender} ;
|
||||
Det = {s : NounGender => Str ; n : Number ; b : SpeciesP} ;
|
||||
NDet = {s : NounGender => Str ; b : SpeciesP} ;
|
||||
N2 = Function ;
|
||||
-- = CommNoun ** {s2 : Preposition} ;
|
||||
N3 = Function ** {s3 : Preposition} ;
|
||||
@@ -72,6 +73,7 @@ lincat
|
||||
RS = {s : GenNum => Person => Str} ;
|
||||
RCl = {s : Bool => SForm => GenNum => Person => Str} ;
|
||||
IP = NounPhrase ;
|
||||
IDet = {s : NounGender => Str ; n : Number ; b : SpeciesP} ;
|
||||
QS = {s : QuestForm => Str} ;
|
||||
QCl = {s : Bool => SForm => QuestForm => Str} ;
|
||||
Imp = {s : Number => Str} ;
|
||||
@@ -84,4 +86,6 @@ lincat
|
||||
ListS = {s1,s2 : Order => Str} ;
|
||||
ListAP = {s1,s2 : AdjFormPos => Case => Str ; p : Bool} ;
|
||||
ListNP = {s1,s2 : NPForm => Str ; g : Gender ; n : Number ; p : Person} ;
|
||||
ListAdv = {s1,s2 : Str} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ lin
|
||||
DefNumNP = defNounPhraseNum plural ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
NDetNP = numDetNounPhrase ;
|
||||
NDetNum = justNumDetNounPhrase ;
|
||||
MassNP = detNounPhrase (mkDeterminerSg (detSgInvar []) IndefP) ;
|
||||
|
||||
AppN2 = appFunComm ;
|
||||
@@ -94,6 +96,7 @@ lin
|
||||
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
AdvAdv = cc2 ;
|
||||
|
||||
--3 Sentences and relative clauses
|
||||
--
|
||||
@@ -111,13 +114,14 @@ lin
|
||||
--3 Questions and imperatives
|
||||
--
|
||||
|
||||
WhoOne = intPronWho singular ;
|
||||
WhoMany = intPronWho plural ;
|
||||
WhatOne = intPronWhat singular ;
|
||||
WhatMany = intPronWhat plural ;
|
||||
IDetCN d n = detNounPhrase d n ;
|
||||
FunIP = funIntPron ;
|
||||
NounIPOne = nounIntPron singular ;
|
||||
NounIPMany = nounIntPron plural ;
|
||||
-- NounIPOne = nounIntPron singular ;
|
||||
-- NounIPMany = nounIntPron plural ;
|
||||
-- WhoOne = intPronWho singular ;
|
||||
-- WhoMany = intPronWho plural ;
|
||||
-- WhatOne = intPronWhat singular ;
|
||||
-- WhatMany = intPronWhat plural ;
|
||||
|
||||
QuestCl = questClause ;
|
||||
IntSlash = intSlash ;
|
||||
@@ -132,7 +136,9 @@ lin
|
||||
ImperMany = imperUtterance plural ;
|
||||
|
||||
AdvCl = advClause ;
|
||||
AdvVP = advVerbPhrase ;
|
||||
AdvPhr = advSentence ;
|
||||
AdCPhr = advSentence ;
|
||||
|
||||
|
||||
--!
|
||||
@@ -154,6 +160,11 @@ lin
|
||||
ConjNP = conjunctNounPhrase ;
|
||||
ConjDNP = conjunctDistrNounPhrase ;
|
||||
|
||||
TwoAdv = twoAdverb ;
|
||||
ConsAdv = consAdverb ;
|
||||
ConjAdv = conjunctAdverb ;
|
||||
ConjDAdv = conjunctDistrAdverb ;
|
||||
|
||||
SubjS = subjunctSentence ;
|
||||
SubjImper = subjunctImperative ;
|
||||
SubjQS = subjunctQuestion ;
|
||||
|
||||
@@ -119,7 +119,8 @@ oper
|
||||
-- Determiners are inflected according to noun in gender and sex.
|
||||
-- The number and species of the noun are determined by the determiner.
|
||||
|
||||
Determiner : Type = {s : NounGender => Str ; n : Number ; b : SpeciesP} ;
|
||||
Determiner : Type = {s : NounGender => Str ; n : Number ; b : SpeciesP} ;
|
||||
DeterminerNum : Type = {s : NounGender => Str ; b : SpeciesP} ;
|
||||
|
||||
artIndef : Gender => Str ;
|
||||
|
||||
@@ -131,6 +132,17 @@ oper
|
||||
{s = table {c => en.s ! man.g ++ man.s ! en.n ! en.b ! npCase c} ;
|
||||
g = genNoun man.g ; n = en.n ; p = P3} ;
|
||||
|
||||
numDetNounPhrase : DeterminerNum -> Numeral -> CommNounPhrase -> NounPhrase =
|
||||
\alla,sex, man ->
|
||||
{s = \\c => alla.s ! man.g ++ sex.s ! Nom ++ man.s ! Pl ! alla.b ! npCase c ;
|
||||
g = genNoun man.g ; n = Pl ; p = P3} ;
|
||||
|
||||
justNumDetNounPhrase : DeterminerNum -> Numeral -> NounPhrase =
|
||||
\alla,sex ->
|
||||
{s = \\c => alla.s ! NNeutr ++ sex.s ! npCase c ;
|
||||
g = Neutr ; n = Pl ; p = P3} ;
|
||||
|
||||
|
||||
-- The following macros are sufficient to define most determiners.
|
||||
-- All $SpeciesP$ values come into question:
|
||||
-- "en god vän" - "min gode vän" - "den gode vännen".
|
||||
@@ -142,14 +154,13 @@ oper
|
||||
{s = en ; n = Sg ; b = b} ;
|
||||
|
||||
mkDeterminerPl : DetPl -> SpeciesP -> Determiner = \alla,b ->
|
||||
mkDeterminerPlNum alla b noNum ;
|
||||
|
||||
mkDeterminerPlNum : DetPl -> SpeciesP -> Numeral -> Determiner = \alla,b,n ->
|
||||
{s = \\_ => alla ++ n.s ! Nom ;
|
||||
{s = \\_ => alla ;
|
||||
n = Pl ;
|
||||
b = b
|
||||
} ;
|
||||
|
||||
mkDeterminerPlNum : DetPl -> SpeciesP -> DeterminerNum = mkDeterminerPl ;
|
||||
|
||||
detSgInvar : Str -> DetSg = \varje -> table {_ => varje} ;
|
||||
|
||||
-- A large class of determiners can be built from a gender-dependent table.
|
||||
@@ -226,9 +237,10 @@ oper
|
||||
(mkDeterminerSgGender (table {g => artDef ! cn.p ! ASg g})
|
||||
(DefP (specDefPhrase cn.p))) cn ;
|
||||
deDet : Numeral -> CommNounPhrase -> NounPhrase = \n,cn ->
|
||||
detNounPhrase
|
||||
numDetNounPhrase
|
||||
(mkDeterminerPlNum (artDef ! cn.p ! APl)
|
||||
(DefP (specDefPhrase cn.p)) n) cn ;
|
||||
(DefP (specDefPhrase cn.p)))
|
||||
n cn ;
|
||||
|
||||
-- This is uniformly $Def$ in Swedish, but in Danish, $Indef$ for
|
||||
-- compounds with determiner.
|
||||
@@ -726,6 +738,12 @@ oper
|
||||
s3 = \\sf,g,n,p => spelar.s3 ! sf ! g ! n ! p
|
||||
} ;
|
||||
|
||||
advVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \sing, well ->
|
||||
{
|
||||
s = \\a,b,c,d => sing.s ! a ! b ! c ! d ++ well.s
|
||||
} ;
|
||||
|
||||
|
||||
advAdjPhrase : SS -> AdjPhrase -> AdjPhrase = \mycket, dyr ->
|
||||
{s = \\a,c => mycket.s ++ dyr.s ! a ! c ;
|
||||
p = dyr.p
|
||||
@@ -1325,6 +1343,35 @@ oper
|
||||
|
||||
conjGender : Gender -> Gender -> Gender ;
|
||||
|
||||
--3 Coordinating adverbs
|
||||
--
|
||||
-- We need a category of lists of adverbs. It is a discontinuous
|
||||
-- category, the parts corresponding to 'init' and 'last' segments
|
||||
-- (rather than 'head' and 'tail', because we have to keep track of the slot between
|
||||
-- the last two elements of the list). A list has at least two elements.
|
||||
|
||||
ListAdverb : Type = SD2 ;
|
||||
|
||||
twoAdverb : (_,_ : Adverb) -> ListAdverb = CO.twoSS ;
|
||||
|
||||
consAdverb : ListAdverb -> Adverb -> ListAdverb =
|
||||
CO.consSS CO.comma ;
|
||||
|
||||
-- To coordinate a list of adverbs by a simple conjunction, we place
|
||||
-- it between the last two elements; commas are put in the other slots,
|
||||
|
||||
conjunctAdverb : Conjunction -> ListAdverb -> Adverb = \c,xs ->
|
||||
ss (CO.conjunctX c xs) ;
|
||||
|
||||
-- To coordinate a list of adverbs by a distributed conjunction, we place
|
||||
-- the first part (e.g. "either") in front of the first element, the second
|
||||
-- part ("or") between the last two elements, and commas in the other slots.
|
||||
|
||||
conjunctDistrAdverb : ConjunctionDistr -> ListAdverb -> Adverb =
|
||||
\c,xs ->
|
||||
ss (CO.conjunctDistrX c xs) ;
|
||||
|
||||
|
||||
|
||||
--2 Subjunction
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user