am b751dbb6: Add shortcuts to XML output of makedict (B7)

* commit 'b751dbb6c8505e717db9b0db223bed24dc06d2f7':
  Add shortcuts to XML output of makedict (B7)
main
Jean Chalard 2012-01-10 23:50:31 -08:00 committed by Android Git Automerger
commit 0a15f84628
1 changed files with 10 additions and 0 deletions

View File

@ -42,6 +42,7 @@ public class XmlDictInputOutput {
private static final String WORD_TAG = "w"; private static final String WORD_TAG = "w";
private static final String BIGRAM_TAG = "bigram"; private static final String BIGRAM_TAG = "bigram";
private static final String SHORTCUT_TAG = "shortcut";
private static final String FREQUENCY_ATTR = "f"; private static final String FREQUENCY_ATTR = "f";
private static final String WORD_ATTR = "word"; private static final String WORD_ATTR = "word";
@ -266,6 +267,15 @@ public class XmlDictInputOutput {
for (Word word : set) { for (Word word : set) {
destination.write(" <" + WORD_TAG + " " + WORD_ATTR + "=\"" + word.mWord + "\" " destination.write(" <" + WORD_TAG + " " + WORD_ATTR + "=\"" + word.mWord + "\" "
+ FREQUENCY_ATTR + "=\"" + word.mFrequency + "\">"); + FREQUENCY_ATTR + "=\"" + word.mFrequency + "\">");
if (null != word.mShortcutTargets) {
destination.write("\n");
for (WeightedString target : word.mShortcutTargets) {
destination.write(" <" + SHORTCUT_TAG + " " + FREQUENCY_ATTR + "=\""
+ target.mFrequency + "\">" + target.mWord + "</" + SHORTCUT_TAG
+ ">\n");
}
destination.write(" ");
}
if (null != word.mBigrams) { if (null != word.mBigrams) {
destination.write("\n"); destination.write("\n");
for (WeightedString bigram : word.mBigrams) { for (WeightedString bigram : word.mBigrams) {