Add shortcuts to XML output of makedict (B7)

Change-Id: I579e43cd147c4323c390cf1c9bf5e94ae79f9d86
This commit is contained in:
Jean Chalard 2011-12-26 20:09:03 +09:00
parent 2611d3d751
commit b751dbb6c8

View File

@ -42,6 +42,7 @@ public class XmlDictInputOutput {
private static final String WORD_TAG = "w";
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 WORD_ATTR = "word";
@ -266,6 +267,15 @@ public class XmlDictInputOutput {
for (Word word : set) {
destination.write(" <" + WORD_TAG + " " + WORD_ATTR + "=\"" + word.mWord + "\" "
+ 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) {
destination.write("\n");
for (WeightedString bigram : word.mBigrams) {