Support LT-22605: Add ability to limit HermitCrab parses#452
Draft
jtmaxwell3 wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
MaxUnapplications was an experimental variable that never got incorporated into FieldWorks. I decided to rename it MaxAlternatives for clarity and to change it to throw TimeoutException since the MaxUnapplications implementation truncated results without telling the user and since it could produce different results with different parses of the same word because of multi-threading.
MaxAlternatives caps the number of alternatives produced by each stratum during analysis. This is where most of the blowup occurs since rules and templates within a stratum are unordered and since rules and templates are optional during unapplication (analysis). We could also limit the number of lexical entries found after analysis but the number of lexical entries that are found after analysis is usually proportionate to the number of alternatives, so it probably isn't necessary. Furthermore, we could limit the number of alternatives considered within each stratum during synthesis, but the number of alternatives generated is usually proportionate to the number of lexical entries found because rules are obligatory in the synthesis direction and there are rarely alternative orderings of the rules that match. Limiting the alternatives produced by each stratum should be enough to bound the amount of time spent parsing a word.
I tested this against Aweti-opap-no-go from Andy Black by setting MaxAlternatives to 1000 and all of the words finished in a reasonable amount of time and the words that were limited gave a reasonable error message.
This change is