am 17fce9e3: am fd02ec10: Always consider corrections of intentional omissions (e.g., apostrophe)
* commit '17fce9e3455c9fbc88f6eabf220165abdaaee417': Always consider corrections of intentional omissions (e.g., apostrophe)main
commit
b55f0be85c
|
@ -28,7 +28,8 @@ class Traversal {
|
|||
virtual int getMaxPointerCount() const = 0;
|
||||
virtual bool allowsErrorCorrections(const DicNode *const dicNode) const = 0;
|
||||
virtual bool isOmission(const DicTraverseSession *const traverseSession,
|
||||
const DicNode *const dicNode, const DicNode *const childDicNode) const = 0;
|
||||
const DicNode *const dicNode, const DicNode *const childDicNode,
|
||||
const bool allowsErrorCorrections) const = 0;
|
||||
virtual bool isSpaceSubstitutionTerminal(const DicTraverseSession *const traverseSession,
|
||||
const DicNode *const dicNode) const = 0;
|
||||
virtual bool isSpaceOmissionTerminal(const DicTraverseSession *const traverseSession,
|
||||
|
|
|
@ -296,8 +296,8 @@ void Suggest::expandCurrentDicNodes(DicTraverseSession *traverseSession) const {
|
|||
correctionDicNode.advanceDigraphIndex();
|
||||
processDicNodeAsDigraph(traverseSession, &correctionDicNode);
|
||||
}
|
||||
if (allowsErrorCorrections
|
||||
&& TRAVERSAL->isOmission(traverseSession, &dicNode, childDicNode)) {
|
||||
if (TRAVERSAL->isOmission(traverseSession, &dicNode, childDicNode,
|
||||
allowsErrorCorrections)) {
|
||||
// TODO: (Gesture) Change weight between omission and substitution errors
|
||||
// TODO: (Gesture) Terminal node should not be handled as omission
|
||||
correctionDicNode.initByCopy(childDicNode);
|
||||
|
|
|
@ -43,10 +43,17 @@ class TypingTraversal : public Traversal {
|
|||
}
|
||||
|
||||
AK_FORCE_INLINE bool isOmission(const DicTraverseSession *const traverseSession,
|
||||
const DicNode *const dicNode, const DicNode *const childDicNode) const {
|
||||
const DicNode *const dicNode, const DicNode *const childDicNode,
|
||||
const bool allowsErrorCorrections) const {
|
||||
if (!CORRECT_OMISSION) {
|
||||
return false;
|
||||
}
|
||||
// Note: Always consider intentional omissions (like apostrophes) since they are common.
|
||||
const bool canConsiderOmission =
|
||||
allowsErrorCorrections || childDicNode->canBeIntentionalOmission();
|
||||
if (!canConsiderOmission) {
|
||||
return false;
|
||||
}
|
||||
const int inputSize = traverseSession->getInputSize();
|
||||
// TODO: Don't refer to isCompletion?
|
||||
if (dicNode->isCompletion(inputSize)) {
|
||||
|
|
Loading…
Reference in New Issue