am 11dc3a37: Clean up macro variables
* commit '11dc3a371d3bc682f7307586761ae637170d3505': Clean up macro variablesmain
commit
496bb8af8b
|
@ -287,25 +287,6 @@ static inline void prof_out(void) {
|
|||
#define SUGGEST_MULTIPLE_WORDS true
|
||||
#define SUGGEST_INTERFACE_OUTPUT_SCALE 1000000.0f
|
||||
|
||||
// The following "rate"s are used as a multiplier before dividing by 100, so they are in percent.
|
||||
#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE 80
|
||||
#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X 12
|
||||
#define WORDS_WITH_MISSING_SPACE_CHARACTER_DEMOTION_RATE 58
|
||||
#define WORDS_WITH_MISTYPED_SPACE_DEMOTION_RATE 50
|
||||
#define WORDS_WITH_EXCESSIVE_CHARACTER_DEMOTION_RATE 75
|
||||
#define WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE 75
|
||||
#define WORDS_WITH_TRANSPOSED_CHARACTERS_DEMOTION_RATE 70
|
||||
#define FULL_MATCHED_WORDS_PROMOTION_RATE 120
|
||||
#define WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE 90
|
||||
#define WORDS_WITH_ADDITIONAL_PROXIMITY_CHARACTER_DEMOTION_RATE 70
|
||||
#define WORDS_WITH_MATCH_SKIP_PROMOTION_RATE 105
|
||||
#define WORDS_WITH_JUST_ONE_CORRECTION_PROMOTION_RATE 148
|
||||
#define WORDS_WITH_JUST_ONE_CORRECTION_PROMOTION_MULTIPLIER 3
|
||||
#define CORRECTION_COUNT_RATE_DEMOTION_RATE_BASE 45
|
||||
#define INPUT_EXCEEDS_OUTPUT_DEMOTION_RATE 70
|
||||
#define FIRST_CHAR_DIFFERENT_DEMOTION_RATE 96
|
||||
#define TWO_WORDS_CAPITALIZED_DEMOTION_RATE 50
|
||||
#define TWO_WORDS_CORRECTION_DEMOTION_BASE 80
|
||||
#define ZERO_DISTANCE_PROMOTION_RATE 110.0f
|
||||
#define NEUTRAL_SCORE_SQUARED_RADIUS 8.0f
|
||||
#define HALF_SCORE_SQUARED_RADIUS 32.0f
|
||||
|
@ -330,6 +311,13 @@ static inline void prof_out(void) {
|
|||
#define MAX_POINTER_COUNT 1
|
||||
#define MAX_POINTER_COUNT_G 2
|
||||
|
||||
// Queue IDs and size for DicNodesCache
|
||||
#define DIC_NODES_CACHE_INITIAL_QUEUE_ID_ACTIVE 0
|
||||
#define DIC_NODES_CACHE_INITIAL_QUEUE_ID_NEXT_ACTIVE 1
|
||||
#define DIC_NODES_CACHE_INITIAL_QUEUE_ID_TERMINAL 2
|
||||
#define DIC_NODES_CACHE_INITIAL_QUEUE_ID_CACHE_FOR_CONTINUOUS_SUGGESTION 3
|
||||
#define DIC_NODES_CACHE_PRIORITY_QUEUES_SIZE 4
|
||||
|
||||
// Size, in bytes, of the bloom filter index for bigrams
|
||||
// 128 gives us 1024 buckets. The probability of false positive is (1 - e ** (-kn/m))**k,
|
||||
// where k is the number of hash functions, n the number of bigrams, and m the number of
|
||||
|
|
|
@ -30,6 +30,27 @@ namespace latinime {
|
|||
|
||||
class ProximityInfo;
|
||||
|
||||
// private static const member variables
|
||||
// The following "rate"s are used as a multiplier before dividing by 100, so they are in percent.
|
||||
const int Correction::WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE = 80;
|
||||
const int Correction::WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X = 12;
|
||||
const int Correction::WORDS_WITH_MISSING_SPACE_CHARACTER_DEMOTION_RATE = 58;
|
||||
const int Correction::WORDS_WITH_MISTYPED_SPACE_DEMOTION_RATE = 50;
|
||||
const int Correction::WORDS_WITH_EXCESSIVE_CHARACTER_DEMOTION_RATE = 75;
|
||||
const int Correction::WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE = 75;
|
||||
const int Correction::WORDS_WITH_TRANSPOSED_CHARACTERS_DEMOTION_RATE = 70;
|
||||
const int Correction::FULL_MATCHED_WORDS_PROMOTION_RATE = 120;
|
||||
const int Correction::WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE = 90;
|
||||
const int Correction::WORDS_WITH_ADDITIONAL_PROXIMITY_CHARACTER_DEMOTION_RATE = 70;
|
||||
const int Correction::WORDS_WITH_MATCH_SKIP_PROMOTION_RATE = 105;
|
||||
const int Correction::WORDS_WITH_JUST_ONE_CORRECTION_PROMOTION_RATE = 148;
|
||||
const int Correction::WORDS_WITH_JUST_ONE_CORRECTION_PROMOTION_MULTIPLIER = 3;
|
||||
const int Correction::CORRECTION_COUNT_RATE_DEMOTION_RATE_BASE = 45;
|
||||
const int Correction::INPUT_EXCEEDS_OUTPUT_DEMOTION_RATE = 70;
|
||||
const int Correction::FIRST_CHAR_DIFFERENT_DEMOTION_RATE = 96;
|
||||
const int Correction::TWO_WORDS_CAPITALIZED_DEMOTION_RATE = 50;
|
||||
const int Correction::TWO_WORDS_CORRECTION_DEMOTION_BASE = 80;
|
||||
|
||||
/////////////////////////////
|
||||
// edit distance funcitons //
|
||||
/////////////////////////////
|
||||
|
|
|
@ -135,6 +135,27 @@ class Correction {
|
|||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(Correction);
|
||||
|
||||
// The following "rate"s are used as a multiplier before dividing by 100, so they are in
|
||||
// percent.
|
||||
static const int WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE;
|
||||
static const int WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X;
|
||||
static const int WORDS_WITH_MISSING_SPACE_CHARACTER_DEMOTION_RATE;
|
||||
static const int WORDS_WITH_MISTYPED_SPACE_DEMOTION_RATE;
|
||||
static const int WORDS_WITH_EXCESSIVE_CHARACTER_DEMOTION_RATE;
|
||||
static const int WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE;
|
||||
static const int WORDS_WITH_TRANSPOSED_CHARACTERS_DEMOTION_RATE;
|
||||
static const int FULL_MATCHED_WORDS_PROMOTION_RATE;
|
||||
static const int WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE;
|
||||
static const int WORDS_WITH_ADDITIONAL_PROXIMITY_CHARACTER_DEMOTION_RATE;
|
||||
static const int WORDS_WITH_MATCH_SKIP_PROMOTION_RATE;
|
||||
static const int WORDS_WITH_JUST_ONE_CORRECTION_PROMOTION_RATE;
|
||||
static const int WORDS_WITH_JUST_ONE_CORRECTION_PROMOTION_MULTIPLIER;
|
||||
static const int CORRECTION_COUNT_RATE_DEMOTION_RATE_BASE;
|
||||
static const int INPUT_EXCEEDS_OUTPUT_DEMOTION_RATE;
|
||||
static const int FIRST_CHAR_DIFFERENT_DEMOTION_RATE;
|
||||
static const int TWO_WORDS_CAPITALIZED_DEMOTION_RATE;
|
||||
static const int TWO_WORDS_CORRECTION_DEMOTION_BASE;
|
||||
|
||||
/////////////////////////
|
||||
// static inline utils //
|
||||
/////////////////////////
|
||||
|
|
|
@ -22,12 +22,6 @@
|
|||
#include "defines.h"
|
||||
#include "suggest/core/dicnode/dic_node_priority_queue.h"
|
||||
|
||||
#define INITIAL_QUEUE_ID_ACTIVE 0
|
||||
#define INITIAL_QUEUE_ID_NEXT_ACTIVE 1
|
||||
#define INITIAL_QUEUE_ID_TERMINAL 2
|
||||
#define INITIAL_QUEUE_ID_CACHE_FOR_CONTINUOUS_SUGGESTION 3
|
||||
#define PRIORITY_QUEUES_SIZE 4
|
||||
|
||||
namespace latinime {
|
||||
|
||||
class DicNode;
|
||||
|
@ -38,11 +32,12 @@ class DicNode;
|
|||
class DicNodesCache {
|
||||
public:
|
||||
AK_FORCE_INLINE DicNodesCache()
|
||||
: mActiveDicNodes(&mDicNodePriorityQueues[INITIAL_QUEUE_ID_ACTIVE]),
|
||||
mNextActiveDicNodes(&mDicNodePriorityQueues[INITIAL_QUEUE_ID_NEXT_ACTIVE]),
|
||||
mTerminalDicNodes(&mDicNodePriorityQueues[INITIAL_QUEUE_ID_TERMINAL]),
|
||||
mCachedDicNodesForContinuousSuggestion(
|
||||
&mDicNodePriorityQueues[INITIAL_QUEUE_ID_CACHE_FOR_CONTINUOUS_SUGGESTION]),
|
||||
: mActiveDicNodes(&mDicNodePriorityQueues[DIC_NODES_CACHE_INITIAL_QUEUE_ID_ACTIVE]),
|
||||
mNextActiveDicNodes(&mDicNodePriorityQueues[
|
||||
DIC_NODES_CACHE_INITIAL_QUEUE_ID_NEXT_ACTIVE]),
|
||||
mTerminalDicNodes(&mDicNodePriorityQueues[DIC_NODES_CACHE_INITIAL_QUEUE_ID_TERMINAL]),
|
||||
mCachedDicNodesForContinuousSuggestion(&mDicNodePriorityQueues[
|
||||
DIC_NODES_CACHE_INITIAL_QUEUE_ID_CACHE_FOR_CONTINUOUS_SUGGESTION]),
|
||||
mInputIndex(0), mLastCachedInputIndex(0) {
|
||||
}
|
||||
|
||||
|
@ -147,9 +142,8 @@ class DicNodesCache {
|
|||
mCachedDicNodesForContinuousSuggestion->dump();
|
||||
}
|
||||
mInputIndex = mLastCachedInputIndex;
|
||||
mCachedDicNodesForContinuousSuggestion =
|
||||
moveNodesAndReturnReusableEmptyQueue(
|
||||
mCachedDicNodesForContinuousSuggestion, &mActiveDicNodes);
|
||||
mCachedDicNodesForContinuousSuggestion = moveNodesAndReturnReusableEmptyQueue(
|
||||
mCachedDicNodesForContinuousSuggestion, &mActiveDicNodes);
|
||||
}
|
||||
|
||||
AK_FORCE_INLINE static DicNodePriorityQueue *moveNodesAndReturnReusableEmptyQueue(
|
||||
|
@ -169,7 +163,7 @@ class DicNodesCache {
|
|||
mTerminalDicNodes->clear();
|
||||
}
|
||||
|
||||
DicNodePriorityQueue mDicNodePriorityQueues[PRIORITY_QUEUES_SIZE];
|
||||
DicNodePriorityQueue mDicNodePriorityQueues[DIC_NODES_CACHE_PRIORITY_QUEUES_SIZE];
|
||||
// Active dicNodes currently being expanded.
|
||||
DicNodePriorityQueue *mActiveDicNodes;
|
||||
// Next dicNodes to be expanded.
|
||||
|
|
Loading…
Reference in New Issue