string_similarity
2.2.0, released 8 months ago by jeremylandon.com
Finds the degree of similarity between strings using Dice's Coefficient.
What it does
Calculates the similarity fraction between two strings or finds the best matching string from a list of targets. It uses Dice's Coefficient and provides convenient string extensions.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to implement fuzzy string searching or matching
- You want to compare how similar two strings are
Skip it when
- Comparing strings shorter than 2 characters, as they always return 0.0
Strengths
- Provides both extension methods and static methods
- Often performs better than Levenshtein distance for text comparison
Weaknesses
- Strings shorter than 2 characters are not meaningful and return a similarity score of 0.0
- Comparison is case and diacritic sensitive
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:string_similarity/string_similarity.dart';
var similarity = 'french'.similarityTo('quebec');
var matches = 'healed'.bestMatch(['edward', 'sealed', 'theatre']);Alternatives
Packages that do the same job and could replace string_similarity.
- validators2
String validation and sanitization for Dart.
83Compare - text_comparison_score_codespark
Calculate string similarity and fuzzy matching scores using Levenshtein, Damerau-Levenshtein, and Jaro-Winkler.
57Compare - string_to_color
Convert strings to colors, hex strings, or hex integers in Dart and Flutter.
42Compare - age_calculator
Calculate age, date differences, and add time durations in years, months, and days.
48Compare
Works with
Packages commonly used together with string_similarity: ones it builds on, ones built on it, and its own family.