Zonble: KeyHandler // Don't let UOM remember symbols.
- This feature is okay to be enabled since we have introduced SymbolLM.
This commit is contained in:
parent
36121e98cc
commit
dc8fc553e3
|
@ -208,7 +208,17 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
// If the length of the readings and the characters do not match,
|
// If the length of the readings and the characters do not match,
|
||||||
// it often means it is a special symbol and it should not be stored
|
// it often means it is a special symbol and it should not be stored
|
||||||
// in the user override model.
|
// in the user override model.
|
||||||
if (selectedNode.spanningLength == [value count]) {
|
BOOL addToOverrideModel = YES;
|
||||||
|
if (selectedNode.spanningLength != [value count]) {
|
||||||
|
addToOverrideModel = NO;
|
||||||
|
}
|
||||||
|
if (addToOverrideModel) {
|
||||||
|
double score = selectedNode.node->scoreForCandidate(stringValue);
|
||||||
|
if (score <= -12) { // 威注音的 SymbolLM 的 Score 是 -12。
|
||||||
|
addToOverrideModel = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (addToOverrideModel) {
|
||||||
_userOverrideModel->observe(_walkedNodes, cursorIndex, stringValue, [[NSDate date] timeIntervalSince1970]);
|
_userOverrideModel->observe(_walkedNodes, cursorIndex, stringValue, [[NSDate date] timeIntervalSince1970]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,15 +184,15 @@ inline const std::string& Node::key() const { return m_key; }
|
||||||
|
|
||||||
inline double Node::score() const { return m_score; }
|
inline double Node::score() const { return m_score; }
|
||||||
|
|
||||||
// Prevents the override model to remember symbols with scode -X or lower.
|
|
||||||
//inline double Node::scoreForCandidate(const std::string& candidate) const {
|
inline double Node::scoreForCandidate(const std::string& candidate) const {
|
||||||
// for (auto unigram : m_unigrams) {
|
for (auto unigram : m_unigrams) {
|
||||||
// if (unigram.keyValue.value == candidate) {
|
if (unigram.keyValue.value == candidate) {
|
||||||
// return unigram.score;
|
return unigram.score;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// return 0.0;
|
return 0.0;
|
||||||
//}
|
}
|
||||||
|
|
||||||
inline double Node::highestUnigramScore() const {
|
inline double Node::highestUnigramScore() const {
|
||||||
if (m_unigrams.empty()) {
|
if (m_unigrams.empty()) {
|
||||||
|
|
Loading…
Reference in New Issue