Skip to content

Replace every occurrence of searched words #6

Description

@Seb35

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions