aboutsummaryrefslogtreecommitdiff
path: root/srchr/src/corpus.rs
diff options
context:
space:
mode:
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]
- ))
- }
-}