|
|
|
@ -10,7 +10,7 @@ pub fn feed(chain: &mut Chain<String>, what: impl AsRef<str>, bounds: impl std::
|
|
|
|
|
cfg_if! {
|
|
|
|
|
if #[cfg(feature="split-sentance")] {
|
|
|
|
|
let map = Sentance::new_iter(&what) //get each sentance in string
|
|
|
|
|
.map(|what| what.split_whitespace() // .words() here will remove the punctuation.
|
|
|
|
|
.map(|what| what.words()
|
|
|
|
|
.filter(|word| !word.is_empty())
|
|
|
|
|
.map(|s| s.to_owned()).collect::<Vec<_>>());
|
|
|
|
|
debug_assert!(!bounds.contains(&0), "Cannot allow 0 size feeds");
|
|
|
|
@ -24,7 +24,7 @@ pub fn feed(chain: &mut Chain<String>, what: impl AsRef<str>, bounds: impl std::
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
let map = Sentance::new_iter(&what) //get each sentance in string
|
|
|
|
|
.map(|what| what.split_whitespace() // .words() here will remove the punctuation.
|
|
|
|
|
.map(|what| what.words()
|
|
|
|
|
.filter(|word| !word.is_empty()))
|
|
|
|
|
.flatten() // add all into one buffer
|
|
|
|
|
.map(|s| s.to_owned()).collect::<Vec<_>>();
|
|
|
|
|