Skip to content

jakergrossman/trie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trie

implementation of a Trie/Prefix Tree

Requirements

Building Examples

Use the build script ./build-example.sh to create example binaries with SBCL:

$ ./build-example.sh graph  # build the executable 'graph' in the repository root.

Examples

NCURSES Prediction (prediction.lisp)

Loads a dictionary file and presents a list of autocomplete suggestions using the user input as the prefix to search for.

$ ./build-example.sh prediction      # build 'prediction' executable
$ ./prediction --dict dict/long.txt  # run the demo using 'dict/long.txt' as the dictionary

Then, type to see autocomplete suggestions for the current input.

Use Escape to exit, and Enter to reset input.

prediction demo with the controls, input, and completion information

Graphviz DOT File (graph.lisp)

Additional Requirements

  • Graphviz

Prints a DOT language representation of the input dictionary to standard output.

$ ./build-example.sh graph.lisp  # build 'graph' executable
$ ./graph $filename > trie.dot   # using `filename` as input, save DOT output to 'trie.dot'
$ dot -Tsvg trie.dot -O          # create SVG using 'trie.dot' as input

Input (included in dict/short.txt):

Helper
Helium
Hello
Fry
Barium
Baritone
Bass

Output

Individual words highlighted for clarity

Prefix tree for specified input

About

Implementation of a Trie or Prefix Tree in Common Lisp.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published