Back to LanguageTool Homepage - Privacy - Imprint

Case replacement for part of word


(Ruud Baars) #1

In Dutch, DVD and CD should be written as dvd and cd, also in compounds. Is there a way to replace CD-woord and DVD-woord in one replacement regexp to cd-woord and dvd-woord?


(Jan Schreiber) #2

The only way I can think of is with two rules in a group:
<message>Did you mean <suggestion><match no="1" regexp_match="^CD" regexp_replace="cd"/></suggestion>?
and the same for DVD\-.+.


(Ruud Baars) #3

I hoped there would be a smart trick. But this will work.


(Ruud Baars) #4



BTW-.*

BTW hoeft niet met hoofdletters:
Ik doe de BTW-boeking.

This gives an error; I think it is the built-in case correction which is in the way....

Exception in thread "main" java.lang.AssertionError: Dutch: Incorrect suggestions: [btw-boeking] != [Btw-boeking] for rule TST_HOOFDLETTERS_OVERBODIG[2] on input: Ik doe de BTW-boeking. expected:<[btw-boeking]> but was:<[Btw-boeking]>


(Jan Schreiber) #5

Sorry, I forgot that part: add case_conversion="alllower" inside the match tag. This works for German at least.


(Ruud Baars) #6

Allower is all that is needed. It is not exactly what I need, but good enough in most cases.