This is my personal fork of xsznix/keygen that I refactored for my personal use. I added a few penalties (notably for detached same-finger bigrams) and added multithreading via the rayon crate.
You should start by reading the readme of the original project here.
To install keygen locally, run
git clone https://github.com/bR3iN/keygen
cd keygen
cargo install --path .
and make sure that ~/.cargo/bin/
is in your path.
To run keygen without installing it first, use cargo run --
from
inside this repository instead of keygen
.
The penalties are explained and configured at the top of src/penalty.rs
. After changing these, you have to reinstall keygen
if you've installed it locally.
The command keygen
(or cargo run --
if you proceeded without local
installation) takes two mandatory arguments. The second one is the
path to the text corpus to penalize against (for example ./corpus/books.short.txt
). The first argument is one
of the following.
Refines an existing layout by determining the best layout obtained by
swapping up to n
keys. This process is repeated until no better
layout is found and the obtained layout is written to
refined.layout
.
n
is 2 by default and can be changed via the -s|--swaps-per-iteration
option.
The starting layout is the one defined via the INIT_LAYOUT
variable in
src/penalty.rs
but can be changed at runtime by passing a file containing
the layout to the -l|--layout
option.
The format used inside this file has to be the same as in the output files generated by keygen
, see ./mroi.layout
for a reference.
To write the resulting layout to another file than refined.layout
, use the -o|--output
option.
Runs Carpalx's simulated annealing algorithm. The best layout found along the way (not necessarily the last) is saved to winner.layout
.
If a positive integer is passed to the -r|--repetitions
option, this algorithm is repeated that amount of times (with the same starting layout) and only the best layout among all repetitions is saved.
The maximal number of swaps per iteration as well as the starting layout and the output's filename are configured with the same options as for refine
above.
Analyzes a few hardcoded reference layout as well as the starting layout for refine
and run
and prints the result to the screen. Recall that the starting layout is either configured via the INIT_LAYOUT
variable in src/penalty.rs
or via the -l
option at runtime.
Searches for an analyze
directory in the current path. If found, all files inside are interpreted as layouts and are penalized and printed to the screen.
Useful for comparing multiple user-defined layouts.
The simulated annealing algorithm and corpus are taken from Carpalx by Martin Krzywinski.
The original keygen project is by xsznix and can be found here
MIT