Merge lp:~jpakkane/libcolumbus/lessfuzz-test into lp:libcolumbus/0.4

Proposed by Jussi Pakkanen
Status: Merged
Approved by: Mathieu Trudel-Lapierre
Approved revision: 444
Merged at revision: 443
Proposed branch: lp:~jpakkane/libcolumbus/lessfuzz-test
Merge into: lp:libcolumbus/0.4
Diff against target: 34 lines (+9/-6)
1 file modified
src/Matcher.cc (+9/-6)
To merge this branch: bzr merge lp:~jpakkane/libcolumbus/lessfuzz-test
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Mathieu Trudel-Lapierre Approve
Review via email: mp+158595@code.launchpad.net

Commit message

Reduce fuzziness by making the error tolerances stricter.

Description of the change

Reduce fuzziness by making the error tolerances stricter. This reduces the amount of matches reduced which users might consider confusing.

To post a comment you must log in.
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Approve.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Matcher.cc'
2--- src/Matcher.cc 2013-01-30 15:21:02 +0000
3+++ src/Matcher.cc 2013-04-12 12:34:05 +0000
4@@ -138,21 +138,24 @@
5 }
6
7 /*
8- * These are helper functions for Matcher. They are not member functions to avoid polluting the header
9- * with STL includes.
10+ * Long words should allow for more error than short ones.
11+ * This is a simple function which is meant to be strict
12+ * so there won't be too many matches.
13 */
14
15-
16 static int getDynamicError(const Word &w) {
17 size_t len = w.length();
18 if(len < 2)
19 return LevenshteinIndex::getDefaultError();
20- else if(len < 5)
21+ else
22 return 2*LevenshteinIndex::getDefaultError();
23- else
24- return int((1+len/4.0)*LevenshteinIndex::getDefaultError()); // Permit a typo for every fourth letter.
25 }
26
27+/*
28+ * These are helper functions for Matcher. They are not member functions to avoid polluting the header
29+ * with STL includes.
30+ */
31+
32 static void addMatches(MatcherPrivate *p, BestIndexMatches &bestIndexMatches, const Word &queryWord, const WordID indexID, IndexMatches &matches) {
33 MatchIndIterator it = bestIndexMatches.find(indexID);
34 map<WordID, int> *indexMatches;

Subscribers

People subscribed via source and target branches

to all changes: