Add a functionality to limit the max correction errors
Before
==== test finished, terminate logcat =====
(0) 121.97 (0.28%)
(1) 42032.07 (95.46%)
(2) 11.03 (0.03%)
(3) 12.19 (0.03%)
(4) 10.02 (0.02%)
(5) 1417.41 (3.22%)
(6) 258.43 (0.59%)
(20) 50.20 (0.11%)
Total 44033.07 (sum of others 43913.32)
After
==== test finished, terminate logcat =====
(0) 110.81 (0.29%)
(1) 36416.11 (94.47%)
(2) 10.06 (0.03%)
(3) 9.45 (0.02%)
(4) 9.83 (0.03%)
(5) 1535.52 (3.98%)
(6) 290.25 (0.75%)
(20) 40.57 (0.11%)
Total 38546.83 (sum of others 38422.60)
Change-Id: Iffd24ce0b2dc422c8c6085d5be5f6bfdaf59ca7d
diff --git a/native/src/unigram_dictionary.h b/native/src/unigram_dictionary.h
index 0b01265..f5cb438 100644
--- a/native/src/unigram_dictionary.h
+++ b/native/src/unigram_dictionary.h
@@ -61,6 +61,10 @@
static const int FLAG_ATTRIBUTE_ADDRESS_TYPE_TWOBYTES = 0x20;
static const int FLAG_ATTRIBUTE_ADDRESS_TYPE_THREEBYTES = 0x30;
+ // Error tolerances
+ static const int DEFAULT_MAX_ERRORS = 2;
+ static const int MAX_ERRORS_FOR_TWO_WORDS = 1;
+
UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultipler,
int fullWordMultiplier, int maxWordLength, int maxWords, int maxProximityChars,
const bool isLatestDictVersion);