Skip to content

Commit

Permalink
chore(fuzzysearch): dartfmt
Browse files Browse the repository at this point in the history
Signed-off-by: SphericalKat <amolele@gmail.com>
  • Loading branch information
SphericalKat committed Mar 27, 2021
1 parent 7aa2c0e commit 00fc439
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
@@ -0,0 +1,9 @@
# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/
12 changes: 12 additions & 0 deletions lib/fuzzy_search.dart
@@ -1,5 +1,6 @@
import 'algorithms/token_set.dart';
import 'algorithms/token_sort.dart';
import 'algorithms/weighted_ratio.dart';
import 'ratios/partial_ratio.dart';
import 'ratios/simple_ratio.dart';

Expand All @@ -26,3 +27,14 @@ int tokenSetRatio(String s1, String s2) {
int tokenSetPartialRatio(String s1, String s2) {
return TokenSet().apply(s1, s2, PartialRatio());
}

/// Calculates a weighted ratio between [s1] and [s2] using several different
/// fuzzy matching algorithms
///
/// Example:
/// ```dart
/// weightedRatio("The quick brown fox jimps ofver the small lazy dog", "the quick brown fox jumps over the small lazy dog") // 97
/// ```
int weightedRatio(String s1, String s2) {
return WeightedRatio().apply(s1.toLowerCase(), s2.toLowerCase());
}
Empty file removed lib/main.dart
Empty file.
5 changes: 5 additions & 0 deletions pubspec.lock
@@ -0,0 +1,5 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages: {}
sdks:
dart: ">=2.7.0 <3.0.0"
1 change: 1 addition & 0 deletions pubspec.yaml
@@ -1,6 +1,7 @@
name: "fuzzywuzzy"
version: "0.1.0"
homepage: "https://github.com/sphericalkat/dart-fuzzywuzzy"
description: An implementation of the popular fuzzywuzzy package in dart

environment:
sdk: ">=2.7.0 <3.0.0"

0 comments on commit 00fc439

Please sign in to comment.