summaryrefslogtreecommitdiff
path: root/old-lib/resource/catalan/DiffCat.gf
blob: 1b41659f3b69d1d3d7f76283ff7b5d34467a1051 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
--# -path=.:../romance:../abstract:../common:prelude

instance DiffCat of DiffRomance = open CommonRomance, PhonoCat, BeschCat, Prelude in {

  flags optimize=noexpand ;

  param 
    Prepos = P_de | P_a ;
    VType = VHabere | VRefl ;

oper
    dative   : Case = CPrep P_a ;
    genitive : Case = CPrep P_de ;

    prepCase = \c -> case c of {
      Nom => [] ;
      Acc => [] ; 
      CPrep P_de => "de" ;
      CPrep P_a  => "a"
      } ;

        
    artDef : Gender -> Number -> Case -> Str = \g,n,c ->
      case <g,n,c> of {
        <Masc,Sg, CPrep P_de> => pre {"del" ; ["de l'"] / vocalForta} ;
        <Masc,Sg, CPrep P_a>  => pre {"al" ; ["a l'"]  / vocalForta} ;
        <Masc,Sg, _>    => elisEl ;
        <Fem, Sg, _>    => prepCase c ++ elisLa ;
        <_,   Pl, CPrep P_de> => "dels" ;
        <_,   Pl, CPrep P_a>  => "als" ;
        <Masc,   Pl, _ >   => "els" ;
        <Fem,   Pl, _ >   => "les"
        } ;

        

    artIndef = \g,n,c -> case <n,c> of {
      <Sg,CPrep P_de>   => genForms ["d' un"] ["d' una"] ! g ;
      <Pl,CPrep P_de> => genForms ["d' uns"] ["d' unes"] ! g ;
      <Sg,_> => prepCase c ++ genForms "un" "una" ! g ;
      <Pl,_> => prepCase c ++ genForms "uns" "unes" ! g
      } ;

      

    possCase = \_,_,c -> prepCase c ;

    partitive = \g,c -> case c of {
      CPrep P_de => "de" ;
      _ => prepCase c ++ artDef g Sg (CPrep P_de)
      } ;

    conjunctCase : NPForm -> NPForm = \c -> case c of {
      Ton Nom | Aton Nom => Ton Nom ;
      _ => Ton Acc 
      } ;

    auxVerb : VType -> (VF => Str) = \_ -> haver_V.s ;

    partAgr : VType -> VPAgr = \vtyp -> vpAgrNone ;

    vpAgrClit : Agr -> VPAgr = \a ->
      vpAgrNone ;

  pronArg = \n,p,acc,dat ->
      let 
        paccp = case acc of {
          CRefl   => <reflPron n p Acc, p,True> ;
          CPron ag an ap => <argPron ag an ap Acc, ap,True> ;
          _ => <[],P2,False>
          } ;
        pdatp = case dat of {
          CPron ag an ap => <argPron ag an ap dative, ap,True> ;
          _ => <[],P2,False>
          }
       in case <paccp.p2, pdatp.p2> of {
         ---- AR 8/6/2008 efficiency problem in pgf generation: 
         ---- replace the case expr with
         ---- a constant produces an error in V3 predication with two pronouns
         ---- <P3,P3> => <"se" ++ paccp.p1, [],True> ;
         _       => <pdatp.p1 ++ paccp.p1, [],orB paccp.p3 pdatp.p3>
         } ;
         
    --case <p,acc,dat> of {
    --    <Sg,P2,CRefl,CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;
    --    <_,_,CPron {n = Sg ; p = P2},CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;

   infForm _ _ _ _  = True ;

   mkImperative _ p vp = { --- politeness
      s = \\pol,aag => 
        let 
          agr   = aag ** {p = p} ;
          verb  = case <aag.n, pol> of {
            <Sg,Neg> => (vp.s ! VPFinite (VPres Conjunct) Simul).fin ! agr ;
            _ => (vp.s ! VPImperat).fin ! agr
            } ;
          neg   = vp.neg ! pol ;
          clpr  = pronArg agr.n agr.p vp.clAcc vp.clDat ;
          compl = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
        in
        neg.p1 ++ verb ++ bindIf clpr.p3 ++ clpr.p1 ++ compl ;
      } ;
      
    negation : Polarity => (Str * Str) = table {
      Pos => <[],[]> ;
      Neg => <"no",[]>
      } ;

    conjThan = "que" ;
    conjThat = "que" ;
    subjIf = "si" ;


   
    clitInf b cli inf = inf ++ bindIf b ++ cli ; --- JS copied from DiffSpa

    relPron : Bool => AAgr => Case => Str = \\b,a,c => 
      case c of {
        Nom | Acc => "que" ;
        CPrep P_a => "cuyo" ;
        _ => prepCase c ++ "cuyo"
        } ;

    pronSuch : AAgr => Str = aagrForms "tal" "tal" "tals" "tals" ;

    quelPron : AAgr => Str = aagrForms "qual" "qual" "quals" "quals" ;

    partQIndir = [] ; ---- ?

    reflPron : Number -> Person -> Case -> Str = \n,p,c -> 
        let pro = argPron Fem n p c 
        in
        case p of { 
        P3 => case c of {
          Acc | CPrep P_a => "se" ;
          _ => "sÌ"
          } ;
        _ => pro
        } ; 

    argPron : Gender -> Number -> Person -> Case -> Str = 
      let 
        cases : (x,y : Str) -> Case -> Str = \me,moi,c -> case c of {
          Acc | CPrep P_a => me ;
          _ => moi
          } ;
        cases3 : (x,y,z : Str) -> Case -> Str = \les,leur,eux,c -> case c of {
          Acc => les ;
          CPrep P_a => leur ;
          _ => eux
          } ;
      in 
      \g,n,p -> case <g,n,p> of { 
        <_,Sg,P1> => cases "em" "mí" ;
        <_,Sg,P2> => cases "et" "tú" ;
        <_,Pl,P1> => cases "ens" "nosaltres" ; --- nosotros
        <_,Pl,P2> => cases "us" "vosaltres" ; --- vosotros
        <Fem,Sg,P3> => cases3 "la" "li" "ella" ;
        <Masc,  Sg,P3> => cases3 "el" "li" "ell" ;
        <Fem,Pl,P3> => cases3 "les" "les" "elles" ;
        <Masc,  Pl,P3> => cases3 "els" "els" "ells"
        } ;

    vRefl   : VType = VRefl ;
    isVRefl : VType -> Bool = \ty -> case ty of {
      VRefl => True ;
      _ => False
      } ;

    auxPassive : Verb = copula ;

    copula = verbBeschH (ser_52 "ser") ;

    haver_V : Verb = verbBeschH (haver_59 "haver") ;

    verbBeschH : Verbum -> Verb = \v -> verbBesch v ** {vtyp = VHabere} ;

}