summaryrefslogtreecommitdiff
path: root/old-lib/resource/catalan/MorphoCat.gf
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2009-06-22 15:39:08 +0000
committeraarne <aarne@chalmers.se>2009-06-22 15:39:08 +0000
commite89fdae2fa1626348d8025824a7469252fa85e42 (patch)
treec7d46bbd0494043b4bd6f917a25a7687517d0547 /old-lib/resource/catalan/MorphoCat.gf
parent3049b59b35b25381a7c6787444165c200d66e08b (diff)
next-lib renamed to lib, lib to old-lib
Diffstat (limited to 'old-lib/resource/catalan/MorphoCat.gf')
-rw-r--r--old-lib/resource/catalan/MorphoCat.gf160
1 files changed, 160 insertions, 0 deletions
diff --git a/old-lib/resource/catalan/MorphoCat.gf b/old-lib/resource/catalan/MorphoCat.gf
new file mode 100644
index 000000000..f21bc849d
--- /dev/null
+++ b/old-lib/resource/catalan/MorphoCat.gf
@@ -0,0 +1,160 @@
+--# -path=.:../romance:../common:../../prelude
+
+--1 A Simple Catalan Resource Morphology
+--
+-- Aarne Ranta 2002 -- 2005
+-- Jordi Saludes 2008: Derived from MorphoSpa.
+--
+-- This resource morphology contains definitions needed in the resource
+-- syntax. To build a lexicon, it is better to use $ParadigmsCat$, which
+-- gives a higher-level access to this module.
+
+resource MorphoCat = CommonRomance, ResCat **
+ open PhonoCat, Prelude, Predef in {
+
+ flags optimize=all ; coding=utf8 ;
+
+--2 Nouns
+--
+-- The following macro is useful for creating the forms of number-dependent
+-- tables, such as common nouns.
+-- gcc M2.3
+oper
+ numForms : (_,_ : Str) -> Number => Str = \vi, vins ->
+ table {Sg => vi ; Pl => vins} ;
+
+ nomCep : Str -> Number => Str = \cep ->
+ numForms cep (cep + "s") ;
+
+
+ nomCasa : Str -> Str -> Number => Str = \es,casa ->
+ numForms casa (init casa + es) ;
+
+ nomFre : Str -> Number => Str = \fre ->
+ numForms fre (fre + "ns") ;
+
+ nomCas : Str -> Number => Str = \cas ->
+ numForms cas (cas + "os") ;
+
+ nomTest : Str -> Number => Str = \test ->
+ numForms test (variants {test + "s"; test + "os"}) ;
+
+ nomFaig : Str -> Number => Str = \faig ->
+ let
+ fa = Predef.tk 2 faig
+ in
+ numForms faig (variants {fa + "jos" ; faig + "s"}) ;
+
+ nomDesig : Str -> Number => Str = \desig ->
+ let
+ desi = Predef.tk 1 desig
+ in
+ numForms desig (variants {desi + "tjos" ; desi + "gs"}) ;
+
+ nomTemps : Str -> Number => Str = \temps ->
+ numForms temps temps ;
+
+-- Common nouns are inflected in number and have an inherent gender.
+
+ mkNoun : (Number => Str) -> Gender -> Noun = \noinois,gen ->
+ {s = noinois ; g = gen} ;
+
+ mkNounIrreg : Str -> Str -> Gender -> Noun = \vi,vins ->
+ mkNoun (numForms vi vins) ;
+
+ mkNomReg : Str -> Noun = \noi ->
+ let
+ mkNounMas : (Str -> Number => Str) -> Noun = \rule -> mkNoun (rule noi) Masc
+ in
+ case last noi of {
+ "a" => mkNoun (nomCasa "es" noi) Fem ;
+ "s"|"x"|"ç" => mkNounMas nomCas ;
+ "i"|"e" => mkNounMas nomFre ;
+ "í" => mkNounMas (nomCasa "ins") ;
+ "à" => mkNounMas (nomCasa "ans") ;
+ "ó" => mkNounMas (nomCasa "ons") ;
+ "g" => mkNounMas nomFaig ;
+ _ => mkNounMas nomCep
+ } ;
+
+--2 Adjectives
+--
+-- Adjectives are conveniently seen as gender-dependent nouns.
+-- Here are some patterns. First one that describes the worst case.
+-- gcc M2.1
+
+ mkAdj : (_,_,_,_,_ : Str) -> Adj = \prim,prima,prims,primes,primament ->
+ {s = table {
+ AF Masc n => numForms prim prims ! n ;
+ AF Fem n => numForms prima primes ! n ;
+ AA => primament
+ }
+ } ;
+
+--- Then the regular and invariant patterns.
+
+ adjPrim : Str -> Adj = \prim ->
+ mkAdj prim (prim + "a") (prim + "s") (prim + "es") (prim + "ament") ;
+
+ adjBlau : Str -> Str -> Adj = \blau,blava ->
+ let
+ blav = Predef.tk 1 blava
+ in
+ mkAdj blau blava (blau + "s") (blav + "es") (blava + "ment") ;
+
+ adjFondo : Str -> Adj = \fondo ->
+ let
+ fond = Predef.tk 1 fondo
+ in
+ adjBlau fondo (fond + "a") ;
+
+ adjBo : Str -> Adj = \bo ->
+ mkAdj bo (bo + "na") (bo + "ns") (bo + "nes") (bo + "nament") ;
+
+ adjFidel : Str -> Adj = \fidel ->
+ let
+ fidels = fidel + "s"
+ in
+ mkAdj fidel fidel fidels fidels (fidel + "ment") ;
+
+ mkAdjReg : Str -> Adj = \prim ->
+ case last prim of {
+ "e"|"u"|"o" => adjFondo prim ;
+ _ => adjPrim prim
+ } ;
+
+
+--2 Personal pronouns
+--
+-- All the eight personal pronouns can be built by the following macro.
+-- The use of "ne" as atonic genitive is debatable.
+-- We follow the rule that the atonic nominative is empty.
+
+ mkPronoun : (_,_,_,_,_,_,_,_ : Str) ->
+ Gender -> Number -> Person -> Pronoun =
+ \il,le,lui,Lui,son,sa,ses,see,g,n,p ->
+ {s = table {
+ Ton Nom => il ;
+ Ton x => prepCase x ++ Lui ;
+ Aton Nom => strOpt il ; ---- [] ;
+ Aton Acc => le ;
+ Aton (CPrep P_a) => lui ;
+ Aton q => prepCase q ++ Lui ; ---- GF bug with c or p!
+ Poss Masc Sg => son ;
+ Poss Fem Sg => sa ;
+ Poss Masc Pl => ses ;
+ Poss Fem Pl => see
+ } ;
+ a = {g = g ; n = n ; p = p} ;
+ hasClit = True
+ } ;
+
+
+--2 Determiners
+--
+-- Determiners, traditionally called indefinite pronouns, are inflected
+-- in gender and number, like adjectives.
+
+ pronForms : Adj -> Gender -> Number -> Str = \tal,g,n -> tal.s ! AF g n ;
+
+}