Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion harper-core/dictionary.dict
Original file line number Diff line number Diff line change
Expand Up @@ -52467,7 +52467,7 @@ wrongful/~JYp
wrongfulness/Nmg
wrongheaded/JYp
wrongheadedness/Ng
wrongness/Nmg
wrongness/Ng
wrote/~Vtr
wroth/J
wrought/~JV
Expand Down
2 changes: 2 additions & 0 deletions harper-core/src/expr/sequence_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ impl SequenceExpr {
gen_then_from_is!(auxiliary_verb);
gen_then_from_is!(linking_verb);
gen_then_from_is!(verb_lemma);
gen_then_from_is!(verb_simple_past_form);
gen_then_from_is!(verb_past_participle_form);

// Adjectives

Expand Down
29 changes: 23 additions & 6 deletions harper-core/src/linting/simple_past_to_past_participle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,50 @@ use crate::{

/// Maps common irregular verbs between their simple past and past participle forms.
const IRREGULAR_VERBS: &[(&str, &str)] = &[
("arose", "arisen"),
("ate", "eaten"),
("awoke", "awoken"),
("bade", "bidden"),
("became", "become"),
("began", "begun"),
("bit", "bitten"),
("blew", "blown"),
("broke", "broken"),
("came", "come"),
("chose", "chosen"),
("did", "done"),
("drank", "drunk"),
("drove", "driven"),
("fell", "fallen"),
("flew", "flown"),
("forgot", "forgotten"),
("forwent", "forgone"),
("gave", "given"),
("knew", "known"),
("mistook", "mistaken"),
("overtook", "overtaken"),
("partook", "partaken"),
// proved, proved/proven
("ran", "run"),
("rang", "rung"),
("rode", "ridden"),
("rose", "risen"),
("sang", "sung"),
("sank", "sunken"),
("saw", "seen"),
("sewed", "sewn"),
("slew", "slain"),
("spoke", "spoken"),
("stank", "stunk"),
("stole", "stolen"),
("swam", "swum"),
("trod", "trodden"),
("took", "taken"),
// was, been
// were, been
("went", "gone"),
("woke", "woken"),
("wove", "woven"),
("wrote", "written"),
];

Expand All @@ -40,11 +62,6 @@ pub struct SimplePastToPastParticiple {

impl Default for SimplePastToPastParticiple {
fn default() -> Self {
let mut simple_past_forms_word_set = WordSet::default();
for (simple_past, _) in IRREGULAR_VERBS {
simple_past_forms_word_set.add(simple_past);
}

Self {
expr: Box::new(All::new(vec![
// positive: the general case
Expand All @@ -57,7 +74,7 @@ impl Default for SimplePastToPastParticiple {
Box::new(InflectionOfBe::default()),
])
.t_ws()
.then(simple_past_forms_word_set),
.then_verb_simple_past_form(),
),
// negative: one known exception
Box::new(
Expand Down
1 change: 1 addition & 0 deletions harper-core/src/token_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ impl TokenKind {
is_linking_verb,
is_verb_lemma,
is_verb_simple_past_form,
is_verb_past_participle_form,
is_verb_progressive_form,
is_verb_third_person_singular_present_form,

Expand Down
Loading