mirror of
https://github.com/crate-ci/typos.git
synced 2026-10-17 09:35:11 +02:00
Merge pull request #315 from epage/more
feat(dict): Add more corrections
This commit is contained in:
Vendored
+24945
-481
File diff suppressed because it is too large
Load Diff
+101086
-16734
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user