dict.cc dictionary

DictIndex Class

Dictionary index

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

System.Object
   dict.DictIndex

[Visual Basic]
Public Class DictIndex
    Implements IDisposable
[C#]
public class DictIndex : IDisposable

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.

Remarks

The dictionary index contains a map of keywords to locations in the dict.cc dictionary file describing the keywords. The keywords are for example English keywords in the English-German dictionary. The location of the description of the keyword in the dictionary file is described in a DictEntryRef entry. Each keyword is mapped to an array of DictEntryRef entries, because one keyword is usually described by many lines in the dictionary file. The best example could be the description of English keywords like of or the, which may have several thousands corresponding descriptions (though the number of such description is limited in DictImport to DictImport.MAXENTRIES, usually a max. human acceptable number like 150 or so). The whole index is kept in the memory of the computer/device, what can be problematic on small PDA devices with a limited amount of memory. Therefore the internal memory representation of the index is more compilated. The map of the index keeps only keywords as keys, the values for each keyword are two integers: the starting index in a huge array of DictEntryRef entries and the number of these entries in the array. While looking for keywords both integers are retrieved from the memory and the array of DictEntryRef entries is then retrieved from the file. Using this array the program accesses then the dictionary file and reads the keyword descriptions from there. Thus searching may be also performed on limited memory devices, though few megabytes of RAM is required for the program to run.

The format of the index file from which the index is build is described by the method DictImport.saveIdx. Generally it consists of the map keyword - two integers on the top of the file. This map is read into the memory. Then the file contains the huge array of DictEntryRef entries. While reading the index file the class remembers the position of the beginning of this huge array in the file and then it recomputes the location of the DictEntryRef entries relatively to this position assuming, that each DictEntryRef entry occupies 6 bytes (one Int32 and one Int16) in it.

In GUI environments use DictIdxRdForm.rdIndex() rather than this class directly in order to create a dictionary index. The method creates a nice form with a progress bar while reading the index file. Reading of the index file on slow PDAs may take few (tenths) of seconds, so that showing a progress bar during the reading process is a must.

Requirements

Namespace: dict

Assembly: dict (in dict.exe)

See Also

DictIndex Members | dict Namespace | DictImport | DictIdxRdForm