Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added hindi language toml and wiki sample #89

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
15 changes: 9 additions & 6 deletions src/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,19 @@ fn choose(
predicate: impl FnMut(&Rules, &str) -> bool,
mut replacer: impl FnMut(&Rules, &str) -> String,
) -> Vec<String> {
let sentences_replaced_abbreviations: Vec<String> = SentenceTokenizer::<Standard>::new(text, training_data)
.map(|item| { replacer(rules, item) })
.collect();

let replaced_text = replacer(rules, text);
let mut sentences: Vec<String> = vec![];
let tokenizer = SentenceTokenizer::<Standard>::new(&replaced_text, training_data);
for sentence in tokenizer {
sentences.push(String::from(sentence));
}

if config.no_check {
sentences_replaced_abbreviations
sentences
} else {
pick_sentences(
rules,
sentences_replaced_abbreviations,
sentences,
existing_sentences,
config.max_sentences_per_text,
predicate,
Expand Down
Loading