This is a quite simple issue and could be a good first bug for a newcomer in SedLex codebase.
When diffs are generated by SedLex (in AddDiffVisitor), when DuraLex tree says to replace a word (well an expression possibly with multiple words) by another, only the first one is replaced. The perimeter is currently delimited by (self.begin, self.end), this should be changed into a list of perimeters and then do the edit operation in each perimeter. Some care should be taken because the text should not be reset between each sub-edit operation, particularly for exact diffs.
This can be tested on Durafront - it can be checked that the DuraLex tree is correct.
Amendment =
Le mot "truc" est remplacé par le mot "machin".
Text to be amended:
Le truc est ici. Le truc n'est pas ici.
Currently only the first "truc" is changed to "machin".
When this will be implemented, the diff of the above example will look like:
--- "unnamed article"
+++ "unnamed article"
@@ -1 +1 @@
-Le truc est ici. Le truc n'est pas ici.
+Le machin est ici. Le machin n'est pas ici.
and the exact diff will look like:
--- "unnamed article"
+++ "unnamed article"
@@ -4,4 +4,6 @@
-truc
+machin
@@ -21,4 +21,6 @@
-truc
+machin
This is a quite simple issue and could be a good first bug for a newcomer in SedLex codebase.
When diffs are generated by SedLex (in AddDiffVisitor), when DuraLex tree says to replace a word (well an expression possibly with multiple words) by another, only the first one is replaced. The perimeter is currently delimited by (self.begin, self.end), this should be changed into a list of perimeters and then do the edit operation in each perimeter. Some care should be taken because the text should not be reset between each sub-edit operation, particularly for exact diffs.
This can be tested on Durafront - it can be checked that the DuraLex tree is correct.
Amendment =
Text to be amended:
Currently only the first "truc" is changed to "machin".
When this will be implemented, the diff of the above example will look like:
and the exact diff will look like: