]> gitweb.fperrin.net Git - DictionaryPC.git/blobdiff - src/com/hughes/android/dictionary/parser/EnWiktionaryXmlParser.java
Initialism, changes in regex matching.
[DictionaryPC.git] / src / com / hughes / android / dictionary / parser / EnWiktionaryXmlParser.java
index a7bf170c09e145b582919d43fb5d5ed0963dc20b..9c867a0a8de132a068d748557cd45d60046acea4 100644 (file)
@@ -46,7 +46,7 @@ public class EnWiktionaryXmlParser {
       "Noun|Verb|Adjective|Adverb|Pronoun|Conjunction|Interjection|" +
       "Preposition|Proper noun|Article|Prepositional phrase|Acronym|" +
       "Abbreviation|Initialism|Contraction|Prefix|Suffix|Symbol|Letter|" +
-      "Ligature|Idiom|Phrase|" +
+      "Ligature|Idiom|Phrase|{{initialism}}|" +
       // These are @deprecated:
       "Noun form|Verb form|Adjective form|Nominal phrase|Noun phrase|" +
       "Verb phrase|Transitive verb|Intransitive verb|Reflexive verb|" +
@@ -201,6 +201,7 @@ public class EnWiktionaryXmlParser {
           // TODO: would also be nice...
         } else if (functionName.startsWith("picdic")) {
         } else if (functionName.startsWith("checktrans")) {
+          done = true;
         } else if (functionName.startsWith("ttbc")) {
           wikiTokenizer.nextLine();
           // TODO: would be great to handle ttbc
@@ -213,7 +214,7 @@ public class EnWiktionaryXmlParser {
         // This line could produce an output...
         
         if (line.contains("ich hoan dich gear")) {
-          System.out.println();
+          //System.out.println();
         }
         
         // First strip the language and check whether it matches.
@@ -704,14 +705,16 @@ public class EnWiktionaryXmlParser {
           pairEntry.pairs.add(pair);
         }
       } else if (nextPrefix.equals("#::") || nextPrefix.equals("#**")) {
-        if (lastForeign != null) {
+        if (lastForeign != null && pairEntry.pairs.size() > 0) {
           pairEntry.pairs.remove(pairEntry.pairs.size() - 1);
           final Pair pair = new Pair(formatAndIndexExampleString(nextLine, enIndexBuilder, indexedEntry), formatAndIndexExampleString(lastForeign, otherIndexBuilder, indexedEntry), swap);
           if (pair.lang1 != "--" && pair.lang1 != "--") {
             pairEntry.pairs.add(pair);
           }
+          lastForeign = null;
         } else {
-          LOG.warning("English example with no foreign: " + title + ", " + nextLine);
+          LOG.warning("TODO: English example with no foreign: " + title + ", " + nextLine);
+          // TODO: add something.
         }
       } else if (nextPrefix.equals("#*")) {
         // Can't really index these.