aboutsummaryrefslogtreecommitdiffstats
path: root/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-11-11 21:21:03 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-11 21:21:04 +0000
commitda99cfc29d71f7aa417b4646234d532ed5dcb7de (patch)
treeee7e78c20d6e2c8b3434654f30659c65cf20e42c /native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h
parent7a3e6242103b7637171c6430bb9cca916583bfc0 (diff)
parentcd105409739db85f5f325e7cca322dadb12cded7 (diff)
downloadlatinime-da99cfc29d71f7aa417b4646234d532ed5dcb7de.tar.gz
latinime-da99cfc29d71f7aa417b4646234d532ed5dcb7de.tar.xz
latinime-da99cfc29d71f7aa417b4646234d532ed5dcb7de.zip
Merge "Introduce OffdeviceIntermediateDict for dicttolkit."
Diffstat (limited to 'native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h')
-rw-r--r--native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h b/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h
new file mode 100644
index 000000000..dfdb6a897
--- /dev/null
+++ b/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 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_DICT_TOOLKIT_OFFDEVICE_INTERMEDIATE_DICT_H
+#define LATINIME_DICT_TOOLKIT_OFFDEVICE_INTERMEDIATE_DICT_H
+
+#include "dict_toolkit_defines.h"
+#include "offdevice_intermediate_dict/offdevice_intermediate_dict_pt_node_array.h"
+#include "suggest/core/dictionary/property/word_property.h"
+#include "utils/int_array_view.h"
+
+namespace latinime {
+namespace dicttoolkit {
+
+/**
+ * On memory patricia trie to represent a dictionary.
+ */
+class OffdeviceIntermediateDict final {
+ public:
+ bool addWord(const WordProperty &wordProperty);
+ // The returned value will be invalid after modifying the dictionary. e.g. calling addWord().
+ const WordProperty *getWordProperty(const CodePointArrayView codePoints) const;
+
+ private:
+ DISALLOW_ASSIGNMENT_OPERATOR(OffdeviceIntermediateDict);
+
+ OffdeviceIntermediateDictPtNodeArray mRootPtNodeArray;
+
+ bool addWordInner(const CodePointArrayView codePoints, const WordProperty &wordProperty,
+ OffdeviceIntermediateDictPtNodeArray &ptNodeArray);
+};
+
+} // namespace dicttoolkit
+} // namespace latinime
+#endif // LATINIME_DICT_TOOLKIT_OFFDEVICE_INTERMEDIATE_DICT_H