GithubHelp home page GithubHelp logo

ghostcir / levenshtein Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kmaher9/levenshtein

0.0 1.0 0.0 7 KB

A Golang implementation of the Levenshtein Distance Algorithm.

License: Apache License 2.0

Go 100.00%

levenshtein's Introduction

How similar are these texts? A Golang implementation.

I perform a lot of scripting tasks in my line of employment.

I started in Python, then moved to C# (not an ideal language for throwaway code), and a few months ago I finally settled on Go. Go is a brilliant language to implement many complex algorithms (due to ease of implementation and compilation time, in my opinion.), and one I find myself using frequently is the Levenshtein Distance Algorithm (“LDA”).

The Levenshtein Distance “a measure of dissimilarity between two strings”. What this means in human terms, is it is a calculation of how many changes need to be made between two pieces of text to make them the same.

As an example, let’s take the words “kitten” and “sitting”. If I want to determine how different these two words are, I could take word, and determine how many changes need to be made to make these words identical, as below:

K I T T E N
S I T T I N G

To make them identical, I would have to change the first character (K-S), then the next three characters remain the same (ITT), then the fifth character changes (E-I), the sixth stays the same (N), and the seventh needs changing, or rather, adding (null-G).

This algorithm is featured in almost all spellchecks I’ve ever observed. I also use it frequently on larger bodies of text, and it still remains the fastest algorithm for string comparison I’ve encountered, that isn’t a direct comparison between the two.

levenshtein's People

Contributors

kmaher9 avatar ghostcir avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.