我不知道我们如何编写规则,其中令牌涉及单词和标点符号的组合。
我应该如何处理LanguageTool
规则中的标点符号?
我在网上查了一下,尝试了几件事无济于事。
例如,两者 1)
<rule id="THAT_AND_THAN_DOT" name="that and than dot">
<pattern>
<token>that</token>
<token regexp="yes">
another.|
himself.|
herself.|
itself.</token>
</pattern>
<message>Did you mean <suggestion>than \2.</suggestion>?</message>
<example correction='than another.'>Yes, better <marker>than another. </marker></example>
</rule>
2)
<rule id="THAT_AND_THAN_DOT" name="that and than dot">
<pattern>
<token>that</token>
<token regexp="yes">
another|
himself|
herself|
itself</token>
<token regexp="yes">
[.]</token>
</pattern>
<message>Did you mean <suggestion>than \2.</suggestion>?</message>
<example correction='than another.'>Yes, better <marker>than another. </marker></example>
</rule>
和 3)
<rule id="THAT_AND_THAN_DOT" name="that and than dot">
<pattern>
<token>that</token>
<token regexp="yes">
another|
himself|
herself|
itself</token>
<token regexp="yes">
[:punct:]</token>
</pattern>
<message>Did you mean <suggestion>than \2.</suggestion>?</message>
<example correction='than another.'>Yes, better <marker>than another. </marker></example>
</rule>
失败的。另一方面
<rule id="THAT_AND_THAN_DOT" name="that and than dot">
<pattern>
<token>that</token>
<token regexp="yes">
another|
himself|
herself|
itself</token>
</pattern>
<message>Did you mean <suggestion>than \2.</suggestion>?</message>
<example correction='than another.'>Yes, better <marker>than another. </marker></example>
</rule>
工作,尽管没有考虑到我想做的点。
注意:我在LanguageTool
里面使用Texstudio
。