This repository has been archived by the owner on Feb 25, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change addresses two things:
The deinflection rules added in Add support for progressive/perfect inflections #235 weren't specific enough and were generating false positives. Invalid terms like 着かないで and 着かないでない were being deinflected incorrectly. This change improves the specificity of the deinflection rules, as well as adds support for the とる contraction which I previously thought would be more difficult. This change fixes all the false positives that I was seeing.
Improves the performance of
Deinflector.deinflect
by somewhere in the range of 2x to 5x. Previously, the deinflect algorithm would do an intersection test on the rule arrays to see if there was any overlap. This has been simplified to use a bitwise&
check instead, after first converting the rules arrays into a single flags integer value.This is similar to the algorithm I saw in rikaichamp when creating Update deinflect.json #199, except I have not changed the JSON file structure. Instead, the JSON data is converted to an array-based structure, which should also result in faster access than object property lookup (i.e.
kanaIn = array[0];
rather thankanaIn = object.kanaIn;
, and so on). This structure also converts the rules arrays into flags integer values.Performance optimizations #189