This repo is an informal collection of functions that (attempt to) check whether a given list of code words is uniquely decodable.
Note: If you're just looking to check if a word list is uniquely decodable, I'd point you to my Word List Auditor tool.
I think that best way to do check if a list is uniquely decodable is to implement the Sardinas–Patterson algorithm, but it might not be the only way?
So far this project includes two implementations of Sardinas-Patterson:
src/schlinkert.rs
)src/colfenor_rodeh.rs
). Seems to be very fast detecting if a list is not uniquely decodable, but struggles with longer (8,000-word) uniquely decodable lists?cargo test
This project uses Criterion.rs v0.5 to benchmark.
cargo bench
FYI running all benchmarks can take a few minutes, depending on which are commented in and out.
I 100% welcome and encourage you to contribute to this project, either with your own implementation of Sardinas-Patterson, or some other way of checking for unique decodability. See the current modules for requirements.