X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2Fparser%2Fwiktionary%2FEnFunctionCallbacks.java;h=3161f4abeec1d832f32b63a98f2623064e22ba05;hb=752c81f1f8ec816865611477896093d81a77f90a;hp=60de2fc82c6c1c1e9ff481ae48aa1843f907d128;hpb=1b515f031d39e758e8e6339c03e124f1548579cc;p=DictionaryPC.git diff --git a/src/com/hughes/android/dictionary/parser/wiktionary/EnFunctionCallbacks.java b/src/com/hughes/android/dictionary/parser/wiktionary/EnFunctionCallbacks.java index 60de2fc..3161f4a 100644 --- a/src/com/hughes/android/dictionary/parser/wiktionary/EnFunctionCallbacks.java +++ b/src/com/hughes/android/dictionary/parser/wiktionary/EnFunctionCallbacks.java @@ -66,7 +66,13 @@ class EnFunctionCallbacks { callbacks.put("zh-attention", callback); callbacks.put("top2", callback); callbacks.put("mid2", callback); + callbacks.put("top3", callback); + callbacks.put("mid3", callback); callbacks.put("bottom", callback); + callbacks.put("rel-mid", callback); + callbacks.put("rel-mid3", callback); + callbacks.put("rel-mid4", callback); + callbacks.put("rel-bottom", callback); callback = new AppendName(); callbacks.put("...", callback); @@ -659,49 +665,6 @@ class EnFunctionCallbacks { // Italian stuff // ----------------------------------------------------------------------- - static void passThroughOrFillIn(final Map namedArgs, final String key, final String fillIn, final boolean quoteToEmpty) { - final String value = namedArgs.get(key); - if (quoteToEmpty && "''".equals(value)) { - namedArgs.put(key, ""); - return; - } - if (value == null || value.equals("")) { - namedArgs.put(key, fillIn); - } - } - - static final List it_number_s_p = Arrays.asList("s", "p"); - static final List it_person_1_2_3 = Arrays.asList("1", "2", "3"); - static final List it_reflexive_pronouns = Arrays.asList("mi ", "ti ", "si ", "ci ", "vi ", "si "); - static final List it_empty = Arrays.asList("", "", "", "", "", ""); - static void it_conj_passMood(final Map namedArgs, final String moodName, final boolean quoteToEmpty, final String root, final List suffixes) { - assert suffixes.size() == 6; - int i = 0; - for (final String number : it_number_s_p) { - for (final String person : it_person_1_2_3) { - passThroughOrFillIn(namedArgs, String.format("%s%s%s", moodName, person, number), root + suffixes.get(i), quoteToEmpty); - ++i; - } - } - } - - private static void outputKeyVariations(AppendAndIndexWikiCallback appendAndIndexWikiCallback, - final StringBuilder builder, final String keyBase, Map namedArgs, boolean isForm) { - for (int suffix = 0; suffix <= 4; ++suffix) { - final String key = suffix == 0 ? keyBase : keyBase + suffix; - final String val = namedArgs.remove(key); - if (val != null) { - if (suffix > 0) { - builder.append(", "); - } - appendAndIndexWikiCallback.dispatch(val, null); - if (isForm) { - appendAndIndexWikiCallback.parser.addLinkToCurrentEntry(val, EntryTypeName.WIKTIONARY_INFLECTED_FORM_MULTI); - } - } - } - } - static final class it_conj_are implements FunctionCallback { final it_conj dest; it_conj_are(it_conj dest) { @@ -1112,4 +1075,49 @@ static final class it_conj_are implements Fu builder.append("\n"); } } + + static void passThroughOrFillIn(final Map namedArgs, final String key, final String fillIn, final boolean quoteToEmpty) { + final String value = namedArgs.get(key); + if (quoteToEmpty && "''".equals(value)) { + namedArgs.put(key, ""); + return; + } + if (value == null || value.equals("")) { + namedArgs.put(key, fillIn); + } + } + + static final List it_number_s_p = Arrays.asList("s", "p"); + static final List it_person_1_2_3 = Arrays.asList("1", "2", "3"); + static final List it_reflexive_pronouns = Arrays.asList("mi ", "ti ", "si ", "ci ", "vi ", "si "); + static final List it_empty = Arrays.asList("", "", "", "", "", ""); + static void it_conj_passMood(final Map namedArgs, final String moodName, final boolean quoteToEmpty, final String root, final List suffixes) { + assert suffixes.size() == 6; + int i = 0; + for (final String number : it_number_s_p) { + for (final String person : it_person_1_2_3) { + passThroughOrFillIn(namedArgs, String.format("%s%s%s", moodName, person, number), root + suffixes.get(i), quoteToEmpty); + ++i; + } + } + } + + private static void outputKeyVariations(AppendAndIndexWikiCallback appendAndIndexWikiCallback, + final StringBuilder builder, final String keyBase, Map namedArgs, boolean isForm) { + for (int suffix = 0; suffix <= 4; ++suffix) { + final String key = suffix == 0 ? keyBase : keyBase + suffix; + final String val = namedArgs.remove(key); + if (val != null && !val.trim().equals("")) { + if (suffix > 0) { + builder.append(", "); + } + appendAndIndexWikiCallback.dispatch(val, null); + if (isForm) { + appendAndIndexWikiCallback.parser.addLinkToCurrentEntry(val, EntryTypeName.WIKTIONARY_INFLECTED_FORM_MULTI); + } + } + } + } + + } \ No newline at end of file