i read homestuck ;-;
This commit is contained in:
parent
13a2eb6d36
commit
22146b5b5c
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -94,7 +94,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dw"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"chbs",
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "dw"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
authors = ["Emi Simpson <emi@alchemi.dev>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
23
src/main.rs
23
src/main.rs
|
@ -1,16 +1,33 @@
|
|||
use chbs::{component::{phrase::BasicPhraseBuilder, word::{FixedWordSetProvider, WordCapitalizer}}, probability::Probability, scheme::Scheme, word::WordList};
|
||||
use chbs::{component::{phrase::BasicPhraseBuilder, word::{FixedWordSetProvider, WordCapitalizer}}, entropy::{Entropy, HasEntropy}, prelude::WordStyler, probability::Probability, scheme::Scheme, word::WordList};
|
||||
|
||||
fn main() {
|
||||
let wordlist = WordList::builtin_eff_general_short();
|
||||
let provider = FixedWordSetProvider::new(wordlist.sampler(), 6);
|
||||
let styler = WordCapitalizer::new(Probability::half(), Probability::half());
|
||||
let capitalizer = WordCapitalizer::new(Probability::Sometimes(0.3), Probability::Sometimes(0.8));
|
||||
let builder = BasicPhraseBuilder::new("✨".into());
|
||||
let scheme = Scheme::new(
|
||||
Box::new(provider),
|
||||
vec![Box::new(styler)],
|
||||
vec![Box::new(capitalizer), Box::new(Terezifier{})],
|
||||
Box::new(builder),
|
||||
Vec::new(),
|
||||
);
|
||||
|
||||
println!("{}", scheme.generate());
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Terezifier {}
|
||||
|
||||
impl WordStyler for Terezifier {
|
||||
fn style_word(&self, word: String) -> String {
|
||||
word.replace(&['i', 'I'], "1")
|
||||
.replace(&['e', 'E'], "3")
|
||||
.replace(&['a', 'A'], "4")
|
||||
}
|
||||
}
|
||||
|
||||
impl HasEntropy for Terezifier {
|
||||
fn entropy(&self) -> Entropy {
|
||||
Entropy::one()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue