Implementation of Levenshtein distance in C++
C++ R
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Levenshtein.cpp
MyNode.cpp
MyNode.h
README
node.txt
profiling.R
simple.txt

README

Implementation of Levenstein's distance in C++. If you are looking for simple/pure implementation of it, please refer Levenshtein.cpp->int levenshtein_distance(std::string target, std::string source, int kMaxCost). 

However, if the dictionary is big and you are looking for ways to boost performance, then you need to use trie data structure + Levenshtein distance algorithm. MyNode class implements simple tree structure and provides Levenshtein distance search.

Levenshtein.cpp file has testNode() and testDict() functions for code profiling. Use runLookup() method for term lookup.  

To compile:
g++ -g MyNode.cpp Levenshtein.cpp -lrt -o dict

For more information please check this post: http://www.investuotojas.eu/2012/03/25/levenshtein-distance-in-c-and-code-profiling-in-r/

License
===
Copyright 2012 Dzidorius Martinaitis
GPL - http://www.gnu.org/licenses/agpl.txt