completing Structural

This commit is contained in:
aarne
2005-11-30 11:17:21 +00:00
parent 80fcb22ef4
commit 198b527658
10 changed files with 232 additions and 103 deletions

View File

@@ -12,4 +12,6 @@ abstract Adverb = Cat ** {
SubjS : Subj -> S -> Adv ;
AdnCAdv : CAdv -> AdN ;
}

View File

@@ -15,4 +15,6 @@ concrete AdverbEng of Adverb = CatEng ** open ResEng, Prelude in {
SubjS = cc2 ;
AdnCAdv cadv = {s = cadv.s ++ "than"} ;
}

View File

@@ -36,6 +36,7 @@ abstract Cat = {
AdV ;
AdA ;
AdS ;
AdN ;
CN ;
N ;

View File

@@ -30,7 +30,7 @@ concrete CatEng of Cat = open ResEng, Prelude in {
A = {s : AForm => Str} ;
A2 = {s : AForm => Str ; c2 : Str} ;
Adv, AdV, AdA, AdS = {s : Str} ;
Adv, AdV, AdA, AdS, AdN = {s : Str} ;
Prep = {s : Str} ;
Det, Quant = {s : Str ; n : Number} ;

View File

@@ -27,7 +27,6 @@ oper
} ;
--2 Nouns
--
-- For conciseness and abstraction, we define a worst-case macro for
@@ -43,21 +42,22 @@ oper
Pl => table {Gen => mens ; _ => men}
}} ;
nounReg : Str -> CommonNoun = \dog ->
mkNoun dog (dog + "s") (dog + "'s") (dog + "s'");
nounS : Str -> CommonNoun = \kiss ->
mkNoun kiss (kiss + "es") (kiss + "'s") (kiss + "es'") ;
nounY : Str -> CommonNoun = \fl ->
mkNoun (fl + "y") (fl + "ies") (fl + "y's") (fl + "ies'") ;
nounGen : Str -> CommonNoun = \dog -> case last dog of {
"y" => nounY "dog" ;
"s" => nounS (init "dog") ;
_ => nounReg "dog"
} ;
-- These are auxiliaries to $nounGen$.
nounReg : Str -> CommonNoun = \dog ->
mkNoun dog (dog + "s") (dog + "'s") (dog + "s'");
nounS : Str -> CommonNoun = \kiss ->
mkNoun kiss (kiss + "es") (kiss + "'s") (kiss + "es'") ;
nounY : Str -> CommonNoun = \fl ->
mkNoun (fl + "y") (fl + "ies") (fl + "y's") (fl + "ies'") ;
--3 Proper names
--
-- Regular proper names are inflected with "'s" in the genitive.
@@ -65,6 +65,10 @@ oper
nameReg : Str -> Gender -> {s : Case => Str} = \john,g ->
{s = table {Gen => john + "'s" ; _ => john} ; g = g} ;
--2 Determiners
mkDeterminer : Number -> Str -> {s : Str ; n : Number} = \n,s ->
{s = s ; n = n} ;
--2 Pronouns
--
@@ -191,18 +195,6 @@ oper
mkVerb : (_,_,_ : Str) -> Verb = \ring,rang,rung ->
mkVerb4 ring (ring + "s") rang rung ;
regVerbP3 : Str -> Verb = \walk ->
mkVerb walk (walk + "ed") (walk + "ed") ;
verbP3s : Str -> Verb = \kiss ->
mkVerb4 kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ;
verbP3e : Str -> Verb = \love ->
mkVerb4 love (love + "s") (love + "d") (love + "d") ;
verbP3y : Str -> Verb = \cr ->
mkVerb4 (cr + "y") (cr + "ies") (cr + "ied") (cr + "ied") ;
verbGen : Str -> Verb = \kill -> case last kill of {
"y" => verbP3y (init kill) ;
"e" => verbP3y (init kill) ;
@@ -210,10 +202,21 @@ oper
_ => regVerbP3 kill
} ;
--- These are for later use.
-- These are just auxiliary to $verbGen$.
regVerbP3 : Str -> Verb = \walk ->
mkVerb walk (walk + "ed") (walk + "ed") ;
verbP3s : Str -> Verb = \kiss ->
mkVerb4 kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ;
verbP3e : Str -> Verb = \love ->
mkVerb4 love (love + "s") (love + "d") (love + "d") ;
verbP3y : Str -> Verb = \cr ->
mkVerb4 (cr + "y") (cr + "ies") (cr + "ied") (cr + "ied") ;
--- The particle always appears right after the verb.
verbPart : Verb -> Str -> Verb = \v,p ->
v ** {s1 = p} ;
{s = \\f => v.s ! f ++ p} ;
verbNoPart : Verb -> Verb = \v -> verbPart v [] ;

View File

@@ -16,9 +16,10 @@ abstract Noun = Cat ** {
NoNum : Num ;
NumInt : Int -> Num ;
NumNumeral : Numeral -> Num ;
AdNum : AdN -> Num -> Num ;
OrdNumeral : Numeral -> Ord ;
NoOrd : Ord ;

View File

@@ -21,6 +21,8 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
NumNumeral numeral = {s = numeral.s ! NCard} ;
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
AdNum adn num = {s = adn.s ++ num.s} ;
OrdSuperl a = {s = a.s ! AAdj Superl} ;
DefSg = {s = artDef ; n = Sg} ;

View File

@@ -59,6 +59,9 @@ resource ResEng = ParamEng ** open Prelude in {
}
} ;
regNP : Str -> Number -> {s : Case => Str ; a : Agr} = \that,n ->
mkNP that that (that + "'s") n P3 ;
-- We have just a heuristic definition of the indefinite article.
-- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic
-- "o" ("one-sided"), vocalic "u" ("umbrella").

View File

@@ -1,41 +1,108 @@
--1 GF Resource Grammar API for Structural Words
--
-- AR 21/11/2003 -- 30/11/2005
--
-- Here we have some words belonging to closed classes and appearing
-- in all languages we have considered.
-- Sometimes they are not really meaningful, e.g. $we_NP$ in Spanish
-- should be replaced by masculine and feminine variants.
abstract Structural = Cat ** {
fun
-- structural
-- This is an alphabetical list of structural words
above_Prep : Prep ;
after_Prep : Prep ;
-- all8mass_Det : Det ;
-- all_NDet : NDet ;
all_Predet : Predet ; --
almost_AdA : AdA ; -- Adv
almost_AdN : AdN ; --
although_Subj : Subj ;
and_Conj : Conj ;
always_AdV : AdV ; --
because_Subj : Subj ;
before_Prep : Prep ;
behind_Prep : Prep ;
between_Prep : Prep ;
both7and_DConj : DConj ; -- ConjD
but_PConj : PConj ; --
by8agent_Prep : Prep ;
by8means_Prep : Prep ;
can8know_VV : VV ;
can_VV : VV ;
during_Prep : Prep ;
either7or_DConj : DConj ; -- ConjD
every_Det : Det ;
everybody_NP : NP ;
everything_NP : NP ;
everywhere_Adv : Adv ;
from_Prep : Prep ;
he_Pron : Pron ; -- NP
here_Adv : Adv ; --
how_IAdv : IAdv ;
how8many_IDet : IDet ;
i_Pron : Pron ; -- NP
if_Subj : Subj ;
in8front_Prep : Prep ;
in_Prep : Prep ;
it_Pron : Pron ;
less_CAdv : CAdv ; --
many_Det : Det ;
more_CAdv : CAdv ; --
most_Predet : Predet ; -- Det
-- most8many_Det : Det ;
much_Det : Det ;
must_VV : VV ;
no_Phr : Phr ;
on_Prep : Prep ;
only_Predet : Predet ; --
or_Conj : Conj ;
otherwise_PConj : PConj ; -- AdC
part_Prep : Prep ;
please_Voc : Voc ;
possess_Prep : Prep ;
quite_Adv : AdA ;
she_Pron : Pron ;
so_AdA : AdA ; -- Adv
someSg_Det : Det ; -- some_Det
somePl_Det : Det ; -- NDet
somebody_NP : NP ;
something_NP : NP ;
somewhere_Adv : Adv ;
that_Quant : Quant ; -- Det
that_NP : NP ;
therefore_PConj : PConj ; -- AdC
these_Quant : Quant ; -- NDet
-- they8fem_NP : NP ;
they_Pron : Pron ; -- NP
this_Quant : Quant ; -- NDet
this_NP : NP ;
those_Quant : Quant ; -- NDet
thou_Pron : Pron ; -- NP
through_Prep : Prep ;
to_Prep : Prep ;
too_AdA : AdA ; -- Adv
under_Prep : Prep ;
very_AdA : AdA ; -- Adv
want_VV : VV ;
we_Pron : Pron ; -- NP
whatPl_IP : IP ; -- many
whatSg_IP : IP ; -- one
when_IAdv : IAdv ;
when_Subj : Subj ;
where_IAdv : IAdv ;
whichPl_IDet : IDet ; -- many
whichSg_IDet : IDet ; -- one
whoPl_IP : IP ; -- many
whoSg_IP : IP ; -- one
why_IAdv : IAdv ;
with_Prep : Prep ;
without_Prep : Prep ;
ye_Pron : Pron ; -- NP
yes_Phr : Phr ;
you_Pron : Pron ; -- NP
only_Predet, all_Predet : Predet ;
this_Quant, these_Quant : Quant ;
i_Pron, he_Pron, we_Pron : Pron ;
whoSg_IP, whoPl_IP : IP ;
when_IAdv, where_IAdv, why_IAdv : IAdv ;
whichSg_IDet, whichPl_IDet : IDet ;
here_Adv : Adv ;
very_AdA : AdA ;
always_AdV : AdV ;
one_Numeral, forty_Numeral : Numeral ;
in_Prep, of_Prep : Prep ;
and_Conj : Conj ;
either7or_DConj : DConj ;
but_PConj : PConj ;
if_Subj, because_Subj : Subj ;
please_Voc : Voc ;
more_CAdv, less_CAdv : CAdv ;
}

View File

@@ -1,47 +1,95 @@
concrete StructuralEng of Structural = CatEng ** open ResEng, Prelude in {
concrete StructuralEng of Structural = CatEng ** open MorphoEng, Prelude in {
flags optimize=all ;
lin
here_Adv = {s = "here"} ;
very_AdA = {s = "very"} ;
always_AdV = {s = "always"} ;
only_Predet = {s = "only"} ;
all_Predet = {s = "only"} ;
this_Quant = {s = "this" ; n = Sg} ;
these_Quant = {s = "these" ; n = Pl} ;
i_Pron = mkNP "I" "me" "my" Sg P1 ;
he_Pron = mkNP "he" "him" "his" Sg P3 ;
we_Pron = mkNP "we" "us" "our" Pl P1 ;
whoSg_IP = mkIP "who" "whom" "whose" Sg ;
whoPl_IP = mkIP "who" "whom" "whose" Pl ;
when_IAdv = {s = "when"} ;
where_IAdv = {s = "where"} ;
why_IAdv = {s = "why"} ;
whichSg_IDet = {s = "which" ; n = Sg} ;
whichPl_IDet = {s = "which" ; n = Pl} ;
one_Numeral = {s = table {NCard => "one" ; NOrd => "first"} ; n = Sg} ;
forty_Numeral = {s = table {NCard => "forty" ; NOrd => "fortieth"} ; n = Pl} ;
in_Prep = {s = "in"} ;
of_Prep = {s = "of"} ;
and_Conj = {s = "and" ; n = Pl} ;
either7or_DConj = {s1 = "either" ; s2 = "or" ; n = Sg} ;
if_Subj = ss "if" ;
because_Subj = ss "because" ;
but_PConj = {s = "but"} ;
please_Voc = {s = "," ++ "please"} ;
more_CAdv = ss "more" ;
less_CAdv = ss "less" ;
above_Prep = ss "above" ;
after_Prep = ss "after" ;
all_Predet = ss "all" ;
almost_AdA, almost_AdN = ss "almost" ;
although_Subj = ss "although" ;
always_AdV = ss "always" ;
and_Conj = ss "and" ** {n = Pl} ;
because_Subj = ss "because" ;
before_Prep = ss "before" ;
behind_Prep = ss "behind" ;
between_Prep = ss "between" ;
both7and_DConj = sd2 "both" "and" ** {n = Pl} ;
but_PConj = ss "but" ;
by8agent_Prep = ss "by" ;
by8means_Prep = ss "by" ;
---- can8know_VV = vvCan ;
---- can_VV = vvCan ;
during_Prep = ss "during" ;
either7or_DConj = sd2 "either" "or" ** {n = Sg} ;
everybody_NP = regNP "everybody" Sg ;
every_Det = mkDeterminer Sg "every" ;
everything_NP = regNP "everything" Sg ;
everywhere_Adv = ss "everywhere" ;
from_Prep = ss "from" ;
he_Pron = mkNP "he" "him" "his" Sg P3 ;
here_Adv = ss "here" ;
how_IAdv = ss "how" ;
how8many_IDet = mkDeterminer Pl ["how many"] ;
if_Subj = ss "if" ;
in8front_Prep = ss ["in front of"] ;
i_Pron = mkNP "I" "me" "my" Sg P1 ;
in_Prep = ss "in" ;
it_Pron = mkNP "it" "it" "its" Sg P3 ;
less_CAdv = ss "less" ;
many_Det = mkDeterminer Pl "many" ;
more_CAdv = ss "more" ;
most_Predet = ss "most" ;
much_Det = mkDeterminer Sg "much" ;
---- must_VV = vvMust ;
no_Phr = ss "no" ;
on_Prep = ss "on" ;
only_Predet = ss "only" ;
or_Conj = ss "or" ** {n = Sg} ;
otherwise_PConj = ss "otherwise" ;
part_Prep = ss "of" ;
please_Voc = ss "please" ;
possess_Prep = ss "of" ;
quite_Adv = ss "quite" ;
she_Pron = mkNP "she" "her" "her" Sg P3 ;
so_AdA = ss "so" ;
somebody_NP = regNP "somebody" Sg ;
someSg_Det = mkDeterminer Sg "some" ;
somePl_Det = mkDeterminer Pl "some" ;
something_NP = regNP "something" Sg ;
somewhere_Adv = ss "somewhere" ;
that_Quant = mkDeterminer Sg "that" ;
that_NP = regNP "that" Sg ;
therefore_PConj = ss "therefore" ;
these_Quant = mkDeterminer Pl "these" ;
they_Pron = mkNP "they" "them" "their" Pl P3 ;
this_Quant = mkDeterminer Sg "this" ;
this_NP = regNP "this" Sg ;
those_Quant = mkDeterminer Pl "those" ;
thou_Pron = mkNP "you" "you" "your" Sg P2 ;
through_Prep = ss "through" ;
too_AdA = ss "too" ;
to_Prep = ss "to" ;
under_Prep = ss "under" ;
very_AdA = ss "very" ;
---- want_VV = verb2aux (verbNoPart (regVerbP3 "want")) ** {isAux = False} ;
we_Pron = mkNP "we" "us" "our" Pl P1 ;
whatPl_IP = mkIP "what" "what" "what's" Sg ;
whatSg_IP = mkIP "what" "what" "what's" Sg ;
when_IAdv = ss "when" ;
when_Subj = ss "when" ;
where_IAdv = ss "where" ;
whichPl_IDet = mkDeterminer Pl ["which"] ;
whichSg_IDet = mkDeterminer Sg ["which"] ;
whoSg_IP = mkIP "who" "whom" "whose" Sg ;
whoPl_IP = mkIP "who" "whom" "whose" Pl ;
why_IAdv = ss "why" ;
without_Prep = ss "without" ;
with_Prep = ss "with" ;
ye_Pron = mkNP "you" "you" "your" Pl P2 ;
you_Pron = mkNP "you" "you" "your" Sg P2 ;
yes_Phr = ss "yes" ;
}