forked from GitHub/gf-core
cleaning up resource module structure
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Adjectives and adjectival phrases</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:37 2006
|
||||
Last update: Wed Jan 25 10:50:12 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Adverbs and adverbial phrases</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:37 2006
|
||||
Last update: Wed Jan 25 10:50:12 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> A Basic Lexicon</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:37 2006
|
||||
Last update: Wed Jan 25 10:50:12 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> The category system</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:37 2006
|
||||
Last update: Wed Jan 25 10:50:12 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Coordination</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:38 2006
|
||||
Last update: Wed Jan 25 10:50:13 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> The Main Module of the Resource Grammar</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:38 2006
|
||||
Last update: Wed Jan 25 10:50:13 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Symbolic expressions</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:38 2006
|
||||
Last update: Wed Jan 25 10:50:13 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> The construction of nouns, noun phrases, and determiners</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:38 2006
|
||||
Last update: Wed Jan 25 10:50:13 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Numerals</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:38 2006
|
||||
Last update: Wed Jan 25 10:50:13 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<P></P>
|
||||
<P>
|
||||
Author:
|
||||
Last update: Fri Jan 20 18:01:40 2006
|
||||
Last update: Wed Jan 25 10:50:14 2006
|
||||
</P>
|
||||
<P>
|
||||
Produced by
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<P></P>
|
||||
<P>
|
||||
Author:
|
||||
Last update: Fri Jan 20 18:01:41 2006
|
||||
Last update: Wed Jan 25 10:50:15 2006
|
||||
</P>
|
||||
<P>
|
||||
Produced by
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<P></P>
|
||||
<P>
|
||||
Author:
|
||||
Last update: Fri Jan 20 18:01:41 2006
|
||||
Last update: Wed Jan 25 10:50:15 2006
|
||||
</P>
|
||||
<P>
|
||||
Produced by
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<P></P>
|
||||
<P>
|
||||
Author:
|
||||
Last update: Fri Jan 20 18:01:41 2006
|
||||
Last update: Wed Jan 25 10:50:15 2006
|
||||
</P>
|
||||
<P>
|
||||
Produced by
|
||||
@@ -90,8 +90,8 @@ words.
|
||||
open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
ResScand,
|
||||
DiffSwe,
|
||||
CommonScand,
|
||||
ResSwe,
|
||||
MorphoSwe,
|
||||
CatSwe in {
|
||||
</PRE>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Phrases and utterances</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:39 2006
|
||||
Last update: Wed Jan 25 10:50:13 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Questions and interrogative pronouns</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:39 2006
|
||||
Last update: Wed Jan 25 10:50:13 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Relative clauses and pronouns</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:39 2006
|
||||
Last update: Wed Jan 25 10:50:14 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Clauses, imperatives, and sentential complements</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:39 2006
|
||||
Last update: Wed Jan 25 10:50:14 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> GF Resource Grammar API for Structural Words</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:39 2006
|
||||
Last update: Wed Jan 25 10:50:14 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
@@ -119,7 +119,6 @@ This is an alphabetical list of structural words
|
||||
this_NP : NP ;
|
||||
those_NP : NP ;
|
||||
those_Quant : QuantPl ;
|
||||
thou_Pron : Pron ;
|
||||
through_Prep : Prep ;
|
||||
to_Prep : Prep ;
|
||||
too_AdA : AdA ;
|
||||
@@ -139,9 +138,10 @@ This is an alphabetical list of structural words
|
||||
why_IAdv : IAdv ;
|
||||
with_Prep : Prep ;
|
||||
without_Prep : Prep ;
|
||||
ye_Pron : Pron ;
|
||||
yes_Phr : Phr ;
|
||||
you_Pron : Pron ;
|
||||
youSg_Pron : Pron ;
|
||||
youPl_Pron : Pron ;
|
||||
youPol_Pron : Pron ;
|
||||
|
||||
}
|
||||
</PRE>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Tense, Polarity, and Anteriority</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:40 2006
|
||||
Last update: Wed Jan 25 10:50:14 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> Tensed forms of sentences, questions, and relative clauses</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:40 2006
|
||||
Last update: Wed Jan 25 10:50:14 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<P ALIGN="center"><CENTER><H1> The construction of verb phrases</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Fri Jan 20 18:01:40 2006
|
||||
Last update: Wed Jan 25 10:50:14 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
--concrete ListConjunctionGer of Conjunction =
|
||||
-- CatGer ** open ResGer, Coordination, Prelude in {
|
||||
--
|
||||
-- lin
|
||||
--
|
||||
-- ConjS conj ss = {s = conjunctX conj ss} ;
|
||||
-- DConjS conj ss = {s = conjunctDistrX conj ss} ;
|
||||
--
|
||||
-- ConjAdv conj ss = {s = conjunctX conj ss} ;
|
||||
-- DConjAdv conj ss = {s = conjunctDistrX conj ss} ;
|
||||
--
|
||||
-- ConjNP conj ss = conjunctTable Case conj ss ** {
|
||||
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
|
||||
-- } ;
|
||||
-- DConjNP conj ss = conjunctDistrTable Case conj ss ** {
|
||||
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
|
||||
-- } ;
|
||||
--
|
||||
-- ConjAP conj ss = conjunctTable Agr conj ss ** {
|
||||
-- isPre = ss.isPre
|
||||
-- } ;
|
||||
-- DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
|
||||
-- isPre = ss.isPre
|
||||
-- } ;
|
||||
--
|
||||
---- These fun's are generated from the list cat's.
|
||||
--
|
||||
-- BaseS = twoSS ;
|
||||
-- ConsS = consrSS comma ;
|
||||
-- BaseAdv = twoSS ;
|
||||
-- ConsAdv = consrSS comma ;
|
||||
-- BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
|
||||
-- ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
|
||||
-- BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
|
||||
-- ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
|
||||
--
|
||||
-- lincat
|
||||
-- [S] = {s1,s2 : Str} ;
|
||||
-- [Adv] = {s1,s2 : Str} ;
|
||||
-- [NP] = {s1,s2 : Case => Str ; a : Agr} ;
|
||||
-- [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
|
||||
--
|
||||
--}
|
||||
193
lib/resource-1.0/scandinavian/CommonScand.gf
Normal file
193
lib/resource-1.0/scandinavian/CommonScand.gf
Normal file
@@ -0,0 +1,193 @@
|
||||
--1 Auxiliary operations common for Scandinavian languages.
|
||||
--
|
||||
-- This module contains operations that are shared by the Scandinavian
|
||||
-- languages. The complete set of auxiliary operations needed to
|
||||
-- implement [Test Test.html] is defined in [ResScandinavian ResScandinavian.html],
|
||||
-- which depends on [DiffScandinavian DiffScandinavian.html].
|
||||
|
||||
resource CommonScand = ParamScand ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
oper
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
-- For each lexical category, here are the worst-case constructors.
|
||||
--
|
||||
-- But $mkNoun$ is fully defined only for each language, since
|
||||
-- $Gender$ varies.
|
||||
|
||||
nounForms : (x1,_,_,x4 : Str) -> (Number => Species => Case => Str) =
|
||||
\man,mannen,men,mennen -> \\n,d,c => case <n,d> of {
|
||||
<Sg,Indef> => mkCase c man ;
|
||||
<Sg,Def> => mkCase c mannen ;
|
||||
<Pl,Indef> => mkCase c men ;
|
||||
<Pl,Def> => mkCase c mennen
|
||||
} ;
|
||||
|
||||
Adjective : Type = {s : AForm => Str} ;
|
||||
|
||||
mkAdjective : (x1,_,_,_,_,_,x7 : Str) -> {s : AForm => Str} =
|
||||
\liten, litet, lilla, sma, mindre, minst, minsta -> {
|
||||
s = table {
|
||||
AF (APosit a) c => mkCase c (mkAdjPos a liten litet lilla sma) ;
|
||||
AF ACompar c => mkCase c mindre ;
|
||||
AF (ASuperl SupStrong) c => mkCase c minst ;
|
||||
AF (ASuperl SupWeak) c => mkCase c minsta
|
||||
}
|
||||
} ;
|
||||
|
||||
mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> {s : VForm => Str ; vtype : VType} =
|
||||
\finna,finner,finn,fann,funnit,funnen,funnet,funna -> {
|
||||
s = table {
|
||||
VF (VPres Act) => finner ;
|
||||
VF (VPres Pass) => mkVoice Pass finn ;
|
||||
VF (VPret v) => mkVoice v fann ;
|
||||
VF (VImper v) => mkVoice v finn ;
|
||||
VI (VInfin v) => mkVoice v finna ;
|
||||
VI (VSupin v) => mkVoice v funnit ;
|
||||
VI (VPtPret a c)=> mkCase c (mkAdjPos a funnen funnet funna funna)
|
||||
} ;
|
||||
vtype = VAct
|
||||
} ;
|
||||
|
||||
-- These are useful auxiliaries.
|
||||
|
||||
mkCase : Case -> Str -> Str = \c,f -> case c of {
|
||||
Nom => f ;
|
||||
Gen => f + case last f of {
|
||||
"s" | "x" => [] ;
|
||||
_ => "s"
|
||||
}
|
||||
} ;
|
||||
|
||||
mkAdjPos : AFormPos -> (s1,_,_,s4 : Str) -> Str =
|
||||
\a, liten, litet, lilla, sma ->
|
||||
case a of {
|
||||
Strong gn => case gn of {
|
||||
SgUtr => liten ;
|
||||
SgNeutr => litet ;
|
||||
Plg => sma
|
||||
} ;
|
||||
Weak Sg => lilla ;
|
||||
Weak Pl => sma
|
||||
} ;
|
||||
|
||||
mkVoice : Voice -> Str -> Str = \v,s -> case v of {
|
||||
Act => s ;
|
||||
Pass => s + case last s of {
|
||||
"s" => "es" ;
|
||||
_ => "s"
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
-- For $Noun$.
|
||||
|
||||
artDef : GenNum -> Str = \gn -> gennumForms "den" "det" "de" ! gn ;
|
||||
|
||||
mkNP : (x1,_,_,_,x5 : Str) -> GenNum -> Person ->
|
||||
{s : NPForm => Str ; a : Agr} = \du,dig,din,ditt,dina,gn,p -> {
|
||||
s = table {
|
||||
NPNom => du ;
|
||||
NPAcc => dig ;
|
||||
NPPoss g => gennumForms din ditt dina ! g
|
||||
} ;
|
||||
a = {
|
||||
gn = gn ;
|
||||
p = p
|
||||
}
|
||||
} ;
|
||||
|
||||
gennumForms : (x1,x2,x3 : Str) -> GenNum => Str = \den,det,de ->
|
||||
table {
|
||||
SgUtr => den ;
|
||||
SgNeutr => det ;
|
||||
_ => de
|
||||
} ;
|
||||
|
||||
regNP : Str -> Str -> GenNum -> {s : NPForm => Str ; a : Agr} =
|
||||
\det,dess,gn ->
|
||||
mkNP det det dess dess dess gn P3 ;
|
||||
|
||||
|
||||
-- For $Verb$.
|
||||
|
||||
Verb : Type = {
|
||||
s : VForm => Str ;
|
||||
vtype : VType
|
||||
} ;
|
||||
|
||||
VP = {
|
||||
s : VPForm => {
|
||||
fin : Str ; -- V1 har ---s1
|
||||
inf : Str -- V2 sagt ---s4
|
||||
} ;
|
||||
a1 : Polarity => Str ; -- A1 inte ---s3
|
||||
n2 : Agr => Str ; -- N2 dig ---s5
|
||||
a2 : Str ; -- A2 idag ---s6
|
||||
ext : Str ; -- S-Ext att hon går ---s7
|
||||
--- ea1,ev2, --- these depend on params of v and a1
|
||||
en2,ea2,eext : Bool -- indicate if the field exists
|
||||
} ;
|
||||
|
||||
|
||||
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = vp.a1 ;
|
||||
n2 = \\a => vp.n2 ! a ++ obj ! a ;
|
||||
a2 = vp.a2 ;
|
||||
ext = vp.ext ;
|
||||
en2 = True ;
|
||||
ea2 = vp.ea2 ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
insertAdv : Str -> VP -> VP = \adv,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = vp.a1 ;
|
||||
n2 = vp.n2 ;
|
||||
a2 = vp.a2 ++ adv ;
|
||||
ext = vp.ext ;
|
||||
en2 = vp.en2 ;
|
||||
ea2 = True ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
insertAdV : Str -> VP -> VP = \adv,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = \\b => vp.a1 ! b ++ adv ;
|
||||
n2 = vp.n2 ;
|
||||
a2 = vp.a2 ;
|
||||
ext = vp.ext ;
|
||||
en2 = vp.en2 ;
|
||||
ea2 = vp.ea2 ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
infVP : VP -> Agr -> Str = \vp,a ->
|
||||
(vp.s ! VPInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1
|
||||
|
||||
|
||||
-- For $Sentence$.
|
||||
|
||||
Clause : Type = {
|
||||
s : Tense => Anteriority => Polarity => Order => Str
|
||||
} ;
|
||||
|
||||
mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> {
|
||||
s = \\t,a,b,o =>
|
||||
let
|
||||
verb = vp.s ! VPFinite t a ;
|
||||
neg = vp.a1 ! b ;
|
||||
compl = vp.n2 ! agr ++ vp.a2 ++ vp.ext
|
||||
in
|
||||
case o of {
|
||||
Main => subj ++ verb.fin ++ neg ++ verb.inf ++ compl ;
|
||||
Inv => verb.fin ++ subj ++ neg ++ verb.inf ++ compl ;
|
||||
Sub => subj ++ neg ++ verb.fin ++ verb.inf ++ compl
|
||||
}
|
||||
} ;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user