1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "suggest/policyimpl/typing/scoring_params.h"
18 
19 namespace latinime {
20 // TODO: RENAME all
21 const float ScoringParams::MAX_SPATIAL_DISTANCE = 1.0f;
22 const int ScoringParams::THRESHOLD_NEXT_WORD_PROBABILITY = 40;
23 const int ScoringParams::THRESHOLD_NEXT_WORD_PROBABILITY_FOR_CAPPED = 120;
24 const float ScoringParams::AUTOCORRECT_OUTPUT_THRESHOLD = 1.0f;
25 
26 const float ScoringParams::EXACT_MATCH_PROMOTION = 1.1f;
27 const float ScoringParams::PERFECT_MATCH_PROMOTION = 1.1f;
28 const float ScoringParams::CASE_ERROR_PENALTY_FOR_EXACT_MATCH = 0.01f;
29 const float ScoringParams::ACCENT_ERROR_PENALTY_FOR_EXACT_MATCH = 0.02f;
30 const float ScoringParams::DIGRAPH_PENALTY_FOR_EXACT_MATCH = 0.03f;
31 
32 // TODO: Unlimit max cache dic node size
33 const int ScoringParams::MAX_CACHE_DIC_NODE_SIZE = 170;
34 const int ScoringParams::MAX_CACHE_DIC_NODE_SIZE_FOR_SINGLE_POINT = 310;
35 const int ScoringParams::MAX_CACHE_DIC_NODE_SIZE_FOR_LOW_PROBABILITY_LOCALE = 50;
36 const int ScoringParams::THRESHOLD_SHORT_WORD_LENGTH = 4;
37 
38 const float ScoringParams::DISTANCE_WEIGHT_LENGTH = 0.1524f;
39 const float ScoringParams::PROXIMITY_COST = 0.0694f;
40 const float ScoringParams::FIRST_CHAR_PROXIMITY_COST = 0.072f;
41 const float ScoringParams::FIRST_PROXIMITY_COST = 0.07788f;
42 const float ScoringParams::INTENTIONAL_OMISSION_COST = 0.1f;
43 const float ScoringParams::OMISSION_COST = 0.467f;
44 const float ScoringParams::OMISSION_COST_SAME_CHAR = 0.345f;
45 const float ScoringParams::OMISSION_COST_FIRST_CHAR = 0.5256f;
46 const float ScoringParams::INSERTION_COST = 0.7248f;
47 const float ScoringParams::TERMINAL_INSERTION_COST = 0.8128f;
48 const float ScoringParams::INSERTION_COST_SAME_CHAR = 0.5508f;
49 const float ScoringParams::INSERTION_COST_PROXIMITY_CHAR = 0.674f;
50 const float ScoringParams::INSERTION_COST_FIRST_CHAR = 0.639f;
51 const float ScoringParams::TRANSPOSITION_COST = 0.5608f;
52 const float ScoringParams::SPACE_SUBSTITUTION_COST = 0.33f;
53 const float ScoringParams::SPACE_OMISSION_COST = 0.1f;
54 const float ScoringParams::ADDITIONAL_PROXIMITY_COST = 0.37972f;
55 const float ScoringParams::SUBSTITUTION_COST = 0.3806f;
56 const float ScoringParams::COST_SECOND_OR_LATER_WORD_FIRST_CHAR_UPPERCASE = 0.3224f;
57 const float ScoringParams::DISTANCE_WEIGHT_LANGUAGE = 1.1214f;
58 const float ScoringParams::COST_FIRST_COMPLETION = 0.4836f;
59 const float ScoringParams::COST_COMPLETION = 0.00624f;
60 const float ScoringParams::HAS_PROXIMITY_TERMINAL_COST = 0.0683f;
61 const float ScoringParams::HAS_EDIT_CORRECTION_TERMINAL_COST = 0.0362f;
62 const float ScoringParams::HAS_MULTI_WORD_TERMINAL_COST = 0.3482f;
63 const float ScoringParams::TYPING_BASE_OUTPUT_SCORE = 1.0f;
64 const float ScoringParams::TYPING_MAX_OUTPUT_SCORE_PER_INPUT = 0.1f;
65 const float ScoringParams::NORMALIZED_SPATIAL_DISTANCE_THRESHOLD_FOR_EDIT = 0.095f;
66 const float ScoringParams::LOCALE_WEIGHT_THRESHOLD_FOR_SPACE_SUBSTITUTION = 0.99f;
67 const float ScoringParams::LOCALE_WEIGHT_THRESHOLD_FOR_SPACE_OMISSION = 0.99f;
68 const float ScoringParams::LOCALE_WEIGHT_THRESHOLD_FOR_SMALL_CACHE_SIZE = 0.99f;
69 } // namespace latinime
70