1 /* 2 * Copyright (C) 2013 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 "defines.h" 18 #include "suggest/core/layout/proximity_info_params.h" 19 20 namespace latinime { 21 const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f; 22 const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5; 23 const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE = 1.0f; 24 const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G = 0.5f; 25 26 /* Per method constants */ 27 // Used by ProximityInfoStateUtils::updateNearKeysDistances() 28 const float ProximityInfoParams::NEAR_KEY_THRESHOLD_FOR_DISTANCE = 2.0f; 29 30 // Used by ProximityInfoStateUtils::isPrevLocalMin() 31 const float ProximityInfoParams::MARGIN_FOR_PREV_LOCAL_MIN = 0.01f; 32 33 // Used by ProximityInfoStateUtils::getPointScore() 34 const int ProximityInfoParams::DISTANCE_BASE_SCALE = 100; 35 const float ProximityInfoParams::NEAR_KEY_THRESHOLD_FOR_POINT_SCORE = 0.6f; 36 const int ProximityInfoParams::CORNER_CHECK_DISTANCE_THRESHOLD_SCALE = 25; 37 const float ProximityInfoParams::NOT_LOCALMIN_DISTANCE_SCORE = -1.0f; 38 const float ProximityInfoParams::LOCALMIN_DISTANCE_AND_NEAR_TO_KEY_SCORE = 1.0f; 39 const float ProximityInfoParams::CORNER_ANGLE_THRESHOLD_FOR_POINT_SCORE = M_PI_F * 2.0f / 3.0f; 40 const float ProximityInfoParams::CORNER_SUM_ANGLE_THRESHOLD = M_PI_F / 4.0f; 41 const float ProximityInfoParams::CORNER_SCORE = 1.0f; 42 43 // Used by ProximityInfoStateUtils::refreshSpeedRates() 44 const int ProximityInfoParams::NUM_POINTS_FOR_SPEED_CALCULATION = 2; 45 46 // Used by ProximityInfoStateUtils::pushTouchPoint() 47 const int ProximityInfoParams::LAST_POINT_SKIP_DISTANCE_SCALE = 4; 48 49 // Used by ProximityInfoStateUtils::updateAlignPointProbabilities() 50 const float ProximityInfoParams::MIN_PROBABILITY = 0.000005f; 51 const float ProximityInfoParams::MAX_SKIP_PROBABILITY = 0.95f; 52 const float ProximityInfoParams::SKIP_FIRST_POINT_PROBABILITY = 0.01f; 53 const float ProximityInfoParams::SKIP_LAST_POINT_PROBABILITY = 0.1f; 54 const float ProximityInfoParams::MIN_SPEED_RATE_FOR_SKIP_PROBABILITY = 0.15f; 55 const float ProximityInfoParams::SPEED_WEIGHT_FOR_SKIP_PROBABILITY = 0.9f; 56 const float ProximityInfoParams::SLOW_STRAIGHT_WEIGHT_FOR_SKIP_PROBABILITY = 0.6f; 57 const float ProximityInfoParams::NEAREST_DISTANCE_WEIGHT = 0.5f; 58 const float ProximityInfoParams::NEAREST_DISTANCE_BIAS = 0.5f; 59 const float ProximityInfoParams::NEAREST_DISTANCE_WEIGHT_FOR_LAST = 0.6f; 60 const float ProximityInfoParams::NEAREST_DISTANCE_BIAS_FOR_LAST = 0.4f; 61 const float ProximityInfoParams::ANGLE_WEIGHT = 0.90f; 62 const float ProximityInfoParams::DEEP_CORNER_ANGLE_THRESHOLD = M_PI_F * 60.0f / 180.0f; 63 const float ProximityInfoParams::SKIP_DEEP_CORNER_PROBABILITY = 0.1f; 64 const float ProximityInfoParams::CORNER_ANGLE_THRESHOLD = M_PI_F * 30.0f / 180.0f; 65 const float ProximityInfoParams::STRAIGHT_ANGLE_THRESHOLD = M_PI_F * 15.0f / 180.0f; 66 const float ProximityInfoParams::SKIP_CORNER_PROBABILITY = 0.4f; 67 const float ProximityInfoParams::SPEED_MARGIN = 0.1f; 68 const float ProximityInfoParams::CENTER_VALUE_OF_NORMALIZED_DISTRIBUTION = 0.0f; 69 // TODO: The variance is critical for accuracy; thus, adjusting these parameters by machine 70 // learning or something would be efficient. 71 const float ProximityInfoParams::SPEEDxANGLE_WEIGHT_FOR_STANDARD_DEVIATION = 0.3f; 72 const float ProximityInfoParams::MAX_SPEEDxANGLE_RATE_FOR_STANDARD_DEVIATION = 0.25f; 73 const float ProximityInfoParams::SPEEDxNEAREST_WEIGHT_FOR_STANDARD_DEVIATION = 0.5f; 74 const float ProximityInfoParams::MAX_SPEEDxNEAREST_RATE_FOR_STANDARD_DEVIATION = 0.15f; 75 const float ProximityInfoParams::MIN_STANDARD_DEVIATION = 0.37f; 76 const float ProximityInfoParams::STANDARD_DEVIATION_X_WEIGHT_FOR_FIRST = 1.25f; 77 const float ProximityInfoParams::STANDARD_DEVIATION_Y_WEIGHT_FOR_FIRST = 0.85f; 78 const float ProximityInfoParams::STANDARD_DEVIATION_X_WEIGHT_FOR_LAST = 1.4f; 79 const float ProximityInfoParams::STANDARD_DEVIATION_Y_WEIGHT_FOR_LAST = 0.95f; 80 const float ProximityInfoParams::STANDARD_DEVIATION_X_WEIGHT = 1.1f; 81 const float ProximityInfoParams::STANDARD_DEVIATION_Y_WEIGHT = 0.95f; 82 83 // Used by ProximityInfoStateUtils::suppressCharProbabilities() 84 const float ProximityInfoParams::SUPPRESSION_LENGTH_WEIGHT = 1.5f; 85 const float ProximityInfoParams::MIN_SUPPRESSION_RATE = 0.1f; 86 const float ProximityInfoParams::SUPPRESSION_WEIGHT = 0.5f; 87 const float ProximityInfoParams::SUPPRESSION_WEIGHT_FOR_PROBABILITY_GAIN = 0.1f; 88 const float ProximityInfoParams::SKIP_PROBABALITY_WEIGHT_FOR_PROBABILITY_GAIN = 0.3f; 89 90 // Used by ProximityInfoStateUtils::getMostProbableString() 91 const float ProximityInfoParams::DEMOTION_LOG_PROBABILITY = 0.3f; 92 93 // Used by ProximityInfoStateUtils::updateSampledSearchKeySets() 94 // TODO: Investigate if this is required 95 const float ProximityInfoParams::SEARCH_KEY_RADIUS_RATIO = 0.95f; 96 97 // Used by ProximityInfoStateUtils::calculateBeelineSpeedRate() 98 const int ProximityInfoParams::LOOKUP_RADIUS_PERCENTILE = 50; 99 const int ProximityInfoParams::FIRST_POINT_TIME_OFFSET_MILLIS = 150; 100 const int ProximityInfoParams::STRONG_DOUBLE_LETTER_TIME_MILLIS = 600; 101 102 } // namespace latinime 103