Home | History | Annotate | Download | only in typing
      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 MAX_CACHE_DIC_NODE_SIZE_FOR_LOW_PROBABILITY_LOCALE;
     34     static const int THRESHOLD_SHORT_WORD_LENGTH;
     35 
     36     static const float EXACT_MATCH_PROMOTION;
     37     static const float PERFECT_MATCH_PROMOTION;
     38     static const float CASE_ERROR_PENALTY_FOR_EXACT_MATCH;
     39     static const float ACCENT_ERROR_PENALTY_FOR_EXACT_MATCH;
     40     static const float DIGRAPH_PENALTY_FOR_EXACT_MATCH;
     41 
     42     // Numerically optimized parameters (currently for tap typing only).
     43     // TODO: add ability to modify these constants programmatically.
     44     // TODO: explore optimization of gesture parameters.
     45     static const float DISTANCE_WEIGHT_LENGTH;
     46     static const float PROXIMITY_COST;
     47     static const float FIRST_CHAR_PROXIMITY_COST;
     48     static const float FIRST_PROXIMITY_COST;
     49     static const float INTENTIONAL_OMISSION_COST;
     50     static const float OMISSION_COST;
     51     static const float OMISSION_COST_SAME_CHAR;
     52     static const float OMISSION_COST_FIRST_CHAR;
     53     static const float INSERTION_COST;
     54     static const float TERMINAL_INSERTION_COST;
     55     static const float INSERTION_COST_SAME_CHAR;
     56     static const float INSERTION_COST_PROXIMITY_CHAR;
     57     static const float INSERTION_COST_FIRST_CHAR;
     58     static const float TRANSPOSITION_COST;
     59     static const float SPACE_SUBSTITUTION_COST;
     60     static const float SPACE_OMISSION_COST;
     61     static const float ADDITIONAL_PROXIMITY_COST;
     62     static const float SUBSTITUTION_COST;
     63     static const float COST_SECOND_OR_LATER_WORD_FIRST_CHAR_UPPERCASE;
     64     static const float DISTANCE_WEIGHT_LANGUAGE;
     65     static const float COST_FIRST_COMPLETION;
     66     static const float COST_COMPLETION;
     67     static const float HAS_PROXIMITY_TERMINAL_COST;
     68     static const float HAS_EDIT_CORRECTION_TERMINAL_COST;
     69     static const float HAS_MULTI_WORD_TERMINAL_COST;
     70     static const float TYPING_BASE_OUTPUT_SCORE;
     71     static const float TYPING_MAX_OUTPUT_SCORE_PER_INPUT;
     72     static const float NORMALIZED_SPATIAL_DISTANCE_THRESHOLD_FOR_EDIT;
     73     static const float LOCALE_WEIGHT_THRESHOLD_FOR_SPACE_SUBSTITUTION;
     74     static const float LOCALE_WEIGHT_THRESHOLD_FOR_SPACE_OMISSION;
     75     static const float LOCALE_WEIGHT_THRESHOLD_FOR_SMALL_CACHE_SIZE;
     76 
     77  private:
     78     DISALLOW_IMPLICIT_CONSTRUCTORS(ScoringParams);
     79 };
     80 } // namespace latinime
     81 #endif // LATINIME_SCORING_PARAMS_H
     82