This is a Rust port of the original ArmaMagna C++ anagrammer engine.
🔗 Original C++ implementation (GitHub):
https://github.com/merhametsize/armamagna
The Rust port uses the exact architecture of the C++ version, while leveraging Rust’s memory safety, fearless concurrency etc etc.
- Phrase anagram support: Solves anagrams for entire phrases, ignoring spaces and punctuation within the input text.
- Filter by substring (-i/--incl): Allows users to specify a word or phrase that must be present in the final anagram. This drastically reduces computation time.
- Constraints: Provides control over the anagram structure via two mandatory parameters:
- Cardinality: Minimum and maximum total number of words in the resulting anagram (--mincard, --maxcard).
- Unicode normalization: Uses the
unicode-normalizationpackage to normalize accented characters (e.g., é, è, ê are all treated as the base letter e).
- Rust development environment.
-
Clone the repository:
git clone https://github.com/merhametsize/armamagna-rs.git cd armamagna-rs -
Build (Release Mode): This preset applies
opt-level = 3anddebug = falsefor maximum performance.cargo build --release
The executable is located at
./target/release/armamagna. -
Build (Debug Mode): This preset enables overflow checks and debug symbols.
cargo build
The executable is located at
./target/debug/armamagna.
./armamagna <text_to_anagram> -d <dictionary_path> --mincard <min_words> --maxcard <max_words> [optional_flags]For example:
./armamagna "sator arepo tenet opera rotas" -d ../../data/it.txt -i "trota" --mincard 1 --maxcard 3 -t 4 [optional_flags]