Added ? and ! to finishing characters
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
09ae96555c
commit
711d65424a
@ -1,4 +1,4 @@
|
||||
use std::{fs, env, collections::{HashMap, HashSet}};
|
||||
use std::{fs, env, collections::{HashMap, HashSet}, time::Instant};
|
||||
use rand::{seq::SliceRandom, prelude::ThreadRng};
|
||||
|
||||
fn read_input(path: &str) -> String {
|
||||
@ -34,8 +34,10 @@ fn main() {
|
||||
let mut rng = &mut rand::thread_rng();
|
||||
let mut sen = vec![];
|
||||
loop {
|
||||
while !sen.last().unwrap_or(&"".to_string()).ends_with(".") {
|
||||
sen.push(get_random_next_from(sen.last().unwrap_or(&"".to_string()), &vec_in, &mut rng));
|
||||
let mut last = "".to_string();
|
||||
while !(last.ends_with(".") || last.ends_with("?") || last.ends_with("!")) {
|
||||
last = get_random_next_from(&last, &vec_in, &mut rng);
|
||||
sen.push(last.clone());
|
||||
}
|
||||
if !input.contains(sen.join(" ").as_str()) { break; } else { sen.clear(); }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user