]> gitweb.fperrin.net Git - DictionaryPC.git/commitdiff
Refine fix for Spanish wiktionary.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Wed, 9 Jan 2019 22:47:02 +0000 (23:47 +0100)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Wed, 9 Jan 2019 22:47:02 +0000 (23:47 +0100)
src/com/hughes/android/dictionary/engine/WiktionarySplitter.java
src/com/hughes/android/dictionary/parser/wiktionary/WiktionaryLangs.java

index 435c3f212cd623cf9456054768d6feab355abfe4..5935df8f51646f28d6462f9d59bf679ec65cabc5 100644 (file)
@@ -205,8 +205,8 @@ public class WiktionarySplitter extends org.xml.sax.helpers.DefaultHandler {
         }
 
         String text = textBuilder.toString();
-        // Workaround for Spanish wiktionary {{ES}} pattern
-        text = text.replace("{{ES}}", "== {{lengua|es}} ==");
+        // Workaround for Spanish wiktionary {{ES}} and {{ES|word}} patterns
+        text = text.replaceAll("\\{\\{ES(\\|[^{}=]*)?}}", "== {{lengua|es}} ==");
         String translingual = "";
         int start = 0;
         final Matcher startMatcher = headingStart.matcher(text);
index af7bf1803fda90a2a5a19f3aa406acc050621632..1160bf250192da70a97c82b1c1ee342b38bb3e09 100644 (file)
@@ -135,11 +135,11 @@ public class WiktionaryLangs {
 
     public static final Map<String,Map<String,String>> wikiCodeToIsoCodeToWikiName = new LinkedHashMap<String, Map<String,String>>();
     static {
+        Map<String,String> isoCodeToWikiName;
+
         // en
         wikiCodeToIsoCodeToWikiName.put("en", isoCodeToEnWikiName);
 
-        Map<String,String> isoCodeToWikiName;
-
         // egrep -o '\{\{Wortart[^}]+\}\}' dewiktionary-pages-articles.xml | cut -d \| -f3 | sort | uniq -c | sort -nr
         isoCodeToWikiName = new LinkedHashMap<String, String>();
         wikiCodeToIsoCodeToWikiName.put("de", isoCodeToWikiName);