OPENNLP-1893: Correct Hunspell parsing and analysis - #1266
Conversation
Add focused cases for flag aliases, continuation classes, zero-material affixes, forbidden entries, compound Unicode boundaries, invalid limits, and malformed input encoding. Red evidence on current main: the focused Hunspell suite reported 38 failures across these cases.
Apply file-wide FLAG and AF settings, reject malformed values and encodings, and count Unicode compound boundaries by code point. Handle continuation flags, identity affixes, and forbidden surface forms during analysis.
|
Here are some load bearing comments ;-) The real fixes in here are good and well-pinned: whole-file Blocking1.
Separately: 2.
3. The added paragraph documents 4. return position != CompoundPosition.END && contains(flags, compoundForbid);
5. Restore the gutted class Javadoc on The concrete supported-feature list on 6. 18 x That phrasing is this package's own convention, introduced with #1190: 20 occurrences across 7. Unrelated prose churn throughout — please revert it. A representative sample, none of which is a functional change: "carries" -> "contains" (~20x), "declared" -> "selected"/"specified" (~15x), "Never {@code null}." removal, "every" -> "all", "forbids" -> "rejects". One is a factual regression: Two comments deleted with no replacement should come back:
Minor
Process
|
Preserve ResourceInstaller and the merged CJK implementation. Document skipped-directive limitations and restore pre-existing stemmer comments. The affected reactor passes 3,091 tests with no failures, errors, or skips, including 128 Hunspell fixture cases and four real-dictionary cases. The separate run with LibreOffice en_US and the de_DE_frami and hu_HU packages also passes all four cases. Javadocs, DocBook HTML/PDF, Checkstyle, and forbidden API checks pass.
Record the merged apache#1190, apache#1191, apache#1265, and apache#1211 (now supplied by main), the slimmed subword-API-only apache#1165 with its add-ons PR apache#178, the open apache#1266 hunspell follow-up, refreshed PR heads, and the regenerated uber and helper tips.
# Conflicts: # opennlp-docs/src/docbkx/stemmer.xml
rzo1
left a comment
There was a problem hiding this comment.
All blocking and minor items from the review above are addressed in e695b66d, 6e185321 and 8baa234d, and the net diff against main is confined to the five Hunspell files.
Two notes for the record, neither blocking:
- The six result-altering directives (
ICONV,OCONV,COMPLEXPREFIXES,COMPOUNDRULE,IGNORE,KEEPCASE) moved from reject to skip, not just the twelve added ones. That reverses the fail-loud stance from #1190. It is documented indev/README-hunspell-dictionaries.md,stemmer.xmland the class Javadoc, so I am fine with it, but it is a deliberate behavior change and not merely the revert I asked for. - The
HunspellRealDictionaryTestrun againsten_US,de_DE_framiandhu_HUis reported in the8baa234dcommit message rather than in this thread. Since thedefault:throw is gone the regression risk is moot, so I am not asking for a repost.
Please still file a separate JIRA issue for this follow-up so the release notes describe it and OPENNLP-1893 stays closed.
|
I’ll file a follow-up JIRA to complete Hunspell compatibility for stemming and analysis. Until those features are supported, I’d propose failing at load time for unsupported directives that could change the results, with an explicit option for partial compatibility. The error should identify the unsupported feature, not imply the dictionary is invalid. We should implement those rules rather than require users to remove them. I'll do it now. |
Follow-up to #1190 after its merge.
This change:
The tests were committed first. On current main, the focused Hunspell suite reported 38 failures from the added cases. With the implementation applied: