- new DictFileParser(charset, false, DictFileParser.DOUBLE_COLON, DictFileParser.PIPE, dictionaryBuilder, dictionaryBuilder.indexBuilders.toArray(new IndexBuilder[0]), null).parseFile(file);
- } else if ("wiktionary".equals(inputFormat)) {
- throw new RuntimeException();
-// new WiktionaryXmlParser(dict).parse(file);
+ final boolean flipColumns = "true".equals(keyValueArgs.remove(prefix + "FlipColumns"));
+ new DictFileParser(charset, flipColumns, DictFileParser.DOUBLE_COLON, DictFileParser.PIPE, dictionaryBuilder, dictionaryBuilder.indexBuilders.toArray(new IndexBuilder[0]), null).parseFile(file, entrySource);
+ } else if ("enwiktionary".equals(inputFormat)) {
+ final Pattern langPattern = Pattern.compile(keyValueArgs.remove(prefix + "LangPattern"), Pattern.CASE_INSENSITIVE);
+ 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.indexBuilders.get(enIndex), dictionaryBuilder.indexBuilders.get(1-enIndex),
+ langPattern, langCodePattern, enIndex != 0).parse(file, entrySource, Integer.parseInt(pageLimit));