aboutsummaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
Diffstat (limited to 'native')
-rw-r--r--native/jni/HostUnitTests.mk4
-rw-r--r--native/jni/src/suggest/core/dicnode/dic_node_utils.cpp5
2 files changed, 7 insertions, 2 deletions
diff --git a/native/jni/HostUnitTests.mk b/native/jni/HostUnitTests.mk
index 40ec2558e..e30d50a2e 100644
--- a/native/jni/HostUnitTests.mk
+++ b/native/jni/HostUnitTests.mk
@@ -29,8 +29,10 @@ include $(LOCAL_PATH)/NativeFileList.mk
#################### Host library for unit test
# TODO: Remove -std=c++11 once it is set by default on host build.
LATIN_IME_SRC_DIR := src
+LOCAL_ADDRESS_SANITIZER := true
LOCAL_CFLAGS += -std=c++11 -Wno-unused-parameter -Wno-unused-function
LOCAL_CLANG := true
+LOCAL_CXX_STL := libc++
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
LOCAL_MODULE := liblatinime_host_static_for_unittests
LOCAL_MODULE_TAGS := optional
@@ -40,9 +42,11 @@ include $(BUILD_HOST_STATIC_LIBRARY)
#################### Host native tests
include $(CLEAR_VARS)
LATIN_IME_TEST_SRC_DIR := tests
+LOCAL_ADDRESS_SANITIZER := true
# TODO: Remove -std=c++11 once it is set by default on host build.
LOCAL_CFLAGS += -std=c++11 -Wno-unused-parameter -Wno-unused-function
LOCAL_CLANG := true
+LOCAL_CXX_STL := libc++
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
LOCAL_MODULE := liblatinime_host_unittests
LOCAL_MODULE_TAGS := tests
diff --git a/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp b/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp
index 7d2898b7a..ea438922f 100644
--- a/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp
+++ b/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp
@@ -74,8 +74,9 @@ namespace latinime {
}
const WordAttributes wordAttributes = dictionaryStructurePolicy->getWordAttributesInContext(
dicNode->getPrevWordIds(), dicNode->getWordId(), multiBigramMap);
- if (dicNode->hasMultipleWords()
- && (wordAttributes.isBlacklisted() || wordAttributes.isNotAWord())) {
+ if (wordAttributes.getProbability() == NOT_A_PROBABILITY
+ || (dicNode->hasMultipleWords()
+ && (wordAttributes.isBlacklisted() || wordAttributes.isNotAWord()))) {
return static_cast<float>(MAX_VALUE_FOR_WEIGHTING);
}
// TODO: This equation to calculate the improbability looks unreasonable. Investigate this.