LanguageTool : 单词后跟不同于的单词
LanguageTool : words followed by word different from
如何匹配一系列单词后跟不同于 x
的单词?
例如,我如何匹配 at the cost of
后跟不同于 some
的单词?
我尝试了以下方法,但无济于事:
<rule id="AT_THE_COST_OF_!SOME" name="at the cost of !some">
<pattern>
<token>at</token>
<token>the</token>
<token>cost</token>
<token>of</token>
<token regexp="yes">/^((?!some).)*$</token>
</pattern>
<message>Did you mean <suggestion>at the cost of some </suggestion>?</message>
<example correction='at the cost of some efforts'>Yes, it comes
<marker>at the cost of efforts</marker>.</example>
</rule>
传统的正则表达式也可以通过使用<regexp>
标签而不是使用<token>
标签来使用。 (但需要 LanguageTool 3.2 或更高版本才能使用 <regexp>
)。欲了解更多信息 - wiki
<regexp>(at the cost of (?!some\b))\w+<regexp>
匹配的模式:
at the cost of someone
at the cost of everything
模式被丢弃:
at the cost of some
请测试一下here
LanguageTool 适用于标记。使用 regexp 是一种特殊情况,如果使用 regexp,它们将处理单个标记(使用 pattern
时)。这将解决您的问题:
<pattern>
<token>at</token>
<token>the</token>
<token>cost</token>
<token>of</token>
<token><exception>some</exception></token>
</pattern>
无论如何要使用正则表达式,请使用 <regexp>
,如 http://wiki.languagetool.org/development-overview#toc8 中所述。
如何匹配一系列单词后跟不同于 x
的单词?
例如,我如何匹配 at the cost of
后跟不同于 some
的单词?
我尝试了以下方法,但无济于事:
<rule id="AT_THE_COST_OF_!SOME" name="at the cost of !some">
<pattern>
<token>at</token>
<token>the</token>
<token>cost</token>
<token>of</token>
<token regexp="yes">/^((?!some).)*$</token>
</pattern>
<message>Did you mean <suggestion>at the cost of some </suggestion>?</message>
<example correction='at the cost of some efforts'>Yes, it comes
<marker>at the cost of efforts</marker>.</example>
</rule>
传统的正则表达式也可以通过使用<regexp>
标签而不是使用<token>
标签来使用。 (但需要 LanguageTool 3.2 或更高版本才能使用 <regexp>
)。欲了解更多信息 - wiki
<regexp>(at the cost of (?!some\b))\w+<regexp>
匹配的模式:
at the cost of someone
at the cost of everything
模式被丢弃:
at the cost of some
请测试一下here
LanguageTool 适用于标记。使用 regexp 是一种特殊情况,如果使用 regexp,它们将处理单个标记(使用 pattern
时)。这将解决您的问题:
<pattern>
<token>at</token>
<token>the</token>
<token>cost</token>
<token>of</token>
<token><exception>some</exception></token>
</pattern>
无论如何要使用正则表达式,请使用 <regexp>
,如 http://wiki.languagetool.org/development-overview#toc8 中所述。