+ Reply to Thread
Results 1 to 9 of 9

Levenshtein Match for Words

  1. #1
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Question Levenshtein Match for Words

    Hi,

    I am having trouble spotting the problem with this code. It checks the Levenshtein Distance between two strings, but unlike the standard Levenshtein Distance, doesn't match individual characters but rather words. One of the problems is that if the cell only contains one word then it gives me a #value error. Also it is calculating the distances incorrectly. I am hoping a fresh pair of eyes will help spot the problem(s).

    *** Edited - Check working code in post #9 ***

    Thanks.

    abousetta
    Last edited by abousetta; 05-12-2012 at 06:12 PM.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Levenshtein Match for Words

    why do you have d(i, j) + 1 twice in the application.min line?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Levenshtein Match for Words

    You're right. This line

    Please Login or Register  to view this content.
    should be

    Please Login or Register  to view this content.
    but it is still not working correctly. There is something wrong with this line but I can't seem to get it right.

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Levenshtein Match for Words

    *** Edited - Check working code in post #9 ***
    Last edited by abousetta; 05-12-2012 at 06:13 PM.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Levenshtein Match for Words

    Try this:

    Please Login or Register  to view this content.
    Last edited by shg; 05-12-2012 at 02:11 PM.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Levenshtein Match for Words

    Hi shg,

    Thanks for looking at this. I am trying to compare words rather than characters in a string. I started with the traditional Levenshtein Distance an am attempting to modify it to use check an array of words created by splitting a string.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Levenshtein Match for Words

    Then you could split the strings and use the function to compare each word ...

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Levenshtein Match for Words

    I was able to split the strings

    Please Login or Register  to view this content.
    and looped through them fine. I must be sending messing up the syntax later. I will start over again.

  9. #9
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Levenshtein Match for Words

    Thanks shg for posting your version. I compared it to mine and made some minor adjustments accordingly. Its working fine now

    Please Login or Register  to view this content.
    Last edited by abousetta; 05-16-2012 at 05:10 AM. Reason: Corrected the code

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1