Distance editing algorithm (where changes can be made for all substrings)

Are there examples of algorithms for determining the editing distance between two lines when there are additional primitive operations (the standard is inserting, deleting, transposing and replacing a single character) that work on a whole substring. Examples of possible additional primitive operations are:

1) Duplicate function - copies any substring and pastes it where necessary

2) Move function - which moves any substring to a new location

Using them if d and D is the Levenshtein distance, but D also includes 1) and 2), d (Sheep, SheepBeep) = 4 (you need to make 4 inserts), but D (Sheep, " SheepBeep ") = 2 (insert" B ", then duplicate" eep "). Similarly, d ("CarDog", "DogCar") = 6, but D ("CarDog", "DogCar") = 1 in 2).

Are there (simple) modifications that can be made to the Levenstein Distance algorithm for this?

+3
source share
1 answer

, NP-hard . , , . , - , , .

, " " " ".

+1

Source: https://habr.com/ru/post/1760917/


All Articles