+ "--lang1=" + langCode,
+ "--lang2=" + "EN",
+ "--lang1Stoplist=" + STOPLISTS + "empty.txt",
+ "--lang2Stoplist=" + STOPLISTS + "empty.txt",
+ "--dictInfo=SomeWikiDataWholeSection",
+
+ "--input4=" + WIKISPLIT_EN + langCode + ".data",
+ "--input4Name=" + name,
+ "--input4Format=" + WholeSectionToHtmlParser.NAME,
+ "--input4WiktionaryLang=EN",
+ "--input4SkipLang=" + langCode,
+ "--input4TitleIndex=" + "1",
+ "--input4PageLimit=" + pageLimit,
+
+ "--print=" + result.getPath() + ".text",
+ });
+ checkGolden(name, result);
+ }
+
+ //-----------------------------------------------------------------
+
+ public void testSingleLang_EN() throws Exception {
+ wiktionaryTestSingleLang("SingleLang_EN.quickdic", "EN", 100);
+ }
+
+ public void testSingleLang_DE() throws Exception {
+ wiktionaryTestSingleLang("SingleLang_DE.quickdic", "DE", 100);
+ }
+
+ public void testSingleLang_IT() throws Exception {
+ wiktionaryTestSingleLang("SingleLang_IT.quickdic", "IT", 100);
+ }
+
+ public void testSingleLang_FR() throws Exception {
+ wiktionaryTestSingleLang("SingleLang_FR.quickdic", "FR", 100);
+ }
+
+ public void wiktionaryTestSingleLang(final String name, final String langCode, final int pageLimit) throws Exception {
+ final File result = new File(TEST_OUTPUTS + name);
+ System.out.println("Writing to: " + result);
+ DictionaryBuilder.main(new String[] {
+ "--dictOut=" + result.getAbsolutePath(),
+ "--lang1=" + langCode,
+ "--lang1Stoplist=" + STOPLISTS + "empty.txt",
+ "--dictInfo=SomeWikiDataWholeSection",
+ "--input4=" + WIKISPLIT + langCode.toLowerCase() + "/" + langCode + ".data",
+ "--input4Name=" + name,
+ "--input4Format=" + WholeSectionToHtmlParser.NAME,
+ "--input4WiktionaryLang=" + langCode,
+ "--input4SkipLang=" + langCode,
+ "--input4TitleIndex=" + "1",
+ "--input4PageLimit=" + pageLimit,
+ "--print=" + result.getPath() + ".text",
+ });
+ checkGolden(name, result);
+ }
+
+ //-----------------------------------------------------------------
+
+ public void testWiktionary_IT_EN() throws Exception {
+ wiktionaryTestWithLangToEn("wiktionary.it_en.quickdic", "IT", "it.txt",
+ "EN.data", "enwiktionary.english", "Italian", "it", 1000);
+ }
+
+ public void testWiktionary_cmn_EN() throws Exception {
+ wiktionaryTestWithLangToEn("wiktionary.cmn_en.quickdic", "cmn", "empty.txt",
+ // These missing "e" prevents a complete match, forcing the name to be printed
+ "EN.data", "enwiktionary.english", "Chinese|Mandarin", "cmn", 1000);
+ }
+
+ public void testWiktionary_DE_EN() throws Exception {
+ wiktionaryTestWithLangToEn("wiktionary.de_en.quickdic", "DE", "de.txt",
+ "EN.data", "enwiktionary.english", "German", "de", 1000);
+ }
+
+ public void testWiktionary_IT_IT() throws Exception {
+ wiktionaryTestWithLangToEn("wiktionary.it_it.quickdic", "IT", "it.txt",
+ "IT.data", "enwiktionary.italian", "Italian", "it", 1000);
+ }
+
+ // French
+ public void testWiktionary_FR_FR() throws Exception {
+ wiktionaryTestWithLangToEn("wiktionary.fr_fr.quickdic", "FR", "fr.txt",
+ "FR.data", "enwiktionary.french", "French", "fr", 1000);
+ }
+
+
+ // Arabic
+ public void testWiktionary_AR_AR() throws Exception {
+ // Arabic is really big for some reason, use fewer pages.
+ wiktionaryTestWithLangToEn("wiktionary.ar_ar.quickdic", "AR", "empty.txt",
+ "AR.data", "enwiktionary.arabic", "Arabic", "ar", 200);
+ }
+
+ // Chinese
+ public void testWiktionary_cmn_cmn() throws Exception {
+ wiktionaryTestWithLangToEn("wiktionary.cmn_cmn.quickdic", "cmn", "empty.txt",
+ // These missing "e" prevents a complete match, forcing the name to be printed.
+ "cmn.data", "enwiktionary.chinese", "Chinese|Mandarin", "cmn", 1000);
+ }
+
+ // German
+ public void testWiktionary_DE_DE() throws Exception {
+ wiktionaryTestWithLangToEn("wiktionary.de_de.quickdic", "DE", "de.txt",
+ "DE.data", "enwiktionary.german", "German", "de", 1000);
+ }
+
+ // Thai
+ public void testWiktionary_TH_TH() throws Exception {
+ wiktionaryTestWithLangToEn("wiktionary.th_th.quickdic", "TH", "empty.txt",
+ // These missing "e" prevents a complete match, forcing the name to be printed.
+ "TH.data", "enwiktionary.thai", "Thai", "th", 1000);
+ }
+
+ public void wiktionaryTestWithLangToEn(final String name, final String lang1,
+ final String stoplist, final String data, final String dictName,
+ final String langPattern, final String langCode, int pageLimit) throws Exception {
+ final File result = new File(TEST_OUTPUTS + name);
+ System.out.println("Writing to: " + result);
+ final String type = data.equals("EN.data") ? "EnToTranslation" : "EnForeign";
+ DictionaryBuilder.main(new String[] {
+ "--dictOut=" + result.getAbsolutePath(),
+ "--lang1=" + lang1,