-
Notifications
You must be signed in to change notification settings - Fork 112
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
fix deinflection bug #547
fix deinflection bug #547
Conversation
✔️ No visual differences introduced by this PR. View Playwright Report (note: open the "playwright-report" artifact) |
I honestly don't quite understand what's going on in the deinflector logic to determine if this is right (and whether there's a better naming option) so hopefully toasted-nutbread can provide some insight. |
lgtm |
I believe the reason this works is because of some shenanigans with the bitflags and the way that the const definitionRules = Deinflector.rulesToRuleFlags(databaseEntry.rules);
for (const deinflection of uniqueDeinflectionArrays[databaseEntry.index]) {
const deinflectionRules = deinflection.rules;
if (!partsOfSpeechFilter || Deinflector.rulesMatch(deinflectionRules, definitionRules)) {
deinflection.databaseEntries.push(databaseEntry);
}
}
This is seems to be why these rules are set up this way: ['v1', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000011)], // Verb ichidan
['v1d', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000010)], // Verb ichidan dictionary form
['v1p', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000001)], // Verb ichidan progressive or perfect This functions as a way to just prevent this from happening:
With the new rules:
|
Exactly. |
I think the overall idea is that Generally I don't see a huge issue with it being done this way, I can't think of any immediate edge cases where this breaks down. The only thing is that it makes the subtleties of the logic a bit more confusing to understand I suppose, due to the idiosyncrasies of the bitflags test I mentioned above, but that's fine. I think that issue can be addressed by adjusting the structure of the deinflect.json file, which I think would also benefit other language support as well. I'll try looking into that at some point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for breaking it down. I think I understand, and approve of the change. That said, this introduces even more complexity into the already confusing logic here, so I definitely feel a need for some rework of the deinflector overall, as well as deinflection rule names to be a little less opaque, with more clarity of intent of each part in the naming and structure.
With #503, more than one inflection rule chain is now shown. Seems the deinflector is producing an incorrect chain for -te form of ichidan verbs:
Not sure if the two subcategories of ichidan verbs in this PR are aptly named, but this seems to fix the problem.