Description

Dictionary representation of Trie

Package Information

Version1.0.2 (2015-Dec-03)
Repository https://github.com/IshitaTakeshi/DTrie
LicenseMIT
CopyrightCopyright © 2015, Ishita Takeshi
AuthorsIshita Takeshi
Registered byIshitaTakeshi
Dependencies none

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

DTrie

The dictionary representation of the Trie data structure.

Usage

import dtrie;

auto dictionary = new DTrie!(T)(keys, values);
assert(dictionary[keys[0]] == [values[0]]);

Where T is the type of an element of values.

Examples

import dtrie;

auto dictionary = new DTrie!string(["Win", "hot"], ["Lose", "cold"]);
assert(dictionary["Win"] == ["Lose"]);
assert(dictionary["hot"] == ["cold"]);
dictionary["won"];  //KeyError

Multi-byte strings are available.

import dtrie;

string[] keys = [
    "あけます", "あけます",
    "あけました", "あけました",
];

string[] values = [
    "開けます", "明けます",
    "開けました", "明けました",
];

auto dictionary = new DTrie!(string)(keys, values);

//"あけます" is associated to "開けます" and "明けます"
assert(dictionary["あけます"] == ["開けます", "明けます"]);

//"あけました" is associated  to "開けました" and "明けました"
assert(dictionary["あけました"] == ["開けました", "明けました"]);

Build options

  • Running Tests

$dub test
  • Generating documentations

$dub build --build=docs

Available versions

1.0.2 1.0.1 1.0.0 ~master