Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop 五段化 potential rule #2047

Merged
merged 2 commits into from
Oct 16, 2024
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
1 change: 0 additions & 1 deletion src/background/deinflect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ describe('deinflect', () => {
['発する', '発さない', [Reason.Irregular, Reason.Negative]],
['発する', '発さず', [Reason.Irregular, Reason.Zu]],
['発する', '発そう', [Reason.Irregular, Reason.Volitional]],
['愛する', '愛せる', [Reason.Irregular, Reason.Potential]],
['愛する', '愛せば', [Reason.Irregular, Reason.Ba]],
['愛する', '愛せ', [Reason.Irregular, Reason.Imperative]],
// ずる / vz class verbs
Expand Down
17 changes: 2 additions & 15 deletions src/background/deinflect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ const deinflectRuleData: Array<
['せん', 'する', Type.Initial, Type.SuruVerb, [Reason.Negative]],
['せば', 'す', Type.Initial, Type.GodanVerb, [Reason.Ba]],
['せば', 'する', Type.Initial, Type.SpecialSuruVerb, [Reason.Irregular, Reason.Ba]],
['せる', 'する', Type.IchidanVerb, Type.SpecialSuruVerb, [Reason.Irregular, Reason.Potential]],
['せよ', 'する', Type.Initial, Type.SuruVerb, [Reason.Imperative]],
['せる', 'す', Type.IchidanVerb, Type.GodanVerb, [Reason.Potential]],
['せる', '', Type.IchidanVerb, Type.IrrealisStem, [Reason.Causative]],
Expand Down Expand Up @@ -534,21 +533,9 @@ export function deinflect(word: string): CandidateWord[] {
continue;
}

// Verify that adding the rule won't lead to duplicates or an unreasonable
// sequencing of reasons in the reason chain.
// Continue if the rule introduces a duplicate in the reason chain,
// as it wouldn't make sense grammatically.
const ruleReasons = new Set(rule.reasons);

// Avoid matches such as 'potential < potential or passive' or
// 'potential < causative', which are grammatically incorrect.
// This is an issue when handling irregular forms like 罰せられる,
// where the structure could be misinterpreted as
// 'irregular < potential < potential or passive' instead of the correct
// 'irregular < potential or passive'.
if (ruleReasons.has(Reason.Potential)) {
ruleReasons.add(Reason.PotentialOrPassive);
ruleReasons.add(Reason.Causative);
}

if (thisCandidate.reasonChains.flat().some((r) => ruleReasons.has(r))) {
continue;
}
Expand Down