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 #ifndef LATINIME_SCORING_PARAMS_H 18 #define LATINIME_SCORING_PARAMS_H 19 20 #include "defines.h" 21 22 namespace latinime { 23 24 class ScoringParams { 25 public: 26 // Fixed model parameters 27 static const float MAX_SPATIAL_DISTANCE; 28 static const int THRESHOLD_NEXT_WORD_PROBABILITY; 29 static const int THRESHOLD_NEXT_WORD_PROBABILITY_FOR_CAPPED; 30 static const float AUTOCORRECT_OUTPUT_THRESHOLD; 31 static const int MAX_CACHE_DIC_NODE_SIZE; 32 static const int MAX_CACHE_DIC_NODE_SIZE_FOR_SINGLE_POINT; 33 static const int THRESHOLD_SHORT_WORD_LENGTH; 34 35 static const float EXACT_MATCH_PROMOTION; 36 static const float CASE_ERROR_PENALTY_FOR_EXACT_MATCH; 37 static const float ACCENT_ERROR_PENALTY_FOR_EXACT_MATCH; 38 static const float DIGRAPH_PENALTY_FOR_EXACT_MATCH; 39 40 // Numerically optimized parameters (currently for tap typing only). 41 // TODO: add ability to modify these constants programmatically. 42 // TODO: explore optimization of gesture parameters. 43 static const float DISTANCE_WEIGHT_LENGTH; 44 static const float PROXIMITY_COST; 45 static const float FIRST_CHAR_PROXIMITY_COST; 46 static const float FIRST_PROXIMITY_COST; 47 static const float INTENTIONAL_OMISSION_COST; 48 static const float OMISSION_COST; 49 static const float OMISSION_COST_SAME_CHAR; 50 static const float OMISSION_COST_FIRST_CHAR; 51 static const float INSERTION_COST; 52 static const float TERMINAL_INSERTION_COST; 53 static const float INSERTION_COST_SAME_CHAR; 54 static const float INSERTION_COST_PROXIMITY_CHAR; 55 static const float INSERTION_COST_FIRST_CHAR; 56 static const float TRANSPOSITION_COST; 57 static const float SPACE_SUBSTITUTION_COST; 58 static const float ADDITIONAL_PROXIMITY_COST; 59 static const float SUBSTITUTION_COST; 60 static const float COST_NEW_WORD; 61 static const float COST_SECOND_OR_LATER_WORD_FIRST_CHAR_UPPERCASE; 62 static const float DISTANCE_WEIGHT_LANGUAGE; 63 static const float COST_FIRST_COMPLETION; 64 static const float COST_COMPLETION; 65 static const float HAS_PROXIMITY_TERMINAL_COST; 66 static const float HAS_EDIT_CORRECTION_TERMINAL_COST; 67 static const float HAS_MULTI_WORD_TERMINAL_COST; 68 static const float TYPING_BASE_OUTPUT_SCORE; 69 static const float TYPING_MAX_OUTPUT_SCORE_PER_INPUT; 70 static const float NORMALIZED_SPATIAL_DISTANCE_THRESHOLD_FOR_EDIT; 71 72 private: 73 DISALLOW_IMPLICIT_CONSTRUCTORS(ScoringParams); 74 }; 75 } // namespace latinime 76 #endif // LATINIME_SCORING_PARAMS_H 77