Removes unused code and fixes a typo.
This commit is contained in:
parent
abdf97f652
commit
84fc2f068b
|
@ -59,8 +59,6 @@ namespace Formosa {
|
||||||
|
|
||||||
Grid& grid();
|
Grid& grid();
|
||||||
|
|
||||||
bool checkIfUnigramExistInVector(Unigram& unigram, vector<Unigram>vector);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void build();
|
void build();
|
||||||
|
|
||||||
|
@ -198,16 +196,6 @@ namespace Formosa {
|
||||||
return m_grid;
|
return m_grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool BlockReadingBuilder::checkIfUnigramExistInVector(Unigram& unigram, vector<Unigram>vector)
|
|
||||||
{
|
|
||||||
for (std::vector<Unigram>::iterator it=vector.begin(); it!=vector.end(); ++it) {
|
|
||||||
if (it->keyValue.value == unigram.keyValue.value) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void BlockReadingBuilder::build()
|
inline void BlockReadingBuilder::build()
|
||||||
{
|
{
|
||||||
if (!m_LM) {
|
if (!m_LM) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ McBopomofoLM::~McBopomofoLM()
|
||||||
{
|
{
|
||||||
m_languageModel.close();
|
m_languageModel.close();
|
||||||
m_userPhrases.close();
|
m_userPhrases.close();
|
||||||
m_excluddePhrases.close();
|
m_excludedPhrases.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void McBopomofoLM::loadLanguageModel(const char* languageModelDataPath)
|
void McBopomofoLM::loadLanguageModel(const char* languageModelDataPath)
|
||||||
|
@ -27,8 +27,8 @@ void McBopomofoLM::loadUserPhrases(const char* userPhrasesDataPath,
|
||||||
{
|
{
|
||||||
m_userPhrases.close();
|
m_userPhrases.close();
|
||||||
m_userPhrases.open(userPhrasesDataPath);
|
m_userPhrases.open(userPhrasesDataPath);
|
||||||
m_excluddePhrases.close();
|
m_excludedPhrases.close();
|
||||||
m_excluddePhrases.open(excludedPhrasesDataPath);
|
m_excludedPhrases.open(excludedPhrasesDataPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector<Bigram> McBopomofoLM::bigramsForKeys(const string& preceedingKey, const string& key)
|
const vector<Bigram> McBopomofoLM::bigramsForKeys(const string& preceedingKey, const string& key)
|
||||||
|
@ -45,8 +45,8 @@ const vector<Unigram> McBopomofoLM::unigramsForKey(const string& key)
|
||||||
unordered_set<string> excludedValues;
|
unordered_set<string> excludedValues;
|
||||||
unordered_set<string> userValues;
|
unordered_set<string> userValues;
|
||||||
|
|
||||||
if (m_excluddePhrases.hasUnigramsForKey(key)) {
|
if (m_excludedPhrases.hasUnigramsForKey(key)) {
|
||||||
vector<Unigram> excludedUnigrams = m_excluddePhrases.unigramsForKey(key);
|
vector<Unigram> excludedUnigrams = m_excludedPhrases.unigramsForKey(key);
|
||||||
transform(excludedUnigrams.begin(), excludedUnigrams.end(),
|
transform(excludedUnigrams.begin(), excludedUnigrams.end(),
|
||||||
inserter(excludedValues, excludedValues.end()),
|
inserter(excludedValues, excludedValues.end()),
|
||||||
[](const Unigram &u) { return u.keyValue.value; });
|
[](const Unigram &u) { return u.keyValue.value; });
|
||||||
|
@ -83,7 +83,7 @@ const vector<Unigram> McBopomofoLM::unigramsForKey(const string& key)
|
||||||
|
|
||||||
bool McBopomofoLM::hasUnigramsForKey(const string& key)
|
bool McBopomofoLM::hasUnigramsForKey(const string& key)
|
||||||
{
|
{
|
||||||
if (!m_excluddePhrases.hasUnigramsForKey(key)) {
|
if (!m_excludedPhrases.hasUnigramsForKey(key)) {
|
||||||
return m_userPhrases.hasUnigramsForKey(key) ||
|
return m_userPhrases.hasUnigramsForKey(key) ||
|
||||||
m_languageModel.hasUnigramsForKey(key);
|
m_languageModel.hasUnigramsForKey(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
FastLM m_languageModel;
|
FastLM m_languageModel;
|
||||||
FastLM m_userPhrases;
|
FastLM m_userPhrases;
|
||||||
FastLM m_excluddePhrases;
|
FastLM m_excludedPhrases;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue