Back to LanguageTool Homepage - Privacy - Imprint

Exception Rule - Help with syntax


(philr) #1

I am trying to specify a rule which says that the word "portable" must be preceded somewhere by variants of the word "large". Here's what I've tried in German.

tragbargroßen|großes|großem|großer

I want to match "Das neue Acme Smartphone mit Android-Betriebssystem NuPhone T Ultra ist elegant, tragbar und leicht." but not match "... großen Display ist das Dual-SIM-Smartphone {120} überraschend leicht, tragbar und elegant.".


(Daniel Naber) #2

I guess this cannot be expressed by our XML syntax, but I might be wrong. You might want to subscribe to our mailing list to ask for help (https://lists.sourceforge.net/lists/listinfo/languagetool-devel), or you might want to write a Java rule which can easily do this.


(philr) #3

Just to help my understanding. In the context of scope, "previous" and "next" mean literally as opposed to "preceding" or "following" which would explain why my rule doesn't work? Do the combination of skip="-5" and scope="previous" make any difference?


(Daniel Naber) #4

I actually didn't try the combination of skip and scope, maybe it works. Here's an example:
http://wiki.languagetool.org/development-overview#toc13

But I think the problem is a logical one: if there can be any number of tokens between "groß" and "tragbar", you need to skip. But then there will always be a word that's not "groß" somewhere and you'll get a match. What you would need is a way to negate to whole pattern, not just a token, but we don't have that.