Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Match word letter by letter
#1
Hi all

I'm looking to do a scan of a word and score it  on how much it matches the original for example

If the initial word was keyboard but the second iteration was spelled like keyboarf (typo for example) then the match (points) would be 7.
If the initial word was microphone but the second iteration was spelled like micorphone would be 8 (because 7 letters are in the same position as the original, only the o and r are incorrect.)

It needs to go through and compare the second word against the first word letter by letter ideally and the word size is always going to change.
#2
Macro LevenshteinDistance help
Code:
Copy      Help
;Computes <link "https://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein Distance</link> between two strings.
;Also known as fuzzy matching, fuzzy searching, approximate matching.
;Compares two strings and returns 0 if equal, 1 if almost equal, and so on.
;Uses C# code from <link>https://www.dotnetperls.com/levenshtein</link>

;EXAMPLES

#compile "__LevenshteinDistance"
LevenshteinDistance x.Init

;example 1
out x.x.Compute("keyboard" "keyboarf") ;;1

;example 2
str s1="kitten"
str s2="SITTING"
s1.lcase
s2.lcase
int n=x.x.Compute(s1 s2)
out n ;;3


Attached Files
.qml   LevenshteinDistance.qml (Size: 6 KB / Downloads: 323)


Forum Jump:


Users browsing this thread: 1 Guest(s)