mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-21 16:41:01 -05:00
feat(dict): Pull in codespell items
This commit is contained in:
parent
a9d9fc03a2
commit
7523a865f7
7 changed files with 91469 additions and 8958 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -334,6 +334,7 @@ dependencies = [
|
|||
"dictgen",
|
||||
"itertools",
|
||||
"snapbox",
|
||||
"typos",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
|
|
|
@ -25,3 +25,4 @@ itertools = "0.10"
|
|||
codegenrs = "2.0"
|
||||
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
|
||||
snapbox = { version = "0.4.11", features = ["path"] }
|
||||
typos = { path = "../typos" }
|
||||
|
|
40952
crates/codespell-dict/assets/compatible.csv
Normal file
40952
crates/codespell-dict/assets/compatible.csv
Normal file
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,36 @@ fn codegen() {
|
|||
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) {
|
||||
writeln!(
|
||||
file,
|
||||
|
|
1
crates/typos-dict/assets/allowed.csv
vendored
1
crates/typos-dict/assets/allowed.csv
vendored
|
@ -4,3 +4,4 @@ hardlinked,filesystem term
|
|||
referer,http header field
|
||||
deques,noun
|
||||
dequeues,verb
|
||||
ons,so `add-ons` works
|
||||
|
|
|
10376
crates/typos-dict/assets/words.csv
vendored
10376
crates/typos-dict/assets/words.csv
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue