diff options
| author | tslil clingman <tslil@posteo.de> | 2022-10-17 23:13:48 +0200 |
|---|---|---|
| committer | tslil clingman <tslil@posteo.de> | 2022-10-20 22:41:12 +0200 |
| commit | aa55ddbbf13ea8b2a259ad7a07490efe9dda57f5 (patch) | |
| tree | 8c9ea4eca46c3f1a4630933cc8e5531947f37c1d /srchr/src | |
| parent | f3f8aa54db89283e1d92f798ba185162ce737e34 (diff) | |
correct skipgram computation
Diffstat (limited to 'srchr/src')
| -rw-r--r-- | srchr/src/config.rs | 22 | ||||
| -rw-r--r-- | srchr/src/corpus.rs | 2 | ||||
| -rw-r--r-- | srchr/src/evaluation.rs | 41 | ||||
| -rw-r--r-- | srchr/src/layout.rs | 2 |
4 files changed, 54 insertions, 13 deletions
diff --git a/srchr/src/config.rs b/srchr/src/config.rs index 2633a71..5bb35c5 100644 --- a/srchr/src/config.rs +++ b/srchr/src/config.rs @@ -1,19 +1,18 @@ // With the below parameters and the supplied corpus searches seem to converge on a few layouts, with one of the better ones being - -// V L O M Q P F U H , +// V L O M Z P F U H , // S R A T K Y C E N I -// Z X / D J G W ' B . +// X J / D Q G W ' B . // Percent per key: -// 0.92 3.96 7.42 2.57 0.10 1.62 2.10 2.77 5.94 1.78 +// 0.92 3.96 7.42 2.57 0.06 1.62 2.10 2.77 5.94 1.78 // 6.03 5.56 7.74 8.60 0.77 1.99 2.35 11.90 6.62 6.68 -// 0.06 0.15 0.14 4.25 0.15 1.93 2.27 1.00 1.50 1.14 +// 0.15 0.15 0.14 4.25 0.10 1.93 2.27 1.00 1.50 1.14 // -// Finger usage: 7.02%, 9.66%, 15.30%, 16.44%, 12.25%, 15.67%, 14.06%, 9.61% +// Finger usage: 7.10%, 9.66%, 15.30%, 16.36%, 12.25%, 15.67%, 14.06%, 9.61% // Hand usage: 48.42% vs 51.58% -// SFB distribution : 0.001%, 0.087%, 0.089%, 0.047%, 0.104%, 0.197%, 0.044%, 0.024% -// DSFB distribution: 0.147%, 0.431%, 0.615%, 0.999%, 0.208%, 0.997%, 1.102%, 0.408% -// Total sfb: 0.594% (49972) -// Total dsfb: 4.906% (412768) +// SFB distribution : 0.002%, 0.088%, 0.089%, 0.047%, 0.104%, 0.197%, 0.044%, 0.024% +// DSFB distribution: 0.166%, 0.402%, 0.614%, 1.302%, 0.761%, 0.985%, 1.101%, 0.405% +// Total sfb: 0.595% (50086) +// Total dsfb: 5.736% (482638) // ----------------------------------------------------------------------------- // Tweak @@ -34,7 +33,8 @@ pub const MAX_NUM_TRANSPOSITIONS: usize = 12; // Fitness parameters pub const DESIRED_INDEX_USAGE_PERCENT: f32 = 0.12; -pub const STANDARD_DSFB_WEIGHT: f32 = 1.0 / 32.0; +pub const STANDARD_DSFB_WEIGHT: f32 = 1.0 / 8.0; +pub const INDEX_DSFB_WEIGHT: f32 = 1.0 / 8.0; pub fn index_usage_fitness(total_count: u32, index_count: u32) -> f32 { let index_perc = index_count as f32 / total_count as f32; if index_perc < DESIRED_INDEX_USAGE_PERCENT { diff --git a/srchr/src/corpus.rs b/srchr/src/corpus.rs index 4428bc6..7216b1a 100644 --- a/srchr/src/corpus.rs +++ b/srchr/src/corpus.rs @@ -68,7 +68,7 @@ impl Corpus { if let Some(c) = current_char { if let Some(lc) = last_char { if let Some(llc) = last_last_char { - if llc != c { + if llc != lc && lc != c && llc != c { skipgram_count[pair_to_index(llc, c)] += 1; skipgram_count[pair_to_index(c, llc)] += 1; } diff --git a/srchr/src/evaluation.rs b/srchr/src/evaluation.rs index a855d89..1c40b44 100644 --- a/srchr/src/evaluation.rs +++ b/srchr/src/evaluation.rs @@ -51,6 +51,23 @@ pub fn prelayout_fitness(corpus: &Corpus, layout: &Prelayout) -> f32 { + corpus.get_bigram_perc(k3, k4) + corpus.get_bigram_perc(k3, k5) + corpus.get_bigram_perc(k3, k6); + + score += (corpus.get_skipgram_perc(k1, k2) + + corpus.get_skipgram_perc(k1, k3) + + corpus.get_skipgram_perc(k2, k3) + + corpus.get_skipgram_perc(k4, k5) + + corpus.get_skipgram_perc(k4, k6) + + corpus.get_skipgram_perc(k5, k6) + + corpus.get_skipgram_perc(k1, k4) + + corpus.get_skipgram_perc(k1, k5) + + corpus.get_skipgram_perc(k1, k6) + + corpus.get_skipgram_perc(k2, k4) + + corpus.get_skipgram_perc(k2, k5) + + corpus.get_skipgram_perc(k2, k6) + + corpus.get_skipgram_perc(k3, k4) + + corpus.get_skipgram_perc(k3, k5) + + corpus.get_skipgram_perc(k3, k6)) + * INDEX_DSFB_WEIGHT; } score @@ -105,6 +122,18 @@ impl Evaluation { + corpus.get_bigram_perc(k3, k4) + corpus.get_bigram_perc(k3, k5) + corpus.get_bigram_perc(k3, k6); + dsfb[i] += corpus.get_skipgram_perc(k4, k5) + + corpus.get_skipgram_perc(k4, k6) + + corpus.get_skipgram_perc(k5, k6) + + corpus.get_skipgram_perc(k1, k4) + + corpus.get_skipgram_perc(k1, k5) + + corpus.get_skipgram_perc(k1, k6) + + corpus.get_skipgram_perc(k2, k4) + + corpus.get_skipgram_perc(k2, k5) + + corpus.get_skipgram_perc(k2, k6) + + corpus.get_skipgram_perc(k3, k4) + + corpus.get_skipgram_perc(k3, k5) + + corpus.get_skipgram_perc(k3, k6); } else if i == 4 { let k4 = layout.get_key(5 + 10 * 0); let k5 = layout.get_key(5 + 10 * 1); @@ -121,6 +150,18 @@ impl Evaluation { + corpus.get_bigram_perc(k3, k4) + corpus.get_bigram_perc(k3, k5) + corpus.get_bigram_perc(k3, k6); + dsfb[i] += corpus.get_skipgram_perc(k4, k5) + + corpus.get_skipgram_perc(k4, k6) + + corpus.get_skipgram_perc(k5, k6) + + corpus.get_skipgram_perc(k1, k4) + + corpus.get_skipgram_perc(k1, k5) + + corpus.get_skipgram_perc(k1, k6) + + corpus.get_skipgram_perc(k2, k4) + + corpus.get_skipgram_perc(k2, k5) + + corpus.get_skipgram_perc(k2, k6) + + corpus.get_skipgram_perc(k3, k4) + + corpus.get_skipgram_perc(k3, k5) + + corpus.get_skipgram_perc(k3, k6); } } diff --git a/srchr/src/layout.rs b/srchr/src/layout.rs index 841c085..81cfd9b 100644 --- a/srchr/src/layout.rs +++ b/srchr/src/layout.rs @@ -128,8 +128,8 @@ impl Layout { wcol.sort_by(|(_, l), (_, r)| r.cmp(l)); wcol.swap(0, 1); if N == 6 { - wcol.swap(3, 4); wcol.swap(0, 2); + wcol.swap(3, 4); wcol.swap(3, 5); } (wcol.into_iter().map(|(k, _)| k as u8).collect(), weight) |
