Add verb past form only helpers#3379
Conversation
hippietrail
left a comment
There was a problem hiding this comment.
It looks good to me. Your implementation was quite different from the mass noun one so I asked two AIs to compare them since I didn't trust my own Rust-foo.
Your test cases gave me an idea for a third you method you could trivially add that complements these.
| } | ||
|
|
||
| #[test] | ||
| fn thought_is_neither_past_form_only() { |
There was a problem hiding this comment.
Hey you know what would be even better, adding an is_verb_regular_past_form that does exactly this.
|
Thanks for the suggestion. I added Local checks run:
|
| pub fn is_verb_regular_past_form(&self) -> bool { | ||
| self.verb.is_some_and(|v| { | ||
| v.verb_forms | ||
| .is_some_and(|vf| vf.contains(VerbFormFlags::PAST)) |
There was a problem hiding this comment.
Actually I have a hunch that ::PAST might be unreliable. I think a more explicit way would be more trustworthy:
v.verb_forms
.is_some_and(|vf| vf.contains(VerbFormFlags::PRETERITE)
&& vf.contains(VerbFormFlags::PAST_PARTICIPLE))
There was a problem hiding this comment.
Thanks, updated it to use the explicit PRETERITE + PAST_PARTICIPLE check instead of relying on PAST. I also adjusted the regular-past tests around thought and kept the distinct-form checks for ate, eaten, and walked.
Local checks run:
cargo fmt --package harper-corecargo test -p harper-core regular_past --libcargo test -p harper-core past_only --libcargo test -p harper-core participle_only --libgit diff --check
elijah-potter
left a comment
There was a problem hiding this comment.
This looks good to me too. Thanks!
Summary
DictWordMetadata::is_verb_simple_past_onlyDictWordMetadata::is_verb_past_participle_onlyTokenKindate,eaten) and ambiguous/regular forms (thought,walked)Fixes #3372.
Testing
cargo fmt --package harper-corecargo test -p harper-core past_only --libcargo test -p harper-core participle_only --libcargo test -p harper-core neither_past_form_only --libgit diff --check