Merge "Make the dictionary iterator shortcut-aware (B4)"
This commit is contained in:
commit
69f94e1983
3 changed files with 8 additions and 5 deletions
|
@ -1003,8 +1003,7 @@ public class BinaryDictInputOutput {
|
|||
new FusionDictionary.DictionaryOptions());
|
||||
if (null != dict) {
|
||||
for (Word w : dict) {
|
||||
// TODO: pass the shortcut targets
|
||||
newDict.add(w.mWord, w.mFrequency, null, w.mBigrams);
|
||||
newDict.add(w.mWord, w.mFrequency, w.mShortcutTargets, w.mBigrams);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -592,8 +592,7 @@ public class FusionDictionary implements Iterable<Word> {
|
|||
}
|
||||
if (currentGroup.mFrequency >= 0)
|
||||
return new Word(mCurrentString.toString(), currentGroup.mFrequency,
|
||||
// TODO: pass the shortcut targets here
|
||||
currentGroup.mBigrams);
|
||||
currentGroup.mShortcutTargets, currentGroup.mBigrams);
|
||||
} else {
|
||||
mPositions.removeLast();
|
||||
currentPos = mPositions.getLast();
|
||||
|
|
|
@ -28,11 +28,15 @@ import java.util.ArrayList;
|
|||
public class Word implements Comparable<Word> {
|
||||
final String mWord;
|
||||
final int mFrequency;
|
||||
final ArrayList<WeightedString> mShortcutTargets;
|
||||
final ArrayList<WeightedString> mBigrams;
|
||||
|
||||
public Word(String word, int frequency, ArrayList<WeightedString> bigrams) {
|
||||
public Word(final String word, final int frequency,
|
||||
final ArrayList<WeightedString> shortcutTargets,
|
||||
final ArrayList<WeightedString> bigrams) {
|
||||
mWord = word;
|
||||
mFrequency = frequency;
|
||||
mShortcutTargets = shortcutTargets;
|
||||
mBigrams = bigrams;
|
||||
}
|
||||
|
||||
|
@ -60,6 +64,7 @@ public class Word implements Comparable<Word> {
|
|||
if (!(o instanceof Word)) return false;
|
||||
Word w = (Word)o;
|
||||
return mFrequency == w.mFrequency && mWord.equals(w.mWord)
|
||||
&& mShortcutTargets.equals(w.mShortcutTargets)
|
||||
&& mBigrams.equals(w.mBigrams);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue