/src/aspell/modules/speller/default/editdist2.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | |
2 | | #include "leditdist.hpp" |
3 | | #include "editdist.hpp" |
4 | | |
5 | | #include <cassert> |
6 | | |
7 | | namespace aspeller { |
8 | | inline int edit_distance(ParmString a, ParmString b, |
9 | | int level, // starting level |
10 | | int limit, // maximum level |
11 | | const EditDistanceWeights & w |
12 | | = EditDistanceWeights()) |
13 | 18.2M | { |
14 | 18.2M | int score; |
15 | 18.2M | assert(level > 0 && limit >= level); |
16 | 18.7M | do { |
17 | 18.7M | if (level == 2) { |
18 | 10.1M | score = limit2_edit_distance(a,b,w); |
19 | 10.1M | } else if (level < 5) { |
20 | 7.39M | score = limit_edit_distance(a,b,level,w); |
21 | 7.39M | } else { |
22 | 1.17M | score = edit_distance(a,b,w); |
23 | 1.17M | } |
24 | 18.7M | ++level; |
25 | 18.7M | } while (score >= LARGE_NUM && level <= limit); |
26 | 18.2M | return score; |
27 | 18.2M | } |
28 | | } |