Skip to content

Commit

Permalink
fix(treewide): format code using dartfmt
Browse files Browse the repository at this point in the history
Signed-off-by: SphericalKat <[email protected]>
  • Loading branch information
SphericalKat committed Apr 6, 2021
1 parent ade8d1c commit db74783
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 64 deletions.
102 changes: 49 additions & 53 deletions example/fuzzywuzzy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,70 +23,66 @@ void main() {
// Extracting top 4 choices above 50% match
print(
extractTop(
query: 'goolge',
choices: [
'google',
'bing',
'facebook',
'linkedin',
'twitter',
'googleplus',
'bingnews',
'plexoogl'
],
limit: 4,
cutoff: 50
),
query: 'goolge',
choices: [
'google',
'bing',
'facebook',
'linkedin',
'twitter',
'googleplus',
'bingnews',
'plexoogl'
],
limit: 4,
cutoff: 50),
);

print(
extractAllSorted(
query: 'goolge',
choices: [
'google',
'bing',
'facebook',
'linkedin',
'twitter',
'googleplus',
'bingnews',
'plexoogl'
],
cutoff: 10
),
query: 'goolge',
choices: [
'google',
'bing',
'facebook',
'linkedin',
'twitter',
'googleplus',
'bingnews',
'plexoogl'
],
cutoff: 10),
);

print(
extractAll(
query: 'goolge',
choices: [
'google',
'bing',
'facebook',
'linkedin',
'twitter',
'googleplus',
'bingnews',
'plexoogl'
],
cutoff: 10
),
query: 'goolge',
choices: [
'google',
'bing',
'facebook',
'linkedin',
'twitter',
'googleplus',
'bingnews',
'plexoogl'
],
cutoff: 10),
);

print(
extractOne(
query: 'goolge',
choices: [
'google',
'bing',
'facebook',
'linkedin',
'twitter',
'googleplus',
'bingnews',
'plexoogl'
],
cutoff: 10
),
query: 'goolge',
choices: [
'google',
'bing',
'facebook',
'linkedin',
'twitter',
'googleplus',
'bingnews',
'plexoogl'
],
cutoff: 10),
);
}
1 change: 0 additions & 1 deletion lib/extractor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class Extractor {
List<ExtractedResult<T>> extractTop<T>(
String query, List<T> choices, Applicable func, int limit,
[String Function(T obj)? getter]) {

var best = extractWithoutOrder(query, choices, func, getter);
var results = _findTopKHeap(best, limit);
return results.reversed.toList();
Expand Down
19 changes: 9 additions & 10 deletions test/fuzzywuzzy_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,15 @@ void main() {

test('extract one returns appropriate values for generic container', () {
final result = extractOne<TestContainer>(
query: 'cowboys',
choices: [
'Atlanta Falcons',
'New York Jets',
'New York Giants',
'Dallas Cowboys'
].map((e) => TestContainer(e)).toList(),
cutoff: 10,
getter: (x) => x.innerVal
).toString();
query: 'cowboys',
choices: [
'Atlanta Falcons',
'New York Jets',
'New York Giants',
'Dallas Cowboys'
].map((e) => TestContainer(e)).toList(),
cutoff: 10,
getter: (x) => x.innerVal).toString();
expect(result, '(string Dallas Cowboys, score: 90, index: 3)');
});
});
Expand Down

0 comments on commit db74783

Please sign in to comment.