Next: Customs, Previous: Climbing, Up: Principles list
principle.coindex
D
Coindex (priority 120)CoindexEdge (priority 100)
This principle supports the grammar Grammars/coindex.ul
(coindex).
Here is the definition of the Coindex constraint functor:
%% Copyright 2001-2008
%% by Ralph Debusmann <rade@ps.uni-sb.de> (Saarland University) and
%% Denys Duchier <duchier@ps.uni-sb.de> (LIFO, Orleans) and
%% Jorge Marques Pelizzoni <jpeliz@icmc.usp.br> (ICMC, Sao Paulo) and
%% Jochen Setz <info@jochensetz.de> (Saarland University)
%%
functor
import
% System(show)
export
Constraint
prepare
ListTakeDrop = List.takeDrop
define
proc {Constraint Nodes G Principle FD FS Select}
DVA2DIDA = Principle.dVA2DIDA
DIDA = {DVA2DIDA 'D'}
for Node in Nodes do
Attrs = Node.DIDA.attrs
Entry = Node.DIDA.entry
in
{FS.include Attrs.root.top.number Entry.root.top.number}
{FS.include Attrs.root.top.gender Entry.root.top.gender}
{FS.include Attrs.root.bot.number Entry.root.bot.number}
{FS.include Attrs.root.bot.gender Entry.root.bot.gender}
%%
{FS.include Attrs.subj.top.number Entry.subj.top.number}
{FS.include Attrs.subj.top.gender Entry.subj.top.gender}
{FS.include Attrs.subj.bot.number Entry.subj.bot.number}
{FS.include Attrs.subj.bot.gender Entry.subj.bot.gender}
%%
{FS.include Attrs.pred.top.number Entry.pred.top.number}
{FS.include Attrs.pred.top.gender Entry.pred.top.gender}
{FS.include Attrs.pred.bot.number Entry.pred.bot.number}
{FS.include Attrs.pred.bot.gender Entry.pred.bot.gender}
end
%%
DIDA2EntryLat = G.dIDA2EntryLat
EntryLat = {DIDA2EntryLat DIDA}
ALatRec = EntryLat.record
Lat = ALatRec.coindex
TupLat = Lat.domain
TupCardI = TupLat.card
TupI2As = TupLat.i2AIs
in
for Node in Nodes do
Attrs = Node.DIDA.attrs
CoindexM = Node.DIDA.entry.coindex
in
for I in 1..TupCardI do
As = {TupI2As I}
As1 As2
{ListTakeDrop As ({Length As} div 2) As1 As2}
D1 =
{FoldL As1
fun {$ AccX A1} AccX.A1 end Attrs}
D2 =
{FoldL As2
fun {$ AccX A2} AccX.A2 end Attrs}
in
{FD.impl
{FS.reified.include I CoindexM}
{FD.reified.equal D1 D2} 1}
end
end
end
end
And here is the definition of the CoindexEdge constraint
functor:
%% Copyright 2001-2008
%% by Ralph Debusmann <rade@ps.uni-sb.de> (Saarland University) and
%% Denys Duchier <duchier@ps.uni-sb.de> (LIFO, Orleans) and
%% Jorge Marques Pelizzoni <jpeliz@icmc.usp.br> (ICMC, Sao Paulo) and
%% Jochen Setz <info@jochensetz.de> (Saarland University)
%%
functor
import
Helpers(checkModel reifiedADRecEqual) at 'Helpers.ozf'
Opti(isIn) at 'Opti.ozf'
export
Constraint
define
proc {Constraint Nodes G Principle FD FS Select}
DVA2DIDA = Principle.dVA2DIDA
%%
DIDA = {DVA2DIDA 'D'}
DIDA2LabelLat = G.dIDA2LabelLat
LabelLat = {DIDA2LabelLat DIDA}
LAs = LabelLat.constants
in
%% check features
if {Helpers.checkModel 'CoindexEdge.oz' Nodes
[DIDA#daughtersL]} then
for Node1 in Nodes do
for Node2 in Nodes do
for LA in LAs do
if {Not {Opti.isIn Node2.index Node1.DIDA.model.daughtersL.LA}=='out'} then
{FD.impl
{FS.reified.include Node2.index Node1.DIDA.model.daughtersL.LA}
{FD.conj
{FD.reified.equal Node1.id.attrs.subj.top.number Node2.id.attrs.root.top.number}
{FD.conj
{FD.reified.equal Node1.id.attrs.subj.top.gender Node2.id.attrs.root.top.gender}
{FD.conj
{FD.reified.equal Node1.id.attrs.subj.bot.number Node2.id.attrs.root.bot.number}
{FD.conj
{FD.reified.equal Node1.id.attrs.subj.bot.gender Node2.id.attrs.root.bot.gender}
{FD.conj
{FD.reified.equal Node1.id.attrs.pred.top.number Node2.id.attrs.root.top.number}
{FD.conj
{FD.reified.equal Node1.id.attrs.pred.top.gender Node2.id.attrs.root.top.gender}
{FD.conj
{FD.reified.equal Node1.id.attrs.pred.bot.number Node2.id.attrs.root.bot.number}
{FD.reified.equal Node1.id.attrs.pred.bot.gender Node2.id.attrs.root.bot.gender}}}}}}}} 1}
end
end
end
end
end
end
end