- ` par un simple `M` par exemple.
fr: J'ai obtenu quelque chose comme :
subgraph cluster_x {
node [label="C"] C_x ;
node [label="E"] E_x ;
node [label="a1"] tag1_x ;
node [label="a2"] tag2_x ;
node [label="R", color="#880000", fillcolor="#880000", fontcolor="white"] R_x ;
R_x -> C_x;
C_x -> tag1_x ;
C_x -> tag2_x ;
R_x -> E_x ;
}
subgraph cluster_y {
node [label="C"] C_y ;
node [label="E"] E_y ;
node [label="a1"] tag1_y ;
node [label="a2"] tag2_y ;
node [label="R", color="#880000", fillcolor="#880000", fontcolor="white"] R_y ;
R_y -> C_y;
C_y -> tag1_y ;
C_y -> tag2_y ;
R_y -> E_y ;
}
subgraph cluster_z {
node [label="C"] C_z ;
node [label="E"] E_z ;
node [label="a1"] tag1_z ;
node [label="a2"] tag2_z ;
node [label="R", color="#880000", style="filled", fillcolor="#880000", fontcolor="white"] R_z ;
R_z -> C_z;
C_z -> tag1_z ;
C_z -> tag2_z ;
R_z -> E_z ;
}
E_x -> R_y ;
E_x -> R_z ;
en: and
fr: et
subgraph cluster_x {
node [label="M"] E_x ;
node [label="a1"] tag1_x ;
node [label="V"] value_tag1_x ;
node [label="a2"] tag2_x ;
node [label="V"] value_tag2_x ;
node [label="V", color="#880000", fillcolor="#880000", fontcolor="white"] R_x ;
R_x -> value_tag1_x -> tag1_x ;
R_x -> value_tag2_x -> tag2_x ;
R_x -> E_x ;
}
subgraph cluster_y {
node [label="M"] E_y ;
node [label="a1"] tag1_y ;
node [label="V"] value_tag1_y ;
node [label="a2"] tag2_y ;
node [label="V"] value_tag2_y ;
node [label="V", color="#880000", fillcolor="#880000", fontcolor="white"] R_y ;
R_y -> value_tag1_y -> tag1_y ;
R_y -> value_tag2_y -> tag2_y ;
R_y -> E_y ;
}
subgraph cluster_z {
node [label="M"] E_z ;
node [label="a1"] tag1_z ;
node [label="V"] value_tag1_z ;
node [label="a2"] tag2_z ;
node [label="V"] value_tag2_z ;
node [label="V", color="#880000", fillcolor="#880000", fontcolor="white"] R_z ;
R_z -> value_tag1_z -> tag1_z ;
R_z -> value_tag2_z -> tag2_z ;
R_z -> E_z ;
}
E_x -> R_y ;
E_x -> R_z ;
en: Then I made myself the following reflexion:
fr: Puis, je me suis fait la réflexion suivante :
en: Considering Tree Edit Distance, each unitary transformation of tree correspond to a simple search and replace on my xml source[^nb].
en: We consider three atomic transformations on trees:
fr: Dans les distances d'éditions sur les arbres, chaque opération atomique correspond à un simple *search and replace* sur mon fichier xml source[^nb].
fr: On considère trois opérations atomiques sur les arbres :
en: - *substitution*: renaming a node
en: - *insertion*: adding a node
en: - *deletion*: remove a node
fr: - *substitution*: renommer un nœud
fr: - *insertion*: ajouter un nœud
fr: - *délétion*: supprimer un nœud
en: [^nb]: I did a program which generate automatically the weight in a matrix of each edit distance from data.
fr: [^nb]: J'ai programmé un outil qui calcule automatiquement le poids de chaque élément des matrices d'édition à partir de données.
en: One of the particularity of atomic transformations on trees, is ; if you remove a node, all children of this node, became children of its father.
fr: Une des particularité avec les transformations sur les arbres est celle-ci :
fr: supprimer un nœud et tous ses enfants deviendront les enfants du père de ce nœud.
en: An example:
fr: Un exemple:
r - x - a
\ \
\ b
y - c
en: If you delete the `x` node, you obtain
fr: Si vous supprimez le nœud `x`, vous obtenez
a
/
r - b
\
y - c
fr: And look at what it implies when you write it in xml:
en: Et regardez ce que ça implique quand on l'écrit en xml :
value for a
value for b
value for c
en: Then deleting all `x` nodes is equivalent to pass the xml via the following search and replace script:
fr: Alors supprimer tous les nœuds `x` revient à faire passer le xml à travers le filtre suivant :
s/<\/?x>//g
en: Therefore, if there exists a one state deterministic transducer which transform my trees ;
en: I can transform the xml from one format to another with just a simple list of search and replace directives.
fr: Par conséquent, s'il existe un transducteur déterministe à un état qui permet de transformer mes arbres ;
fr: je suis capable de transformer le xml d'un format à l'autre en utilisant une simple liste de *search and replace*.
# Solution
en: Transform this tree:
fr: Transformer cet arbre :
R - C - tag1
\ \
\ tag2
E -- R - C - tag1
\ \ \
\ \ tag2
\ E ...
R - C - tag1
\ \
\ tag2
E ...
en: to this tree:
fr: en celui-ci :
tag1
/
M - V - M - V - tag2 tag1
\ /
M --- V - tag2
\ \
\ M
\ tag1
\ /
V - tag2
\
M
en: can be done using the following one state deterministic tree transducer:
fr: peut-être fait en utilisant le transducteur déterministe à un état suivant:
> C -> ε
> E -> R
> R -> V
en: Wich can be traduced by the following simple search and replace directives:
fr: Ce qui peut-être traduit par les simples directives Perl suivantes :
s/C//g
s/E/M/g
s/R/V/g
en: Once adapted to xml it becomes:
fr: Une fois adapté au xml cela devient :
s%?contenu>%%g
s%%- %g
s%
%- %g
s%?rubrique>%%g
s%%%g
en: That is all.
fr: Et c'est tout.
# Conclusion
en: It should seems a bit paradoxal, but sometimes the most efficient approach to a pragmatic problem is to use the theoretical methodology.
fr: Même si cela peut sembler paradoxal, parfois la solution la plus efficace à un problème pragmatique est d'utiliser une méthodologie théorique.