This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math' as math; | |
/// see https://en.wikipedia.org/wiki/Levenshtein_distance | |
void main() { | |
/// terms distance can be used as threshold value when you filter similar results. | |
/// if the number of "editions" is low, you can suppose a typo and provide the "similar" | |
/// result (maybe using the `int` distance as a sorting method). | |
print(levenshtein('sittin', 'sitting')); | |
print(levenshtein('casa', 'calle')); | |
} |