From 3dc9219ea23017f1fae06671d3a2a335b85ba89b Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 20 Nov 2023 14:03:07 +0100 Subject: [PATCH] feat: allow to print chances but censored --- src/counter.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/counter.rs b/src/counter.rs index b676423..6e12cd0 100644 --- a/src/counter.rs +++ b/src/counter.rs @@ -16,8 +16,15 @@ fn main() { probabilities.sort_by_key(|x| x.1); + let censored = std::env::args().nth(1).as_deref().unwrap_or("") == "--censored"; + println!("{{"); for (line, count, chance) in probabilities { + let l = if censored { + "■".repeat(line.len()) + } else { + line.replace('"', "\\\"") + }; println!(" \"{}\": [{}, {:.4}],", l, count, chance*100.); } println!(" \"count\": {},", lines.len());