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
=== modified file 'src/Matcher.cc'
--- src/Matcher.cc 2013-01-30 15:21:02 +0000
+++ src/Matcher.cc 2013-04-12 12:34:05 +0000
@@ -138,21 +138,24 @@
138}138}
139139
140/*140/*
141 * These are helper functions for Matcher. They are not member functions to avoid polluting the header141 * Long words should allow for more error than short ones.
142 * with STL includes.142 * This is a simple function which is meant to be strict
143 * so there won't be too many matches.
143 */144 */
144145
145
146static int getDynamicError(const Word &w) {146static int getDynamicError(const Word &w) {
147 size_t len = w.length();147 size_t len = w.length();
148 if(len < 2)148 if(len < 2)
149 return LevenshteinIndex::getDefaultError();149 return LevenshteinIndex::getDefaultError();
150 else if(len < 5)150 else
151 return 2*LevenshteinIndex::getDefaultError();151 return 2*LevenshteinIndex::getDefaultError();
152 else
153 return int((1+len/4.0)*LevenshteinIndex::getDefaultError()); // Permit a typo for every fourth letter.
154}152}
155153
154/*
155 * These are helper functions for Matcher. They are not member functions to avoid polluting the header
156 * with STL includes.
157 */
158
156static void addMatches(MatcherPrivate *p, BestIndexMatches &bestIndexMatches, const Word &queryWord, const WordID indexID, IndexMatches &matches) {159static void addMatches(MatcherPrivate *p, BestIndexMatches &bestIndexMatches, const Word &queryWord, const WordID indexID, IndexMatches &matches) {
157 MatchIndIterator it = bestIndexMatches.find(indexID);160 MatchIndIterator it = bestIndexMatches.find(indexID);
158 map<WordID, int> *indexMatches;161 map<WordID, int> *indexMatches;

Subscribers

People subscribed via source and target branches

to all changes: