My first thought would be “DAWG”. That’s a smart way to represent a trie, with identical ‘tail’ ends of the trie merged into one. https://www.cs.cmu.edu/afs/cs/academic/class/15451-s06/www/l... compresses a 780k word list into 175k. That’s about 22% of the size. This accomplishes 27%. This list is a lot shorter, so there will be fewer opportunities for savings. On the other hand, all words are five letters, so the ‘i…
I based my approach on http://www.wutka.com/dawg.html and http://stevehanov.ca/blog/?id=115.
I generated a DAWG with 12,822 nodes, which means you need 14 bits for each pointer. A trie representation can be packed much smaller because you don't need to randomly jump around the graph, you can just read it out sequentially.
With huffman coded labels and offsets, I got the size down to approximately:
- 94,761 bits for offsets. - 56,900 bits for labels. - 12,822 bits for indicating when you're at the end of a next chain.
= 164,483 bits + Size of Huffman Table = ~20,560 bytes
I assumed I didn't need any bits for indicating end of word, because all Wordle words are length 5.
Meanwhile, bitpacked trie can get down to 15,599 bytes.
https://github.com/adamcw/wordle-trie-packing#all-words
It's not clear to me a path that will compress the DAWG so much that it could cut another 5000 bytes and whatever the Huffman table size is.