comparison software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/lt/lex/db/LexHandler.java @ 6:2396a569e446

new functions: externalObjects, normalizer, Unicode2Betacode
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Tue, 08 Feb 2011 14:54:09 +0100
parents 408254cf2f1d
children
comparison
equal deleted inserted replaced
5:94305c504178 6:2396a569e446
57 Lemma l = formLemmas.get(j); 57 Lemma l = formLemmas.get(j);
58 String lName = l.getLemmaName(); 58 String lName = l.getLemmaName();
59 if (! hasLexEntry) { 59 if (! hasLexEntry) {
60 hasLexEntry = hasLexEntryKey(lName, language); 60 hasLexEntry = hasLexEntryKey(lName, language);
61 } 61 }
62 if (language.equals("de") || language.equals("fr") || language.equals("nl")) // TODO Lexika für diese Sprachen in BerkeleyDB einbringen (für frund nl auch eine bessere Morph.) und dann diese Zeilen wieder löschen
63 lexEntryKeys.add(lName);
62 if (! lName.equals(formName) && hasLexEntry) { 64 if (! lName.equals(formName) && hasLexEntry) {
63 lexEntryKeys.add(lName); 65 lexEntryKeys.add(lName);
64 } 66 }
65 } 67 }
66 } 68 }
70 return lexEntryKeys; 72 return lexEntryKeys;
71 } 73 }
72 74
73 public boolean hasLexEntryKey(String formName, String language) throws ApplicationException { 75 public boolean hasLexEntryKey(String formName, String language) throws ApplicationException {
74 boolean hasLexEntry = false; 76 boolean hasLexEntry = false;
77 if (language.equals("zh")) // jedes chin. einzelne Zeichen hat autom. immer einen Lexikoneintrag
78 return true;
75 ArrayList<Lexicon> statLexicons = Lexica.getInstance().getLexicons(language); 79 ArrayList<Lexicon> statLexicons = Lexica.getInstance().getLexicons(language);
76 if (statLexicons != null) { 80 if (statLexicons != null) {
77 for (int i=0; i<statLexicons.size(); i++) { 81 for (int i=0; i<statLexicons.size(); i++) {
78 Lexicon lexicon = statLexicons.get(i).clone(); // clone without lexicon entries 82 Lexicon lexicon = statLexicons.get(i).clone(); // clone without lexicon entries
79 LexiconEntry lexEntry = readEntry(lexicon.getName(), formName); 83 LexiconEntry lexEntry = readEntry(lexicon.getName(), formName);
116 Transcoder transcoder = Transcoder.getInstance(); 120 Transcoder transcoder = Transcoder.getInstance();
117 if (fromEncoding.equals("buckwalter") && toEncoding.equals("unicode")) { 121 if (fromEncoding.equals("buckwalter") && toEncoding.equals("unicode")) {
118 encodedStr = transcoder.transcodeFromBuckwalter2Unicode(inputStr); 122 encodedStr = transcoder.transcodeFromBuckwalter2Unicode(inputStr);
119 } else if (fromEncoding.equals("betacode") && toEncoding.equals("unicode")) { 123 } else if (fromEncoding.equals("betacode") && toEncoding.equals("unicode")) {
120 encodedStr = transcoder.transcodeFromBetaCode2Unicode(inputStr); 124 encodedStr = transcoder.transcodeFromBetaCode2Unicode(inputStr);
125 } else if (fromEncoding.equals("unicode") && toEncoding.equals("betacode")) {
126 encodedStr = transcoder.transcodeFromUnicode2BetaCode(inputStr);
127 } else if (fromEncoding.equals("unicode") && toEncoding.equals("buckwalter")) {
128 encodedStr = transcoder.transcodeFromUnicode2Buckwalter(inputStr);
121 } 129 }
122 return encodedStr; 130 return encodedStr;
123 } 131 }
124 132
125 public static void main(String[] args) throws ApplicationException { 133 public static void main(String[] args) throws ApplicationException {