Change getUnigramProbabilityOfPtNode to getProbabilityOfPtNode()
Bug: 14425059 Change-Id: I92403d750d2979408b41554dcd79b0ed31b41161
parent
ab661e3ef8
commit
96d47fe745
|
@ -94,7 +94,7 @@ int Dictionary::getProbability(const int *word, int length) const {
|
||||||
if (NOT_A_DICT_POS == pos) {
|
if (NOT_A_DICT_POS == pos) {
|
||||||
return NOT_A_PROBABILITY;
|
return NOT_A_PROBABILITY;
|
||||||
}
|
}
|
||||||
return getDictionaryStructurePolicy()->getUnigramProbabilityOfPtNode(pos);
|
return getDictionaryStructurePolicy()->getProbabilityOfPtNode(nullptr /* prevWordsInfo */, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Dictionary::getMaxProbabilityOfExactMatches(const int *word, int length) const {
|
int Dictionary::getMaxProbabilityOfExactMatches(const int *word, int length) const {
|
||||||
|
@ -116,8 +116,8 @@ int Dictionary::getNgramProbability(const PrevWordsInfo *const prevWordsInfo, co
|
||||||
if (bigramsIt.getBigramPos() == nextWordPos
|
if (bigramsIt.getBigramPos() == nextWordPos
|
||||||
&& bigramsIt.getProbability() != NOT_A_PROBABILITY) {
|
&& bigramsIt.getProbability() != NOT_A_PROBABILITY) {
|
||||||
return mDictionaryStructureWithBufferPolicy->getProbability(
|
return mDictionaryStructureWithBufferPolicy->getProbability(
|
||||||
mDictionaryStructureWithBufferPolicy->getUnigramProbabilityOfPtNode(
|
mDictionaryStructureWithBufferPolicy->getProbabilityOfPtNode(
|
||||||
nextWordPos), bigramsIt.getProbability());
|
nullptr /* prevWordsInfo */, nextWordPos), bigramsIt.getProbability());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NOT_A_PROBABILITY;
|
return NOT_A_PROBABILITY;
|
||||||
|
|
|
@ -58,7 +58,8 @@ class DictionaryStructureWithBufferPolicy {
|
||||||
virtual int getProbability(const int unigramProbability,
|
virtual int getProbability(const int unigramProbability,
|
||||||
const int bigramProbability) const = 0;
|
const int bigramProbability) const = 0;
|
||||||
|
|
||||||
virtual int getUnigramProbabilityOfPtNode(const int nodePos) const = 0;
|
virtual int getProbabilityOfPtNode(const PrevWordsInfo *const prevWordsInfo,
|
||||||
|
const int nodePos) const = 0;
|
||||||
|
|
||||||
virtual int getShortcutPositionOfPtNode(const int nodePos) const = 0;
|
virtual int getShortcutPositionOfPtNode(const int nodePos) const = 0;
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,8 @@ int Ver4PatriciaTriePolicy::getProbability(const int unigramProbability,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Ver4PatriciaTriePolicy::getUnigramProbabilityOfPtNode(const int ptNodePos) const {
|
int Ver4PatriciaTriePolicy::getProbabilityOfPtNode(const PrevWordsInfo *const prevWordsInfo,
|
||||||
|
const int ptNodePos) const {
|
||||||
if (ptNodePos == NOT_A_DICT_POS) {
|
if (ptNodePos == NOT_A_DICT_POS) {
|
||||||
return NOT_A_PROBABILITY;
|
return NOT_A_PROBABILITY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,8 @@ class Ver4PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy {
|
||||||
|
|
||||||
int getProbability(const int unigramProbability, const int bigramProbability) const;
|
int getProbability(const int unigramProbability, const int bigramProbability) const;
|
||||||
|
|
||||||
int getUnigramProbabilityOfPtNode(const int ptNodePos) const;
|
int getProbabilityOfPtNode(const PrevWordsInfo *const prevWordsInfo,
|
||||||
|
const int ptNodePos) const;
|
||||||
|
|
||||||
int getShortcutPositionOfPtNode(const int ptNodePos) const;
|
int getShortcutPositionOfPtNode(const int ptNodePos) const;
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,12 @@ int PatriciaTriePolicy::getProbability(const int unigramProbability,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int PatriciaTriePolicy::getUnigramProbabilityOfPtNode(const int ptNodePos) const {
|
int PatriciaTriePolicy::getProbabilityOfPtNode(const PrevWordsInfo *const prevWordsInfo,
|
||||||
|
const int ptNodePos) const {
|
||||||
|
if (prevWordsInfo) {
|
||||||
|
// TODO: Return probability using prevWordsInfo.
|
||||||
|
return NOT_A_PROBABILITY;
|
||||||
|
}
|
||||||
if (ptNodePos == NOT_A_DICT_POS) {
|
if (ptNodePos == NOT_A_DICT_POS) {
|
||||||
return NOT_A_PROBABILITY;
|
return NOT_A_PROBABILITY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ class PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy {
|
||||||
|
|
||||||
int getProbability(const int unigramProbability, const int bigramProbability) const;
|
int getProbability(const int unigramProbability, const int bigramProbability) const;
|
||||||
|
|
||||||
int getUnigramProbabilityOfPtNode(const int ptNodePos) const;
|
int getProbabilityOfPtNode(const PrevWordsInfo *const prevWordsInfo, const int ptNodePos) const;
|
||||||
|
|
||||||
int getShortcutPositionOfPtNode(const int ptNodePos) const;
|
int getShortcutPositionOfPtNode(const int ptNodePos) const;
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,12 @@ int Ver4PatriciaTriePolicy::getProbability(const int unigramProbability,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Ver4PatriciaTriePolicy::getUnigramProbabilityOfPtNode(const int ptNodePos) const {
|
int Ver4PatriciaTriePolicy::getProbabilityOfPtNode(const PrevWordsInfo *const prevWordsInfo,
|
||||||
|
const int ptNodePos) const {
|
||||||
|
if (prevWordsInfo) {
|
||||||
|
// TODO: Return probability using prevWordsInfo.
|
||||||
|
return NOT_A_PROBABILITY;
|
||||||
|
}
|
||||||
if (ptNodePos == NOT_A_DICT_POS) {
|
if (ptNodePos == NOT_A_DICT_POS) {
|
||||||
return NOT_A_PROBABILITY;
|
return NOT_A_PROBABILITY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Ver4PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy {
|
||||||
|
|
||||||
int getProbability(const int unigramProbability, const int bigramProbability) const;
|
int getProbability(const int unigramProbability, const int bigramProbability) const;
|
||||||
|
|
||||||
int getUnigramProbabilityOfPtNode(const int ptNodePos) const;
|
int getProbabilityOfPtNode(const PrevWordsInfo *const prevWordsInfo, const int ptNodePos) const;
|
||||||
|
|
||||||
int getShortcutPositionOfPtNode(const int ptNodePos) const;
|
int getShortcutPositionOfPtNode(const int ptNodePos) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue