5 Computation of Flows
We give below the Compute-Flow algorithm. The notations used are as follows:
function CF(x,y) receives as input a pair of nodes start-destination and returns that
flow which applied to x outputs y; subsumes(x,y) is a predicate function which
applied to two nodes evaluates to true if and only if x subsumes y on the graph;
simplify(x,y) expresses that the node y is simplified to x and returns a flow;
pipeline(f,p), with f a flow and p a process, expresses that the flow f is
pipelined with the process p and returns a flow; merge(f
1
,f
2
) expresses the
merging of flows f
1
and f
2
and returns a flow, and f
∅
is the empty flow.
function CF(st,de)
if (st equals de) then return(f
∅
);
else if (subsumes(de,st)) then return(simplify(de,st));
else if (there is just one node n such that
n pipelines to de by a process p) then
return(pipeline(CF(st,n),p));
else { expr := f
∅
;
while (there still exists a node n pipelining to de
by a process p) do
expr := merge(expr, pipeline(CF(st,n),p));
return(expr); };
Note that in the above notation of the function CF the input is a pair of nodes start-
destination and the output is a computed flow, as an expression of simplify-pipeline-
merge operators. In order to make the computed flow to apply to an input file, the
input file must be given to the result of the computation of a call to the function CF.
Following, we will exemplify with several cases:
- for the graph depicted in Figure 5a, subsumes(B,A) is true, therefore the
algorithm CF(A,B) returns simplify(B,A);
- for the graph in Figure 5c, using short notations for Pipeline (P), Merge (M), and
Simplify (S), the recursive evaluation proceeds as follows, in which the ⇒ sign
should be read as “evaluates to”:
CF(A,B) ⇒ P(CF(A,G),g) ⇒ P(M(P(CF(A,E),f),P(CF(A,F),e)),g) ⇒
P(M(P(P(CF(A,C),b),f),P(M(P(CF(A,A),c),P(CF(A,D),d)),e)),g)
⇒ P(M(P(P(S(A,C),b),f),P(M(P(A,c),P((CF(A,C),a),d)),e)),g)
⇒ P(M(P(P(S(A,C),b),f),P(M(P(A,c),P(P(S(A,C),
a),d)),e)),g).
This expression is identical with the one depicted in section 4 in an abridged form;
- for the graph in Figure 1, if in the call to the function CF the node st is
SCH-
ROOT
and the node de is SCH-COREF, the meaning of the compute request CF(SCH-
ROOT,SCH-COREF)
is that, starting from a raw text one should get annotations for co-
referential anaphora, but including also the marking of tokens, their part-of-speeches,
and the noun phrases – which usually count as referential expressions. The computed
flow is, in the abridged notation for pipelines:
SCH-ROOT > tokeniser > POS-
tagger > NP-chunker > AR
, where tokeniser is the process which tokenises a
raw text, the
POS-tagger adds part-of-speech markings to a tokenised text, the NP-
chunker
marks NPs on a POS-tagged text and AR is the module doing anaphora
resolution on a file having NPs marked;
54