comparison software/mpdl-services/mpiwg-mpdl-lt/src/de/mpg/mpiwg/berlin/mpdl/lt/dict/app/Lexica.java @ 23:e845310098ba

diverse Korrekturen
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Tue, 27 Nov 2012 12:35:19 +0100
parents 4a3641ae14d2
children
comparison
equal deleted inserted replaced
22:6a45a982c333 23:e845310098ba
1 package de.mpg.mpiwg.berlin.mpdl.lt.dict.app; 1 package de.mpg.mpiwg.berlin.mpdl.lt.dict.app;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.Collections;
4 import java.util.HashMap; 5 import java.util.HashMap;
5 import java.util.Iterator; 6 import java.util.Iterator;
6 import java.util.Set; 7 import java.util.Set;
7 8
8 import de.mpg.mpiwg.berlin.mpdl.lt.general.Language; 9 import de.mpg.mpiwg.berlin.mpdl.lt.general.Language;
19 lsj: 112631 records (26922 of them are not xml valid) 20 lsj: 112631 records (26922 of them are not xml valid)
20 */ 21 */
21 public class Lexica { 22 public class Lexica {
22 private static Lexica instance; 23 private static Lexica instance;
23 private static HashMap<String, Lexicon> localLexica = new HashMap<String, Lexicon>(); 24 private static HashMap<String, Lexicon> localLexica = new HashMap<String, Lexicon>();
25 private static HashMap<String, String[]> localLangLexiconNames = new HashMap<String, String[]>();
24 private static HashMap<String, Lexicon> remoteLexica = new HashMap<String, Lexicon>(); 26 private static HashMap<String, Lexicon> remoteLexica = new HashMap<String, Lexicon>();
25 27
26 public static Lexica getInstance() { 28 public static Lexica getInstance() {
27 if (instance == null) { 29 if (instance == null) {
28 instance = new Lexica(); 30 instance = new Lexica();
31 return instance; 33 return instance;
32 } 34 }
33 35
34 private void init() { 36 private void init() {
35 Lexicon autenrieth = new Lexicon("autenrieth", "el"); 37 Lexicon autenrieth = new Lexicon("autenrieth", "el");
36 autenrieth.setDescription("Autenrieth, a Homeric lexicon"); 38 autenrieth.setDescription("Autenrieth: A Homeric lexicon");
37 autenrieth.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0073:entry="); 39 autenrieth.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0073:entry=");
38 Lexicon baretti = new Lexicon("baretti", "it"); 40 Lexicon baretti = new Lexicon("baretti", "it");
39 baretti.setDescription("Baretti, a dictionary of the English and Italian languages"); 41 baretti.setDescription("Baretti: A dictionary of the English and Italian languages");
40 Lexicon bonitz = new Lexicon("bonitz", "el"); 42 Lexicon bonitz = new Lexicon("bonitz", "el");
41 bonitz.setDescription("Bonitz, index Aristotelicus"); 43 bonitz.setDescription("Bonitz: Index Aristotelicus");
42 Lexicon cooper = new Lexicon("cooper", "la"); 44 Lexicon cooper = new Lexicon("cooper", "la");
43 cooper.setDescription("Cooper, Thesaurus Linguae Romanae et Brittanicae"); 45 cooper.setDescription("Cooper: Thesaurus Linguae Romanae et Brittanicae");
44 Lexicon florio = new Lexicon("florio", "it"); 46 Lexicon florio = new Lexicon("florio", "it");
45 florio.setDescription("Florio, a worlde of wordes, or most copious, dictionarie in Italian and English"); 47 florio.setDescription("Florio: a worlde of wordes, or most copious, dictionarie in Italian and English");
46 Lexicon ls = new Lexicon("ls", "la"); 48 Lexicon ls = new Lexicon("ls", "la");
47 ls.setDescription("Lewis and Short, Latin dictionary"); 49 ls.setDescription("Lewis and Short: Latin dictionary");
48 ls.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0059:entry="); 50 ls.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0059:entry=");
49 Lexicon lsj = new Lexicon("lsj", "el"); 51 Lexicon lsj = new Lexicon("lsj", "el");
50 lsj.setDescription("Liddell-Scott-Jones, a Greek-English lexicon"); 52 lsj.setDescription("Liddell-Scott-Jones: A Greek-English lexicon");
51 lsj.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0057:entry="); 53 lsj.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0057:entry=");
52 Lexicon salmone = new Lexicon("salmone", "ar"); 54 Lexicon salmone = new Lexicon("salmone", "ar");
53 salmone.setDescription("Salmone, an advanced learner's Arabic-English dictionary"); 55 salmone.setDescription("Salmone: An advanced learner's Arabic-English dictionary");
54 salmone.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:2002.02.0005:entry="); 56 salmone.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:2002.02.0005:entry=");
55 Lexicon salmoneUnicode = new Lexicon("salmoneUnicode", "ar");
56 salmoneUnicode.setDescription("Salmone, an advanced learner's Arabic-English dictionary");
57 Lexicon webster = new Lexicon("webster", "en"); 57 Lexicon webster = new Lexicon("webster", "en");
58 webster.setDescription("Webster's revised unabridged dictionary (1913)"); 58 webster.setDescription("Webster's revised unabridged dictionary (1913)");
59 localLexica.put("autenrieth", autenrieth); 59 localLexica.put("autenrieth", autenrieth);
60 localLexica.put("baretti", baretti); 60 localLexica.put("baretti", baretti);
61 localLexica.put("bonitz", bonitz); 61 localLexica.put("bonitz", bonitz);
63 localLexica.put("florio", florio); 63 localLexica.put("florio", florio);
64 localLexica.put("ls", ls); 64 localLexica.put("ls", ls);
65 localLexica.put("lsj", lsj); 65 localLexica.put("lsj", lsj);
66 localLexica.put("salmone", salmone); 66 localLexica.put("salmone", salmone);
67 localLexica.put("webster", webster); 67 localLexica.put("webster", webster);
68 localLangLexiconNames = new HashMap<String, String[]>();
69 String[] arLangLexNames = {"salmone"};
70 localLangLexiconNames.put("ar", arLangLexNames);
71 String[] elLangLexNames = {"autenrieth", "bonitz", "lsj"};
72 localLangLexiconNames.put("el", elLangLexNames);
73 String[] enLangLexNames = {"webster"};
74 localLangLexiconNames.put("en", enLangLexNames);
75 String[] itLangLexNames = {"baretti", "florio"};
76 localLangLexiconNames.put("it", itLangLexNames);
77 String[] laLangLexNames = {"cooper", "ls"};
78 localLangLexiconNames.put("la", laLangLexNames);
68 Lexicon dwds = new Lexicon("dwds", "de"); 79 Lexicon dwds = new Lexicon("dwds", "de");
69 dwds.setDescription("Deutsches Wšrterbuch der deutschen Sprache"); 80 dwds.setDescription("DWDS: Deutsches Wšrterbuch der deutschen Sprache");
70 dwds.setQueryUrl("http://www.dwds.de/search/?qu="); 81 dwds.setQueryUrl("http://www.dwds.de/search/?qu=");
71 dwds.setType("remote"); 82 dwds.setType("remote");
83 Lexicon leoDE = new Lexicon("leoDE", "de");
84 leoDE.setDescription("LEO: German - English Dictionary");
85 leoDE.setQueryUrl("http://dict.leo.org/ende?lang=en&search=");
86 leoDE.setType("remote");
87 Lexicon dictLeipzigDE = new Lexicon("dictLeipzigDE", "de");
88 dictLeipzigDE.setDescription("UniversitŠt Leipzig: German - English Dictionary");
89 dictLeipzigDE.setQueryUrl("http://dict.uni-leipzig.de/index.php?wort=");
90 dictLeipzigDE.setType("remote");
91 Lexicon lingueeDE = new Lexicon("lingueeDE", "de");
92 lingueeDE.setDescription("Linguee: German - English Dictionary");
93 lingueeDE.setQueryUrl("http://www.linguee.de/deutsch-englisch/search?query=");
94 lingueeDE.setType("remote");
72 Lexicon slater = new Lexicon("slater", "el"); 95 Lexicon slater = new Lexicon("slater", "el");
73 slater.setDescription("William J. Slater, Lexicon to Pindar"); 96 slater.setDescription("William J. Slater: Lexicon to Pindar");
74 slater.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0072:entry="); 97 slater.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0072:entry=");
75 slater.setType("remote"); 98 slater.setType("remote");
99 Lexicon leoEN = new Lexicon("leoEN", "en");
100 leoEN.setDescription("LEO: German - English Dictionary");
101 leoEN.setQueryUrl("http://dict.leo.org/ende?lang=en&search=");
102 leoEN.setType("remote");
103 Lexicon lingueeEN = new Lexicon("lingueeEN", "en");
104 lingueeEN.setDescription("Linguee: German - English Dictionary");
105 lingueeEN.setQueryUrl("http://www.linguee.de/deutsch-englisch/search?query=");
106 lingueeEN.setType("remote");
107 Lexicon leoFR = new Lexicon("leoFR", "fr");
108 leoFR.setDescription("LEO: German - French Dictionary");
109 leoFR.setQueryUrl("http://dict.leo.org/frde?lang=en&search=");
110 leoFR.setType("remote");
76 Lexicon artflFr = new Lexicon("artfl-fr", "fr"); 111 Lexicon artflFr = new Lexicon("artfl-fr", "fr");
77 artflFr.setDescription("The ARTFL project: Dictionnaires d'autrefois: French dictionaries of the 17th, 18th, 19th and 20th centuries"); 112 artflFr.setDescription("The ARTFL project: Dictionnaires d'autrefois: French dictionaries of the 17th, 18th, 19th and 20th centuries");
78 artflFr.setQueryUrl("http://machaut.uchicago.edu/?resource=frengdict&amp;action=search&amp;french="); 113 artflFr.setQueryUrl("http://machaut.uchicago.edu/?resource=frengdict&amp;action=search&amp;french=");
79 artflFr.setType("remote"); 114 artflFr.setType("remote");
80 Lexicon artflFrEn = new Lexicon("artfl-fr-en", "fr"); 115 Lexicon artflFrEn = new Lexicon("artfl-fr-en", "fr");
81 artflFrEn.setDescription("The ARTFL project: French - English dictionary"); 116 artflFrEn.setDescription("The ARTFL project: French - English dictionary");
82 artflFrEn.setQueryUrl("http://artflx.uchicago.edu/cgi-bin/dicos/pubdico1look.pl?strippedhw="); 117 artflFrEn.setQueryUrl("http://artflx.uchicago.edu/cgi-bin/dicos/pubdico1look.pl?strippedhw=");
83 artflFrEn.setType("remote"); 118 artflFrEn.setType("remote");
119 Lexicon leoIT = new Lexicon("leoIT", "it");
120 leoIT.setDescription("LEO: German - Italian Dictionary");
121 leoIT.setQueryUrl("http://dict.leo.org/itde?lang=en&search=");
122 leoIT.setType("remote");
84 Lexicon lewis = new Lexicon("lewis", "la"); 123 Lexicon lewis = new Lexicon("lewis", "la");
85 lewis.setDescription("Charlton T. Lewis, an Elementary Latin Dictionary"); 124 lewis.setDescription("Charlton T. Lewis: An Elementary Latin Dictionary");
86 lewis.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0060:entry="); 125 lewis.setQueryUrl("http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0060:entry=");
87 lewis.setType("remote"); 126 lewis.setType("remote");
88 Lexicon wikiwoordenboek = new Lexicon("wikiwoordenboek", "nl"); 127 Lexicon wikiwoordenboek = new Lexicon("wikiwoordenboek", "nl");
89 wikiwoordenboek.setDescription("Wiktionary: WikiWoordenboek"); 128 wikiwoordenboek.setDescription("Wiktionary: WikiWoordenboek");
90 wikiwoordenboek.setQueryUrl("http://nl.wiktionary.org/wiki/"); 129 wikiwoordenboek.setQueryUrl("http://nl.wiktionary.org/wiki/");
91 wikiwoordenboek.setType("remote"); 130 wikiwoordenboek.setType("remote");
131 Lexicon leoCH = new Lexicon("leoCH", "ch");
132 leoCH.setDescription("LEO: German - Chinese Dictionary");
133 leoCH.setQueryUrl("http://dict.leo.org/chde?lang=en&search=");
134 leoCH.setType("remote");
92 Lexicon ctp = new Lexicon("ctp", "zh"); 135 Lexicon ctp = new Lexicon("ctp", "zh");
93 ctp.setDescription("Chinese Text Project"); 136 ctp.setDescription("Chinese Text Project: Chinese - English Dictionary");
94 ctp.setQueryUrl("http://ctext.org/dictionary.pl?if=en&amp;char="); 137 ctp.setQueryUrl("http://ctext.org/dictionary.pl?if=en&amp;char=");
95 ctp.setType("remote"); 138 ctp.setType("remote");
96 Lexicon linyutan = new Lexicon("linyutan", "zh"); 139 Lexicon linyutan = new Lexicon("linyutan", "zh");
97 linyutan.setDescription("Lin Yutang"); 140 linyutan.setDescription("Lin Yutang: Chinese - English Dictionary");
98 linyutan.setQueryUrl("http://humanum.arts.cuhk.edu.hk/cgi-bin/agrep-lindict?query="); 141 linyutan.setQueryUrl("http://humanum.arts.cuhk.edu.hk/cgi-bin/agrep-lindict?query=");
99 linyutan.setType("remote"); 142 linyutan.setType("remote");
100 Lexicon chineseUnicode = new Lexicon("chinese-unicode", "zh"); 143 Lexicon chineseUnicode = new Lexicon("chinese-unicode", "zh");
101 chineseUnicode.setDescription("Unicode"); 144 chineseUnicode.setDescription("Unicode.org: Chinese - English");
102 chineseUnicode.setQueryUrl("http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint="); 145 chineseUnicode.setQueryUrl("http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=");
103 chineseUnicode.setType("remote"); 146 chineseUnicode.setType("remote");
104 Lexicon chineseWiktionary = new Lexicon("chinese-wiktionary", "zh"); 147 Lexicon chineseWiktionary = new Lexicon("chinese-wiktionary", "zh");
105 chineseWiktionary.setDescription("Wiktionary"); 148 chineseWiktionary.setDescription("Wiktionary: Chinese - English");
106 chineseWiktionary.setQueryUrl("http://en.wiktionary.org/wiki/"); 149 chineseWiktionary.setQueryUrl("http://en.wiktionary.org/wiki/");
107 chineseWiktionary.setType("remote"); 150 chineseWiktionary.setType("remote");
108 remoteLexica.put("dwds", dwds); 151 remoteLexica.put("dwds", dwds);
152 remoteLexica.put("leoDE", leoDE);
153 remoteLexica.put("dictLeipzigDE", dictLeipzigDE);
154 remoteLexica.put("lingueeDE", lingueeDE);
109 remoteLexica.put("slater", slater); 155 remoteLexica.put("slater", slater);
156 remoteLexica.put("leoEN", leoEN);
157 remoteLexica.put("lingueeEN", lingueeEN);
158 remoteLexica.put("leoFR", leoFR);
110 remoteLexica.put("artfl-fr", artflFr); 159 remoteLexica.put("artfl-fr", artflFr);
111 remoteLexica.put("artfl-fr-en", artflFrEn); 160 remoteLexica.put("artfl-fr-en", artflFrEn);
161 remoteLexica.put("leoIT", leoIT);
112 remoteLexica.put("lewis", lewis); 162 remoteLexica.put("lewis", lewis);
113 remoteLexica.put("wikiwoordenboek", wikiwoordenboek); 163 remoteLexica.put("wikiwoordenboek", wikiwoordenboek);
114 remoteLexica.put("ctp", ctp); 164 remoteLexica.put("ctp", ctp);
165 remoteLexica.put("leoCH", leoCH);
115 remoteLexica.put("linyutan", linyutan); 166 remoteLexica.put("linyutan", linyutan);
116 remoteLexica.put("chinese-unicode", chineseUnicode); 167 remoteLexica.put("chinese-unicode", chineseUnicode);
117 remoteLexica.put("chinese-wiktionary", chineseWiktionary); 168 remoteLexica.put("chinese-wiktionary", chineseWiktionary);
118 } 169 }
119 170
140 } 191 }
141 } 192 }
142 return retLexicons; 193 return retLexicons;
143 } 194 }
144 195
196 public String[] getLocalLexiconNames(String lang) {
197 String language = Language.getInstance().getLanguageId(lang);
198 String[] retLexiconNames = localLangLexiconNames.get(language);
199 return retLexiconNames;
200 }
201
145 public ArrayList<Lexicon> getRemoteLexicons(String lang) { 202 public ArrayList<Lexicon> getRemoteLexicons(String lang) {
146 String language = Language.getInstance().getLanguageId(lang); 203 String language = Language.getInstance().getLanguageId(lang);
147 ArrayList<Lexicon> retLexicons = null; 204 ArrayList<Lexicon> retLexicons = null;
148 Set<String> keys = remoteLexica.keySet(); 205 Set<String> keys = remoteLexica.keySet();
149 Iterator<String> it = keys.iterator(); 206 Iterator<String> it = keys.iterator();
155 if (retLexicons == null) 212 if (retLexicons == null)
156 retLexicons = new ArrayList<Lexicon>(); 213 retLexicons = new ArrayList<Lexicon>();
157 retLexicons.add(lexicon); 214 retLexicons.add(lexicon);
158 } 215 }
159 } 216 }
217 if (retLexicons != null)
218 Collections.sort(retLexicons);
160 return retLexicons; 219 return retLexicons;
161 } 220 }
162 221
163 public ArrayList<Lexicon> getLexicons(String lang) { 222 public ArrayList<Lexicon> getLexicons(String lang) {
164 ArrayList<Lexicon> retLexicons = new ArrayList<Lexicon>(); 223 ArrayList<Lexicon> retLexicons = new ArrayList<Lexicon>();