Add a replacement character to digraphs system
The digraphs system used to allow only the replacement of
a pair (A, B) by (A). This change allows the replacement to
be any character.
Bug: 5140033
Change-Id: Icf5995f0ec553f7b7989af9902cbb2c4c6b51009
diff --git a/native/src/unigram_dictionary.h b/native/src/unigram_dictionary.h
index 5b8b045..b85913f 100644
--- a/native/src/unigram_dictionary.h
+++ b/native/src/unigram_dictionary.h
@@ -29,7 +29,7 @@
class TerminalAttributes;
class UnigramDictionary {
- typedef struct { int first; int second; } digraph_t;
+ typedef struct { int first; int second; int replacement; } digraph_t;
public:
// Mask and flags for children address type selection.
@@ -88,7 +88,7 @@
void getWordSuggestions(ProximityInfo *proximityInfo, const int *xcoordinates,
const int *ycoordinates, const int *codes, const int inputLength,
const int flags, Correction *correction, WordsPriorityQueuePool *queuePool);
- bool isDigraph(const int *codes, const int i, const int codesSize,
+ int getDigraphReplacement(const int *codes, const int i, const int codesSize,
const digraph_t* const digraphs, const unsigned int digraphsSize) const;
void getWordWithDigraphSuggestionsRec(ProximityInfo *proximityInfo,
const int *xcoordinates, const int* ycoordinates, const int *codesBuffer,