aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/src/com/android/inputmethod/latin/AutoCorrection.java36
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java45
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java18
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java7
-rw-r--r--native/jni/Android.mk45
-rw-r--r--native/jni/src/dictionary.cpp5
-rw-r--r--native/jni/src/dictionary.h3
-rw-r--r--native/jni/src/gesture/gesture_decoder_wrapper.cpp (renamed from native/jni/src/gesture/impl/token_impl.cpp)4
-rw-r--r--native/jni/src/gesture/gesture_decoder_wrapper.h91
-rw-r--r--native/jni/src/gesture/impl/gesture_decoder_impl.cpp40
-rw-r--r--native/jni/src/gesture/impl/gesture_decoder_impl.h41
-rw-r--r--native/jni/src/gesture/impl/header/nothing.h23
-rw-r--r--native/jni/src/gesture/impl/incremental_decoder_impl.cpp40
-rw-r--r--native/jni/src/gesture/impl/incremental_decoder_impl.h46
-rw-r--r--native/jni/src/gesture/impl/token_beam_impl.cpp20
-rw-r--r--native/jni/src/gesture/impl/token_beam_impl.h29
-rw-r--r--native/jni/src/gesture/impl/token_impl.h29
-rw-r--r--native/jni/src/gesture/incremental_decoder_interface.cpp24
-rw-r--r--native/jni/src/gesture/incremental_decoder_interface.h29
19 files changed, 151 insertions, 424 deletions
diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java
index 3eb53fca6..c78974dac 100644
--- a/java/src/com/android/inputmethod/latin/AutoCorrection.java
+++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java
@@ -26,6 +26,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class AutoCorrection {
private static final boolean DBG = LatinImeLogger.sDBG;
private static final String TAG = AutoCorrection.class.getSimpleName();
+ private static final int MINIMUM_SAFETY_NET_CHAR_LENGTH = 4;
private AutoCorrection() {
// Purely static class: can't instantiate.
@@ -107,10 +108,43 @@ public class AutoCorrection {
if (DBG) {
Log.d(TAG, "Auto corrected by S-threshold.");
}
- return true;
+ return !shouldBlockAutoCorrectionBySafetyNet(consideredWord.toString(),
+ suggestion.mWord);
}
}
return false;
}
+ // TODO: Resolve the inconsistencies between the native auto correction algorithms and
+ // this safety net
+ public static boolean shouldBlockAutoCorrectionBySafetyNet(final String typedWord,
+ final CharSequence suggestion) {
+ // Safety net for auto correction.
+ // Actually if we hit this safety net, it's a bug.
+ // If user selected aggressive auto correction mode, there is no need to use the safety
+ // net.
+ // If the length of typed word is less than MINIMUM_SAFETY_NET_CHAR_LENGTH,
+ // we should not use net because relatively edit distance can be big.
+ final int typedWordLength = typedWord.length();
+ if (typedWordLength < MINIMUM_SAFETY_NET_CHAR_LENGTH) {
+ return false;
+ }
+ final int maxEditDistanceOfNativeDictionary =
+ (typedWordLength < 5 ? 2 : typedWordLength / 2) + 1;
+ final int distance = BinaryDictionary.editDistance(typedWord, suggestion.toString());
+ if (DBG) {
+ Log.d(TAG, "Autocorrected edit distance = " + distance
+ + ", " + maxEditDistanceOfNativeDictionary);
+ }
+ if (distance > maxEditDistanceOfNativeDictionary) {
+ if (DBG) {
+ Log.e(TAG, "Safety net: before = " + typedWord + ", after = " + suggestion);
+ Log.e(TAG, "(Error) The edit distance of this correction exceeds limit. "
+ + "Turning off auto-correction.");
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
}
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 9e9ffc76a..dcfda86ea 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -18,7 +18,6 @@ package com.android.inputmethod.latin;
import android.content.Context;
import android.text.TextUtils;
-import android.util.Log;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.ProximityInfo;
@@ -58,8 +57,6 @@ public class Suggest {
// Locale used for upper- and title-casing words
final private Locale mLocale;
- private static final int MINIMUM_SAFETY_NET_CHAR_LENGTH = 4;
-
public Suggest(final Context context, final Locale locale) {
initAsynchronously(context, locale);
mLocale = locale;
@@ -229,8 +226,8 @@ public class Suggest {
mWhiteListDictionary.getWhitelistedWord(consideredWord);
final boolean hasAutoCorrection;
- if (!isCorrectionEnabled || wordComposer.isMostlyCaps() || wordComposer.isResumed()
- || !hasMainDictionary()) {
+ if (!isCorrectionEnabled || !allowsToBeAutoCorrected || wordComposer.isMostlyCaps()
+ || wordComposer.isResumed() || !hasMainDictionary()) {
// If we don't have a main dictionary, we never want to auto-correct. The reason for
// this is, the user may have a contact whose name happens to match a valid word in
// their language, and it will unexpectedly auto-correct. For example, if the user
@@ -244,8 +241,7 @@ public class Suggest {
hasAutoCorrection = false;
} else if (AutoCorrection.suggestionExceedsAutoCorrectionThreshold(suggestionsSet.first(),
consideredWord, mAutoCorrectionThreshold)) {
- hasAutoCorrection = !shouldBlockAutoCorrectionBySafetyNet(typedWord,
- suggestionsSet.first().mWord);
+ hasAutoCorrection = true;
} else {
hasAutoCorrection = false;
}
@@ -293,7 +289,7 @@ public class Suggest {
// actual word, it says typedWordValid = false, which looks wrong. We should either
// rename the attribute or change the value.
!isPrediction && !allowsToBeAutoCorrected /* typedWordValid */,
- !isPrediction && hasAutoCorrection && allowsToBeAutoCorrected, /* willAutoCorrect */
+ !isPrediction && hasAutoCorrection, /* willAutoCorrect */
false /* isPunctuationSuggestions */,
false /* isObsoleteSuggestions */,
isPrediction);
@@ -365,37 +361,4 @@ public class Suggest {
}
mMainDictionary = null;
}
-
- // TODO: Resolve the inconsistencies between the native auto correction algorithms and
- // this safety net
- public static boolean shouldBlockAutoCorrectionBySafetyNet(final String typedWord,
- final CharSequence suggestion) {
- // Safety net for auto correction.
- // Actually if we hit this safety net, it's a bug.
- // If user selected aggressive auto correction mode, there is no need to use the safety
- // net.
- // If the length of typed word is less than MINIMUM_SAFETY_NET_CHAR_LENGTH,
- // we should not use net because relatively edit distance can be big.
- final int typedWordLength = typedWord.length();
- if (typedWordLength < Suggest.MINIMUM_SAFETY_NET_CHAR_LENGTH) {
- return false;
- }
- final int maxEditDistanceOfNativeDictionary =
- (typedWordLength < 5 ? 2 : typedWordLength / 2) + 1;
- final int distance = BinaryDictionary.editDistance(typedWord, suggestion.toString());
- if (DBG) {
- Log.d(TAG, "Autocorrected edit distance = " + distance
- + ", " + maxEditDistanceOfNativeDictionary);
- }
- if (distance > maxEditDistanceOfNativeDictionary) {
- if (DBG) {
- Log.e(TAG, "Safety net: before = " + typedWord + ", after = " + suggestion);
- Log.e(TAG, "(Error) The edit distance of this correction exceeds limit. "
- + "Turning off auto-correction.");
- }
- return true;
- } else {
- return false;
- }
- }
}
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index 94af301a2..f079c2112 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -55,7 +55,7 @@ public class SuggestedWords {
return mSuggestedWordInfoList.size();
}
- public CharSequence getWord(int pos) {
+ public String getWord(int pos) {
return mSuggestedWordInfoList.get(pos).mWord;
}
@@ -125,8 +125,7 @@ public class SuggestedWords {
public static final int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation
public static final int KIND_APP_DEFINED = 6; // Suggested by the application
public static final int KIND_SHORTCUT = 7; // A shortcut
- private final String mWordStr;
- public final CharSequence mWord;
+ public final String mWord;
public final int mScore;
public final int mKind; // one of the KIND_* constants above
public final int mCodePointCount;
@@ -135,12 +134,11 @@ public class SuggestedWords {
public SuggestedWordInfo(final CharSequence word, final int score, final int kind,
final String sourceDict) {
- mWordStr = word.toString();
- mWord = word;
+ mWord = word.toString();
mScore = score;
mKind = kind;
mSourceDict = sourceDict;
- mCodePointCount = StringUtils.codePointCount(mWordStr);
+ mCodePointCount = StringUtils.codePointCount(mWord);
}
@@ -158,15 +156,15 @@ public class SuggestedWords {
}
public int codePointAt(int i) {
- return mWordStr.codePointAt(i);
+ return mWord.codePointAt(i);
}
@Override
public String toString() {
if (TextUtils.isEmpty(mDebugString)) {
- return mWordStr;
+ return mWord;
} else {
- return mWordStr + " (" + mDebugString.toString() + ")";
+ return mWord + " (" + mDebugString.toString() + ")";
}
}
@@ -180,7 +178,7 @@ public class SuggestedWords {
final SuggestedWordInfo cur = candidates.get(i);
for (int j = 0; j < i; ++j) {
final SuggestedWordInfo previous = candidates.get(j);
- if (TextUtils.equals(cur.mWord, previous.mWord)) {
+ if (cur.mWord.equals(previous.mWord)) {
candidates.remove(cur.mScore < previous.mScore ? i : j);
--i;
break;
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java
index f087790f6..642a551ce 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java
@@ -57,11 +57,11 @@ import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.MoreKeysPanel;
import com.android.inputmethod.keyboard.PointerTracker;
import com.android.inputmethod.keyboard.ViewLayoutUtils;
+import com.android.inputmethod.latin.AutoCorrection;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResearchLogger;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
-import com.android.inputmethod.latin.Suggest;
import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.Utils;
import com.android.inputmethod.latin.define.ProductionFlag;
@@ -336,8 +336,9 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
if (LatinImeLogger.sDBG && suggestedWords.size() > 1) {
// If we auto-correct, then the autocorrection is in slot 0 and the typed word
// is in slot 1.
- if (index == mCenterSuggestionIndex && Suggest.shouldBlockAutoCorrectionBySafetyNet(
- suggestedWords.getWord(1).toString(), suggestedWords.getWord(0))) {
+ if (index == mCenterSuggestionIndex
+ && AutoCorrection.shouldBlockAutoCorrectionBySafetyNet(
+ suggestedWords.getWord(1).toString(), suggestedWords.getWord(0))) {
return 0xFFFF0000;
}
}
diff --git a/native/jni/Android.mk b/native/jni/Android.mk
index 31feb9510..d40063ed5 100644
--- a/native/jni/Android.mk
+++ b/native/jni/Android.mk
@@ -49,7 +49,7 @@ LATIN_IME_CORE_SRC_FILES := \
proximity_info.cpp \
proximity_info_state.cpp \
unigram_dictionary.cpp \
- gesture/incremental_decoder_interface.cpp
+ gesture/gesture_decoder_wrapper.cpp
LOCAL_SRC_FILES := \
$(LATIN_IME_JNI_SRC_FILES) \
@@ -78,49 +78,8 @@ include $(BUILD_STATIC_LIBRARY)
######################################
include $(CLEAR_VARS)
-LOCAL_C_INCLUDES += $(LATIN_IME_SRC_FULLPATH_DIR) \
- $(addprefix $(LATIN_IME_SRC_FULLPATH_DIR)/, gesture gesture/impl)
-
-LOCAL_CFLAGS += -Werror -Wall
-
-# To suppress compiler warnings for unused variables/functions used for debug features etc.
-LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
-
-LATIN_IME_GESTURE_IMPL_SRC_FILES := \
- gesture/impl/gesture_decoder_impl.cpp \
- gesture/impl/incremental_decoder_impl.cpp \
- gesture/impl/token_beam_impl.cpp \
- gesture/impl/token_impl.cpp
-
-LOCAL_SRC_FILES := $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_GESTURE_IMPL_SRC_FILES))
-
-ifeq ($(FLAG_DO_PROFILE), true)
- $(warning Making profiling version of native library)
- LOCAL_CFLAGS += -DFLAG_DO_PROFILE
-else # FLAG_DO_PROFILE
-ifeq ($(FLAG_DBG), true)
- $(warning Making debug version of native library)
- LOCAL_CFLAGS += -DFLAG_DBG
-endif # FLAG_DBG
-endif # FLAG_DO_PROFILE
-
-# TODO: Can remove this static library from AOSP completely?
-LOCAL_MODULE := libjni_latinime_gesture_impl_aosp_static
-LOCAL_MODULE_TAGS := optional
-
-ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system
-include external/stlport/libstlport.mk
-else # In the NDK build system
-LOCAL_C_INCLUDES += external/stlport/stlport bionic
-endif
-
-include $(BUILD_STATIC_LIBRARY)
-######################################
-include $(CLEAR_VARS)
-
# All code in LOCAL_WHOLE_STATIC_LIBRARIES will be built into this shared library.
-LOCAL_WHOLE_STATIC_LIBRARIES := \
- libjni_latinime_common_static libjni_latinime_gesture_impl_aosp_static
+LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_common_static
ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system
LOCAL_SHARED_LIBRARIES := libstlport
diff --git a/native/jni/src/dictionary.cpp b/native/jni/src/dictionary.cpp
index 60f3c949b..628a16933 100644
--- a/native/jni/src/dictionary.cpp
+++ b/native/jni/src/dictionary.cpp
@@ -22,7 +22,7 @@
#include "binary_format.h"
#include "defines.h"
#include "dictionary.h"
-#include "incremental_decoder_interface.h"
+#include "gesture_decoder_wrapper.h"
namespace latinime {
@@ -44,8 +44,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust,
mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier,
fullWordMultiplier, maxWordLength, maxWords, options);
mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength);
- mGestureDecoder = IncrementalDecoderInterface::getGestureDecoderInstance(maxWordLength,
- maxWords);
+ mGestureDecoder = new GestureDecoderWrapper(maxWordLength, maxWords);
mGestureDecoder->setDict(mUnigramDictionary, mBigramDictionary,
mDict + headerSize /* dict root */, 0 /* root pos */);
}
diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h
index 2b0619c46..431f10337 100644
--- a/native/jni/src/dictionary.h
+++ b/native/jni/src/dictionary.h
@@ -45,6 +45,7 @@ class Dictionary {
result = mGestureDecoder->getSuggestions(proximityInfo, xcoordinates, ycoordinates,
times, pointerIds, codes, codesSize, commitPoint,
outWords, frequencies, spaceIndices);
+ return result;
} else {
std::map<int, int> bigramMap;
uint8_t bigramFilter[BIGRAM_FILTER_BYTE_SIZE];
@@ -53,8 +54,8 @@ class Dictionary {
result = mUnigramDictionary->getSuggestions(proximityInfo, xcoordinates,
ycoordinates, codes, codesSize, &bigramMap, bigramFilter,
useFullEditDistance, outWords, frequencies);
+ return result;
}
- return result;
}
int getBigrams(const int32_t *word, int length, int *codes, int codesSize,
diff --git a/native/jni/src/gesture/impl/token_impl.cpp b/native/jni/src/gesture/gesture_decoder_wrapper.cpp
index fa667f03a..afbe0c5c3 100644
--- a/native/jni/src/gesture/impl/token_impl.cpp
+++ b/native/jni/src/gesture/gesture_decoder_wrapper.cpp
@@ -14,7 +14,9 @@
* limitations under the License.
*/
-#include "token_impl.h"
+#include "gesture_decoder_wrapper.h"
namespace latinime {
+ IncrementalDecoderInterface *
+ (*GestureDecoderWrapper::sGestureDecoderFactoryMethod)(int, int) = 0;
} // namespace latinime
diff --git a/native/jni/src/gesture/gesture_decoder_wrapper.h b/native/jni/src/gesture/gesture_decoder_wrapper.h
new file mode 100644
index 000000000..35982f03d
--- /dev/null
+++ b/native/jni/src/gesture/gesture_decoder_wrapper.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LATINIME_GESTURE_DECODER_WRAPPER_H
+#define LATINIME_GESTURE_DECODER_WRAPPER_H
+
+#include <stdint.h>
+#include "defines.h"
+#include "incremental_decoder_interface.h"
+
+namespace latinime {
+
+class UnigramDictionary;
+class BigramDictionary;
+class ProximityInfo;
+
+class GestureDecoderWrapper : public IncrementalDecoderInterface {
+ public:
+ GestureDecoderWrapper(const int maxWordLength, const int maxWords) {
+ mIncrementalDecoderInterface = getGestureDecoderInstance(maxWordLength, maxWords);
+ }
+
+ virtual ~GestureDecoderWrapper() {
+ delete mIncrementalDecoderInterface;
+ }
+
+ int getSuggestions(ProximityInfo *pInfo, int *inputXs, int *inputYs, int *times,
+ int *pointerIds, int *codes, int inputSize, int commitPoint,
+ unsigned short *outWords, int *frequencies, int *outputIndices) {
+ if (!mIncrementalDecoderInterface) {
+ return 0;
+ }
+ return mIncrementalDecoderInterface->getSuggestions(
+ pInfo, inputXs, inputYs, times, pointerIds, codes, inputSize, commitPoint,
+ outWords, frequencies, outputIndices);
+ }
+
+ void reset() {
+ if (!mIncrementalDecoderInterface) {
+ return;
+ }
+ mIncrementalDecoderInterface->reset();
+ }
+
+ void setDict(const UnigramDictionary *dict, const BigramDictionary *bigram,
+ const uint8_t *dictRoot, int rootPos) {
+ if (!mIncrementalDecoderInterface) {
+ return;
+ }
+ mIncrementalDecoderInterface->setDict(dict, bigram, dictRoot, rootPos);
+ }
+
+ void setPrevWord(const int32_t *prevWord, int prevWordLength) {
+ if (!mIncrementalDecoderInterface) {
+ return;
+ }
+ mIncrementalDecoderInterface->setPrevWord(prevWord, prevWordLength);
+ }
+
+ static void setGestureDecoderFactoryMethod(
+ IncrementalDecoderInterface *(*factoryMethod)(int, int)) {
+ sGestureDecoderFactoryMethod = factoryMethod;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GestureDecoderWrapper);
+ static IncrementalDecoderInterface *getGestureDecoderInstance(int maxWordLength, int maxWords) {
+ if (sGestureDecoderFactoryMethod) {
+ return sGestureDecoderFactoryMethod(maxWordLength, maxWords);
+ }
+ return 0;
+ }
+
+ static IncrementalDecoderInterface *(*sGestureDecoderFactoryMethod)(int, int);
+ IncrementalDecoderInterface *mIncrementalDecoderInterface;
+};
+} // namespace latinime
+#endif // LATINIME_GESTURE_DECODER_WRAPPER_H
diff --git a/native/jni/src/gesture/impl/gesture_decoder_impl.cpp b/native/jni/src/gesture/impl/gesture_decoder_impl.cpp
deleted file mode 100644
index 035850ead..000000000
--- a/native/jni/src/gesture/impl/gesture_decoder_impl.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "gesture_decoder_impl.h"
-#include "incremental_decoder_interface.h"
-
-namespace latinime {
-
-// A factory method for GestureDecoderImpl
-static IncrementalDecoderInterface *getDecoderInstance(int maxWordLength, int maxWords) {
- return new GestureDecoderImpl(maxWordLength, maxWords);
-}
-
-// An ad-hoc internal class to register the factory method defined above
-class GestureDecoderFactoryRegisterer {
- public:
- GestureDecoderFactoryRegisterer() {
- IncrementalDecoderInterface::setGestureDecoderFactoryMethod(getDecoderInstance);
- }
- private:
- DISALLOW_COPY_AND_ASSIGN(GestureDecoderFactoryRegisterer);
-};
-
-// To invoke the GestureDecoderFactoryRegisterer constructor in the global constructor
-// Not sure, but can be static?
-GestureDecoderFactoryRegisterer gestureDecoderFactoryRegisterer;
-} // namespace latinime
diff --git a/native/jni/src/gesture/impl/gesture_decoder_impl.h b/native/jni/src/gesture/impl/gesture_decoder_impl.h
deleted file mode 100644
index 6de807b39..000000000
--- a/native/jni/src/gesture/impl/gesture_decoder_impl.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef LATINIME_GESTURE_DECODER_IMPL_H
-#define LATINIME_GESTURE_DECODER_IMPL_H
-
-#include "defines.h"
-#include "incremental_decoder_impl.h"
-
-namespace latinime {
-
-class GestureDecoderImpl : public IncrementalDecoderImpl {
- public:
- GestureDecoderImpl(int maxWordLength, int maxWords) :
- IncrementalDecoderImpl(maxWordLength, maxWords) {
- }
-
- int getSuggestions(ProximityInfo *pInfo, int *inputXs, int *inputYs, int *times,
- int *pointerIds, int *codes, int inputSize, int commitPoint,
- unsigned short *outWords, int *frequencies, int *outputIndices) {
- return 0;
- }
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(GestureDecoderImpl);
-};
-} // namespace latinime
-#endif // LATINIME_GESTURE_DECODER_IMPL_H
diff --git a/native/jni/src/gesture/impl/header/nothing.h b/native/jni/src/gesture/impl/header/nothing.h
deleted file mode 100644
index c9d8645c9..000000000
--- a/native/jni/src/gesture/impl/header/nothing.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef LATINIME_NOTHING_H
-#define LATINIME_NOTHING_H
-
-namespace latinime {
-} // namespace latinime
-
-#endif // LATINIME_NOTHING_H
diff --git a/native/jni/src/gesture/impl/incremental_decoder_impl.cpp b/native/jni/src/gesture/impl/incremental_decoder_impl.cpp
deleted file mode 100644
index f2b76ed26..000000000
--- a/native/jni/src/gesture/impl/incremental_decoder_impl.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "incremental_decoder_impl.h"
-#include "incremental_decoder_interface.h"
-
-namespace latinime {
-
-// A factory method for IncrementalDecoderImpl
-static IncrementalDecoderInterface *getDecoderInstance(int maxWordLength, int maxWords) {
- return new IncrementalDecoderImpl(maxWordLength, maxWords);
-}
-
-// An ad-hoc internal class to register the factory method defined above
-class IncrementalDecoderFactoryRegisterer {
- public:
- IncrementalDecoderFactoryRegisterer() {
- IncrementalDecoderInterface::setIncrementalDecoderFactoryMethod(getDecoderInstance);
- }
- private:
- DISALLOW_COPY_AND_ASSIGN(IncrementalDecoderFactoryRegisterer);
-};
-
-// To invoke the IncrementalDecoderFactoryRegisterer constructor in the global constructor
-// Not sure, but can be static?
-IncrementalDecoderFactoryRegisterer incrementalDecoderFactoryRegisterer;
-} // namespace latinime
diff --git a/native/jni/src/gesture/impl/incremental_decoder_impl.h b/native/jni/src/gesture/impl/incremental_decoder_impl.h
deleted file mode 100644
index 50ed14303..000000000
--- a/native/jni/src/gesture/impl/incremental_decoder_impl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef LATINIME_INCREMENTAL_DECODER_IMPL_H
-#define LATINIME_INCREMENTAL_DECODER_IMPL_H
-
-#include "defines.h"
-#include "incremental_decoder_interface.h"
-
-namespace latinime {
-
-class UnigramDictionary;
-class BigramDictionary;
-
-class IncrementalDecoderImpl : public IncrementalDecoderInterface {
- public:
- IncrementalDecoderImpl(int maxWordLength, int maxWords) { };
- void setDict(const UnigramDictionary *dict, const BigramDictionary *bigram,
- const uint8_t *dictRoot, int rootPos) { };
- void setPrevWord(const int32_t *prevWord, int prevWordLength) { };
- void reset() { };
-
- int getSuggestions(ProximityInfo *pInfo, int *inputXs, int *inputYs, int *times,
- int *pointerIds, int *codes, int inputSize, int commitPoint,
- unsigned short *outWords, int *frequencies, int *outputIndices) {
- return 0;
- }
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalDecoderImpl);
-};
-} // namespace latinime
-#endif // LATINIME_INCREMENTAL_DECODER_IMPL_H
diff --git a/native/jni/src/gesture/impl/token_beam_impl.cpp b/native/jni/src/gesture/impl/token_beam_impl.cpp
deleted file mode 100644
index ffac4dd39..000000000
--- a/native/jni/src/gesture/impl/token_beam_impl.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "token_beam_impl.h"
-
-namespace latinime {
-} // namespace latinime
diff --git a/native/jni/src/gesture/impl/token_beam_impl.h b/native/jni/src/gesture/impl/token_beam_impl.h
deleted file mode 100644
index 50de9258b..000000000
--- a/native/jni/src/gesture/impl/token_beam_impl.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef LATINIME_TOKEN_BEAM_IMPL_H
-#define LATINIME_TOKEN_BEAM_IMPL_H
-
-#include "defines.h"
-
-namespace latinime {
-
-class TokenBeamImpl {
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(TokenBeamImpl);
-};
-} // namespace latinime
-#endif // LATINIME_TOKEN_BEAM_IMPL_H
diff --git a/native/jni/src/gesture/impl/token_impl.h b/native/jni/src/gesture/impl/token_impl.h
deleted file mode 100644
index 5f2368a93..000000000
--- a/native/jni/src/gesture/impl/token_impl.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef LATINIME_TOKEN_IMPL_H
-#define LATINIME_TOKEN_IMPL_H
-
-#include "defines.h"
-
-namespace latinime {
-
-struct TokenImpl {
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(TokenImpl);
-};
-} // namespace latinime
-#endif // LATINIME_TOKEN_IMPL_H
diff --git a/native/jni/src/gesture/incremental_decoder_interface.cpp b/native/jni/src/gesture/incremental_decoder_interface.cpp
deleted file mode 100644
index 9fb2a17aa..000000000
--- a/native/jni/src/gesture/incremental_decoder_interface.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "incremental_decoder_interface.h"
-
-namespace latinime {
- IncrementalDecoderInterface *
- (*IncrementalDecoderInterface::sGestureDecoderFactoryMethod)(int, int) = 0;
- IncrementalDecoderInterface *
- (*IncrementalDecoderInterface::sIncrementalDecoderFactoryMethod)(int, int) = 0;
-} // namespace latinime
diff --git a/native/jni/src/gesture/incremental_decoder_interface.h b/native/jni/src/gesture/incremental_decoder_interface.h
index 1f92affb6..957f1ebbe 100644
--- a/native/jni/src/gesture/incremental_decoder_interface.h
+++ b/native/jni/src/gesture/incremental_decoder_interface.h
@@ -36,35 +36,6 @@ class IncrementalDecoderInterface {
const uint8_t *dictRoot, int rootPos) = 0;
virtual void setPrevWord(const int32_t *prevWord, int prevWordLength) = 0;
virtual ~IncrementalDecoderInterface() { };
-
- static IncrementalDecoderInterface *getGestureDecoderInstance(int maxWordLength, int maxWords) {
- if (sGestureDecoderFactoryMethod) {
- return sGestureDecoderFactoryMethod(maxWordLength, maxWords);
- }
- return 0;
- }
-
- static IncrementalDecoderInterface *getIncrementalDecoderInstance(int maxWordLength,
- int maxWords) {
- if (sIncrementalDecoderFactoryMethod) {
- return sIncrementalDecoderFactoryMethod(maxWordLength, maxWords);
- }
- return 0;
- }
-
- static void setGestureDecoderFactoryMethod(
- IncrementalDecoderInterface *(*factoryMethod)(int, int)) {
- sGestureDecoderFactoryMethod = factoryMethod;
- }
-
- static void setIncrementalDecoderFactoryMethod(
- IncrementalDecoderInterface *(*factoryMethod)(int, int)) {
- sIncrementalDecoderFactoryMethod = factoryMethod;
- }
-
- private:
- static IncrementalDecoderInterface *(*sGestureDecoderFactoryMethod)(int, int);
- static IncrementalDecoderInterface *(*sIncrementalDecoderFactoryMethod)(int, int);
};
} // namespace latinime
#endif // LATINIME_INCREMENTAL_DECODER_INTERFACE_H