dariogoetz / keyboard_layout_optimizer

A keyboard layout optimizer supporting multiple layers. Implemented in Rust.
https://dariogoetz.github.io/keyboard_layout_optimizer/
GNU General Public License v3.0
92 stars 18 forks source link

Total number of found ngrams changes after splitting modifiers #30

Closed Glitchy-Tozier closed 2 years ago

Glitchy-Tozier commented 2 years ago

Splitting of ngrams changes number of found ngrams

This for example forced https://github.com/dariogoetz/keyboard_layout_optimizer/pull/31/commits/276d0d4e55cc337c8459f1c704839e1cdc1cf23b to be necessary.

Example: (the first number is the count before splitting, the second number is after the splitting.)

Edit: Actually, it might make sense this way. I'm slightly confused.

uni 108783127.16766545
uni 115993432.49160336

tri 108134291.69376425
tri 158193331.2444684

bi 108458004.65033875
bi 140483393.64971808

uni 108783127.16766545
uni 115993432.49160337

tri 108134291.69376425
tri 158195158.18040243

bi 108458004.65033875
bi 140483393.649718

[2022-04-01T20:35:22Z INFO  layout_optimization_sa::optimization] Process   0: Starting layout: .czjöqfsäxwt,lngmdiüyßbuaeoprhkv ( 643.6)
uni 108783127.16766545
uni 115993432.49160343

tri 108134291.69376425
tri 158193343.21547225

bi 108458004.65033875
bi 140483393.64971817

uni 108783127.16766545
uni 115993432.49160343

tri 108134291.69376425
tri 158186184.70580426

bi 108458004.65033875
bi 140482049.10099033

uni 108783127.16766545
uni 115993432.49160337
dariogoetz commented 2 years ago

This is not a bug. Modifier splitting takes an n-gram with "higher-layer" symbols and generates multiple new ones with symbols solely on the base layer. The sum of their weights is not necessarily equal to the "starting weight".