]> gitweb.fperrin.net Git - DictionaryPC.git/commitdiff
include dict.cc entries with subject labels
authorChristoph Lingg <christoph@lingg.eu>
Sun, 20 Dec 2020 01:11:30 +0000 (02:11 +0100)
committerGitHub <noreply@github.com>
Sun, 20 Dec 2020 01:11:30 +0000 (02:11 +0100)
I used this script to turn a DE-ES dict.cc file into a quickdic compatible with my Tolino. From the original 45k entries more than 20k were dropped because they had a subject label:

> WARNING: Malformed line: Atomphysik {f} física {f} atómica noun [phys.]

This change allows lines to have 4 fields/columns: `language1`, `language2`, `word class`,  `subject labels`.

see also https://github.com/natowi/quickdic-dictionary.dictionarypc/issues/1

src/com/hughes/android/dictionary/parser/DictFileParser.java

index e9c61808af5b8a91573cfea2898a7f08fc3bf349..0fa43060086ffce54d1567d9ecd3530c7b94586e 100644 (file)
@@ -110,9 +110,8 @@ public class DictFileParser implements Parser {
             return;
         }
         final String[] fields = fieldSplit.split(line);
             return;
         }
         final String[] fields = fieldSplit.split(line);
-        // dictcc now has a part of speech field as field #3.
-        if (fields.length < 2 || fields.length > 3) {
-            logger.warning("Malformed line: " + line);
+        if (fields.length < 2 || fields.length > 4) {
+            logger.warning("Malformed line, expected 3 or 4 fields, got " + fields.length + ": " + line);
             return;
         }
 
             return;
         }