Ahh, I was looking at SameRuleGroupFilter and I thought the logic was pretty deterministic (we always sort first)
public List<RuleMatch> filter(List<RuleMatch> ruleMatches) { Collections.sort(ruleMatches); ... but I didn't realize we only sort by the error positions so if if positions are exactly the same it's random. Looks like we have two options: 1) add rule.getId() into comparator - very simple to implement, but harder to enforce particular order as you have to be very precise with rule ids 2) somehow take to account the order rules are defined in - a bit harder to implement, but it's easy to control which rule has priority (which will be more useful for grammar vs spelling rules, e.g. with order defined in Language.getRelevantRules()) 3) add both rule.getCategory() (potentially with category being comparable) and rule.getId() to be able to prioritize by category first and then get (less important but still) consistent order with rule id I prefer approach 3) which besides consistent results also gives ability to sort by rule categories. Regards, Andriy 2016-05-16 12:17 GMT-04:00 Daniel Naber <daniel.na...@languagetool.org>: > On 2016-05-16 17:37, Andriy Rysin wrote: > >> Sachs змінив свій прогноз на тлі збою поставок з Нігерії, Венесуели, >> США і Китаю. >> >> "поставок" correctly triggers simple replace rule on the webpage, but >> in Chrome extension I see spelling error. >> Would you know what's the reason for this difference? > > There are two rule matches at exactly the same word. Seems like in one > case we take the first match and ignore the second, and in the other > case it's vice versa. Shouldn't be difficult to "fix", patches welcome. > > Regards > Daniel > > > ------------------------------------------------------------------------------ > Mobile security can be enabling, not merely restricting. Employees who > bring their own devices (BYOD) to work are irked by the imposition of MDM > restrictions. Mobile Device Manager Plus allows you to control only the > apps on BYO-devices by containerizing them, leaving personal data untouched! > https://ad.doubleclick.net/ddm/clk/304595813;131938128;j > _______________________________________________ > Languagetool-devel mailing list > Languagetool-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/languagetool-devel ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ Languagetool-devel mailing list Languagetool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-devel