Skip to content

Instantly share code, notes, and snippets.

View unacorbatanegra's full-sized avatar
💙
Fluttering

Nicolas Lopez unacorbatanegra

💙
Fluttering
View GitHub Profile
@unacorbatanegra
unacorbatanegra / levenshtein.dart
Created July 1, 2021 16:48 — forked from roipeker/levenshtein.dart
basic Dart's Levenshtein distance.
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'));
}