OLD | NEW |
(Empty) | |
| 1 Only in third_party/android_prediction/: BUILD.gn |
| 2 Only in third_party/android_prediction/: CHROMIUM.diff |
| 3 diff -ru /usr/local/google/home/riajiang/Downloads/android_prediction/defines.h
third_party/android_prediction/defines.h |
| 4 --- /usr/local/google/home/riajiang/Downloads/android_prediction/defines.h
2015-08-04 11:08:28.000000000 -0700 |
| 5 +++ third_party/android_prediction/defines.h 2015-08-05 17:18:47.846770065 -0
700 |
| 6 @@ -17,6 +17,8 @@ |
| 7 #ifndef LATINIME_DEFINES_H |
| 8 #define LATINIME_DEFINES_H |
| 9 |
| 10 +#include "base/macros.h" |
| 11 + |
| 12 #ifdef __GNUC__ |
| 13 #define AK_FORCE_INLINE __attribute__((always_inline)) __inline__ |
| 14 #else // __GNUC__ |
| 15 @@ -39,8 +41,8 @@ |
| 16 // TODO: Use size_t instead of int. |
| 17 // Disclaimer: You will see a compile error if you use this macro against a var
iable-length array. |
| 18 // Sorry for the inconvenience. It isn't supported. |
| 19 -template <typename T, int N> |
| 20 -char (&ArraySizeHelper(T (&array)[N]))[N]; |
| 21 +// template <typename T, int N> |
| 22 +// char (&ArraySizeHelper(T (&array)[N]))[N]; |
| 23 #define NELEMS(x) (sizeof(ArraySizeHelper(x))) |
| 24 |
| 25 AK_FORCE_INLINE static int intArrayToCharArray(const int *const source, const i
nt sourceSize, |
| 26 @@ -348,6 +350,7 @@ |
| 27 #define DISALLOW_ASSIGNMENT_OPERATOR(TypeName) \ |
| 28 void operator=(const TypeName&) = delete |
| 29 |
| 30 +/* |
| 31 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
| 32 DISALLOW_COPY_CONSTRUCTOR(TypeName); \ |
| 33 DISALLOW_ASSIGNMENT_OPERATOR(TypeName) |
| 34 @@ -355,6 +358,7 @@ |
| 35 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ |
| 36 DISALLOW_DEFAULT_CONSTRUCTOR(TypeName); \ |
| 37 DISALLOW_COPY_AND_ASSIGN(TypeName) |
| 38 +*/ |
| 39 |
| 40 // Used as a return value for character comparison |
| 41 typedef enum { |
| 42 Only in third_party/android_prediction/: LICENSE |
| 43 Only in third_party/android_prediction/: README.chromium |
| 44 diff -ru /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/co
re/dictionary/dictionary.cpp third_party/android_prediction/suggest/core/diction
ary/dictionary.cpp |
| 45 --- /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/core/di
ctionary/dictionary.cpp 2015-08-04 11:08:28.000000000 -0700 |
| 46 +++ third_party/android_prediction/suggest/core/dictionary/dictionary.cpp
2015-08-05 17:18:47.574768333 -0700 |
| 47 @@ -16,31 +16,29 @@ |
| 48 -#include "utils/log_utils.h" |
| 49 |
| 50 const int Dictionary::HEADER_ATTRIBUTE_BUFFER_SIZE = 32; |
| 51 |
| 52 -Dictionary::Dictionary(JNIEnv *env, DictionaryStructureWithBufferPolicy::Struct
urePolicyPtr |
| 53 +Dictionary::Dictionary(DictionaryStructureWithBufferPolicy::StructurePolicyPtr |
| 54 dictionaryStructureWithBufferPolicy) |
| 55 : mDictionaryStructureWithBufferPolicy(std::move(dictionaryStructureWit
hBufferPolicy)), |
| 56 mGestureSuggest(new Suggest(GestureSuggestPolicyFactory::getGestureSu
ggestPolicy())), |
| 57 mTypingSuggest(new Suggest(TypingSuggestPolicyFactory::getTypingSugge
stPolicy())) { |
| 58 - logDictionaryInfo(env); |
| 59 } |
| 60 |
| 61 void Dictionary::getSuggestions(ProximityInfo *proximityInfo, DicTraverseSessio
n *traverseSession, |
| 62 @@ -191,32 +189,4 @@ |
| 63 token, outCodePoints, outCodePointCount); |
| 64 } |
| 65 |
| 66 -void Dictionary::logDictionaryInfo(JNIEnv *const env) const { |
| 67 - int dictionaryIdCodePointBuffer[HEADER_ATTRIBUTE_BUFFER_SIZE]; |
| 68 - int versionStringCodePointBuffer[HEADER_ATTRIBUTE_BUFFER_SIZE]; |
| 69 - int dateStringCodePointBuffer[HEADER_ATTRIBUTE_BUFFER_SIZE]; |
| 70 - const DictionaryHeaderStructurePolicy *const headerPolicy = |
| 71 - getDictionaryStructurePolicy()->getHeaderStructurePolicy(); |
| 72 - headerPolicy->readHeaderValueOrQuestionMark("dictionary", dictionaryIdCodeP
ointBuffer, |
| 73 - HEADER_ATTRIBUTE_BUFFER_SIZE); |
| 74 - headerPolicy->readHeaderValueOrQuestionMark("version", versionStringCodePoi
ntBuffer, |
| 75 - HEADER_ATTRIBUTE_BUFFER_SIZE); |
| 76 - headerPolicy->readHeaderValueOrQuestionMark("date", dateStringCodePointBuff
er, |
| 77 - HEADER_ATTRIBUTE_BUFFER_SIZE); |
| 78 - |
| 79 - char dictionaryIdCharBuffer[HEADER_ATTRIBUTE_BUFFER_SIZE]; |
| 80 - char versionStringCharBuffer[HEADER_ATTRIBUTE_BUFFER_SIZE]; |
| 81 - char dateStringCharBuffer[HEADER_ATTRIBUTE_BUFFER_SIZE]; |
| 82 - intArrayToCharArray(dictionaryIdCodePointBuffer, HEADER_ATTRIBUTE_BUFFER_SI
ZE, |
| 83 - dictionaryIdCharBuffer, HEADER_ATTRIBUTE_BUFFER_SIZE); |
| 84 - intArrayToCharArray(versionStringCodePointBuffer, HEADER_ATTRIBUTE_BUFFER_S
IZE, |
| 85 - versionStringCharBuffer, HEADER_ATTRIBUTE_BUFFER_SIZE); |
| 86 - intArrayToCharArray(dateStringCodePointBuffer, HEADER_ATTRIBUTE_BUFFER_SIZE
, |
| 87 - dateStringCharBuffer, HEADER_ATTRIBUTE_BUFFER_SIZE); |
| 88 - |
| 89 - LogUtils::logToJava(env, |
| 90 - "Dictionary info: dictionary = %s ; version = %s ; date = %s", |
| 91 - dictionaryIdCharBuffer, versionStringCharBuffer, dateStringCharBuff
er); |
| 92 -} |
| 93 - |
| 94 } // namespace latinime |
| 95 diff -ru /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/co
re/dictionary/dictionary.h third_party/android_prediction/suggest/core/dictionar
y/dictionary.h |
| 96 --- /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/core/di
ctionary/dictionary.h 2015-08-04 11:08:28.000000000 -0700 |
| 97 +++ third_party/android_prediction/suggest/core/dictionary/dictionary.h 2015-08-
05 17:18:47.574768333 -0700 |
| 98 @@ -19,13 +19,12 @@ |
| 99 -#include "jni.h" |
| 100 |
| 101 @@ -59,7 +58,7 @@ |
| 102 static const int KIND_FLAG_EXACT_MATCH = 0x40000000; |
| 103 static const int KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION = 0x200000
00; |
| 104 |
| 105 - Dictionary(JNIEnv *env, DictionaryStructureWithBufferPolicy::StructurePolic
yPtr |
| 106 + Dictionary(DictionaryStructureWithBufferPolicy::StructurePolicyPtr |
| 107 dictionaryStructureWithBufferPolicy); |
| 108 |
| 109 void getSuggestions(ProximityInfo *proximityInfo, DicTraverseSession *trave
rseSession, |
| 110 @@ -136,8 +135,6 @@ |
| 111 mDictionaryStructureWithBufferPolicy; |
| 112 const SuggestInterfacePtr mGestureSuggest; |
| 113 const SuggestInterfacePtr mTypingSuggest; |
| 114 - |
| 115 - void logDictionaryInfo(JNIEnv *const env) const; |
| 116 }; |
| 117 } // namespace latinime |
| 118 #endif // LATINIME_DICTIONARY_H |
| 119 Only in /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/cor
e/dictionary/property: word_property.cpp |
| 120 diff -ru /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/co
re/dictionary/property/word_property.h third_party/android_prediction/suggest/co
re/dictionary/property/word_property.h |
| 121 --- /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/core/di
ctionary/property/word_property.h 2015-08-04 11:08:28.000000000 -0700 |
| 122 +++ third_party/android_prediction/suggest/core/dictionary/property/word_propert
y.h 2015-08-05 17:18:47.578768359 -0700 |
| 123 @@ -19,10 +19,9 @@ |
| 124 -#include "jni.h" |
| 125 |
| 126 @@ -38,10 +37,6 @@ |
| 127 const std::vector<BigramProperty> *const bigrams) |
| 128 : mCodePoints(*codePoints), mUnigramProperty(*unigramProperty), mBi
grams(*bigrams) {} |
| 129 |
| 130 - void outputProperties(JNIEnv *const env, jintArray outCodePoints, jbooleanA
rray outFlags, |
| 131 - jintArray outProbabilityInfo, jobject outBigramTargets, jobject out
BigramProbabilities, |
| 132 - jobject outShortcutTargets, jobject outShortcutProbabilities) const
; |
| 133 - |
| 134 const UnigramProperty *getUnigramProperty() const { |
| 135 return &mUnigramProperty; |
| 136 } |
| 137 diff -ru /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/co
re/layout/proximity_info.cpp third_party/android_prediction/suggest/core/layout/
proximity_info.cpp |
| 138 --- /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/core/la
yout/proximity_info.cpp 2015-08-04 11:08:28.000000000 -0700 |
| 139 +++ third_party/android_prediction/suggest/core/layout/proximity_info.cpp
2015-08-05 17:18:47.578768359 -0700 |
| 140 @@ -16,46 +16,49 @@ |
| 141 -#include "jni.h" |
| 142 |
| 143 namespace latinime { |
| 144 |
| 145 -static AK_FORCE_INLINE void safeGetOrFillZeroIntArrayRegion(JNIEnv *env, jintAr
ray jArray, |
| 146 - jsize len, jint *buffer) { |
| 147 +static AK_FORCE_INLINE void safeGetOrFillZeroIntArrayRegion(const int *jArray, |
| 148 + int len, int *buffer) { |
| 149 if (jArray && buffer) { |
| 150 - env->GetIntArrayRegion(jArray, 0, len, buffer); |
| 151 + for (int i = 0; i < len; i++) { |
| 152 + buffer[i] = jArray[i]; |
| 153 + } |
| 154 } else if (buffer) { |
| 155 memset(buffer, 0, len * sizeof(buffer[0])); |
| 156 } |
| 157 } |
| 158 |
| 159 -static AK_FORCE_INLINE void safeGetOrFillZeroFloatArrayRegion(JNIEnv *env, jflo
atArray jArray, |
| 160 - jsize len, jfloat *buffer) { |
| 161 +static AK_FORCE_INLINE void safeGetOrFillZeroFloatArrayRegion(const float *jArr
ay, |
| 162 + int len, float *buffer) { |
| 163 if (jArray && buffer) { |
| 164 - env->GetFloatArrayRegion(jArray, 0, len, buffer); |
| 165 + for (int i = 0; i < len; i++) { |
| 166 + buffer[i] = jArray[i]; |
| 167 + } |
| 168 } else if (buffer) { |
| 169 memset(buffer, 0, len * sizeof(buffer[0])); |
| 170 } |
| 171 } |
| 172 |
| 173 -ProximityInfo::ProximityInfo(JNIEnv *env, const jstring localeJStr, |
| 174 +ProximityInfo::ProximityInfo(const std::string localeJStr, |
| 175 const int keyboardWidth, const int keyboardHeight, const int gridWidth, |
| 176 const int gridHeight, const int mostCommonKeyWidth, const int mostCommo
nKeyHeight, |
| 177 - const jintArray proximityChars, const int keyCount, const jintArray key
XCoordinates, |
| 178 - const jintArray keyYCoordinates, const jintArray keyWidths, const jintA
rray keyHeights, |
| 179 - const jintArray keyCharCodes, const jfloatArray sweetSpotCenterXs, |
| 180 - const jfloatArray sweetSpotCenterYs, const jfloatArray sweetSpotRadii) |
| 181 + int *proximityChars, int proximitySize, const int keyCount, const int *
keyXCoordinates, |
| 182 + const int *keyYCoordinates, const int *keyWidths, const int *keyHeights
, |
| 183 + const int *keyCharCodes, const float *sweetSpotCenterXs, |
| 184 + const float *sweetSpotCenterYs, const float *sweetSpotRadii) |
| 185 : GRID_WIDTH(gridWidth), GRID_HEIGHT(gridHeight), MOST_COMMON_KEY_WIDTH
(mostCommonKeyWidth), |
| 186 MOST_COMMON_KEY_WIDTH_SQUARE(mostCommonKeyWidth * mostCommonKeyWidth)
, |
| 187 NORMALIZED_SQUARED_MOST_COMMON_KEY_HYPOTENUSE(1.0f + |
| 188 @@ -73,7 +76,7 @@ |
| 189 /* proximityCharsLength */]), |
| 190 mLowerCodePointToKeyMap() { |
| 191 /* Let's check the input array length here to make sure */ |
| 192 - const jsize proximityCharsLength = env->GetArrayLength(proximityChars); |
| 193 + int proximityCharsLength = proximitySize; |
| 194 if (proximityCharsLength != GRID_WIDTH * GRID_HEIGHT * MAX_PROXIMITY_CHARS_
SIZE) { |
| 195 AKLOGE("Invalid proximityCharsLength: %d", proximityCharsLength); |
| 196 ASSERT(false); |
| 197 @@ -82,23 +85,25 @@ |
| 198 if (DEBUG_PROXIMITY_INFO) { |
| 199 AKLOGI("Create proximity info array %d", proximityCharsLength); |
| 200 } |
| 201 - const jsize localeCStrUtf8Length = env->GetStringUTFLength(localeJStr); |
| 202 + const int localeCStrUtf8Length = localeJStr.length(); |
| 203 if (localeCStrUtf8Length >= MAX_LOCALE_STRING_LENGTH) { |
| 204 AKLOGI("Locale string length too long: length=%d", localeCStrUtf8Length
); |
| 205 ASSERT(false); |
| 206 } |
| 207 memset(mLocaleStr, 0, sizeof(mLocaleStr)); |
| 208 - env->GetStringUTFRegion(localeJStr, 0, env->GetStringLength(localeJStr), mL
ocaleStr); |
| 209 - safeGetOrFillZeroIntArrayRegion(env, proximityChars, proximityCharsLength, |
| 210 + for (int i = 0; i < localeCStrUtf8Length; i++) { |
| 211 + mLocaleStr[i] = localeJStr[i]; |
| 212 + } |
| 213 + safeGetOrFillZeroIntArrayRegion(proximityChars, proximityCharsLength, |
| 214 mProximityCharsArray); |
| 215 - safeGetOrFillZeroIntArrayRegion(env, keyXCoordinates, KEY_COUNT, mKeyXCoord
inates); |
| 216 - safeGetOrFillZeroIntArrayRegion(env, keyYCoordinates, KEY_COUNT, mKeyYCoord
inates); |
| 217 - safeGetOrFillZeroIntArrayRegion(env, keyWidths, KEY_COUNT, mKeyWidths); |
| 218 - safeGetOrFillZeroIntArrayRegion(env, keyHeights, KEY_COUNT, mKeyHeights); |
| 219 - safeGetOrFillZeroIntArrayRegion(env, keyCharCodes, KEY_COUNT, mKeyCodePoint
s); |
| 220 - safeGetOrFillZeroFloatArrayRegion(env, sweetSpotCenterXs, KEY_COUNT, mSweet
SpotCenterXs); |
| 221 - safeGetOrFillZeroFloatArrayRegion(env, sweetSpotCenterYs, KEY_COUNT, mSweet
SpotCenterYs); |
| 222 - safeGetOrFillZeroFloatArrayRegion(env, sweetSpotRadii, KEY_COUNT, mSweetSpo
tRadii); |
| 223 + safeGetOrFillZeroIntArrayRegion(keyXCoordinates, KEY_COUNT, mKeyXCoordinate
s); |
| 224 + safeGetOrFillZeroIntArrayRegion(keyYCoordinates, KEY_COUNT, mKeyYCoordinate
s); |
| 225 + safeGetOrFillZeroIntArrayRegion(keyWidths, KEY_COUNT, mKeyWidths); |
| 226 + safeGetOrFillZeroIntArrayRegion(keyHeights, KEY_COUNT, mKeyHeights); |
| 227 + safeGetOrFillZeroIntArrayRegion(keyCharCodes, KEY_COUNT, mKeyCodePoints); |
| 228 + safeGetOrFillZeroFloatArrayRegion(sweetSpotCenterXs, KEY_COUNT, mSweetSpotC
enterXs); |
| 229 + safeGetOrFillZeroFloatArrayRegion(sweetSpotCenterYs, KEY_COUNT, mSweetSpotC
enterYs); |
| 230 + safeGetOrFillZeroFloatArrayRegion(sweetSpotRadii, KEY_COUNT, mSweetSpotRadi
i); |
| 231 initializeG(); |
| 232 } |
| 233 |
| 234 diff -ru /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/co
re/layout/proximity_info.h third_party/android_prediction/suggest/core/layout/pr
oximity_info.h |
| 235 --- /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/core/la
yout/proximity_info.h 2015-08-04 11:08:28.000000000 -0700 |
| 236 +++ third_party/android_prediction/suggest/core/layout/proximity_info.h 2015-08-
05 17:18:47.578768359 -0700 |
| 237 @@ -17,23 +17,23 @@ |
| 238 #ifndef LATINIME_PROXIMITY_INFO_H |
| 239 #define LATINIME_PROXIMITY_INFO_H |
| 240 |
| 241 +#include <string> |
| 242 #include <unordered_map> |
| 243 |
| 244 -#include "jni.h" |
| 245 |
| 246 namespace latinime { |
| 247 |
| 248 class ProximityInfo { |
| 249 public: |
| 250 - ProximityInfo(JNIEnv *env, const jstring localeJStr, |
| 251 + ProximityInfo(const std::string localeJStr, |
| 252 const int keyboardWidth, const int keyboardHeight, const int gridWi
dth, |
| 253 const int gridHeight, const int mostCommonKeyWidth, const int mostC
ommonKeyHeight, |
| 254 - const jintArray proximityChars, const int keyCount, const jintArray
keyXCoordinates, |
| 255 - const jintArray keyYCoordinates, const jintArray keyWidths, const j
intArray keyHeights, |
| 256 - const jintArray keyCharCodes, const jfloatArray sweetSpotCenterXs, |
| 257 - const jfloatArray sweetSpotCenterYs, const jfloatArray sweetSpotRad
ii); |
| 258 + int *proximityChars, int proximitySize, const int keyCount, const i
nt *keyXCoordinates, |
| 259 + const int *keyYCoordinates, const int *keyWidths, const int *keyHei
ghts, |
| 260 + const int *keyCharCodes, const float *sweetSpotCenterXs, |
| 261 + const float *sweetSpotCenterYs, const float *sweetSpotRadii); |
| 262 ~ProximityInfo(); |
| 263 bool hasSpaceProximity(const int x, const int y) const; |
| 264 float getNormalizedSquaredDistanceFromCenterFloatG( |
| 265 diff -ru /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/co
re/result/suggestion_results.cpp third_party/android_prediction/suggest/core/res
ult/suggestion_results.cpp |
| 266 --- /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/core/re
sult/suggestion_results.cpp 2015-08-04 11:08:28.000000000 -0700 |
| 267 +++ third_party/android_prediction/suggest/core/result/suggestion_results.cpp
2015-08-05 17:18:47.582768384 -0700 |
| 268 @@ -14,39 +14,10 @@ |
| 269 * limitations under the License. |
| 270 */ |
| 271 -#include "utils/jni_data_utils.h" |
| 272 |
| 273 namespace latinime { |
| 274 |
| 275 -void SuggestionResults::outputSuggestions(JNIEnv *env, jintArray outSuggestionC
ount, |
| 276 - jintArray outputCodePointsArray, jintArray outScoresArray, jintArray ou
tSpaceIndicesArray, |
| 277 - jintArray outTypesArray, jintArray outAutoCommitFirstWordConfidenceArra
y, |
| 278 - jfloatArray outLanguageWeight) { |
| 279 - int outputIndex = 0; |
| 280 - while (!mSuggestedWords.empty()) { |
| 281 - const SuggestedWord &suggestedWord = mSuggestedWords.top(); |
| 282 - suggestedWord.getCodePointCount(); |
| 283 - const int start = outputIndex * MAX_WORD_LENGTH; |
| 284 - JniDataUtils::outputCodePoints(env, outputCodePointsArray, start, |
| 285 - MAX_WORD_LENGTH /* maxLength */, suggestedWord.getCodePoint(), |
| 286 - suggestedWord.getCodePointCount(), true /* needsNullTermination
*/); |
| 287 - JniDataUtils::putIntToArray(env, outScoresArray, outputIndex, suggested
Word.getScore()); |
| 288 - JniDataUtils::putIntToArray(env, outSpaceIndicesArray, outputIndex, |
| 289 - suggestedWord.getIndexToPartialCommit()); |
| 290 - JniDataUtils::putIntToArray(env, outTypesArray, outputIndex, suggestedW
ord.getType()); |
| 291 - if (mSuggestedWords.size() == 1) { |
| 292 - JniDataUtils::putIntToArray(env, outAutoCommitFirstWordConfidenceAr
ray, 0 /* index */, |
| 293 - suggestedWord.getAutoCommitFirstWordConfidence()); |
| 294 - } |
| 295 - ++outputIndex; |
| 296 - mSuggestedWords.pop(); |
| 297 - } |
| 298 - JniDataUtils::putIntToArray(env, outSuggestionCount, 0 /* index */, outputI
ndex); |
| 299 - JniDataUtils::putFloatToArray(env, outLanguageWeight, 0 /* index */, mLangu
ageWeight); |
| 300 -} |
| 301 - |
| 302 void SuggestionResults::addPrediction(const int *const codePoints, const int co
dePointCount, |
| 303 const int probability) { |
| 304 if (probability == NOT_A_PROBABILITY) { |
| 305 diff -ru /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/co
re/result/suggestion_results.h third_party/android_prediction/suggest/core/resul
t/suggestion_results.h |
| 306 --- /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/core/re
sult/suggestion_results.h 2015-08-04 11:08:28.000000000 -0700 |
| 307 +++ third_party/android_prediction/suggest/core/result/suggestion_results.h
2015-08-05 17:18:47.582768384 -0700 |
| 308 @@ -20,22 +20,17 @@ |
| 309 -#include "jni.h" |
| 310 |
| 311 namespace latinime { |
| 312 |
| 313 class SuggestionResults { |
| 314 public: |
| 315 explicit SuggestionResults(const int maxSuggestionCount) |
| 316 - : mMaxSuggestionCount(maxSuggestionCount), mLanguageWeight(NOT_A_LA
NGUAGE_WEIGHT), |
| 317 - mSuggestedWords() {} |
| 318 + : mSuggestedWords(), mMaxSuggestionCount(maxSuggestionCount), |
| 319 + mLanguageWeight(NOT_A_LANGUAGE_WEIGHT) {} |
| 320 |
| 321 - // Returns suggestion count. |
| 322 - void outputSuggestions(JNIEnv *env, jintArray outSuggestionCount, jintArray
outCodePointsArray, |
| 323 - jintArray outScoresArray, jintArray outSpaceIndicesArray, jintArray
outTypesArray, |
| 324 - jintArray outAutoCommitFirstWordConfidenceArray, jfloatArray outLan
guageWeight); |
| 325 void addPrediction(const int *const codePoints, const int codePointCount, c
onst int score); |
| 326 void addSuggestion(const int *const codePoints, const int codePointCount, |
| 327 const int score, const int type, const int indexToPartialCommit, |
| 328 @@ -51,13 +46,14 @@ |
| 329 return mSuggestedWords.size(); |
| 330 } |
| 331 |
| 332 + std::priority_queue< |
| 333 + SuggestedWord, std::vector<SuggestedWord>, SuggestedWord::Comparator> m
SuggestedWords; |
| 334 + |
| 335 private: |
| 336 DISALLOW_IMPLICIT_CONSTRUCTORS(SuggestionResults); |
| 337 |
| 338 const int mMaxSuggestionCount; |
| 339 float mLanguageWeight; |
| 340 - std::priority_queue< |
| 341 - SuggestedWord, std::vector<SuggestedWord>, SuggestedWord::Comparato
r> mSuggestedWords; |
| 342 }; |
| 343 } // namespace latinime |
| 344 #endif // LATINIME_SUGGESTION_RESULTS_H |
| 345 diff -ru /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/co
re/session/dic_traverse_session.h third_party/android_prediction/suggest/core/se
ssion/dic_traverse_session.h |
| 346 --- /usr/local/google/home/riajiang/Downloads/android_prediction/suggest/core/se
ssion/dic_traverse_session.h 2015-08-04 11:08:28.000000000 -0700 |
| 347 +++ third_party/android_prediction/suggest/core/session/dic_traverse_session.h
2015-08-05 17:18:47.582768384 -0700 |
| 348 @@ -19,11 +19,10 @@ |
| 349 -#include "jni.h" |
| 350 |
| 351 @@ -37,11 +36,11 @@ |
| 352 public: |
| 353 |
| 354 // A factory method for DicTraverseSession |
| 355 - static AK_FORCE_INLINE void *getSessionInstance(JNIEnv *env, jstring locale
Str, |
| 356 - jlong dictSize) { |
| 357 + static AK_FORCE_INLINE void *getSessionInstance(std::string localeStr, |
| 358 + long dictSize) { |
| 359 // To deal with the trade-off between accuracy and memory space, large
cache is used for |
| 360 // dictionaries larger that the threshold |
| 361 - return new DicTraverseSession(env, localeStr, |
| 362 + return new DicTraverseSession(localeStr, |
| 363 dictSize >= DICTIONARY_SIZE_THRESHOLD_TO_USE_LARGE_CACHE_FOR_SU
GGESTION); |
| 364 } |
| 365 |
| 366 @@ -49,7 +48,7 @@ |
| 367 delete traverseSession; |
| 368 } |
| 369 |
| 370 - AK_FORCE_INLINE DicTraverseSession(JNIEnv *env, jstring localeStr, bool use
sLargeCache) |
| 371 + AK_FORCE_INLINE DicTraverseSession(std::string localeStr, bool usesLargeCac
he) |
| 372 : mProximityInfo(nullptr), mDictionary(nullptr), mSuggestOptions(nu
llptr), |
| 373 mDicNodesCache(usesLargeCache), mMultiBigramMap(), mInputSize(0),
mMaxPointerCount(1), |
| 374 mMultiWordCostMultiplier(1.0f) { |
| 375 Only in /usr/local/google/home/riajiang/Downloads/android_prediction/utils: jni_
data_utils.cpp |
| 376 Only in /usr/local/google/home/riajiang/Downloads/android_prediction/utils: jni_
data_utils.h |
| 377 Only in /usr/local/google/home/riajiang/Downloads/android_prediction/utils: log_
utils.cpp |
| 378 Only in /usr/local/google/home/riajiang/Downloads/android_prediction/utils: log_
utils.h |
OLD | NEW |