ugexe / Raku-Text--Levenshtein--Damerau

Damerau Levenshtein edit distance in Raku
Artistic License 2.0
6 stars 1 forks source link

Working on vectors #13

Open antononcube opened 3 months ago

antononcube commented 3 months ago

Please make dld (and related functions) work on vectors (Positionals).

This works:

dld('Pepa' 'Pepper')

# 3

This does not, but it would be nice if it did:

dld('Pepa'.comb, 'Pepper'.comb)

# This type cannot unbox to a native string: P6opaque, Seq

Motivation

ugexe commented 3 months ago

For the most part I'd be ok with accepting a PR that adds a new multi to accommodate this.

I am not immediately sure how to handle cases where an element in the list contains multiple letters though, i.e. dld(['AA','b','c'], ['A','c','b']). It would be simple enough to add a check that each item in the list is only a single character, but I'm not sure if the performance penalty would be acceptable. What do you think?

antononcube commented 3 months ago

In dld(['AA','b','c'], ['A','c','b']) the strings should be treated as characters. I.e. how many edits it will take to turn the first vector into the second.

I consider submitting a PR -- should have tests for dld over vectors.