Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5942285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:13:54+00:00 2026-05-22T16:13:54+00:00

I implemented the Levenshtein algorithm in Java and am now getting the corrections made

  • 0

I implemented the Levenshtein algorithm in Java and am now getting the corrections made by the algorithm, a.k.a. the cost. This does help a little but not much since I want the results as a percentage.

So I want to know how to calculate those similarity points.

I would also like to know how you people do it and why.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:13:55+00:00Added an answer on May 22, 2026 at 4:13 pm

    The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character. (Wikipedia)

    • So a Levenshtein distance of 0 means: both strings are equal
    • The maximum Levenshtein distance (all chars are different) is max(string1.length, string2.length)

    So if you need a percentage, you have to use this to points to scale. For example:

    “Hallo”, “Hello” -> Levenstein distance 1
    Max Levenstein distance for this two strings is: 5.
    So the 20% of the characters do not match.

    String s1 = "Hallo";
    String s2 = "Hello";
    int lfd = calculateLevensteinDistance(s1, s2);
    double ratio = ((double) lfd) / (Math.max(s1.length, s2.length));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implemented an rpc call. It works on local machine but does not work
I'm searching for an implementations of the Damerau–Levenshtein algorithm for PHP, but it seems
I implemented a custom list view, but now there's no visual feedback that an
I implemented the plist in my iOS game following this tutorial: Now I have
Implemented a generic repository with several Methods. One of those is this: public IEnumerable<T>
I implemented a small OOP library in Lua, and two things are not quite
Having implemented CLogClass to make decent logging I also defined macro, but it works
I just implemented a best match file search algorithm to find the closest match
I recently posted a question about optimizing the algorithm to compute the Levenshtein Distance,
Is there a package that contains Levenshtein distance counting function which is implemented as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.