Git Product home page Git Product logo

minimum-edit-distance's Introduction

Minimum-Edit-Distance

This project is an enhanced version of the minimum edit distance algorithm with dynamic programming

Classical Minimum Edit Distance Algorithm

The classical edit distance algorithm efficiently finds the distance between given two words using dynamic programming. However, if we want to find the distance between one word against 1000 words, this becomes inefficient.


Enhanced Minimum Edit Distance Algorithm

  • Instead of using 2D array, I will fill in 3D array as our major dynamic programming table. Previously, Table(I,J) gave me the smallest edit distance between the two words up to letters I and J of these two words. Now, Table(K,I,J) will give me the distance between a given main word and the Kth word (K=0,1,2,...999) up to letters I and J.
  • To make my algorithm more efficient, I will not fill all the 3D elements of Table(K,I,J). I will fill this table until I find most similar top 5 words out of 1000 words.
  • If the distance for a word with the main word is getting higher, I will stop filling the table for that word.
  • First I will fill all costs of 1 in all the table elements for all 1000 words. Then costs of 2, then 3, etc. It means that filling the table element will be rowed by row.

Comparisons

The percentage of occupancy of the dynamic programming table gives us how the program is efficient.

  • Although inefficient_min_edit_distance.py has a 3D array as a dynamic programming table, it is a classical version of the minimum edit distance algorithm. Even though the word has much more distance, the algorithm fills all the cells of the dynamic programming table. So, for all words, the percentage of occupancy of the dynamic programming table will always be %100.
  • min_edit_distance.py is the enhanced version of the minimum edit distance algorithm. It can stop filling the table cell if the distance is getting hihger. So, the percentage of occupancy of the dynamic programming table will not be %100.
  • You can see the real comparison based on the percentage of occupancy of the dynamic programming table here.

Dataset And Random Files


These files are needed to test and compare the enhanced version and the basic version of the minimum edit distance algorithm.

Requirements

  • It is a PyCharm project. So, you may use PyCharm to run it.
  • The version of the python interpreter is Python 3.7.5 and you can find it here.

Running


Static badge Static badge Static badge Static badge Static badge Static badge

minimum-edit-distance's People

Contributors

alihaydarkurban avatar

Stargazers

 avatar

Watchers

 avatar  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.