Merge pull request #315 from epage/more

feat(dict): Add more corrections
This commit is contained in:
Ed Page
2021-07-27 15:08:18 -05:00
committed by GitHub
3 changed files with 126048 additions and 17215 deletions
+24945 -481
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+17
View File
@@ -27,6 +27,19 @@ fn generate<W: std::io::Write>(file: &mut W, dict: &[u8]) {
}));
});
let rows: Dict = rows
.into_iter()
.filter(|(t, _)| is_word(t))
.filter_map(|(t, c)| {
let new_c: Vec<_> = c.into_iter().filter(|c| is_word(c)).collect();
if new_c.is_empty() {
None
} else {
Some((t, new_c))
}
})
.collect();
let disallowed_typos = varcon_words();
let word_variants = proper_word_variants();
let rows: Dict = rows
@@ -67,6 +80,10 @@ fn generate<W: std::io::Write>(file: &mut W, dict: &[u8]) {
wtr.flush().unwrap();
}
fn is_word(word: &str) -> bool {
word.chars().all(|c| c.is_alphabetic())
}
fn varcon_words() -> HashSet<unicase::UniCase<&'static str>> {
// Even include improper ones because we should be letting varcon handle that rather than our
// dictionary