Module indexing

Module indexing 

Source
Expand description

Parse and decode *.index files.

Each dictionary file (*.dict.dz)) is accompanied by a *.index file containing a list of words, together with its (byte) position in the dict file and its (byte) length. This module provides functions to parse this index file.

The position and the length of a definition is given in a semi-base64 encoding. It uses all Latin letters (upper and lower case), all digits and additionally, + and /:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

The calculation works as follows: sum += x * 64^i

  • i is the position within the string to calculate the number from and counts from right to left, starting at 0.
  • x is the index within the array given above, i.e. 'a' == 26.

The sum makes up the index.

Structs§

Entry
Index
The index is partially loaded if state isn’t None.

Traits§

IndexReader

Functions§

decode_number
Decode a number from a given String.
get_base 🔒
Get the assigned number for a character If the character was unknown, an empty Err(()) is returned.
normalize 🔒
parse_index
Parse the index for a dictionary from a given BufRead compatible object. When lazy is true, the loop stops once all the metadata entries are parsed.
parse_index_from_file
Parse the index for a dictionary from a given path.
parse_line 🔒
Parse a single line from the index file.