sequoia_proj.grs 13.8 KB
Newer Older
1
include "sequoia.dom"
2 3

% ====================================================================================================
4 5
% le package [rm_deep] efface les relations D:... %
package rm_deep {
6
  rule r { pattern { e: X -[re"D:.*"]-> Y} commands { del_edge e } }
Bruno Guillaume's avatar
Bruno Guillaume committed
7
}
8 9

% ====================================================================================================
10 11
% le package [rm_surf] efface les relations S:... %
package rm_surf {
12
  rule r { pattern { e: X -[re"S:.*"]-> Y} commands { del_edge e } }
Bruno Guillaume's avatar
Bruno Guillaume committed
13
}
14 15

% ====================================================================================================
16 17
% le package [rm_meddle] efface les relations I:... %
package rm_meddle {
18
  rule r { pattern { e: X -[re"I:.*"]-> Y} commands { del_edge e } }
Bruno Guillaume's avatar
Bruno Guillaume committed
19
}
20 21

% ====================================================================================================
22 23
% le package [surf_final] remplace efface les relations S:x:y par x %
package surf_final {
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
  rule p_obj_o       { pattern { e:X -[S:p_obj.o]-> Y }       commands { del_edge e; add_edge X-[p_obj.o]-> Y } }
  rule mod           { pattern { e:X -[S:mod]-> Y }           commands { del_edge e; add_edge X-[mod]-> Y } }
  rule aff           { pattern { e:X -[S:aff]-> Y }           commands { del_edge e; add_edge X-[aff]-> Y } }
  rule ats_ats       { pattern { e:X -[S:ats:ats]-> Y }       commands { del_edge e; add_edge X-[ats]-> Y } }
  rule arg           { pattern { e:X -[S:arg]-> Y }           commands { del_edge e; add_edge X-[arg]-> Y } }
  rule mod_app       { pattern { e:X -[S:mod.app]-> Y }       commands { del_edge e; add_edge X-[mod.app]-> Y } }
  rule coord         { pattern { e:X -[S:coord]-> Y }         commands { del_edge e; add_edge X-[coord]-> Y } }
  rule dep_coord     { pattern { e:X -[S:dep.coord]-> Y }     commands { del_edge e; add_edge X-[dep.coord]-> Y } }
  rule ponct         { pattern { e:X -[S:ponct]-> Y }         commands { del_edge e; add_edge X-[ponct]-> Y } }
  rule aux_tps       { pattern { e:X -[S:aux.tps]-> Y }       commands { del_edge e; add_edge X-[aux.tps]-> Y } }
  rule aux_pass      { pattern { e:X -[S:aux.pass]-> Y }      commands { del_edge e; add_edge X-[aux.pass]-> Y } }
  rule aux_caus      { pattern { e:X -[S:aux.caus]-> Y }      commands { del_edge e; add_edge X-[aux.caus]-> Y } }
  rule obj_p         { pattern { e:X -[S:obj.p]-> Y }         commands { del_edge e; add_edge X-[obj.p]-> Y } }
  rule obj_cpl       { pattern { e:X -[S:obj.cpl]-> Y }       commands { del_edge e; add_edge X-[obj.cpl]-> Y } }
  rule suj_suj       { pattern { e:X -[S:suj:suj]-> Y }       commands { del_edge e; add_edge X-[suj]-> Y } }
  rule suj_obj       { pattern { e:X -[S:suj:obj]-> Y }       commands { del_edge e; add_edge X-[suj]-> Y } }
  rule obj_obj       { pattern { e:X -[S:obj:obj]-> Y }       commands { del_edge e; add_edge X-[obj]-> Y } }
  rule a_obj_a_obj   { pattern { e:X -[S:a_obj:a_obj]-> Y }   commands { del_edge e; add_edge X-[a_obj]-> Y } }
  rule a_obj_suj     { pattern { e:X -[S:a_obj:suj]-> Y }     commands { del_edge e; add_edge X-[a_obj]-> Y } }
  rule de_obj_de_obj { pattern { e:X -[S:de_obj:de_obj]-> Y } commands { del_edge e; add_edge X-[de_obj]-> Y } }
  rule pobj_agt_suj  { pattern { e:X -[S:p_obj.agt:suj]-> Y } commands { del_edge e; add_edge X-[p_obj.agt]-> Y } }
  rule suj_void      { pattern { e:X -[S:suj:_]-> Y }         commands { del_edge e; add_edge X-[suj]-> Y } }

  rule aff_demsuj    { pattern { e:X -[S:aff.demsuj]-> Y }    commands { del_edge e; add_edge X-[aff.demsuj]-> Y } }
  rule dep           { pattern { e:X -[S:dep]-> Y }           commands { del_edge e;  add_edge X-[dep]-> Y } }
  rule det           { pattern { e:X -[S:det]-> Y }           commands { del_edge e; add_edge X-[det]-> Y } }
  rule obj_suj       { pattern { e:X -[S:obj:suj]-> Y }       commands { del_edge e; add_edge X-[obj]-> Y } }
  rule mod_rel       { pattern { e:X -[S:mod.rel]-> Y }       commands { del_edge e; add_edge X-[mod.rel]-> Y } }
  rule dis_suj       { pattern { e:X -[S:dis:suj]-> Y }       commands { del_edge e; add_edge X-[dis]-> Y } }
  rule dis_obj       { pattern { e:X -[S:dis:obj]-> Y }       commands { del_edge e; add_edge X-[dis]-> Y } }
  rule root          { pattern { e:X -[S:root]-> Y }          commands { del_edge e; add_edge X-[root]-> Y } }
55
} % end package surf_final
56 57

% ====================================================================================================
58 59
% le package [final] remplace efface les relations x:y par x %
package final {
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
  rule suj_suj { pattern { e:X -[suj:suj]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule ats_ats { pattern { e:X -[ats:ats]-> Y } commands { del_edge e; add_edge X-[ats]-> Y } }
  rule ats_ato { pattern { e:X -[ats:ato]-> Y } commands { del_edge e; add_edge X-[ats]-> Y } }
  rule ato_ato { pattern { e:X -[ato:ato]-> Y } commands { del_edge e; add_edge X-[ato]-> Y } }
  rule suj_obj { pattern { e:X -[suj:obj]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule obj_obj { pattern { e:X -[obj:obj]-> Y } commands { del_edge e; add_edge X-[obj]-> Y } }
  rule a_obj_a_obj { pattern { e:X -[a_obj:a_obj]-> Y } commands { del_edge e; add_edge X-[a_obj]-> Y } }
  rule de_obj_de_obj { pattern { e:X -[de_obj:de_obj]-> Y } commands { del_edge e; add_edge X-[de_obj]-> Y } }
  rule a_obj_suj { pattern { e:X -[a_obj:suj]-> Y } commands { del_edge e; add_edge X-[a_obj]-> Y } }
  rule pobj_agt_suj { pattern { e:X -[p_obj.agt:suj]-> Y } commands { del_edge e; add_edge X-[p_obj.agt]-> Y } }
  rule obj_suj { pattern { e:X -[obj:suj]-> Y } commands { del_edge e; add_edge X-[obj]-> Y } }
  rule suj_void { pattern { e:X -[suj:_]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule suj_argc { pattern { e:X -[suj:argc]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule dis_dis { pattern { e:X -[dis:dis]-> Y } commands { del_edge e; add_edge X-[dis]-> Y } }
  rule dis_suj { pattern { e:X -[dis:suj]-> Y } commands { del_edge e; add_edge X-[dis]-> Y } }
  rule dis_obj { pattern { e:X -[dis:obj]-> Y } commands { del_edge e; add_edge X-[dis]-> Y } }
76

77
} % end package final
78 79

% ====================================================================================================
80 81
% le package [deep_canonical] remplace efface les relations D:x:y par y %
package deep_canonical {
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
  rule p_obj_o { pattern { e:X -[D:p_obj.o]-> Y } commands { del_edge e; add_edge X-[p_obj.o]-> Y } }
  rule mod { pattern { e:X -[D:mod]-> Y } commands { del_edge e; add_edge X-[mod]-> Y } }
  rule ats_ats { pattern { e:X -[D:ats:ats]-> Y } commands { del_edge e; add_edge X-[ats]-> Y } }
  rule arg { pattern { e:X -[D:arg]-> Y } commands { del_edge e; add_edge X-[arg]-> Y } }
  rule arg_comp { pattern { e:X -[D:arg.comp]-> Y } commands { del_edge e; add_edge X-[arg.comp]-> Y } }
  rule arg_cons { pattern { e:X -[D:arg.cons]-> Y } commands { del_edge e; add_edge X-[arg.cons]-> Y } }
  rule mod_comp { pattern { e:X -[D:mod.comp]-> Y } commands { del_edge e; add_edge X-[mod.comp]-> Y } }
  rule mod_super { pattern { e:X -[D:mod.super]-> Y } commands { del_edge e; add_edge X-[mod.super]-> Y } }
  rule mod_app { pattern { e:X -[D:mod.app]-> Y } commands { del_edge e; add_edge X-[mod.app]-> Y } }
  rule mod_rel { pattern { e:X -[D:mod.rel]-> Y } commands { del_edge e; add_edge X-[mod.rel]-> Y } }
  rule mod_rel_part { pattern { e:X -[D:mod.rel.part]-> Y } commands { del_edge e; add_edge X-[mod.rel.part]-> Y } }
  rule coord { pattern { e:X -[D:coord]-> Y } commands { del_edge e; add_edge X-[coord]-> Y } }
  rule dep_coord { pattern { e:X -[D:dep.coord]-> Y } commands { del_edge e; add_edge X-[dep.coord]-> Y } }
  rule dep_de { pattern { e:X -[D:dep.de]-> Y } commands { del_edge e; add_edge X-[dep.de]-> Y } }
  rule obj_p { pattern { e:X -[D:obj.p]-> Y } commands { del_edge e; add_edge X-[obj.p]-> Y } }
  rule suj_suj { pattern { e:X -[D:suj:suj]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule suj_obj { pattern { e:X -[D:suj:obj]-> Y } commands { del_edge e; add_edge X-[obj]-> Y } }
  rule obj_obj { pattern { e:X -[D:obj:obj]-> Y } commands { del_edge e; add_edge X-[obj]-> Y } }
  rule a_obj_a_obj { pattern { e:X -[D:a_obj:a_obj]-> Y } commands { del_edge e; add_edge X-[a_obj]-> Y } }
  rule de_obj_de_obj { pattern { e:X -[D:de_obj:de_obj]-> Y } commands { del_edge e; add_edge X-[de_obj]-> Y } }
  rule a_obj_suj { pattern { e:X -[D:a_obj:suj]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule pobj_agt_suj { pattern { e:X -[D:p_obj.agt:suj]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule obj_suj { pattern { e:X -[D:obj:suj]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule suj_void { pattern { e:X -[D:suj:_]-> Y } commands { del_edge e} }
  rule suj_argc { pattern { e:X -[D:suj:argc]-> Y } commands { del_edge e; add_edge X-[argc]-> Y } }

  rule ponct { pattern { e:X -[D:ponct]-> Y } commands { del_edge e; add_edge X-[ponct]-> Y } }
  rule dep { pattern { e:X -[D:dep]-> Y } commands { del_edge e; add_edge X-[dep]-> Y } }
  rule det { pattern { e:X -[D:det]-> Y } commands { del_edge e; add_edge X-[det]-> Y } }
  rule obj_cpl { pattern { e:X -[D:obj.cpl]-> Y } commands { del_edge e; add_edge X-[obj.cpl]-> Y } }
  rule dis_suj { pattern { e:X -[D:dis:suj]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule dis_obj { pattern { e:X -[D:dis:obj]-> Y } commands { del_edge e; add_edge X-[obj]-> Y } }
  rule root { pattern { e:X -[D:root]-> Y } commands { del_edge e; add_edge X-[root]-> Y } }
115

116
} % end package deep_canonical
117 118

% ====================================================================================================
119 120
% le package [canonical] remplace les relations x:y par x %
package canonical {
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
  rule suj_suj       { pattern { e:X -[suj:suj]-> Y }       commands { del_edge e; add_edge X-[suj]-> Y } }
  rule ats_ats       { pattern { e:X -[ats:ats]-> Y }       commands { del_edge e; add_edge X-[ats]-> Y } }
  rule ats_ato       { pattern { e:X -[ats:ato]-> Y }       commands { del_edge e; add_edge X-[ato]-> Y } }
  rule ato_ato       { pattern { e:X -[ato:ato]-> Y }       commands { del_edge e; add_edge X-[ato]-> Y } }
  rule suj_obj       { pattern { e:X -[suj:obj]-> Y }       commands { del_edge e; add_edge X-[obj]-> Y } }
  rule obj_obj       { pattern { e:X -[obj:obj]-> Y }       commands { del_edge e; add_edge X-[obj]-> Y } }
  rule a_obj_a_obj   { pattern { e:X -[a_obj:a_obj]-> Y }   commands { del_edge e; add_edge X-[a_obj]-> Y } }
  rule de_obj_de_obj { pattern { e:X -[de_obj:de_obj]-> Y } commands { del_edge e; add_edge X-[de_obj]-> Y } }
  rule a_obj_suj     { pattern { e:X -[a_obj:suj]-> Y }     commands { del_edge e; add_edge X-[suj]-> Y } }
  rule pobj_agt_suj  { pattern { e:X -[p_obj.agt:suj]-> Y } commands { del_edge e; add_edge X-[suj]-> Y } }
  rule obj_suj       { pattern { e:X -[obj:suj]-> Y }       commands { del_edge e; add_edge X-[suj]-> Y } }
  rule suj_void      { pattern { e:X -[suj:_]-> Y }         commands { del_edge e } }
  rule suj_argc      { pattern { e:X -[suj:argc]-> Y }      commands { del_edge e; add_edge X-[argc]-> Y } }
  rule dis_dis       { pattern { e:X -[dis:dis]-> Y }       commands { del_edge e; add_edge X-[dis]-> Y } }
  rule dis_suj       { pattern { e:X -[dis:suj]-> Y }       commands { del_edge e; add_edge X-[suj]-> Y } }
  rule dis_obj       { pattern { e:X -[dis:obj]-> Y }       commands { del_edge e; add_edge X-[obj]-> Y } }
137
} % end package canonical
138 139

% ====================================================================================================
140 141
% le package [remove_deep_features] supprime les traits deep-only void=y %
package remove_deep_features {
142 143 144 145 146 147 148 149 150
  rule void_y         { pattern { X[void=y] }           commands { del_feat X.void } }
  rule dl             { pattern { X[dl=*] }             commands { del_feat X.dl } }
  rule dm             { pattern { X[dm=*] }             commands { del_feat X.dm } }
  rule diat           { pattern { X[diat=*] }           commands { del_feat X.diat } }
  rule def            { pattern { X[def=*] }            commands { del_feat X.def } }
  rule intrinsimp     { pattern { X[intrinsimp=*] }     commands { del_feat X.intrinsimp } }
  rule se             { pattern { X[se=*] }             commands { del_feat X.se } }
  rule cltype         { pattern { X[cltype=*] }         commands { del_feat X.cltype } }
  rule lexicalisation { pattern { X[lexicalisation=*] } commands { del_feat X.lexicalisation } }
151
} % end package remove_deep_features
152 153

% ====================================================================================================
154 155
% le package [sentid] reporte le trait sentid sur le premier mot non vide pour éviter de perdre l'identifiant %
package sentid {
156
  rule report {
157
    pattern { X[sentid=*, void=y]; Y[!void]; X.position < Y.position}
158 159 160
    without { Z [!void]; X.position < Z.position; Z.position < Y.position }
    commands { Y.sentid = X.sentid; del_feat X.sentid }
  }
161
} % end package sentid
162 163

% ====================================================================================================
164 165
% le package [clean] supprime les nœuds avec void=y %
package clean {
166
  rule clean { pattern { X[void=y] } commands { del_node X } }
167
} % end package clean
168

bguillaum's avatar
bguillaum committed
169
% ====================================================================================================
170 171
% le package [clean] rattache les nœuds avec void=y au pseudo-noeud 0 %
package void {
bguillaum's avatar
bguillaum committed
172
  rule clean {
173
    pattern { X[void=y]; ZERO[!phon]}
174 175
    without { ZERO -[void]-> X }
    commands { add_edge ZERO -[void]-> X }
bguillaum's avatar
bguillaum committed
176
  }
177
} % end package clean
178 179

% ====================================================================================================
180 181 182
strat surf {
  Seq (
    Onf (rm_deep),
Bruno Guillaume's avatar
Bruno Guillaume committed
183
    Onf (rm_meddle),
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
    Onf (surf_final),
    Onf (final),
    Onf (remove_deep_features),
  )
}

strat deep {
  Seq (
    Onf(rm_surf),
    Onf(rm_meddle),
    Onf(deep_canonical),
    Onf(canonical),
    Onf(void),
  )
}

strat deep_clean {
  Seq (
    Onf(rm_surf),
    Onf(rm_meddle),
    Onf(deep_canonical),
    Onf(canonical),
    Onf(sentid),
    Onf(clean),
  )
209
}