Finished before reread

This commit is contained in:
Yann Esposito (Yogsototh) 2010-05-28 15:02:52 +02:00
parent 735a28f18b
commit 103ee6af0e
3 changed files with 111 additions and 73 deletions

View file

@ -148,8 +148,9 @@ This is the second sentence that was plainly wrong. I started in the wrong direc
## Think ## Think
After some times, I just stopped to work. Tell myself *"it is enough, now, I must finish it!"*. After some times, I just stopped to work. Tell myself *"it is enough, now, I must finish it!"*.
I took a sheet of paper, a pen and began to write down some trees. I took a sheet of paper, a pen and began to draw some trees.
I began by make by removing most of the verbosity.
I first renamed `<item name="Menu">` by simpler name `M` for example. I first renamed `<item name="Menu">` by simpler name `M` for example.
I obtained something like: I obtained something like:
@ -160,18 +161,19 @@ and
<%= blogimage('formal_Menu_tree.png', 'The destination tree') %> <%= blogimage('formal_Menu_tree.png', 'The destination tree') %>
And I made myself the following reflexion: Then I made myself the following reflexion:
Considering Tree Edit Distance, each unitary transformation of tree correspond to a simple search and replace on my XML source. Considering Tree Edit Distance, each unitary transformation of tree correspond to a simple search and replace on my <sc>xml</sc> source[^nb].
I did a program which generate automatically the weight in a matrix of each edit distance.
We consider three atomic transformations on trees: We consider three atomic transformations on trees:
- *substitution*: renaming a node - *substitution*: renaming a node
- *insertion*: adding a node - *insertion*: adding a node
- *deletion*: remove a node - *deletion*: remove a node
The particularity with trees, is that, removing a node, do the following:
all children of this node, became children of its father. [^nb]: I did a program which generate automatically the weight in a matrix of each edit distance from data.
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.
An example: An example:
@ -192,7 +194,7 @@ r - b
y - c y - c
</pre> </pre>
And look at what it implies when you write it in <sc>xml</sc>: Et regardez ce que ça implique quand on l'écrit en <sc>xml</sc> :
<code class="xml"> <code class="xml">
<r> <r>
@ -206,13 +208,13 @@ And look at what it implies when you write it in <sc>xml</sc>:
</r> </r>
</code> </code>
Then deleting all `x` nodes is equivalent to pass the <sc>xml</sc> via the following search and replace: Then deleting all `x` nodes is equivalent to pass the <sc>xml</sc> via the following search and replace script:
<code class="perl"> <code class="perl">
s/<\/?x>//g s/<\/?x>//g
</code> </code>
Therefore, if there exists a one state deterministic transducer to transform the source tree to the destination tree. Therefore, if there exists a one state deterministic transducer which transform my trees ;
I can transform the <sc>xml</sc> from one format to another with just a simple list of search and replace directives. I can transform the <sc>xml</sc> from one format to another with just a simple list of search and replace directives.
# Solution # Solution
@ -250,14 +252,15 @@ M - V - M - V - tag2 tag1
M M
</pre> </pre>
using only an acyclic deterministic tree transducer:
can be done using the following one state deterministic tree transducer:
> C -> &epsilon; > C -> &epsilon;
> E -> R > E -> R
> R -> V > R -> V
Wich can be traduced by the following simple regular expression expression: Wich can be traduced by the following simple search and replace directives:
<code class="perl"> <code class="perl">
s/C//g s/C//g
@ -265,7 +268,7 @@ s/E/M/g
s/R/V/g s/R/V/g
</code> </code>
Adapted to XML it becomes: Once adapted to <sc>xml</sc> it becomes:
<code class="perl"> <code class="perl">
s%</?contenu>%%g s%</?contenu>%%g
@ -277,6 +280,6 @@ s%</rubrique>%</value>%g
That is all. That is all.
# conclusion # Conclusion
It should seems a bit paradoxal, but sometimes the most pragmatic approach to a pragmatic problem is to use the theoretical methodology. Not the commonly accepted pragmatic one. This simple experience prove this point. It should seems a bit paradoxal, but sometimes the most efficient approach to a pragmatic problem is to use the theoretical methodology.

View file

@ -51,7 +51,7 @@ J'ai pris un stylo et une feuille de papier. Je me suis souvenu de de ce que j'a
Finalement, le problème fut résolu en moins de 20 minutes. Finalement, le problème fut résolu en moins de 20 minutes.
Je pense que la leçon à retenir de cette expérience est de se souvenir que la méthodologie la plus efficace pour résoudre ce problème *pragamtique* était la méthode *théorique*. Je pense que la leçon à retenir de cette expérience est de se souvenir que la méthodologie la plus efficace pour résoudre ce problème *pragamtique* était la méthode *théorique*.
Et par conséquent, les arguments qui opposent la science et la théories au pragmatisme et à l'efficacité sont faux. Ça ne signifie pas que la méthode théorique est toujours la meilleure, mais en tout cas, il ne faut pas l'écarter.
newcorps newcorps
@ -152,33 +152,36 @@ C'est la deuxième phrase qui est complètement fausse. Parce que j'avais mal co
## Réfléchir ## Réfléchir
After some times, I just stopped to work. Tell myself *"it is enough, now, I must finish it!"*. Après un certain temps, j'ai arrêté de programmer et je me suis dit : &laquo;Maintenant, ça suffit !&raquo;.
I took a sheet of paper, a pen and began to write down some trees. J'ai pris une feuille et un stylo et j'ai commencé à dessiner des arbres.
I first renamed `<item name="Menu">` by simpler name `M` for example. J'ai commencer par simplifier un peu en enlevant le maximum de verbiage.
I obtained something like: Tout d'abord en renommant `<item name="Menu">` par un simple `M` par exemple.
J'ai obtenu quelque chose comme :
<%= blogimage('formal_DCR_tree.png', 'The source tree') %> <%= blogimage('formal_DCR_tree.png', 'The source tree') %>
and et
<%= blogimage('formal_Menu_tree.png', 'The destination tree') %> <%= blogimage('formal_Menu_tree.png', 'The destination tree') %>
And I made myself the following reflexion: Puis, je me suis fait la réflexion suivante :
Considering Tree Edit Distance, each unitary transformation of tree correspond to a simple search and replace on my XML source. Dans les distances d'éditions sur les arbres, chaque opération atomique correspond à un simple *search and replace* sur mon fichier <sc>xml</sc> source[^nb].
I did a program which generate automatically the weight in a matrix of each edit distance. On considère trois opérations atomiques sur les arbres :
We consider three atomic transformations on trees:
- *substitution*: renaming a node - *substitution*: renommer un nœud
- *insertion*: adding a node - *insertion*: ajouter un nœud
- *deletion*: remove a node - *délétion*: supprimer un nœud
The particularity with trees, is that, removing a node, do the following:
all children of this node, became children of its father.
An example: [^nb]: J'ai programmé un outil qui calcule automatiquement le poids de chaque élément des matrices d'édition à partir de données.
Une des particularité avec les transformations sur les arbres est celle-ci :
supprimer un nœud et tous ses enfants deviendront les enfants du père de ce nœud.
Un exemple:
<pre class="twilight"> <pre class="twilight">
r - x - a r - x - a
@ -187,7 +190,7 @@ r - x - a
y - c y - c
</pre> </pre>
If you delete the `x` node, you obtain Si vous supprimez le nœud `x`, vous obtenez
<pre class="twilight"> <pre class="twilight">
a a
@ -211,18 +214,18 @@ And look at what it implies when you write it in <sc>xml</sc>:
</r> </r>
</code> </code>
Then deleting all `x` nodes is equivalent to pass the <sc>xml</sc> via the following search and replace: Alors supprimer tous les nœuds `x` revient à faire passer le <sc>xml</sc> à travers le filtre suivant :
<code class="perl"> <code class="perl">
s/<\/?x>//g s/<\/?x>//g
</code> </code>
Therefore, if there exists a one state deterministic transducer to transform the source tree to the destination tree. Par conséquent, s'il existe un transducteur déterministe à un état qui permet de transformer mes arbres ;
I can transform the <sc>xml</sc> from one format to another with just a simple list of search and replace directives. je suis capable de transformer le <sc>xml</sc> d'un format à l'autre en utilisant une simple liste de *search and replace*.
# Solution # Solution
Transform this tree: Transformer cet arbre :
<pre class="twilight"> <pre class="twilight">
R - C - tag1 R - C - tag1
@ -238,7 +241,7 @@ R - C - tag1
E ... E ...
</pre> </pre>
to this tree: en celui-ci :
<pre class="twilight"> <pre class="twilight">
tag1 tag1
@ -255,14 +258,15 @@ M - V - M - V - tag2 tag1
M M
</pre> </pre>
using only an acyclic deterministic tree transducer:
peut-être fait en utilisant le transducteur déterministe à un état suivant:
> C -> &epsilon; > C -> &epsilon;
> E -> R > E -> R
> R -> V > R -> V
Wich can be traduced by the following simple regular expression expression: Ce qui peut-être traduit par les simples directives Perl suivantes :
<code class="perl"> <code class="perl">
s/C//g s/C//g
@ -270,7 +274,7 @@ s/E/M/g
s/R/V/g s/R/V/g
</code> </code>
Adapted to XML it becomes: Une fois adapté au <sc>xml</sc> cela devient :
<code class="perl"> <code class="perl">
s%</?contenu>%%g s%</?contenu>%%g
@ -280,8 +284,8 @@ s%</?rubrique>%<value>%g
s%</rubrique>%</value>%g s%</rubrique>%</value>%g
</code> </code>
That is all. Et c'est tout.
# conclusion # Conclusion
It should seems a bit paradoxal, but sometimes the most pragmatic approach to a pragmatic problem is to use the theoretical methodology. Not the commonly accepted pragmatic one. This simple experience prove this point. 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.

View file

@ -215,33 +215,51 @@ fr: C'est la deuxième phrase qui est complètement fausse. Parce que j'avais ma
en: ## Think en: ## Think
fr: ## Réfléchir fr: ## Réfléchir
After some times, I just stopped to work. Tell myself *"it is enough, now, I must finish it!"*. en: After some times, I just stopped to work. Tell myself *"it is enough, now, I must finish it!"*.
I took a sheet of paper, a pen and began to write down some trees. en: I took a sheet of paper, a pen and began to draw some trees.
fr: Après un certain temps, j'ai arrêté de programmer et je me suis dit : &laquo;Maintenant, ça suffit !&raquo;.
fr: J'ai pris une feuille et un stylo et j'ai commencé à dessiner des arbres.
I first renamed `<item name="Menu">` by simpler name `M` for example. en: I began by make by removing most of the verbosity.
I obtained something like: en: I first renamed `<item name="Menu">` by simpler name `M` for example.
en: I obtained something like:
fr: J'ai commencer par simplifier un peu en enlevant le maximum de verbiage.
fr: Tout d'abord en renommant `<item name="Menu">` par un simple `M` par exemple.
fr: J'ai obtenu quelque chose comme :
<%= blogimage('formal_DCR_tree.png', 'The source tree') %> <%= blogimage('formal_DCR_tree.png', 'The source tree') %>
and en: and
fr: et
<%= blogimage('formal_Menu_tree.png', 'The destination tree') %> <%= blogimage('formal_Menu_tree.png', 'The destination tree') %>
And I made myself the following reflexion: en: Then I made myself the following reflexion:
fr: Puis, je me suis fait la réflexion suivante :
Considering Tree Edit Distance, each unitary transformation of tree correspond to a simple search and replace on my XML source. en: Considering Tree Edit Distance, each unitary transformation of tree correspond to a simple search and replace on my <sc>xml</sc> source[^nb].
I did a program which generate automatically the weight in a matrix of each edit distance. en: We consider three atomic transformations on trees:
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 <sc>xml</sc> source[^nb].
fr: On considère trois opérations atomiques sur les arbres :
- *substitution*: renaming a node en: - *substitution*: renaming a node
- *insertion*: adding a node en: - *insertion*: adding a node
- *deletion*: remove 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
The particularity with trees, is that, removing a node, do the following:
all children of this node, became children of its father.
An example: 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:
<pre class="twilight"> <pre class="twilight">
r - x - a r - x - a
@ -250,7 +268,8 @@ r - x - a
y - c y - c
</pre> </pre>
If you delete the `x` node, you obtain en: If you delete the `x` node, you obtain
fr: Si vous supprimez le nœud `x`, vous obtenez
<pre class="twilight"> <pre class="twilight">
a a
@ -260,7 +279,8 @@ r - b
y - c y - c
</pre> </pre>
And look at what it implies when you write it in <sc>xml</sc>: fr: And look at what it implies when you write it in <sc>xml</sc>:
en: Et regardez ce que ça implique quand on l'écrit en <sc>xml</sc> :
<code class="xml"> <code class="xml">
<r> <r>
@ -274,18 +294,22 @@ And look at what it implies when you write it in <sc>xml</sc>:
</r> </r>
</code> </code>
Then deleting all `x` nodes is equivalent to pass the <sc>xml</sc> via the following search and replace: en: Then deleting all `x` nodes is equivalent to pass the <sc>xml</sc> via the following search and replace script:
fr: Alors supprimer tous les nœuds `x` revient à faire passer le <sc>xml</sc> à travers le filtre suivant :
<code class="perl"> <code class="perl">
s/<\/?x>//g s/<\/?x>//g
</code> </code>
Therefore, if there exists a one state deterministic transducer to transform the source tree to the destination tree. en: Therefore, if there exists a one state deterministic transducer which transform my trees ;
I can transform the <sc>xml</sc> from one format to another with just a simple list of search and replace directives. en: I can transform the <sc>xml</sc> 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 <sc>xml</sc> d'un format à l'autre en utilisant une simple liste de *search and replace*.
# Solution # Solution
Transform this tree: en: Transform this tree:
fr: Transformer cet arbre :
<pre class="twilight"> <pre class="twilight">
R - C - tag1 R - C - tag1
@ -301,7 +325,8 @@ R - C - tag1
E ... E ...
</pre> </pre>
to this tree: en: to this tree:
fr: en celui-ci :
<pre class="twilight"> <pre class="twilight">
tag1 tag1
@ -318,14 +343,17 @@ M - V - M - V - tag2 tag1
M M
</pre> </pre>
using only an acyclic deterministic tree transducer:
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 -> &epsilon; > C -> &epsilon;
> E -> R > E -> R
> R -> V > R -> V
Wich can be traduced by the following simple regular expression expression: 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 :
<code class="perl"> <code class="perl">
s/C//g s/C//g
@ -333,7 +361,8 @@ s/E/M/g
s/R/V/g s/R/V/g
</code> </code>
Adapted to XML it becomes: en: Once adapted to <sc>xml</sc> it becomes:
fr: Une fois adapté au <sc>xml</sc> cela devient :
<code class="perl"> <code class="perl">
s%</?contenu>%%g s%</?contenu>%%g
@ -343,8 +372,10 @@ s%</?rubrique>%<value>%g
s%</rubrique>%</value>%g s%</rubrique>%</value>%g
</code> </code>
That is all. en: That is all.
fr: Et c'est tout.
# conclusion # Conclusion
It should seems a bit paradoxal, but sometimes the most pragmatic approach to a pragmatic problem is to use the theoretical methodology. Not the commonly accepted pragmatic one. This simple experience prove this point. 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.