Back to LanguageTool Homepage - Privacy - Imprint

Phrase XML rule example


(Nina) #1

Can you please post an example of XML rule using a phrase as a pattern. For example, writing a rule using several phrases ORed together. "as long as"|" as well as"| ...


(Daniel Naber) #2

This should work:


as

long
well

as

If the phrases differ not only in a single word, I suggest you write separate rules.


(Nina) #3

Thanks.
Sometimes there are several permutations of patterns are needed. Having a support for phrase would be great. The .xsd files indicate phrase element within phrases ... I thought this is a support for patterns containing white spaces.


(Daniel Naber) #4

Yes, that's possible but I'm not sure how a logical OR and phrases work together. Actually, when I just tried




it behaved like DUMMY1 OR DUMMY2, but I'm not sure if that's stable behavior.

You can find some examples of phrases in this file: https://github.com/languagetool-org/languagetool/blob/master/languagetool-core/src/main/resources/org/languagetool/rules/xx/grammar.xml