dict.cc dictionary

DictImport Class

Used for dictionary index file creation

For a list of all members of this type, see DictImport Members.


[Visual Basic]
Public Class DictImport
    Implements IDisposable, IDictParserHandler
public class DictImport : IDisposable, IDictParserHandler

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.


Use this class in order to create a dictionary index file (http://www1.dict.cc/translation_file_request.php). The index creation, started in the method start() in createproc() uses the dictionary parse DictParser, which extracts the keywords from the dictionary file. Each keyword is checked using the regular expression MUSTMATCH, if it is suitable for use as the dictionary keyword. Generally only keywords consistiong of at least two letters are accepted, remaining keywords are ignored. The keywords are then collected as keys in a local map, the values for each keys are offsets and lengths in bytes of the locations in the dict.cc dictionary file, where the keywords are explained. The dictionary file from dict.cc is in a huge part a free text file, so than many keywords, like for example the English the or of may easyly have several thousands explanations. In order to limit the amount of translations to a human acceptable level, the class accepts max. MAXENTRIES (150) explanations for one keyword, the remaining explanations are slightly ignored. See also the description of the class DictParser for more details of the expected format of the dictionary file and the description of the method DictImport.saveIdx() for more details on the format of the dictionary index file created here. The index files created in DictImport.saveIdx() may be used for instantationg the dictionary index objects DictIndex used for querying the dictionary.


The following example creates a dictionary index file from a dictionary file obtained from dict.cc: c:\temp\engdeu.idx from a dictionary file c:\temp\engdeu.txt obtained from dict.cc:

using dict;
using System;
public class Import : IProgress {
  public void progress(int perc) {
    Console.WriteLine("Imported {0} percents", perc);
  public void ready(string message) {
    if (message != null) Console.WriteLine(message);
    Console.WriteLine("Ready, press ENTER to exit");
  public Import(string dictfile, string idxfile) {
    DictImport imp;
    imp = new DictImport(this, dictfile, idxfile);
    Console.WriteLine("Wait until ready or press ENTER to break");
    if (imp.lastexcp != null) Console.Writeline(imp.lastexcp);
  public static void Main() {
    new Import(@"c:\temp\engdeu.txt", @"c:\temp\engdeu.idx");


Namespace: dict

Assembly: dict (in dict.exe)

See Also

DictImport Members | dict Namespace | DictParser | DictIndex