Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75534

Functions for Levenshtein Distance and Longest Commom Subsequence

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • None

    Description

      Hi Qt devs!

      I recently worked on a project where I needed string comparison via the Levenshtein Distance and displaying of the differences of string pairs based on the Longest Commom Subsequence (diff-like).

      It was not too hard but also not trivial to find/write functions doing the calculation. I'm not sure if this would be in the scope of Qt, but I wondered if such a functionality would be a candidate for integration into Qt (probably directly into QString), as these algorithms seem to be univerally shareable and widely used.

      I appended the code I use to calculate the Levenshtein Distance of two QStrings (which seems to be quite nicely optimized as it only caches the last column of the comparison matrix instead of calculating it as a whole first) and the Longest Commom Subsequence of two QStrings (which does the whole calculation first, but I don't know how to optimize it furtherly).

      Maybe this could be of interest for you and/or other Qt users.

      Cheers, Tobias

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            l3u Tobias Leupold
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes