import java.io.IOException;
import java.io.PrintWriter;
import java.io.RandomAccessFile;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
import com.hughes.android.dictionary.DictionaryInfo;
-import com.hughes.android.dictionary.engine.Index.IndexEntry;
public class CheckDictionariesMain {
static final String BASE_URL = "http://quickdic-dictionary.googlecode.com/files/";
- static final String VERSION_CODE = "v002";
+ static final String VERSION_CODE = "v003";
public static void main(String[] args) throws IOException {
final File dictDir = new File(DictionaryBuilderMain.OUTPUTS);
}
System.out.println(dictFile.getPath());
- final DictionaryInfo dictionaryInfo = new DictionaryInfo();
final RandomAccessFile raf = new RandomAccessFile(dictFile, "r");
final Dictionary dict = new Dictionary(raf);
-
+
+ final DictionaryInfo dictionaryInfo = dict.getDictionaryInfo();
+
dictionaryInfo.uncompressedFilename = dictFile.getName();
dictionaryInfo.downloadUrl = BASE_URL + dictFile.getName() + "." + VERSION_CODE + ".zip";
// TODO: zip it right here....
- dictionaryInfo.creationMillis = dict.creationMillis;
dictionaryInfo.uncompressedSize = dictFile.length();
// Print it.
// Find the stats.
System.out.println("Stats...");
- for (int i = 0; i < 2; ++i) {
- dictionaryInfo.langIsos[i] = dict.indices.get(i).sortLanguage.getIsoCode();
- final Index index = dict.indices.get(i);
- for (final IndexEntry indexEntry : index.sortedIndexEntries) {
- final TokenRow tokenRow = (TokenRow) index.rows.get(indexEntry.startRow);
- dictionaryInfo.allTokenCounts[i]++;
- if (tokenRow.hasMainEntry) {
- dictionaryInfo.mainTokenCounts[i]++;
- }
- }
- }
+ final String row = dictionaryInfo.append(new StringBuilder()).toString();
+ System.out.println(row + "\n");
+
+ dictionaryInfoOut.println(row);
+ dictionaryInfoOut.flush();
raf.close();
- dictionaryInfoOut.println(dictionaryInfo.toTabSeparatedString());
- dictionaryInfoOut.flush();
- System.out.println(dictionaryInfo.toTabSeparatedString() + "\n");
}
dictionaryInfoOut.close();
// isoToWikiName.keySet().retainAll(Arrays.asList("UK", "HR", "FI"));
//isoToWikiName.clear();
- boolean go = true;
+ boolean go = false;
for (final String foreignIso : isoToWikiName.keySet()) {
- if (foreignIso.equals("SK")) {
+ if (foreignIso.equals("blah")) {
go = true;
}
if (!go) {
} // foreignIso
- final String dictFile = String.format("%s/DE-EN_chemnitz_enwiktionary.%s.quickdic", OUTPUTS);
+ final String dictFile = String.format("%s/DE-EN_chemnitz_enwiktionary.quickdic", OUTPUTS);
DictionaryBuilder.main(new String[] {
"--dictOut=" + dictFile,
"--lang1=DE",
public void build() {
final Set<IndexedEntry> tokenEntryDatas = new HashSet<IndexedEntry>();
final List<RowBase> rows = index.rows;
+ index.mainTokenCount = 0;
for (final TokenData tokenData : tokenToData.values()) {
tokenEntryDatas.clear();
final int indexIndex = index.sortedIndexEntries.size();
final int startRow = rows.size();
- rows.add(new TokenRow(indexIndex, rows.size(), index, tokenData.hasMainEntry));
+ final TokenRow tokenRow = new TokenRow(indexIndex, rows.size(), index, tokenData.hasMainEntry);
+ rows.add(tokenRow);
+ if (tokenRow.hasMainEntry) {
+ index.mainTokenCount++;
+ }
// System.out.println("Added TokenRow: " + rows.get(rows.size() - 1));
int numRows = 0;
// System.out.println("TOKEN: " + tokenData.token);
appendAndIndexWikiCallback.builder.append("|");
appendAndIndexWikiCallback.dispatch(entry.getKey(), null, null);
appendAndIndexWikiCallback.builder.append("=");
- appendAndIndexWikiCallback.dispatch(entry.getValue(), null, null);
+ EntryTypeName entryTypeName = null;
+ IndexBuilder indexBuilder = null;
+ // This doesn't work: we'd need to add to word-forms.
+// System.out.println(entry.getKey());
+// if (entry.getKey().equals("tr")) {
+// entryTypeName = EntryTypeName.WIKTIONARY_TRANSLITERATION;
+// indexBuilder = appendAndIndexWikiCallback.parser.foreignIndexBuilder;
+// }
+ appendAndIndexWikiCallback.dispatch(entry.getValue(), indexBuilder, entryTypeName);
}
}