aboutsummaryrefslogtreecommitdiff
path: root/srchr/src/corpus.rs
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2022-10-23 13:38:28 +0200
committertslil clingman <tslil@posteo.de>2022-10-23 13:38:28 +0200
commit13e282705df90829ac39b75efde47e84e35cc1b1 (patch)
treee88a0799573a035f6ee1e095c218b19c167872c9 /srchr/src/corpus.rs
parent6db23c417ea59dd9b9b928f022d40e20b80d2e67 (diff)
enhanced pre-layout -> layout algorithm
Diffstat (limited to 'srchr/src/corpus.rs')
-rw-r--r--srchr/src/corpus.rs35
1 files changed, 0 insertions, 35 deletions
diff --git a/srchr/src/corpus.rs b/srchr/src/corpus.rs
index 846f611..bc6813e 100644
--- a/srchr/src/corpus.rs
+++ b/srchr/src/corpus.rs
@@ -1,4 +1,3 @@
-use std::fmt;
use std::fs;
use crate::config::*;
@@ -152,37 +151,3 @@ impl Corpus {
});
}
}
-
-fn dump_bigrams(corpus: &Corpus) -> Vec<(String, f32)> {
- let mut result: Vec<(String, f32)> = Vec::new();
-
- for &x in KEY_CHARS.iter() {
- for &y in KEY_CHARS.iter() {
- let mut pair = String::from(x);
- pair.push(y);
- let perc = corpus.bigram_percs[pair_to_index(x as u8, y as u8)];
- if perc > 0.0 {
- result.push((pair, perc));
- }
- }
- }
-
- result.sort_by(|(_, c1), (_, c2)| {
- if c2 < c1 {
- std::cmp::Ordering::Less
- } else {
- std::cmp::Ordering::Greater
- }
- });
-
- return result;
-}
-
-impl fmt::Display for Corpus {
- fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- formatter.write_str(&format!(
- "Corpus has top 5 bigrams {:?}",
- &dump_bigrams(self)[0..5]
- ))
- }
-}