fatalError("Must specify human readable name for: " + prefix + "Name");
}
+ final EntrySource entrySource = new EntrySource(dictionaryBuilder.dictionary.sources.size(), inputName, dictionaryBuilder.dictionary.pairEntries.size());
+ System.out.println("");
+
String inputFormat = keyValueArgs.remove(prefix + "Format");
if ("dictcc".equals(inputFormat)) {
new DictFileParser(charset, false, DictFileParser.TAB, null, dictionaryBuilder, dictionaryBuilder.indexBuilders.toArray(new IndexBuilder[0]), null).parseFile(file);
} else if ("chemnitz".equals(inputFormat)) {
new DictFileParser(charset, false, DictFileParser.DOUBLE_COLON, DictFileParser.PIPE, dictionaryBuilder, dictionaryBuilder.indexBuilders.toArray(new IndexBuilder[0]), null).parseFile(file);
} else if ("enwiktionary".equals(inputFormat)) {
- final Pattern[] translationPatterns = new Pattern[2];
- translationPatterns[0] = Pattern.compile(keyValueArgs.remove(prefix + "TranslationPattern1"));
- translationPatterns[1] = Pattern.compile(keyValueArgs.remove(prefix + "TranslationPattern2"));
+ final Pattern langPattern = Pattern.compile(keyValueArgs.remove(prefix + "LangPattern"));
+ final Pattern langCodePattern = Pattern.compile(keyValueArgs.remove(prefix + "LangCodePattern"));
final int enIndex = Integer.parseInt(keyValueArgs.remove(prefix + "EnIndex")) - 1;
+ String pageLimit = keyValueArgs.remove(prefix + "PageLimit");
+ if (pageLimit == null) {
+ pageLimit = "-1";
+ }
+
if (enIndex < 0 || enIndex >= 2) {
fatalError("Must be 1 or 2: " + prefix + "EnIndex");
}
- new EnWiktionaryXmlParser(dictionaryBuilder, translationPatterns, enIndex).parse(file);
+ new EnWiktionaryXmlParser(dictionaryBuilder.indexBuilders.get(enIndex), dictionaryBuilder.indexBuilders.get(1-enIndex),
+ langPattern, langCodePattern, enIndex != 0).parse(file, Integer.parseInt(pageLimit));
} else {
fatalError("Invalid or missing input format: " + inputFormat);
}
- final EntrySource entrySource = new EntrySource(dictionaryBuilder.dictionary.sources.size(), inputName);
dictionaryBuilder.dictionary.sources.add(entrySource);
System.out.println("Done: " + file + "\n\n");
}