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