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 "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::initGeometricDistanceInfos() 28 const float ProximityInfoParams::NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD = 4.0f; 29 30 // Used by ProximityInfoStateUtils::updateNearKeysDistances() 31 const float ProximityInfoParams::NEAR_KEY_THRESHOLD_FOR_DISTANCE = 2.0f; 32 33 // Used by ProximityInfoStateUtils::isPrevLocalMin() 34 const float ProximityInfoParams::MARGIN_FOR_PREV_LOCAL_MIN = 0.01f; 35 36 // Used by ProximityInfoStateUtils::getPointScore() 37 const int ProximityInfoParams::DISTANCE_BASE_SCALE = 100; 38 const float ProximityInfoParams::NEAR_KEY_THRESHOLD_FOR_POINT_SCORE = 0.6f; 39 const int ProximityInfoParams::CORNER_CHECK_DISTANCE_THRESHOLD_SCALE = 25; 40 const float ProximityInfoParams::NOT_LOCALMIN_DISTANCE_SCORE = -1.0f; 41 const float ProximityInfoParams::LOCALMIN_DISTANCE_AND_NEAR_TO_KEY_SCORE = 1.0f; 42 const float ProximityInfoParams::CORNER_ANGLE_THRESHOLD_FOR_POINT_SCORE = M_PI_F * 2.0f / 3.0f; 43 const float ProximityInfoParams::CORNER_SUM_ANGLE_THRESHOLD = M_PI_F / 4.0f; 44 const float ProximityInfoParams::CORNER_SCORE = 1.0f; 45 46 // Used by ProximityInfoStateUtils::refreshSpeedRates() 47 const int ProximityInfoParams::NUM_POINTS_FOR_SPEED_CALCULATION = 2; 48 49 // Used by ProximityInfoStateUtils::pushTouchPoint() 50 const int ProximityInfoParams::LAST_POINT_SKIP_DISTANCE_SCALE = 4; 51 52 // Used by ProximityInfoStateUtils::updateAlignPointProbabilities() 53 const float ProximityInfoParams::MIN_PROBABILITY = 0.000001f; 54 const float ProximityInfoParams::MAX_SKIP_PROBABILITY = 0.95f; 55 const float ProximityInfoParams::SKIP_FIRST_POINT_PROBABILITY = 0.01f; 56 const float ProximityInfoParams::SKIP_LAST_POINT_PROBABILITY = 0.1f; 57 const float ProximityInfoParams::MIN_SPEED_RATE_FOR_SKIP_PROBABILITY = 0.15f; 58 const float ProximityInfoParams::SPEED_WEIGHT_FOR_SKIP_PROBABILITY = 0.9f; 59 const float ProximityInfoParams::SLOW_STRAIGHT_WEIGHT_FOR_SKIP_PROBABILITY = 0.6f; 60 const float ProximityInfoParams::NEAREST_DISTANCE_WEIGHT = 0.5f; 61 const float ProximityInfoParams::NEAREST_DISTANCE_BIAS = 0.5f; 62 const float ProximityInfoParams::NEAREST_DISTANCE_WEIGHT_FOR_LAST = 0.6f; 63 const float ProximityInfoParams::NEAREST_DISTANCE_BIAS_FOR_LAST = 0.4f; 64 const float ProximityInfoParams::ANGLE_WEIGHT = 0.90f; 65 const float ProximityInfoParams::DEEP_CORNER_ANGLE_THRESHOLD = M_PI_F * 60.0f / 180.0f; 66 const float ProximityInfoParams::SKIP_DEEP_CORNER_PROBABILITY = 0.1f; 67 const float ProximityInfoParams::CORNER_ANGLE_THRESHOLD = M_PI_F * 30.0f / 180.0f; 68 const float ProximityInfoParams::STRAIGHT_ANGLE_THRESHOLD = M_PI_F * 15.0f / 180.0f; 69 const float ProximityInfoParams::SKIP_CORNER_PROBABILITY = 0.4f; 70 const float ProximityInfoParams::SPEED_MARGIN = 0.1f; 71 const float ProximityInfoParams::CENTER_VALUE_OF_NORMALIZED_DISTRIBUTION = 0.0f; 72 // TODO: The variance is critical for accuracy; thus, adjusting these parameter by machine 73 // learning or something would be efficient. 74 const float ProximityInfoParams::SPEEDxANGLE_WEIGHT_FOR_STANDARD_DIVIATION = 0.3f; 75 const float ProximityInfoParams::MAX_SPEEDxANGLE_RATE_FOR_STANDERD_DIVIATION = 0.25f; 76 const float ProximityInfoParams::SPEEDxNEAREST_WEIGHT_FOR_STANDARD_DIVIATION = 0.5f; 77 const float ProximityInfoParams::MAX_SPEEDxNEAREST_RATE_FOR_STANDERD_DIVIATION = 0.15f; 78 const float ProximityInfoParams::MIN_STANDERD_DIVIATION = 0.37f; 79 const float ProximityInfoParams::PREV_DISTANCE_WEIGHT = 0.5f; 80 const float ProximityInfoParams::NEXT_DISTANCE_WEIGHT = 0.6f; 81 82 // Used by ProximityInfoStateUtils::suppressCharProbabilities() 83 const float ProximityInfoParams::SUPPRESSION_LENGTH_WEIGHT = 1.5f; 84 const float ProximityInfoParams::MIN_SUPPRESSION_RATE = 0.1f; 85 const float ProximityInfoParams::SUPPRESSION_WEIGHT = 0.5f; 86 const float ProximityInfoParams::SUPPRESSION_WEIGHT_FOR_PROBABILITY_GAIN = 0.1f; 87 const float ProximityInfoParams::SKIP_PROBABALITY_WEIGHT_FOR_PROBABILITY_GAIN = 0.3f; 88 89 // Used by ProximityInfoStateUtils::getMostProbableString() 90 const float ProximityInfoParams::DEMOTION_LOG_PROBABILITY = 0.3f; 91 92 // Used by ProximityInfoStateUtils::updateSampledSearchKeySets() 93 // TODO: Investigate if this is required 94 const float ProximityInfoParams::SEARCH_KEY_RADIUS_RATIO = 0.95f; 95 96 // Used by ProximityInfoStateUtils::calculateBeelineSpeedRate() 97 const int ProximityInfoParams::LOOKUP_RADIUS_PERCENTILE = 50; 98 const int ProximityInfoParams::FIRST_POINT_TIME_OFFSET_MILLIS = 150; 99 const int ProximityInfoParams::STRONG_DOUBLE_LETTER_TIME_MILLIS = 600; 100 101 // Used by ProximityInfoStateUtils::calculateNormalizedSquaredDistance() 102 const int ProximityInfoParams::NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR = 1 << 10; 103 104 } // namespace latinime 105