From a65c267b1f1207e54c6f821148c600e3899b7f9c Mon Sep 17 00:00:00 2001 From: Ken Wakasa <kwakasa@google.com> Date: Fri, 31 May 2013 00:02:57 +0900 Subject: [PATCH] Move some dictionary related implementations to the dictionary directory Change-Id: I6fe71a540ad91ca46755be234abc8894242e2413 --- native/jni/Android.mk | 5 +++-- .../com_android_inputmethod_latin_BinaryDictionary.cpp | 5 +++-- native/jni/src/bigram_dictionary.cpp | 7 ++++--- native/jni/src/suggest/core/dicnode/dic_node.cpp | 2 +- native/jni/src/suggest/core/dicnode/dic_node.h | 10 +++++----- .../src/suggest/core/dicnode/dic_node_priority_queue.h | 4 ++-- .../jni/src/suggest/core/dicnode/dic_node_properties.h | 2 +- native/jni/src/suggest/core/dicnode/dic_node_state.h | 8 ++++---- .../src/suggest/core/dicnode/dic_node_state_prevword.h | 2 +- .../src/suggest/core/dicnode/dic_node_state_scoring.h | 2 +- native/jni/src/suggest/core/dicnode/dic_node_utils.cpp | 10 +++++----- native/jni/src/suggest/core/dicnode/dic_node_vector.h | 2 +- .../jni/src/suggest/core/dicnode/dic_nodes_cache.cpp | 6 +++--- native/jni/src/suggest/core/dicnode/dic_nodes_cache.h | 2 +- .../src/{ => suggest/core/dictionary}/binary_format.h | 2 +- .../src/{ => suggest/core/dictionary}/bloom_filter.h | 0 .../src/{ => suggest/core/dictionary}/dictionary.cpp | 4 ++-- .../jni/src/{ => suggest/core/dictionary}/dictionary.h | 0 .../{ => suggest/core/dictionary}/digraph_utils.cpp | 5 +++-- .../src/{ => suggest/core/dictionary}/digraph_utils.h | 2 ++ .../{ => suggest/core/dictionary}/multi_bigram_map.h | 3 +-- .../jni/src/suggest/core/dictionary/shortcut_utils.h | 2 +- .../core/dictionary}/terminal_attributes.h | 3 ++- .../core/layout/touch_position_correction_utils.h | 2 +- .../src/suggest/core/session/dic_traverse_session.cpp | 4 ++-- .../src/suggest/core/session/dic_traverse_session.h | 2 +- native/jni/src/suggest/core/suggest.cpp | 6 +++--- native/jni/src/unigram_dictionary.cpp | 8 ++++---- native/jni/src/unigram_dictionary.h | 3 ++- 29 files changed, 60 insertions(+), 53 deletions(-) rename native/jni/src/{ => suggest/core/dictionary}/binary_format.h (99%) rename native/jni/src/{ => suggest/core/dictionary}/bloom_filter.h (100%) rename native/jni/src/{ => suggest/core/dictionary}/dictionary.cpp (97%) rename native/jni/src/{ => suggest/core/dictionary}/dictionary.h (100%) rename native/jni/src/{ => suggest/core/dictionary}/digraph_utils.cpp (98%) rename native/jni/src/{ => suggest/core/dictionary}/digraph_utils.h (99%) rename native/jni/src/{ => suggest/core/dictionary}/multi_bigram_map.h (98%) rename native/jni/src/{ => suggest/core/dictionary}/terminal_attributes.h (98%) diff --git a/native/jni/Android.mk b/native/jni/Android.mk index ea35dab18b..34b352433c 100644 --- a/native/jni/Android.mk +++ b/native/jni/Android.mk @@ -49,9 +49,7 @@ LATIN_IME_CORE_SRC_FILES := \ bigram_dictionary.cpp \ char_utils.cpp \ correction.cpp \ - dictionary.cpp \ dic_traverse_wrapper.cpp \ - digraph_utils.cpp \ unigram_dictionary.cpp \ words_priority_queue.cpp \ suggest/core/suggest.cpp \ @@ -59,6 +57,9 @@ LATIN_IME_CORE_SRC_FILES := \ dic_node.cpp \ dic_node_utils.cpp \ dic_nodes_cache.cpp) \ + $(addprefix suggest/core/dictionary/, \ + dictionary.cpp \ + digraph_utils.cpp) \ $(addprefix suggest/core/layout/, \ additional_proximity_chars.cpp \ proximity_info.cpp \ diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp index 03b3c60286..9f5e2ae73f 100644 --- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp +++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp @@ -29,13 +29,14 @@ #include <cstdio> // for fopen() etc. #endif // USE_MMAP_FOR_DICTIONARY -#include "binary_format.h" #include "com_android_inputmethod_latin_BinaryDictionary.h" + #include "correction.h" -#include "dictionary.h" #include "jni.h" #include "jni_common.h" #include "suggest_options.h" +#include "suggest/core/dictionary/binary_format.h" +#include "suggest/core/dictionary/dictionary.h" namespace latinime { diff --git a/native/jni/src/bigram_dictionary.cpp b/native/jni/src/bigram_dictionary.cpp index 9053e72260..c592542bd0 100644 --- a/native/jni/src/bigram_dictionary.cpp +++ b/native/jni/src/bigram_dictionary.cpp @@ -19,11 +19,12 @@ #define LOG_TAG "LatinIME: bigram_dictionary.cpp" #include "bigram_dictionary.h" -#include "binary_format.h" -#include "bloom_filter.h" + #include "char_utils.h" #include "defines.h" -#include "dictionary.h" +#include "suggest/core/dictionary/binary_format.h" +#include "suggest/core/dictionary/bloom_filter.h" +#include "suggest/core/dictionary/dictionary.h" namespace latinime { diff --git a/native/jni/src/suggest/core/dicnode/dic_node.cpp b/native/jni/src/suggest/core/dicnode/dic_node.cpp index 8c48c587bb..de088c7d05 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node.cpp +++ b/native/jni/src/suggest/core/dicnode/dic_node.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "dic_node.h" +#include "suggest/core/dicnode/dic_node.h" namespace latinime { diff --git a/native/jni/src/suggest/core/dicnode/dic_node.h b/native/jni/src/suggest/core/dicnode/dic_node.h index 4225bb3e5c..1510e3d5e0 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node.h +++ b/native/jni/src/suggest/core/dicnode/dic_node.h @@ -19,11 +19,11 @@ #include "char_utils.h" #include "defines.h" -#include "dic_node_state.h" -#include "dic_node_profiler.h" -#include "dic_node_properties.h" -#include "dic_node_release_listener.h" -#include "digraph_utils.h" +#include "suggest/core/dicnode/dic_node_state.h" +#include "suggest/core/dicnode/dic_node_profiler.h" +#include "suggest/core/dicnode/dic_node_properties.h" +#include "suggest/core/dicnode/dic_node_release_listener.h" +#include "suggest/core/dictionary/digraph_utils.h" #if DEBUG_DICT #define LOGI_SHOW_ADD_COST_PROP \ diff --git a/native/jni/src/suggest/core/dicnode/dic_node_priority_queue.h b/native/jni/src/suggest/core/dicnode/dic_node_priority_queue.h index d3f28a8bd6..970e3bda4c 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_priority_queue.h +++ b/native/jni/src/suggest/core/dicnode/dic_node_priority_queue.h @@ -21,8 +21,8 @@ #include <vector> #include "defines.h" -#include "dic_node.h" -#include "dic_node_release_listener.h" +#include "suggest/core/dicnode/dic_node.h" +#include "suggest/core/dicnode/dic_node_release_listener.h" #define MAX_DIC_NODE_PRIORITY_QUEUE_CAPACITY 200 diff --git a/native/jni/src/suggest/core/dicnode/dic_node_properties.h b/native/jni/src/suggest/core/dicnode/dic_node_properties.h index 63a6b13403..d2f87c10bb 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_properties.h +++ b/native/jni/src/suggest/core/dicnode/dic_node_properties.h @@ -19,8 +19,8 @@ #include <stdint.h> -#include "binary_format.h" #include "defines.h" +#include "suggest/core/dictionary/binary_format.h" namespace latinime { diff --git a/native/jni/src/suggest/core/dicnode/dic_node_state.h b/native/jni/src/suggest/core/dicnode/dic_node_state.h index 239b63c320..d35e7d79f6 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_state.h +++ b/native/jni/src/suggest/core/dicnode/dic_node_state.h @@ -18,10 +18,10 @@ #define LATINIME_DIC_NODE_STATE_H #include "defines.h" -#include "dic_node_state_input.h" -#include "dic_node_state_output.h" -#include "dic_node_state_prevword.h" -#include "dic_node_state_scoring.h" +#include "suggest/core/dicnode/dic_node_state_input.h" +#include "suggest/core/dicnode/dic_node_state_output.h" +#include "suggest/core/dicnode/dic_node_state_prevword.h" +#include "suggest/core/dicnode/dic_node_state_scoring.h" namespace latinime { diff --git a/native/jni/src/suggest/core/dicnode/dic_node_state_prevword.h b/native/jni/src/suggest/core/dicnode/dic_node_state_prevword.h index e3b892bdaa..c3968c0906 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_state_prevword.h +++ b/native/jni/src/suggest/core/dicnode/dic_node_state_prevword.h @@ -21,7 +21,7 @@ #include <stdint.h> #include "defines.h" -#include "dic_node_utils.h" +#include "suggest/core/dicnode/dic_node_utils.h" namespace latinime { diff --git a/native/jni/src/suggest/core/dicnode/dic_node_state_scoring.h b/native/jni/src/suggest/core/dicnode/dic_node_state_scoring.h index dca9d60da4..4c884225af 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_state_scoring.h +++ b/native/jni/src/suggest/core/dicnode/dic_node_state_scoring.h @@ -20,7 +20,7 @@ #include <stdint.h> #include "defines.h" -#include "digraph_utils.h" +#include "suggest/core/dictionary/digraph_utils.h" namespace latinime { 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 4fe4badc5f..7f0d0ed0ed 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp +++ b/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp @@ -17,11 +17,11 @@ #include <cstring> #include <vector> -#include "binary_format.h" -#include "dic_node.h" -#include "dic_node_utils.h" -#include "dic_node_vector.h" -#include "multi_bigram_map.h" +#include "suggest/core/dicnode/dic_node.h" +#include "suggest/core/dicnode/dic_node_utils.h" +#include "suggest/core/dicnode/dic_node_vector.h" +#include "suggest/core/dictionary/binary_format.h" +#include "suggest/core/dictionary/multi_bigram_map.h" #include "suggest/core/layout/proximity_info.h" #include "suggest/core/layout/proximity_info_state.h" diff --git a/native/jni/src/suggest/core/dicnode/dic_node_vector.h b/native/jni/src/suggest/core/dicnode/dic_node_vector.h index ca07edaee0..e23c411f01 100644 --- a/native/jni/src/suggest/core/dicnode/dic_node_vector.h +++ b/native/jni/src/suggest/core/dicnode/dic_node_vector.h @@ -20,7 +20,7 @@ #include <vector> #include "defines.h" -#include "dic_node.h" +#include "suggest/core/dicnode/dic_node.h" namespace latinime { diff --git a/native/jni/src/suggest/core/dicnode/dic_nodes_cache.cpp b/native/jni/src/suggest/core/dicnode/dic_nodes_cache.cpp index b9a60780b8..c3d2a2e744 100644 --- a/native/jni/src/suggest/core/dicnode/dic_nodes_cache.cpp +++ b/native/jni/src/suggest/core/dicnode/dic_nodes_cache.cpp @@ -17,9 +17,9 @@ #include <list> #include "defines.h" -#include "dic_node_priority_queue.h" -#include "dic_node_utils.h" -#include "dic_nodes_cache.h" +#include "suggest/core/dicnode/dic_node_priority_queue.h" +#include "suggest/core/dicnode/dic_node_utils.h" +#include "suggest/core/dicnode/dic_nodes_cache.h" namespace latinime { diff --git a/native/jni/src/suggest/core/dicnode/dic_nodes_cache.h b/native/jni/src/suggest/core/dicnode/dic_nodes_cache.h index a62aa422ad..7f5bdbcf62 100644 --- a/native/jni/src/suggest/core/dicnode/dic_nodes_cache.h +++ b/native/jni/src/suggest/core/dicnode/dic_nodes_cache.h @@ -20,7 +20,7 @@ #include <stdint.h> #include "defines.h" -#include "dic_node_priority_queue.h" +#include "suggest/core/dicnode/dic_node_priority_queue.h" #define INITIAL_QUEUE_ID_ACTIVE 0 #define INITIAL_QUEUE_ID_NEXT_ACTIVE 1 diff --git a/native/jni/src/binary_format.h b/native/jni/src/suggest/core/dictionary/binary_format.h similarity index 99% rename from native/jni/src/binary_format.h rename to native/jni/src/suggest/core/dictionary/binary_format.h index 98241532f5..65c2e91158 100644 --- a/native/jni/src/binary_format.h +++ b/native/jni/src/suggest/core/dictionary/binary_format.h @@ -21,9 +21,9 @@ #include <map> #include <stdint.h> -#include "bloom_filter.h" #include "char_utils.h" #include "hash_map_compat.h" +#include "suggest/core/dictionary/bloom_filter.h" namespace latinime { diff --git a/native/jni/src/bloom_filter.h b/native/jni/src/suggest/core/dictionary/bloom_filter.h similarity index 100% rename from native/jni/src/bloom_filter.h rename to native/jni/src/suggest/core/dictionary/bloom_filter.h diff --git a/native/jni/src/dictionary.cpp b/native/jni/src/suggest/core/dictionary/dictionary.cpp similarity index 97% rename from native/jni/src/dictionary.cpp rename to native/jni/src/suggest/core/dictionary/dictionary.cpp index d9ed0fe493..1939c74200 100644 --- a/native/jni/src/dictionary.cpp +++ b/native/jni/src/suggest/core/dictionary/dictionary.cpp @@ -16,17 +16,17 @@ #define LOG_TAG "LatinIME: dictionary.cpp" -#include "dictionary.h" +#include "suggest/core/dictionary/dictionary.h" #include <map> // TODO: remove #include <stdint.h> #include "bigram_dictionary.h" -#include "binary_format.h" #include "defines.h" #include "dic_traverse_wrapper.h" #include "suggest_options.h" #include "suggest/core/suggest.h" +#include "suggest/core/dictionary/binary_format.h" #include "suggest/policyimpl/gesture/gesture_suggest_policy_factory.h" #include "suggest/policyimpl/typing/typing_suggest_policy_factory.h" #include "unigram_dictionary.h" diff --git a/native/jni/src/dictionary.h b/native/jni/src/suggest/core/dictionary/dictionary.h similarity index 100% rename from native/jni/src/dictionary.h rename to native/jni/src/suggest/core/dictionary/dictionary.h diff --git a/native/jni/src/digraph_utils.cpp b/native/jni/src/suggest/core/dictionary/digraph_utils.cpp similarity index 98% rename from native/jni/src/digraph_utils.cpp rename to native/jni/src/suggest/core/dictionary/digraph_utils.cpp index 083442669e..7a0f755e59 100644 --- a/native/jni/src/digraph_utils.cpp +++ b/native/jni/src/suggest/core/dictionary/digraph_utils.cpp @@ -14,10 +14,11 @@ * limitations under the License. */ +#include "suggest/core/dictionary/digraph_utils.h" + #include "char_utils.h" -#include "binary_format.h" #include "defines.h" -#include "digraph_utils.h" +#include "suggest/core/dictionary/binary_format.h" namespace latinime { diff --git a/native/jni/src/digraph_utils.h b/native/jni/src/suggest/core/dictionary/digraph_utils.h similarity index 99% rename from native/jni/src/digraph_utils.h rename to native/jni/src/suggest/core/dictionary/digraph_utils.h index 94435228e7..c1205940c3 100644 --- a/native/jni/src/digraph_utils.h +++ b/native/jni/src/suggest/core/dictionary/digraph_utils.h @@ -17,6 +17,8 @@ #ifndef DIGRAPH_UTILS_H #define DIGRAPH_UTILS_H +#include "defines.h" + namespace latinime { class DigraphUtils { diff --git a/native/jni/src/multi_bigram_map.h b/native/jni/src/suggest/core/dictionary/multi_bigram_map.h similarity index 98% rename from native/jni/src/multi_bigram_map.h rename to native/jni/src/suggest/core/dictionary/multi_bigram_map.h index 7e1b6301f8..fcac98f35c 100644 --- a/native/jni/src/multi_bigram_map.h +++ b/native/jni/src/suggest/core/dictionary/multi_bigram_map.h @@ -17,12 +17,11 @@ #ifndef LATINIME_MULTI_BIGRAM_MAP_H #define LATINIME_MULTI_BIGRAM_MAP_H -#include <cstring> #include <stdint.h> #include "defines.h" -#include "binary_format.h" #include "hash_map_compat.h" +#include "suggest/core/dictionary/binary_format.h" namespace latinime { diff --git a/native/jni/src/suggest/core/dictionary/shortcut_utils.h b/native/jni/src/suggest/core/dictionary/shortcut_utils.h index c411408ec4..601ac5f5ad 100644 --- a/native/jni/src/suggest/core/dictionary/shortcut_utils.h +++ b/native/jni/src/suggest/core/dictionary/shortcut_utils.h @@ -19,7 +19,7 @@ #include "defines.h" #include "suggest/core/dicnode/dic_node_utils.h" -#include "terminal_attributes.h" +#include "suggest/core/dictionary/terminal_attributes.h" namespace latinime { diff --git a/native/jni/src/terminal_attributes.h b/native/jni/src/suggest/core/dictionary/terminal_attributes.h similarity index 98% rename from native/jni/src/terminal_attributes.h rename to native/jni/src/suggest/core/dictionary/terminal_attributes.h index 92ef71c2c8..8377c603da 100644 --- a/native/jni/src/terminal_attributes.h +++ b/native/jni/src/suggest/core/dictionary/terminal_attributes.h @@ -18,7 +18,8 @@ #define LATINIME_TERMINAL_ATTRIBUTES_H #include <stdint.h> -#include "binary_format.h" + +#include "suggest/core/dictionary/binary_format.h" namespace latinime { diff --git a/native/jni/src/suggest/core/layout/touch_position_correction_utils.h b/native/jni/src/suggest/core/layout/touch_position_correction_utils.h index e7a8cae58c..429dcae0d8 100644 --- a/native/jni/src/suggest/core/layout/touch_position_correction_utils.h +++ b/native/jni/src/suggest/core/layout/touch_position_correction_utils.h @@ -18,7 +18,7 @@ #define LATINIME_TOUCH_POSITION_CORRECTION_UTILS_H #include "defines.h" -#include "proximity_info_params.h" +#include "suggest/core/layout/proximity_info_params.h" namespace latinime { class TouchPositionCorrectionUtils { diff --git a/native/jni/src/suggest/core/session/dic_traverse_session.cpp b/native/jni/src/suggest/core/session/dic_traverse_session.cpp index f9f1c09151..4e634500c0 100644 --- a/native/jni/src/suggest/core/session/dic_traverse_session.cpp +++ b/native/jni/src/suggest/core/session/dic_traverse_session.cpp @@ -16,12 +16,12 @@ #include "suggest/core/session/dic_traverse_session.h" -#include "binary_format.h" #include "defines.h" -#include "dictionary.h" #include "dic_traverse_wrapper.h" #include "jni.h" #include "suggest/core/dicnode/dic_node_utils.h" +#include "suggest/core/dictionary/binary_format.h" +#include "suggest/core/dictionary/dictionary.h" namespace latinime { diff --git a/native/jni/src/suggest/core/session/dic_traverse_session.h b/native/jni/src/suggest/core/session/dic_traverse_session.h index c774eae716..e5c7f8e0c3 100644 --- a/native/jni/src/suggest/core/session/dic_traverse_session.h +++ b/native/jni/src/suggest/core/session/dic_traverse_session.h @@ -22,8 +22,8 @@ #include "defines.h" #include "jni.h" -#include "multi_bigram_map.h" #include "suggest/core/dicnode/dic_nodes_cache.h" +#include "suggest/core/dictionary/multi_bigram_map.h" #include "suggest/core/layout/proximity_info_state.h" namespace latinime { diff --git a/native/jni/src/suggest/core/suggest.cpp b/native/jni/src/suggest/core/suggest.cpp index 8fe8fbc957..94441877ad 100644 --- a/native/jni/src/suggest/core/suggest.cpp +++ b/native/jni/src/suggest/core/suggest.cpp @@ -17,18 +17,18 @@ #include "suggest/core/suggest.h" #include "char_utils.h" -#include "dictionary.h" -#include "digraph_utils.h" #include "suggest/core/dicnode/dic_node.h" #include "suggest/core/dicnode/dic_node_priority_queue.h" #include "suggest/core/dicnode/dic_node_vector.h" +#include "suggest/core/dictionary/dictionary.h" +#include "suggest/core/dictionary/digraph_utils.h" #include "suggest/core/dictionary/shortcut_utils.h" +#include "suggest/core/dictionary/terminal_attributes.h" #include "suggest/core/layout/proximity_info.h" #include "suggest/core/policy/scoring.h" #include "suggest/core/policy/traversal.h" #include "suggest/core/policy/weighting.h" #include "suggest/core/session/dic_traverse_session.h" -#include "terminal_attributes.h" namespace latinime { diff --git a/native/jni/src/unigram_dictionary.cpp b/native/jni/src/unigram_dictionary.cpp index 08cd7b7fd9..1133256c43 100644 --- a/native/jni/src/unigram_dictionary.cpp +++ b/native/jni/src/unigram_dictionary.cpp @@ -18,13 +18,13 @@ #define LOG_TAG "LatinIME: unigram_dictionary.cpp" -#include "binary_format.h" #include "char_utils.h" #include "defines.h" -#include "dictionary.h" -#include "digraph_utils.h" +#include "suggest/core/dictionary/binary_format.h" +#include "suggest/core/dictionary/dictionary.h" +#include "suggest/core/dictionary/digraph_utils.h" +#include "suggest/core/dictionary/terminal_attributes.h" #include "suggest/core/layout/proximity_info.h" -#include "terminal_attributes.h" #include "unigram_dictionary.h" #include "words_priority_queue.h" #include "words_priority_queue_pool.h" diff --git a/native/jni/src/unigram_dictionary.h b/native/jni/src/unigram_dictionary.h index a64a539bd6..a505032567 100644 --- a/native/jni/src/unigram_dictionary.h +++ b/native/jni/src/unigram_dictionary.h @@ -19,8 +19,9 @@ #include <map> #include <stdint.h> + #include "defines.h" -#include "digraph_utils.h" +#include "suggest/core/dictionary/digraph_utils.h" namespace latinime { -- GitLab