Minimum Edit Distance Reconstruction

后端 未结 3 1292
说谎
说谎 2020-12-24 09:16

I know there are similar answer to this on stack, as well as online, but I feel I\'m missing something. Given the code below, we need to reconstruct the sequence of events t

3条回答
  •  没有蜡笔的小新
    2020-12-24 09:44

    I suggest you have a look at the python-Levenshtein module. Will probably get you a long way there:

    >>> import Levenshtein
    >>> Levenshtein.editops('LEAD','LAST')
    [('replace', 1, 1), ('replace', 2, 2), ('replace', 3, 3)]
    

    You can process the output from edit ops to create your verbose instructions.

提交回复
热议问题