Skip to content

Commit a5579d1

Browse files
author
rajendrant
committed
Remove debugs
1 parent 75d96c7 commit a5579d1

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

src/path_scorer.cc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,6 @@ size_t tau_depth = 20;
88
// Full path is also penalized for length of basename. This adjust a scale factor for that penalty.
99
Score file_coeff = 2.5;
1010

11-
#define TRACE(...) trace_internal(__FUNCTION__, "(", __LINE__, ")", __VA_ARGS__)
12-
13-
void trace_internal() {
14-
std::cout << std::endl;
15-
}
16-
17-
template<typename Head, typename... Args>
18-
void trace_internal(const Head& head, const Args&... args )
19-
{
20-
std::cout << head << " ";
21-
trace_internal(args...);
22-
}
23-
2411
};
2512

2613

@@ -52,11 +39,8 @@ Score path_scorer_score(const Candidate &string, const Element &query, const Opt
5239
return 0;
5340
}
5441
const auto string_lw = ToLower(string);
55-
TRACE(string, query, string_lw);
5642
auto sc = computeScore(string, string_lw, options.preparedQuery);
57-
TRACE(sc);
5843
sc = scorePath(string, string_lw, sc, options);
59-
TRACE(sc);
6044
return ceil(sc);
6145
}
6246

@@ -73,7 +57,6 @@ Score scorePath(const Candidate &subject, const Candidate &subject_lw, Score ful
7357
int end = subject.size() - 1;
7458
while (subject[end] == options.pathSeparator)
7559
end--;
76-
TRACE(end);
7760

7861
// Get position of basePath of subject.
7962
int basePos = subject.rfind(options.pathSeparator, end);
@@ -86,35 +69,30 @@ Score scorePath(const Candidate &subject, const Candidate &subject_lw, Score ful
8669
extAdjust += getExtensionScore(subject_lw, options.preparedQuery.ext, basePos, end, 2);
8770
fullPathScore *= extAdjust;
8871
}
89-
TRACE(fullPathScore, basePos, fileLength, extAdjust);
9072

9173
// no basePath, nothing else to compute.
9274
if (basePos == -1) return fullPathScore;
9375

9476
// Get the number of folder in query
9577
int depth = options.preparedQuery.depth;
96-
TRACE(depth, options.pathSeparator);
9778

9879
// Get that many folder from subject
9980
while (basePos > -1 && depth-- > 0) {
10081
basePos = subject.rfind(options.pathSeparator, basePos - 1);
10182
}
102-
TRACE(basePos);
10383

10484
// Get basePath score, if BaseName is the whole string, no need to recompute
10585
// We still need to apply the folder depth and filename penalty.
10686
Score basePathScore = (basePos == -1) ? fullPathScore :
10787
extAdjust * computeScore(subject.substr(basePos + 1, end + 1), subject_lw.substr(basePos + 1, end + 1), options.preparedQuery);
10888

109-
TRACE(basePathScore);
11089
// Final score is linear interpolation between base score and full path score.
11190
// For low directory depth, interpolation favor base Path then include more of full path as depth increase
11291
//
11392
// A penalty based on the size of the basePath is applied to fullPathScore
11493
// That way, more focused basePath match can overcome longer directory path.
11594

11695
Score alpha = 0.5 * tau_depth / ( tau_depth + countDir(subject, end + 1, options.pathSeparator) );
117-
TRACE(alpha, subject, end);
11896
return alpha * basePathScore + (1 - alpha) * fullPathScore * scoreSize(0, file_coeff * (fileLength));
11997
}
12098

src/scorer.cc

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,6 @@ Score tau_size = 150;
2828
// This has a direct influence on worst case scenario benchmark.
2929
float miss_coeff = 0.75; // Max number missed consecutive hit = ceil(miss_coeff*query.length) + 5
3030

31-
#define TRACE(...) trace_internal(__FUNCTION__, "(", __LINE__, ")", __VA_ARGS__)
32-
33-
void trace_internal() {
34-
std::cout << std::endl;
35-
}
36-
37-
template<typename Head, typename... Args>
38-
void trace_internal(const Head& head, const Args&... args )
39-
{
40-
std::cout << head << " ";
41-
trace_internal(args...);
42-
}
43-
4431
} // namepace
4532

4633
struct AcronymResult {
@@ -128,14 +115,11 @@ Score computeScore(const Candidate &subject, const Candidate &subject_lw, const
128115
int m = subject.size();
129116
int n = query.size();
130117

131-
TRACE(subject, subject_lw, query, query_lw);
132-
133118
//----------------------------
134119
// Abbreviations sequence
135120

136121
auto acro = scoreAcronyms(subject, subject_lw, query, query_lw);
137122
auto acro_score = acro.score;
138-
TRACE(acro.score, acro.pos, acro.count);
139123

140124
// Whole query is abbreviation ?
141125
// => use that as score
@@ -148,7 +132,6 @@ Score computeScore(const Candidate &subject, const Candidate &subject_lw, const
148132

149133
auto pos = subject_lw.find(query_lw);
150134
if (pos != std::string::npos) {
151-
TRACE(pos, n, m);
152135
return scoreExactMatch(subject, subject_lw, query, query_lw, pos, n, m);
153136
}
154137

@@ -166,7 +149,6 @@ Score computeScore(const Candidate &subject, const Candidate &subject_lw, const
166149
auto miss_budget = ceil(miss_coeff * n) + 5;
167150
auto miss_left = miss_budget;
168151
bool csc_should_rebuild = true;
169-
TRACE(sz, miss_budget, miss_left, miss_coeff);
170152

171153
// Fill with 0
172154
/*
@@ -252,7 +234,6 @@ Score computeScore(const Candidate &subject, const Candidate &subject_lw, const
252234

253235
// get hightest score so far
254236
auto score = score_row[n - 1];
255-
TRACE(score, sz);
256237
return score * sz;
257238
}
258239

@@ -303,7 +284,6 @@ Score scoreSize(Score n, Score m) {
303284
}
304285

305286
Score scoreExact(size_t n, size_t m, size_t quality, Score pos) {
306-
TRACE(n, m, quality, pos);
307287
return 2 * n * ( wm * quality + scorePosition(pos) ) * scoreSize(n, m);
308288
}
309289

@@ -402,8 +382,6 @@ Score scoreExactMatch(const Candidate &subject, const Candidate &subject_lw, con
402382

403383
// Test for word start
404384
bool start = isWordStart(pos, subject, subject_lw);
405-
TRACE(query, query_lw);
406-
TRACE(pos, n, m, start);
407385

408386
// Heuristic
409387
// If not a word start, test next occurrence
@@ -418,7 +396,6 @@ Score scoreExactMatch(const Candidate &subject, const Candidate &subject_lw, con
418396
if (start) pos = pos2;
419397
}
420398
}
421-
TRACE(start, pos);
422399

423400
//Exact case bonus.
424401
int i = -1;
@@ -427,10 +404,8 @@ Score scoreExactMatch(const Candidate &subject, const Candidate &subject_lw, con
427404
if (query[i] == subject[pos + i])
428405
sameCase++;
429406
}
430-
TRACE(sameCase);
431407

432408
int end = isWordEnd(pos + n - 1, subject, subject_lw, m);
433-
TRACE(end);
434409

435410
Score baseNameStart = 1;
436411
if (start && pos>0 && subject[pos-1]=='/') {

0 commit comments

Comments
 (0)