feat: allow to print chances but censored

This commit is contained in:
əlemi 2023-11-20 14:03:07 +01:00
parent 1dc9d8575f
commit 3dc9219ea2

View file

@ -16,8 +16,15 @@ fn main() {
probabilities.sort_by_key(|x| x.1); probabilities.sort_by_key(|x| x.1);
let censored = std::env::args().nth(1).as_deref().unwrap_or("") == "--censored";
println!("{{"); println!("{{");
for (line, count, chance) in probabilities { for (line, count, chance) in probabilities {
let l = if censored {
"".repeat(line.len())
} else {
line.replace('"', "\\\"")
};
println!(" \"{}\": [{}, {:.4}],", l, count, chance*100.); println!(" \"{}\": [{}, {:.4}],", l, count, chance*100.);
} }
println!(" \"count\": {},", lines.len()); println!(" \"count\": {},", lines.len());