Skip to content

Retrieve the matched length #5

@Kerollmops

Description

@Kerollmops

Hi,

Is there any way/trick to know the length matched by the text used to match on it?

For example when you construct a prefix DFA, try to make it match with a text, the dfa gives you the edit distance but you do not know the exact length that this text "covers" on the original text.

let query = "Levente";
//                ^ missing "sh"

let max_dist = 3;
let dfa = Dfa::new_prefix(query, max_dist);

let text = "Levenshtein";
let dist = dfa.eval(text);
assert_eq!(dist, 2);

Here we can easily retrieve the edit distance but we would also like to know that this text covers 9 characters (i.e. "Levenshte") and not the text length 6 (i.e. "Levente").

Something I though about was to count the number of insertions and deletions, but the DFA doesn't stores that, didn't it?

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