Python string pattern recognition/compression

前端 未结 6 905
隐瞒了意图╮
隐瞒了意图╮ 2021-02-15 14:45

I can do basic regex alright, but this is slightly different, namely I don\'t know what the pattern is going to be.

For example, I have a list of similar strings:

<
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-15 15:35

    This seems to be an example of the longest common subsequence problem. One way could be to look at how diffs are generated. The Hunt-McIlroy algorithm seems to have been the first, and is such the simplest, especially since it apparently is non-heuristic.

    The first link contains detailed discussion and (pseudo) code examples. Assuming, of course, Im not completely of the track here.

提交回复
热议问题