Back to LanguageTool Homepage - Privacy - Imprint

Rule problem

I want to force a suggestion for pH, not to be written as ph or PH, with an exception for Ph. (Phil).
But LT forces the suggestion first character to upper. Any working suggestions for this rule?

		<rulegroup id="PH" name="pH">
			<rule>
				<antipattern case_sensitive="yes"><token>Ph</token><token>.</token></antipattern>
				<antipattern case_sensitive="yes"><token>pH</token></antipattern>
				<pattern>
					<token>PH</token>
				</pattern>
				<message>De zuurgraad schrijf je anders.</message>
				<suggestion><match no="1" regexp_match="^." regexp_replace="p"/></suggestion>
				<example correction="pH">De <marker>PH</marker> is 7.</example>
			</rule>
		</rulegroup>
1 Like

This is a workaround.

<rulegroup id="PH" name="pH">
    <rule>
        <antipattern case_sensitive="yes"><token>Ph</token><token>.</token></antipattern>
        <antipattern case_sensitive="yes"><token>pH</token></antipattern>
        <pattern>
            <token>PH</token>
        </pattern>
        <message>De zuurgraad schrijf je anders.</message>
        <suggestion><match no="1" case_conversion="startlower" regexp_match="[Hh]" regexp_replace=""/>H</suggestion>
        <example correction="pH">De <marker>PH</marker> is 7.</example>
        <example correction="pH">De <marker>Ph</marker> is 7.</example>
    </rule>
</rulegroup>
1 Like