]> gitweb.fperrin.net Git - DictionaryPC.git/blobdiff - src/com/hughes/android/dictionary/engine/DictionaryBuilderMain.java
Reworking handling of foreign section.
[DictionaryPC.git] / src / com / hughes / android / dictionary / engine / DictionaryBuilderMain.java
index c49305e87677ae45cc0c8e8f59e75e7fc72da849..cf5a5d108b26344ef97d4975d6531a642c4213d0 100644 (file)
@@ -1,3 +1,17 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package com.hughes.android.dictionary.engine;
 
 import java.io.File;
@@ -22,25 +36,16 @@ public class DictionaryBuilderMain extends TestCase {
   
   
   public static void main(final String[] args) throws Exception {
-    DictionaryBuilder.main(new String[] {
-        "--dictOut=dictOutputs/DE-EN_chemnitz.quickdic",
-        "--lang1=DE",
-        "--lang2=EN",
-        "--dictInfo=@dictInputs/de-en_chemnitz.info",
-
-        "--input1=dictInputs/de-en_chemnitz.txt",
-        "--input1Name=chemnitz",
-        "--input1Charset=UTF8",
-        "--input1Format=chemnitz",
-    });
-
 
     Lang[] langs1 = new Lang[] { 
         new Lang("^English$", "EN"),
-        new Lang("^German$", "DE"),
+        //new Lang("^German$", "DE"),
     };
     Lang[] langs2 = new Lang[] { 
-        new Lang("^Italian$", "IT"),
+        new Lang("^.*Italian.*$", "IT"),
+        new Lang("^.*Greek.*$", "EL"),
+        new Lang("^.*Spanish.*$", "ES"),
+        /*
         new Lang("^German$", "DE"),
         new Lang("^Afrikaans$", "AF"),
         new Lang("^Armenian$", "HY"),
@@ -52,7 +57,6 @@ public class DictionaryBuilderMain extends TestCase {
         new Lang("^English$", "EN"),
         new Lang("^Finnish$", "FI"),
         new Lang("^French$", "FR"),
-        new Lang("^Greek$", "EL"),
         new Lang("^Hebrew$", "HE"),
         new Lang("^Hindi$", "HI"),
         new Lang("^Icelandic$", "IS"),
@@ -72,7 +76,6 @@ public class DictionaryBuilderMain extends TestCase {
         new Lang("^Sanskrit$", "SA"),
         new Lang("^Serbian$", "SR"),
         new Lang("^Somali$", "SO"),
-        new Lang("^Spanish$", "ES"),
         new Lang("^Sudanese$", "SU"),
         new Lang("^Swedish$", "SV"),
         new Lang("^Tajik$", "TG"),
@@ -83,7 +86,7 @@ public class DictionaryBuilderMain extends TestCase {
         new Lang("^Vietnamese$", "VI"),
         new Lang("^Welsh$", "CY"),
         new Lang("^Yiddish$", "YI"),
-        new Lang("^Zulu$", "ZU"),
+        new Lang("^Zulu$", "ZU"),*/
     };
     
     for (final Lang lang1 : langs1) {
@@ -93,12 +96,16 @@ public class DictionaryBuilderMain extends TestCase {
         }
         
         int enIndex = -1;
+        Lang nonEnglish = null;
         if (lang2.code.equals("EN")) {
           enIndex = 2;
+          nonEnglish = lang1;
         }
         if (lang1.code.equals("EN")) {
           enIndex = 1;
+          nonEnglish = lang2;
         }
+        assert nonEnglish != null;
 
         final String dictFile = String.format("dictOutputs/%s-%s_enwiktionary.quickdic", lang1.code, lang2.code);
         System.out.println("building dictFile: " + dictFile);
@@ -108,12 +115,13 @@ public class DictionaryBuilderMain extends TestCase {
             String.format("--lang2=%s", lang2.code),
             String.format("--dictInfo=(EN)Wikitionary-based %s-%s dictionary", lang1.code, lang2.code),
 
-            "--input1=dictInputs/enwiktionary-20110205-pages-articles.xml",
-            "--input1Name=enwiktionary",
-            "--input1Format=enwiktionary",
-            String.format("--input1TranslationPattern1=%s", lang1.nameRegex),
-            String.format("--input1TranslationPattern2=%s", lang2.nameRegex),
-            String.format("--input1EnIndex=%d", enIndex),
+            "--input3=wikiSplit/english.data",
+            "--input3Name=enwiktionary.english",
+            "--input3Format=enwiktionary",
+            "--input3LangPattern=" + nonEnglish.nameRegex,
+            "--input3LangCodePattern=" + (enIndex == 1 ? lang2.code : lang1.code).toLowerCase(),
+            "--input3EnIndex=" + enIndex,
+
         });
         
         // Print the entries for diffing.
@@ -131,6 +139,18 @@ public class DictionaryBuilderMain extends TestCase {
       }  // langs2
     }  // langs1
 
+    DictionaryBuilder.main(new String[] {
+        "--dictOut=dictOutputs/DE-EN_chemnitz.quickdic",
+        "--lang1=DE",
+        "--lang2=EN",
+        "--dictInfo=@dictInputs/de-en_chemnitz.info",
+
+        "--input1=dictInputs/de-en_chemnitz.txt",
+        "--input1Name=chemnitz",
+        "--input1Charset=UTF8",
+        "--input1Format=chemnitz",
+    });
+
     DictionaryBuilder.main(new String[] {
         "--dictOut=dictOutputs/de-en_all.quickdic",
         "--lang1=DE",