feat(dict): Pull in codespell items

This commit is contained in:
Ed Page 2023-06-08 08:10:49 -05:00
parent a9d9fc03a2
commit 7523a865f7
7 changed files with 91469 additions and 8958 deletions

1
Cargo.lock generated
View file

@ -334,6 +334,7 @@ dependencies = [
"dictgen", "dictgen",
"itertools", "itertools",
"snapbox", "snapbox",
"typos",
"unicase", "unicase",
] ]

View file

@ -25,3 +25,4 @@ itertools = "0.10"
codegenrs = "2.0" codegenrs = "2.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.4.11", features = ["path"] } snapbox = { version = "0.4.11", features = ["path"] }
typos = { path = "../typos" }

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,36 @@ fn codegen() {
snapbox::assert_eq_path("./src/dict_codegen.rs", &content); snapbox::assert_eq_path("./src/dict_codegen.rs", &content);
} }
#[test]
fn compat() {
use std::fmt::Write as _;
let mut content = String::new();
for (bad, good) in parse_dict(DICT) {
if !is_word(bad) {
continue;
}
if !good.iter().copied().all(is_word) {
continue;
}
let bad = bad.to_lowercase();
write!(content, "{bad}").unwrap();
for good in good {
let good = good.to_lowercase();
write!(content, ",{good}").unwrap();
}
writeln!(content).unwrap();
}
snapbox::assert_eq_path("./assets/compatible.csv", &content);
}
fn is_word(word: &str) -> bool {
let tokenizer = typos::tokens::Tokenizer::new();
tokenizer.parse_str(word).flat_map(|t| t.split()).count() == 1 && !word.contains('_')
}
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {
writeln!( writeln!(
file, file,

View file

@ -4,3 +4,4 @@ hardlinked,filesystem term
referer,http header field referer,http header field
deques,noun deques,noun
dequeues,verb dequeues,verb
ons,so `add-ons` works

1 nilable used in ruby community
4 referer http header field
5 deques noun
6 dequeues verb
7 ons so `add-ons` works

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff