Merge "Add removeUnigramEntry() to native dictionary policy."
This commit is contained in:
commit
86fe8081b3
7 changed files with 28 additions and 0 deletions
|
@ -99,6 +99,11 @@ bool Dictionary::addUnigramEntry(const int *const word, const int length,
|
||||||
return mDictionaryStructureWithBufferPolicy->addUnigramEntry(word, length, unigramProperty);
|
return mDictionaryStructureWithBufferPolicy->addUnigramEntry(word, length, unigramProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Dictionary::removeUnigramEntry(const int *const codePoints, const int codePointCount) {
|
||||||
|
TimeKeeper::setCurrentTime();
|
||||||
|
return mDictionaryStructureWithBufferPolicy->removeUnigramEntry(codePoints, codePointCount);
|
||||||
|
}
|
||||||
|
|
||||||
bool Dictionary::addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
bool Dictionary::addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
||||||
const BigramProperty *const bigramProperty) {
|
const BigramProperty *const bigramProperty) {
|
||||||
TimeKeeper::setCurrentTime();
|
TimeKeeper::setCurrentTime();
|
||||||
|
|
|
@ -81,6 +81,8 @@ class Dictionary {
|
||||||
bool addUnigramEntry(const int *const codePoints, const int codePointCount,
|
bool addUnigramEntry(const int *const codePoints, const int codePointCount,
|
||||||
const UnigramProperty *const unigramProperty);
|
const UnigramProperty *const unigramProperty);
|
||||||
|
|
||||||
|
bool removeUnigramEntry(const int *const codePoints, const int codePointCount);
|
||||||
|
|
||||||
bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
||||||
const BigramProperty *const bigramProperty);
|
const BigramProperty *const bigramProperty);
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ class DictionaryStructureWithBufferPolicy {
|
||||||
virtual bool addUnigramEntry(const int *const word, const int length,
|
virtual bool addUnigramEntry(const int *const word, const int length,
|
||||||
const UnigramProperty *const unigramProperty) = 0;
|
const UnigramProperty *const unigramProperty) = 0;
|
||||||
|
|
||||||
|
// Returns whether the update was success or not.
|
||||||
|
virtual bool removeUnigramEntry(const int *const word, const int length) = 0;
|
||||||
|
|
||||||
// Returns whether the update was success or not.
|
// Returns whether the update was success or not.
|
||||||
virtual bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
virtual bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
||||||
const BigramProperty *const bigramProperty) = 0;
|
const BigramProperty *const bigramProperty) = 0;
|
||||||
|
|
|
@ -111,6 +111,11 @@ class Ver4PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy {
|
||||||
bool addUnigramEntry(const int *const word, const int length,
|
bool addUnigramEntry(const int *const word, const int length,
|
||||||
const UnigramProperty *const unigramProperty);
|
const UnigramProperty *const unigramProperty);
|
||||||
|
|
||||||
|
bool removeUnigramEntry(const int *const word, const int length) {
|
||||||
|
// Removing unigram entry is not supported.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
||||||
const BigramProperty *const bigramProperty);
|
const BigramProperty *const bigramProperty);
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,12 @@ class PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool removeUnigramEntry(const int *const word, const int length) {
|
||||||
|
// This method should not be called for non-updatable dictionary.
|
||||||
|
AKLOGI("Warning: removeUnigramEntry() is called for non-updatable dictionary.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
||||||
const BigramProperty *const bigramProperty) {
|
const BigramProperty *const bigramProperty) {
|
||||||
// This method should not be called for non-updatable dictionary.
|
// This method should not be called for non-updatable dictionary.
|
||||||
|
|
|
@ -221,6 +221,11 @@ bool Ver4PatriciaTriePolicy::addUnigramEntry(const int *const word, const int le
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Ver4PatriciaTriePolicy::removeUnigramEntry(const int *const word, const int length) {
|
||||||
|
// TODO: Implement.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Ver4PatriciaTriePolicy::addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
bool Ver4PatriciaTriePolicy::addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
||||||
const BigramProperty *const bigramProperty) {
|
const BigramProperty *const bigramProperty) {
|
||||||
if (!mBuffers->isUpdatable()) {
|
if (!mBuffers->isUpdatable()) {
|
||||||
|
|
|
@ -93,6 +93,8 @@ class Ver4PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy {
|
||||||
bool addUnigramEntry(const int *const word, const int length,
|
bool addUnigramEntry(const int *const word, const int length,
|
||||||
const UnigramProperty *const unigramProperty);
|
const UnigramProperty *const unigramProperty);
|
||||||
|
|
||||||
|
bool removeUnigramEntry(const int *const word, const int length);
|
||||||
|
|
||||||
bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
|
||||||
const BigramProperty *const bigramProperty);
|
const BigramProperty *const bigramProperty);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue