Skip to content

Commit

Permalink
docs(fuzzywuzzy): add information about getters for generic lists
Browse files Browse the repository at this point in the history
Signed-off-by: SphericalKat <amolele@gmail.com>
  • Loading branch information
SphericalKat committed Mar 30, 2021
1 parent f1d0d24 commit f8cbb6a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/fuzzywuzzy.dart
Expand Up @@ -16,7 +16,7 @@ int ratio(String s1, String s2) {

/// Inconsistent substrings lead to problems in matching.
/// This ratio uses a heuristic called "best partial" for when two strings are
/// of noticeably different lengths
/// of noticeably different lengths.
int partialRatio(String s1, String s2) {
return PartialRatio().apply(s1, s2);
}
Expand All @@ -36,15 +36,15 @@ int tokenSortPartialRatio(String s1, String s2) {
/// Splits the strings into tokens and computes intersections and remainders
/// between the tokens of the two strings. A comparison string is then
/// built up and is compared using the simple ratio algorithm.
/// Useful for strings where words appear redundantly
/// Useful for strings where words appear redundantly.
int tokenSetRatio(String s1, String s2) {
return TokenSet().apply(s1, s2, SimpleRatio());
}

/// Splits the strings into tokens and computes intersections and remainders
/// between the tokens of the two strings. A comparison string is then
/// built up and is compared using the partial ratio algorithm.
/// Useful for strings where words appear redundantly
/// Useful for strings where words appear redundantly.
int tokenSetPartialRatio(String s1, String s2) {
return TokenSet().apply(s1, s2, PartialRatio());
}
Expand All @@ -62,8 +62,10 @@ int weightedRatio(String s1, String s2) {

/// Returns a sorted list of [ExtractedResult] which contains the top [limit]
/// most similar choices. Will reject any items with scores below the [cutoff].
/// Default [cutoff] is 0
/// Default [cutoff] is 0.
/// Uses [WeightedRatio] as the default algorithm.
/// [getter] is optional for [String] types, but MUST NOT be null for any other
/// types
List<ExtractedResult<T>> extractTop<T>({
required String query,
required List<T> choices,
Expand All @@ -79,6 +81,8 @@ List<ExtractedResult<T>> extractTop<T>({
/// Creates a list of [ExtractedResult] which contains all the choices with
/// their corresponding score where higher is more similar.
/// Uses [WeightedRatio] as the default algorithm
/// [getter] is optional for [String] types, but MUST NOT be null for any other
/// types
List<ExtractedResult<T>> extractAll<T>({
required String query,
required List<T> choices,
Expand All @@ -92,6 +96,8 @@ List<ExtractedResult<T>> extractAll<T>({

/// Returns a sorted list of [ExtractedResult] without any cutoffs.
/// Uses [WeightedRatio] as the default algorithm.
/// [getter] is optional for [String] types, but MUST NOT be null for any other
/// types
List<ExtractedResult<T>> extractAllSorted<T>({
required String query,
required List<T> choices,
Expand All @@ -104,6 +110,8 @@ List<ExtractedResult<T>> extractAllSorted<T>({
}

/// Find the single best match above the [cutoff] in a list of choices.
/// [getter] is optional for [String] types, but MUST NOT be null for any other
/// types
ExtractedResult<T> extractOne<T>({
required String query,
required List<T> choices,
Expand Down

0 comments on commit f8cbb6a

Please sign in to comment.