Back to LanguageTool Homepage - Privacy - Imprint

Calling non-xml disambiguation logic from DisambiguationRuleTest

(Andriy) #1

I have some non-trivial disambiguation logic implemented in Java in UkrainianHybridDisambiguator (e.g. adjusting initials gender to that of the following last name) and this logic is invoked before xml disambiguation rules kick in (and some of them rely on this advanced logic to be performed first).
But I've noticed that when we test xml disambiguation rule we invoke all previous xml disabmiguation rules before we test the current one but there's no easy way to invoke this non-xml logic.
So far I can get around it by making DisambiguationRuleTest.disambiguateUntil() non-static and protected and then overriding it in my test class to perform Java logic first. This way the tests match the real-time behavior.
If there's a better way please let me know, otherwise if there's no objection I can push this change later this months.