aboutsummaryrefslogtreecommitdiffstats
path: root/native/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-12-26 17:18:09 +0900
committerJean Chalard <jchalard@google.com>2012-01-06 15:21:11 +0900
commitb0c49b768485a92f6208630b8cef830b63c90513 (patch)
tree25f96efee11516777e1bad0666147a15ac7c931e /native/src
parent69f94e1983f5b0d7b982d806afd9b937c8222b3d (diff)
downloadlatinime-b0c49b768485a92f6208630b8cef830b63c90513.tar.gz
latinime-b0c49b768485a92f6208630b8cef830b63c90513.tar.xz
latinime-b0c49b768485a92f6208630b8cef830b63c90513.zip
Actually add shortcut targets to the suggestions (A4)
Change-Id: Ia6f551d36b2897863e7faf5143bc319522b0668e
Diffstat (limited to 'native/src')
-rw-r--r--native/src/unigram_dictionary.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp
index 5dd4c7e21..e95e03ce5 100644
--- a/native/src/unigram_dictionary.cpp
+++ b/native/src/unigram_dictionary.cpp
@@ -337,8 +337,15 @@ inline void UnigramDictionary::onTerminal(const int freq,
}
TerminalAttributes::ShortcutIterator iterator = terminalAttributes.getShortcutIterator();
while (iterator.hasNextShortcutTarget()) {
- // TODO: add the shortcut to the list of suggestions using the
- // iterator.getNextShortcutTarget(int, uint16_t*) method
+ // TODO: addWord only supports weak ordering, meaning we have no means to control the
+ // order of the shortcuts relative to one another or to the word. We need to either
+ // modulate the frequency of each shortcut according to its own shortcut frequency or
+ // to make the queue so that the insert order is protected inside the queue for words
+ // with the same score.
+ uint16_t shortcutTarget[MAX_WORD_LENGTH_INTERNAL];
+ const int shortcutTargetStringLength = iterator.getNextShortcutTarget(
+ MAX_WORD_LENGTH_INTERNAL, shortcutTarget);
+ addWord(shortcutTarget, shortcutTargetStringLength, finalFreq, queue);
}
}
}