Revision: 6894
http://languagetool.svn.sourceforge.net/languagetool/?rev=6894&view=rev
Author: dnaber
Date: 2012-05-13 21:52:06 +0000 (Sun, 13 May 2012)
Log Message:
-----------
use <marker> tags instead of mark_from and mark_to attributes, so far only the
example grammar has been converted
Modified Paths:
--------------
trunk/JLanguageTool/CHANGES.txt
trunk/JLanguageTool/src/java/org/languagetool/rules/patterns/AbstractPatternRule.java
trunk/JLanguageTool/src/java/org/languagetool/rules/patterns/PatternRuleLoader.java
trunk/JLanguageTool/src/rules/pattern.xsd
trunk/JLanguageTool/src/rules/rules.xsd
trunk/JLanguageTool/src/rules/xx/grammar.xml
Added Paths:
-----------
trunk/JLanguageTool/src/dev/org/languagetool/dev/MarkerConverter.java
Modified: trunk/JLanguageTool/CHANGES.txt
===================================================================
--- trunk/JLanguageTool/CHANGES.txt 2012-05-13 18:07:07 UTC (rev 6893)
+++ trunk/JLanguageTool/CHANGES.txt 2012-05-13 21:52:06 UTC (rev 6894)
@@ -24,6 +24,9 @@
grammar checking dialog in LibreOffice will now offer a "More..." link
to that URL
+ -The XML format for rules has been changed to use <marker>...</marker> tags
instead
+ of mark_from and mark_to attributes
+
-GUI: made the result of "Tag Text" more readable
-Improved startup speed (Jarek Lipski)
Added: trunk/JLanguageTool/src/dev/org/languagetool/dev/MarkerConverter.java
===================================================================
--- trunk/JLanguageTool/src/dev/org/languagetool/dev/MarkerConverter.java
(rev 0)
+++ trunk/JLanguageTool/src/dev/org/languagetool/dev/MarkerConverter.java
2012-05-13 21:52:06 UTC (rev 6894)
@@ -0,0 +1,200 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2012 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool.dev;
+
+import org.languagetool.JLanguageTool;
+import org.languagetool.Language;
+import org.languagetool.rules.Rule;
+import org.languagetool.rules.patterns.PatternRule;
+import org.languagetool.tools.StringTools;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.DefaultHandler;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Convert to the new marker format. Note: is buggy at least with "and"
elements.
+ *
+ * @deprecated for internal one-time conversion only
+ */
+public class MarkerConverter {
+
+ public static void main(String[] args) throws SAXException,
ParserConfigurationException, IOException {
+ final ConverterHandler handler = new ConverterHandler();
+ final SAXParserFactory factory = SAXParserFactory.newInstance();
+ final SAXParser saxParser = factory.newSAXParser();
+
saxParser.getXMLReader().setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
false);
+
saxParser.getXMLReader().setProperty("http://xml.org/sax/properties/lexical-handler",
new MyLexicalHandler());
+ saxParser.parse(new
FileInputStream("/home/dnaber/prg/languagetool-svn/trunk/JLanguageTool/src/rules/xx/grammar.xml"),
handler);
+ }
+
+ static class ConverterHandler extends DefaultHandler {
+
+ private final Map<String, Integer> startPos = new HashMap<String,
Integer>();
+ private final Map<String, Integer> endPos = new HashMap<String, Integer>();
+
+ ConverterHandler() throws IOException {
+ final JLanguageTool languageTool = new JLanguageTool(Language.DEMO);
+ languageTool.activateDefaultPatternRules();
+ final List<Rule> rules = languageTool.getAllRules();
+ for (Rule rule : rules) {
+ if (rule instanceof PatternRule) {
+ final PatternRule pRule = (PatternRule) rule;
+ //System.out.println("***" + pRule.getId() + " " + pRule.getSubId()
+ " --> " + pRule.getStartPositionCorrection()
+ // + ", " + (pRule.getElements().size() +
pRule.getEndPositionCorrection()) + ", size: " + pRule.getElements());
+ final String key = pRule.getId() + " " + pRule.getSubId();
+ startPos.put(key, pRule.getStartPositionCorrection());
+ endPos.put(key, pRule.getElements().size() +
pRule.getEndPositionCorrection());
+ }
+ }
+ }
+
+ @Override
+ public void startPrefixMapping(String prefix, String uri) throws
SAXException {}
+ @Override
+ public void notationDecl(String name, String publicId, String systemId)
throws SAXException {}
+ @Override
+ public void unparsedEntityDecl(String name, String publicId, String
systemId, String notationName) throws SAXException {}
+ @Override
+ public void skippedEntity(String name) throws SAXException {}
+
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) throws
IOException, SAXException {
+ return super.resolveEntity(publicId, systemId);
+ }
+
+ @Override
+ public void processingInstruction(String target, String data) throws
SAXException {
+ System.out.println("<?" + target + " " + data + "?>");
+ }
+
+ private int currentTokenPos = 0;
+ private String currentId = "";
+ private int currentSubId = 0;
+ private boolean inCategory = false;
+ private boolean inRuleGroup = false;
+ private boolean needsMarker = false;
+
+ @Override
+ public void startElement(final String namespaceURI, final String lName,
+ final String qName, final Attributes attrs) throws SAXException {
+
+ if (qName.equals("token") && inCategory) {
+ currentTokenPos++;
+ final String key = currentId + " " + currentSubId;
+ if (needsMarker && startPos.get(key) == currentTokenPos - 1) {
+ System.out.print("<marker>\n");
+ }
+ }
+
+ if (attrs.getLength() > 0) {
+ System.out.print("<" + qName);
+ for (int i = 0; i < attrs.getLength(); i++) {
+ final String qName1 = attrs.getQName(i);
+ if (qName1.equals("mark_from") || qName1.equals("mark_to")) {
+ continue;
+ }
+ System.out.print(" " + qName1 + "=\"" + attrs.getValue(qName1) +
"\"");
+ }
+ System.out.print(">");
+ } else {
+ System.out.print("<" + qName + ">");
+ }
+ if (qName.equals("category")) {
+ inCategory = true;
+ } else if (qName.equals("pattern")) {
+ final boolean defaultStart = attrs.getValue("mark_from") == null ||
attrs.getValue("mark_from").equals("0");
+ final boolean defaultEnd = attrs.getValue("mark_to") == null ||
attrs.getValue("mark_to").equals("0");
+ needsMarker = !defaultStart || !defaultEnd;
+ } else if (qName.equals("rulegroup")) {
+ currentTokenPos = 0;
+ currentId = attrs.getValue("id");
+ currentSubId = 0;
+ inRuleGroup = true;
+ } else if (qName.equals("rule")) {
+ currentTokenPos = 0;
+ if (attrs.getValue("id") != null) {
+ currentId = attrs.getValue("id");
+ }
+ if (inRuleGroup) {
+ currentSubId++;
+ } else {
+ currentSubId = 1;
+ }
+ }
+
+ }
+
+ @Override
+ public void endElement(final String namespaceURI, final String sName,
+ final String qName) throws SAXException {
+ System.out.print("</" + qName + ">");
+ if (qName.equals("rulegroup")) {
+ inRuleGroup = false;
+ } else if (qName.equals("category")) {
+ inCategory = false;
+ } else if (qName.equals("token") && inCategory) {
+ final String key = currentId + " " + currentSubId;
+ if (needsMarker && endPos.get(key) == currentTokenPos) {
+ System.out.print("\n</marker>");
+ }
+ }
+ }
+
+ @Override
+ public void characters(final char[] buf, final int offset, final int len) {
+ final String s = new String(buf, offset, len);
+ System.out.print(StringTools.escapeXML(s));
+ }
+
+ }
+
+ static class MyLexicalHandler implements LexicalHandler {
+
+ @Override
+ public void startDTD(String name, String publicId, String systemId) throws
SAXException {}
+ @Override
+ public void endDTD() throws SAXException {}
+ @Override
+ public void startEntity(String name) throws SAXException {}
+ @Override
+ public void endEntity(String name) throws SAXException {}
+ @Override
+ public void startCDATA() throws SAXException {}
+ @Override
+ public void endCDATA() throws SAXException {}
+
+ @Override
+ public void comment(char[] buf, int offset, int len) throws SAXException {
+ final String s = new String(buf, offset, len);
+ System.out.print("<!--" + StringTools.escapeXML(s) + "-->");
+ }
+ }
+
+}
Modified:
trunk/JLanguageTool/src/java/org/languagetool/rules/patterns/AbstractPatternRule.java
===================================================================
---
trunk/JLanguageTool/src/java/org/languagetool/rules/patterns/AbstractPatternRule.java
2012-05-13 18:07:07 UTC (rev 6893)
+++
trunk/JLanguageTool/src/java/org/languagetool/rules/patterns/AbstractPatternRule.java
2012-05-13 21:52:06 UTC (rev 6894)
@@ -131,10 +131,17 @@
this.startPositionCorrection = startPositionCorrection;
}
+ public final int getStartPositionCorrection() {
+ return this.startPositionCorrection;
+ }
+
public final void setEndPositionCorrection(final int endPositionCorrection) {
this.endPositionCorrection = endPositionCorrection;
}
+ public final int getEndPositionCorrection() {
+ return this.endPositionCorrection;
+ }
protected void setupAndGroup(final int firstMatchToken,
final Element elem, final AnalyzedTokenReadings[] tokens)
Modified:
trunk/JLanguageTool/src/java/org/languagetool/rules/patterns/PatternRuleLoader.java
===================================================================
---
trunk/JLanguageTool/src/java/org/languagetool/rules/patterns/PatternRuleLoader.java
2012-05-13 18:07:07 UTC (rev 6893)
+++
trunk/JLanguageTool/src/java/org/languagetool/rules/patterns/PatternRuleLoader.java
2012-05-13 21:52:06 UTC (rev 6894)
@@ -85,6 +85,8 @@
private Category category;
private String name;
private String ruleGroupDescription;
+ private int startPos = -1;
+ private int endPos = -1;
// ===========================================================
// SAX DocumentHandler methods
@@ -150,6 +152,8 @@
uTypeList.add(uType);
} else if (qName.equals(TOKEN)) {
setToken(attrs);
+ } else if (qName.equals("marker") && inPattern) {
+ startPos = tokenCounter;
} else if (EXCEPTION.equals(qName)) {
setExceptions(attrs);
} else if (qName.equals(EXAMPLE)
@@ -245,6 +249,8 @@
tokenCounter++;
} else if (qName.equals(TOKEN)) {
finalizeTokens();
+ } else if (qName.equals("marker") && inPattern) {
+ endPos = tokenCounter;
} else if (qName.equals(PATTERN)) {
checkMarkPositions();
inPattern = false;
@@ -320,8 +326,15 @@
}
private void prepareRule(final PatternRule rule) {
- rule.setStartPositionCorrection(startPositionCorrection);
- rule.setEndPositionCorrection(endPositionCorrection);
+ if (startPos != -1 && endPos != -1) {
+ rule.setStartPositionCorrection(startPos);
+ rule.setEndPositionCorrection(endPos - elementList.size());
+ } else {
+ rule.setStartPositionCorrection(startPositionCorrection);
+ rule.setEndPositionCorrection(endPositionCorrection);
+ }
+ startPos = -1;
+ endPos = -1;
startPositionCorrection = 0;
endPositionCorrection = 0;
rule.setCorrectExamples(correctExamples);
Modified: trunk/JLanguageTool/src/rules/pattern.xsd
===================================================================
--- trunk/JLanguageTool/src/rules/pattern.xsd 2012-05-13 18:07:07 UTC (rev
6893)
+++ trunk/JLanguageTool/src/rules/pattern.xsd 2012-05-13 21:52:06 UTC (rev
6894)
@@ -177,9 +177,10 @@
</xs:annotation>
<xs:element name="and">
<xs:complexType>
- <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="token" minOccurs="2"
maxOccurs="unbounded" />
- </xs:sequence>
+ <xs:element ref="marker" minOccurs="0"
maxOccurs="1" />
+ </xs:choice>
</xs:complexType>
</xs:element>
@@ -227,6 +228,7 @@
<xs:element ref="feature"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="and" />
+ <xs:element ref="marker" minOccurs="0"
maxOccurs="1"/>
<xs:element ref="token" />
</xs:choice>
</xs:sequence>
@@ -282,7 +284,14 @@
</xs:documentation>
</xs:annotation>
<xs:element name="marker">
- <xs:complexType mixed="true" />
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="token" />
+ <xs:element ref="unify" />
+ <xs:element ref="and" />
+ <xs:element ref="phraseref" />
+ </xs:choice>
+ </xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file
Modified: trunk/JLanguageTool/src/rules/rules.xsd
===================================================================
--- trunk/JLanguageTool/src/rules/rules.xsd 2012-05-13 18:07:07 UTC (rev
6893)
+++ trunk/JLanguageTool/src/rules/rules.xsd 2012-05-13 21:52:06 UTC (rev
6894)
@@ -129,6 +129,7 @@
<xs:element ref="phraseref" />
<xs:element ref="and" />
<xs:element ref="unify" />
+ <xs:element ref="marker" />
</xs:choice>
<xs:attribute name="mark_from"
type="xs:nonNegativeInteger"
use="optional" />
Modified: trunk/JLanguageTool/src/rules/xx/grammar.xml
===================================================================
--- trunk/JLanguageTool/src/rules/xx/grammar.xml 2012-05-13 18:07:07 UTC
(rev 6893)
+++ trunk/JLanguageTool/src/rules/xx/grammar.xml 2012-05-13 21:52:06 UTC
(rev 6894)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../print.xsl"
title="Pretty print" ?>
<?xml-stylesheet type="text/css" href="../rules.css"
@@ -7,9 +6,7 @@
A demo rule file for LanguageTool
Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)
$Id: grammar.xml,v 1.22 2010-07-17 17:15:40 dnaber Exp $
--->
-<rules lang="xx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="../rules.xsd">
+--><rules lang="xx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../rules.xsd">
<!-- tests for phrase syntax -->
<unification feature="case_sensitivity">
<equivalence type="startupper">
@@ -23,9 +20,9 @@
<phrase id="UNIFICATION_PHRASE">
<unify>
<feature id="case_sensitivity">
- <type id="startupper"/>
+ <type id="startupper"></type>
</feature>
- <token/>
+ <token></token>
<token>York</token>
</unify>
</phrase>
@@ -38,7 +35,7 @@
<phrase id="COMPLEX_PHRASE">
<token>complex</token>
<includephrases>
- <phraseref idref="NP"/>
+ <phraseref idref="NP"></phraseref>
</includephrases>
<token>another</token>
</phrase>
@@ -54,9 +51,9 @@
<phrase id="COMPLEX_MULTIPLE">
<token>first</token>
<includephrases>
- <phraseref idref="DUMMY_VB1"/>
- <phraseref idref="DUMMY_VB2"/>
- <phraseref idref="DUMMY_VB3"/>
+ <phraseref idref="DUMMY_VB1"></phraseref>
+ <phraseref idref="DUMMY_VB2"></phraseref>
+ <phraseref idref="DUMMY_VB3"></phraseref>
</includephrases>
<token>last</token>
</phrase>
@@ -66,46 +63,50 @@
<phrase id="TEST_INCLUDE">
<token>beginning</token>
<includephrases>
- <phraseref idref="COMPLEX_MULTIPLE"/>
- <phraseref idref="SINGLE_TOKEN"/>
+ <phraseref idref="COMPLEX_MULTIPLE"></phraseref>
+ <phraseref idref="SINGLE_TOKEN"></phraseref>
</includephrases>
<token>end</token>
</phrase>
<phrase id="trivial_include">
<includephrases>
- <phraseref idref="DUMMY_VB1"/>
+ <phraseref idref="DUMMY_VB1"></phraseref>
</includephrases>
<includephrases>
- <phraseref idref="DUMMY_VB2"/>
+ <phraseref idref="DUMMY_VB2"></phraseref>
</includephrases>
</phrase>
</phrases>
<category name="misc">
- <!-- a trivial demo rule that matches "foo" followed by "bar" -->
+ <!-- a trivial demo rule that matches "foo" followed by
"bar" -->
<rule id="DEMO_RULE" name="Find 'foo bar'">
- <pattern case_sensitive="no" mark_from="0">
+ <pattern case_sensitive="no">
<token>foo</token>
<token>bar</token>
</pattern>
- <message>Did you mean <suggestion><match no="1"/> fuu
bah</suggestion>?</message>
+ <message>Did you mean <suggestion><match no="1"></match> fuu
bah</suggestion>?</message>
<url>http://fake-server.org/foo-bar-error-explained</url>
<example type="correct">This is <marker>fuu bah</marker>.</example>
<example correction="foo fuu bah" type="incorrect">This is <marker>foo
bar</marker>.</example>
</rule>
<rule id="API_OUTPUT_TEST_RULE" name="Find 'foo bar'">
- <pattern case_sensitive="no" mark_from="1">
+ <pattern case_sensitive="no">
<token>ach</token>
- <token>thosnaíos-sa</token>
+ <marker>
+ <token>thosnaíos-sa</token>
+ </marker>
</pattern>
<message>Did you mean <suggestion>fuu bah</suggestion>?</message>
<example type="correct">This is ach <marker>fuu bah</marker>.</example>
<example type="incorrect">This is ach
<marker>thosnaíos-sa</marker>.</example>
</rule>
<rule id="NEGATION_TOKEN" name="test negation">
- <pattern mark_from="1">
+ <pattern>
<token>small</token>
- <token negate="yes">test</token>
+ <marker>
+ <token negate="yes">test</token>
+ </marker>
</pattern>
<message>test</message>
<example type="correct">a small <marker>test</marker></example>
@@ -114,7 +115,7 @@
<rule id="TEST_GO" name="another test of phrases">
<pattern>
<token>foo</token>
- <phraseref idref="DUMMY_VB1"/>
+ <phraseref idref="DUMMY_VB1"></phraseref>
</pattern>
<message>Error!</message>
<example type="correct">foo bar</example>
@@ -124,28 +125,28 @@
</rule>
<rule id="TEST_PHRASES1" name="test phrases mechanism">
<pattern>
- <phraseref idref="COMPLEX_MULTIPLE"/>
+ <phraseref idref="COMPLEX_MULTIPLE"></phraseref>
<token>there</token>
</pattern>
- <message>This is the matched text: <match no="1"/><match
no="2"/></message>
+ <message>This is the matched text: <match no="1"></match><match
no="2"></match></message>
<example type="correct">go here</example>
<example type="incorrect"><marker>first goes last there</marker>,
please!</example>
</rule>
<rule id="test_include" name="test two includeblocks">
<pattern>
- <phraseref idref="TEST_INCLUDE"/>
+ <phraseref idref="TEST_INCLUDE"></phraseref>
</pattern>
- <message>Matched: <suggestion>test <match
no="1"/>trala</suggestion></message>
+ <message>Matched: <suggestion>test <match
no="1"></match>trala</suggestion></message>
<example type="correct">Any string.</example>
<example type="incorrect">Some words, <marker>beginning first go last
end</marker></example>
</rule>
<rule id="test_include_and_skip" name="test two includeblocks">
<pattern>
<token skip="2">any</token>
- <phraseref idref="TEST_INCLUDE"/>
+ <phraseref idref="TEST_INCLUDE"></phraseref>
<token>word</token>
</pattern>
- <message>Matched: <suggestion><match no="1"/> test</suggestion></message>
+ <message>Matched: <suggestion><match no="1"></match>
test</suggestion></message>
<example type="correct">Any string.</example>
<example type="incorrect">Some words, <marker>any word beginning first
go last end word</marker></example>
</rule>
@@ -153,24 +154,26 @@
disjunction for some obscure reason! -->
<rule id="test_two_phrases" name="test two phrases">
<pattern>
- <phraseref idref="COMPLEX_MULTIPLE"/>
- <phraseref idref="SINGLE_TOKEN"/>
+ <phraseref idref="COMPLEX_MULTIPLE"></phraseref>
+ <phraseref idref="SINGLE_TOKEN"></phraseref>
</pattern>
- <message>Matched: <match no="1"/></message>
+ <message>Matched: <match no="1"></match></message>
<example type="correct">Any string.</example>
<example type="incorrect">First words and <marker>first go
last</marker></example>
</rule>
<rule id="test_and_operator" name="test logical AND">
- <pattern mark_to="-1">
+ <pattern>
+ <marker>
<and>
- <token regexp="yes">A.*</token>
+ <token regexp="yes">A.*</token>
<token regexp="yes">[A-Z]B.*</token>
<token negate="yes">ABC</token>
<token regexp="yes">.*D<exception>ABED</exception></token>
</and>
+ </marker>
<token>test</token>
</pattern>
- <message>Matched: <match no="1"/></message>
+ <message>Matched: <match no="1"></match></message>
<example type="correct">CB test</example>
<example type="correct">ABC test</example>
<example type="incorrect"><marker>ABCD</marker> test</example>
@@ -179,9 +182,9 @@
</rule>
<rule id="test_match_ref" name="testing match element...">
<pattern>
- <token/>
+ <token></token>
<token>by</token>
- <token><match no="0"/></token>
+ <token><match no="0"></match></token>
</pattern>
<message>Found \1 \2 \3.</message>
<example type="incorrect"><marker>Step by step</marker>.</example>
@@ -190,9 +193,9 @@
</rule>
<rule id="test_match_ref_superb" name="testing match element on
steroids...">
<pattern>
- <token/>
+ <token></token>
<token>by</token>
- <token><match no="0"/>on</token>
+ <token><match no="0"></match>on</token>
</pattern>
<message>Found \1 \2 \3.</message>
<example type="correct"><marker>Step by step</marker>.</example>
@@ -208,13 +211,13 @@
<token>3</token>
<token>4</token>
<token>5</token>
- <token/>
+ <token></token>
<token>7</token>
<token>8</token>
- <token/>
+ <token></token>
<token>10</token>
</pattern>
- <message>I suggest: <suggestion><match no="10"/>
blahblah</suggestion>.</message>
+ <message>I suggest: <suggestion><match no="10"></match>
blahblah</suggestion>.</message>
<example type="correct">blah</example>
<example correction="10 blahblah" type="incorrect"><marker>1 2 3 4 5 6
7 8 9 10</marker>.</example>
</rule>
@@ -225,10 +228,10 @@
<token>3</token>
<token>4</token>
<token>5</token>
- <token/>
+ <token></token>
<token>7</token>
<token>8</token>
- <token/>
+ <token></token>
<token>10</token>
</pattern>
<message>I suggest: <suggestion>\10 blahblah</suggestion>.</message>
@@ -241,34 +244,38 @@
<token>new-york</token>
<token>cafe</token>
</pattern>
- <message>This name should be uppercase: <suggestion>New <match
case_conversion="startupper" no="1" regexp_match="[Nn]ew-(.*)"
regexp_replace="$1"/> Cafe</suggestion></message>
+ <message>This name should be uppercase: <suggestion>New <match
case_conversion="startupper" no="1" regexp_match="[Nn]ew-(.*)"
regexp_replace="$1"></match> Cafe</suggestion></message>
<example type="correct">New York Cafe</example>
<example correction="New York Cafe" type="incorrect">This is a new
coffeshop in the middle of nowhere called <marker>new-york
cafe</marker>.</example>
</rule>
<rule id="test_unification" name="Test unification of character case">
- <pattern case_sensitive="yes" mark_from="1">
+ <pattern case_sensitive="yes">
<token>abc</token>
+ <marker>
<unify> <feature id="case_sensitivity">
- <type id="startupper"/>
+ <type id="startupper"></type>
</feature>
- <token/>
+ <token></token>
<token>York</token>
</unify>
+ </marker>
</pattern>
<message>Warning: \1 \2 \3!</message>
<example type="incorrect">abc <marker>New York</marker></example>
<example type="correct">abc new York</example>
</rule>
<rule id="test_unification_negate" name="Test negated unification of
character case">
- <pattern case_sensitive="yes" mark_from="1">
+ <pattern case_sensitive="yes">
<token>abc</token>
+ <marker>
<unify negate="yes">
<feature id="case_sensitivity">
- <type id="startupper"/>
+ <type id="startupper"></type>
</feature>
- <token/>
- <token regexp="yes">[yY]ork</token>
+ <token></token>
+ <token regexp="yes">[yY]ork</token>
</unify>
+ </marker>
</pattern>
<message>Warning: \1 \2 \3!</message>
<example type="incorrect">abc <marker>new York</marker></example>
@@ -277,9 +284,11 @@
<example type="correct">abc New York</example>
</rule>
<rule id="test_unification_phrase" name="Test unification of characters'
case via phrase">
- <pattern case_sensitive="yes" mark_from="1">
+ <pattern case_sensitive="yes">
<token>abc</token>
- <phraseref idref="UNIFICATION_PHRASE"/>
+ <marker>
+ <phraseref idref="UNIFICATION_PHRASE"></phraseref>
+ </marker>
</pattern>
<message>Warning: \1 \2 \3!</message>
<example type="incorrect">abc <marker>New York</marker></example>
@@ -290,7 +299,7 @@
<token skip="-1">abc</token>
<token>end</token>
</pattern>
- <message>Warning: <suggestion><match no="1" include_skipped="all"/>
xyz</suggestion></message>
+ <message>Warning: <suggestion><match no="1"
include_skipped="all"></match> xyz</suggestion></message>
<example type="incorrect" correction="abcdef ghi xyz">This is
<marker>abc def ghi end</marker>.</example>
<example type="correct">foobar</example>
</rule>
@@ -298,13 +307,13 @@
<pattern case_sensitive="yes">
<token>Test1</token>
<unify>
- <feature id="case_sensitivity"/>
+ <feature id="case_sensitivity"></feature>
<token skip="-1"><exception scope="next">Ghj</exception></token>
<token regexp="yes">[xX]yz</token>
</unify>
<token>end</token>
</pattern>
- <message>This is not visible anyway<suggestion><match no="2"
include_skipped="all"/></suggestion>.</message>
+ <message>This is not visible anyway<suggestion><match no="2"
include_skipped="all"></match></suggestion>.</message>
<example type="incorrect" correction="Abc">This is <marker>Test1 Abc Xyz
end</marker>.</example>
<example type="incorrect" correction="AbcDef">This is <marker>Test1 Abc
Def Xyz end</marker>.</example>
<!-- skipped elements are NOT unified -->
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Languagetool-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs