MOWE BUG FIXWES ;;;

pull/2/head
Isaac Mills 3 years ago
parent 7f91d6f333
commit 651b1451c1
No known key found for this signature in database
GPG Key ID: B67D7410F33A0F61

File diff suppressed because it is too large Load Diff

@ -150,57 +150,51 @@ impl<'a> UwUify<'a> {
} }
fn uwuify_sentence<T: Write>(&self, text: &str, out: &mut T) -> Result<(), std::io::Error> { fn uwuify_sentence<T: Write>(&self, text: &str, out: &mut T) -> Result<(), std::io::Error> {
text.as_bytes() text.lines().try_for_each(|line| {
.split(|w| matches!(*w, b'\t' | b'\x0C' | b'\r' | b' ')) line.split_whitespace()
.scan([].as_ref(), |scan, i| { .map(|f| f.as_bytes())
let ret = i != &[b' ']; .try_for_each(|word| {
*scan = i; let mut seeder = UwUSeeder::new(word, self.random);
if ret { let random_value = seeder.random();
Some(i)
} else { if random_value <= self.faces {
None out.write_all(FACES[seeder.random_int(0..FACES_SIZE)])?;
} out.write_all(b" ")?;
}) } else if random_value <= self.actions {
.try_for_each(|word| { out.write_all(ACTIONS[seeder.random_int(0..ACTIONS_SIZE)])?;
let mut seeder = UwUSeeder::new(word, self.random); out.write_all(b" ")?;
let random_value = seeder.random(); } else if random_value <= self.stutters {
(0..seeder.random_int(1..2)).into_iter().try_for_each(|_| {
if random_value <= self.faces { out.write_all(&[word[0]])?;
out.write_all(FACES[seeder.random_int(0..FACES_SIZE)])?; out.write_all(b"-")
out.write_all(b" ")?; })?;
} else if random_value <= self.actions { }
out.write_all(ACTIONS[seeder.random_int(0..ACTIONS_SIZE)])?;
out.write_all(b" ")?; if self
} else if random_value <= self.stutters { .linkify
(0..seeder.random_int(1..2)).into_iter().try_for_each(|_| { .links(unsafe { std::str::from_utf8_unchecked(word) })
out.write_all(&[word[0]])?; .count()
out.write_all(b"-") > 0
})?; || random_value > self.words
} {
out.write_all(word)?;
if self } else {
.linkify (0..word.len()).try_for_each(|index| match word[index] {
.links(unsafe { std::str::from_utf8_unchecked(word) }) b'L' | b'R' => out.write_all(b"W"),
.count() b'l' | b'r' => out.write_all(b"w"),
> 0 b'E' | b'e' | b'A' | b'I' | b'O' | b'U' | b'a' | b'i' | b'o' | b'u' => {
|| random_value > self.words match word.get(index - 1).unwrap_or(&word[0]) {
{ b'N' | b'n' => out.write_all(&[b'y', word[index]]),
out.write_all(word)?; _ => out.write_all(&[word[index]]),
} else { }
(0..word.len()).try_for_each(|index| match word[index] {
b'L' | b'R' => out.write_all(b"W"),
b'l' | b'r' => out.write_all(b"w"),
b'E' | b'e' | b'A' | b'I' | b'O' | b'U' | b'a' | b'i' | b'o' | b'u' => {
match word.get(index - 1).unwrap_or(&word[0]) {
b'N' | b'n' => out.write_all(&[b'y', word[index]]),
_ => out.write_all(&[word[index]]),
} }
} _ => out.write_all(&[word[index]]),
_ => out.write_all(&[word[index]]), })?;
})?; }
} out.write_all(b" ")
out.write_all(b" ") })?;
}) out.write_all(b"\n")
})
} }
} }

Loading…
Cancel
Save