Merge "Add ver4 dictionary structure policy file."

main
Keisuke Kuroyanagi 2013-10-17 12:02:01 +00:00 committed by Android (Google) Code Review
commit 585c67118a
3 changed files with 185 additions and 0 deletions

View File

@ -84,6 +84,7 @@ LATIN_IME_CORE_SRC_FILES := \
dynamic_patricia_trie_reading_utils.cpp \ dynamic_patricia_trie_reading_utils.cpp \
dynamic_patricia_trie_writing_helper.cpp \ dynamic_patricia_trie_writing_helper.cpp \
dynamic_patricia_trie_writing_utils.cpp) \ dynamic_patricia_trie_writing_utils.cpp) \
suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.cpp \
$(addprefix suggest/policyimpl/dictionary/utils/, \ $(addprefix suggest/policyimpl/dictionary/utils/, \
buffer_with_extendable_buffer.cpp \ buffer_with_extendable_buffer.cpp \
byte_array_utils.cpp \ byte_array_utils.cpp \

View File

@ -0,0 +1,96 @@
/*
* Copyright (C) 2013, 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 "suggest/policyimpl/dictionary/structure/v4/ver4_patricia_trie_policy.h"
namespace latinime {
void Ver4PatriciaTriePolicy::createAndGetAllChildDicNodes(const DicNode *const dicNode,
DicNodeVector *const childDicNodes) const {
// TODO: Implement.
}
int Ver4PatriciaTriePolicy::getCodePointsAndProbabilityAndReturnCodePointCount(
const int ptNodePos, const int maxCodePointCount, int *const outCodePoints,
int *const outUnigramProbability) const {
// TODO: Implement.
return 0;
}
int Ver4PatriciaTriePolicy::getTerminalPtNodePositionOfWord(const int *const inWord,
const int length, const bool forceLowerCaseSearch) const {
// TODO: Implement.
return NOT_A_DICT_POS;
}
int Ver4PatriciaTriePolicy::getProbability(const int unigramProbability,
const int bigramProbability) const {
// TODO: Implement.
return NOT_A_PROBABILITY;
}
int Ver4PatriciaTriePolicy::getUnigramProbabilityOfPtNode(const int ptNodePos) const {
// TODO: Implement.
return NOT_A_PROBABILITY;
}
int Ver4PatriciaTriePolicy::getShortcutPositionOfPtNode(const int ptNodePos) const {
// TODO: Implement.
return NOT_A_DICT_POS;
}
int Ver4PatriciaTriePolicy::getBigramsPositionOfPtNode(const int ptNodePos) const {
// TODO: Implement.
return NOT_A_DICT_POS;
}
bool Ver4PatriciaTriePolicy::addUnigramWord(const int *const word, const int length,
const int probability) {
// TODO: Implement.
return false;
}
bool Ver4PatriciaTriePolicy::addBigramWords(const int *const word0, const int length0,
const int *const word1, const int length1, const int probability) {
// TODO: Implement.
return false;
}
bool Ver4PatriciaTriePolicy::removeBigramWords(const int *const word0, const int length0,
const int *const word1, const int length1) {
// TODO: Implement.
return false;
}
void Ver4PatriciaTriePolicy::flush(const char *const filePath) {
// TODO: Implement.
}
void Ver4PatriciaTriePolicy::flushWithGC(const char *const filePath) {
// TODO: Implement.
}
bool Ver4PatriciaTriePolicy::needsToRunGC(const bool mindsBlockByGC) const {
// TODO: Implement.
return false;
}
void Ver4PatriciaTriePolicy::getProperty(const char *const query, char *const outResult,
const int maxResultLength) {
// TODO: Implement.
}
} // namespace latinime

View File

@ -0,0 +1,88 @@
/*
* Copyright (C) 2013, 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_VER4_PATRICIA_TRIE_POLICY_H
#define LATINIME_VER4_PATRICIA_TRIE_POLICY_H
#include "defines.h"
#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h"
namespace latinime {
class DicNode;
class DicNodeVector;
// TODO: Implement.
class Ver4PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy {
public:
~Ver4PatriciaTriePolicy() {}
AK_FORCE_INLINE int getRootPosition() const {
return 0;
}
void createAndGetAllChildDicNodes(const DicNode *const dicNode,
DicNodeVector *const childDicNodes) const;
int getCodePointsAndProbabilityAndReturnCodePointCount(
const int terminalPtNodePos, const int maxCodePointCount, int *const outCodePoints,
int *const outUnigramProbability) const;
int getTerminalPtNodePositionOfWord(const int *const inWord,
const int length, const bool forceLowerCaseSearch) const;
int getProbability(const int unigramProbability, const int bigramProbability) const;
int getUnigramProbabilityOfPtNode(const int ptNodePos) const;
int getShortcutPositionOfPtNode(const int ptNodePos) const;
int getBigramsPositionOfPtNode(const int ptNodePos) const;
const DictionaryHeaderStructurePolicy *getHeaderStructurePolicy() const {
return 0;
}
const DictionaryBigramsStructurePolicy *getBigramsStructurePolicy() const {
return 0;
}
const DictionaryShortcutsStructurePolicy *getShortcutsStructurePolicy() const {
return 0;
}
bool addUnigramWord(const int *const word, const int length, const int probability);
bool addBigramWords(const int *const word0, const int length0, const int *const word1,
const int length1, const int probability);
bool removeBigramWords(const int *const word0, const int length0, const int *const word1,
const int length1);
void flush(const char *const filePath);
void flushWithGC(const char *const filePath);
bool needsToRunGC(const bool mindsBlockByGC) const;
void getProperty(const char *const query, char *const outResult,
const int maxResultLength);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Ver4PatriciaTriePolicy);
};
} // namespace latinime
#endif // LATINIME_VER4_PATRICIA_TRIE_POLICY_H