2017 © Pedro Peláez
 

library trie

A package to facilitate usage of the TRIE data structure

image

cal7/trie

A package to facilitate usage of the TRIE data structure

  • Tuesday, January 31, 2017
  • by Cal7
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

php-trie

A PHP package to facilitate usage of the trie data structure., (*1)

Allows the insertion and lookup of words, generation from a text file, and a search feature for Scrabble-like games, (*2)

Word insertion

Word insertion is as easy as:, (*3)

$trie = new Trie();
$trie->addWord("example");

Or if you have a text file containing a list of words (each on a newline), either locally or online, you can use:, (*4)

$trie1 = Trie::fromTextFile("/local/path/to/file.txt");
$trie2 = Trie::fromTextFile("https://example.com/file.txt");

Word finding

This package offers a feature useful for many Scrabble-related applications - word finding. The following snippet showcases this:, (*5)

$trie = new Trie();
$trie->addWords([
  "example",
  "test",
  "tested",
  "testing"
]);
$letters = ["t", "e", "s", "t"];
$wildcardCount = 2; //represents a "blank" tile in the game of Scrabble
$trie->findWords($letters, $wildcardCount); //returns ["test", "tested"]

The Versions

31/01 2017

dev-master

9999999-dev https://github.com/cal7/php-trie

A package to facilitate usage of the TRIE data structure

  Sources   Download

MIT

The Requires

  • php ^7.0

 

by Callum Browne