[Golang] Succinct Trie Implementation
Bits.js ([1]) implements a succinct trie for fast lookup of words in a large dictionary and does not take much space at the same time. I have an application which has about 200,000+ words to be encoded. It takes a lot of time (over 30 minutes) to finish the job, so I decided to re-implement the succinct trie in Golang. The result [2] is great. It takes less than 2 minutes to finish encoding the words. This post shows you how to use the Go implementation of succinct trie.
The following code gives an example of encoding and decoding:
Note that you must include space " " in your alphabet if default alphabet is not used. The default alphabet is [a-z ].
References:
[1] | Succinct Data Structures: Cramming 80,000 words into a Javascript file. (source code) |
[2] | siongui/go-succinct-data-structure-trie: Succinct Trie in Go - GitHub |
[3] | [JavaScript] Bug in Succinct Trie Implementation of Bits.js |