edit_distance 0.4.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 88

edit_distance #

Build Status

Implementation of string distance algorithms.

Description #

Edit distances algorithms for fuzzy matching. Specifically, this library provides:

Examples #

Levenshtein d = new Levenshtein();
print(d.distance('witch', 'kitsch')); // 2

Changelog #

0.4.1 #

  • Apply health suggestions to improve its score.

0.4.0 #

  • Update to Dart 2.x
  • Remove the quiver_iterable dependency and replace it with reduce and min from the built-in math library.

0.3.0 #

  • Add Jaccard and CombinedJaccard.

0.2.1 #

  • Turn on strong mode
  • Fix a bug: JaroWinkler mistakenly used / operator where ~/ is required.

0.2.0 #

  • Add JaroWinkler and LongestCommonSubsequence.
  • Add NormalizedStringDistance whose normalizedDistance method returns a similarity between 0.0 (exact same) and 1.0 (completely different).

0.1.0 #

  • Initial version

example/edit_distance_example.dart

// Copyright (c) 2016, Kwang Yul Seo. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:edit_distance/edit_distance.dart';

void main() {
  Levenshtein d = new Levenshtein();
  print(d.distance('witch', 'kitsch')); // 2
  print(d.normalizedDistance('witch', 'kitsch')); // 0.3333333333333333
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  edit_distance: ^0.4.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:edit_distance/edit_distance.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
81
Health:
Code health derived from static analysis. [more]
93
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
88
Learn more about scoring.

We analyzed this package on Dec 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.1+4

Health suggestions

Fix lib/src/jaccard.dart. (-1.99 points)

Analysis of lib/src/jaccard.dart reported 4 hints:

line 54 col 23: Unnecessary new keyword.

line 74 col 13: Unnecessary new keyword.

line 75 col 23: Unnecessary new keyword.

line 76 col 16: Unnecessary new keyword.

Fix lib/src/jaro_winkler.dart. (-1.99 points)

Analysis of lib/src/jaro_winkler.dart reported 4 hints:

line 56 col 30: Unnecessary new keyword.

line 57 col 29: Unnecessary new keyword.

line 73 col 21: Unnecessary new keyword.

line 74 col 21: Unnecessary new keyword.

Fix lib/src/damerau.dart. (-1.49 points)

Analysis of lib/src/damerau.dart reported 3 hints:

line 24 col 24: Unnecessary new keyword.

line 38 col 25: Unnecessary new keyword.

line 39 col 21: Unnecessary new keyword.

Fix lib/src/lcs.dart. (-1 points)

Analysis of lib/src/lcs.dart reported 2 hints:

line 36 col 9: Unnecessary new keyword.

line 36 col 47: Unnecessary new keyword.

Fix lib/src/levenshtein.dart. (-1 points)

Analysis of lib/src/levenshtein.dart reported 2 hints:

line 26 col 20: Unnecessary new keyword.

line 27 col 20: Unnecessary new keyword.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test ^1.0.0