Revision: 9248
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=9248&view=rev
Author:   jaumeortola
Date:     2013-01-28 11:20:56 +0000 (Mon, 28 Jan 2013)
Log Message:
-----------
A small change in pattern rule syntax. Suggestions are allowed now to be 
written outside the <message> element. Example:

<message>Did you mean <suggestion>A</suggestion>?<message>
<suggestion>B</suggestion>
<suggestion>C</suggestion>
<example type="incorrect" correction="A|B|C"><marker>asdf</marker></example>

Modified Paths:
--------------
    
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/RuleMatch.java
    
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRule.java
    
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleHandler.java
    
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java
    
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/XMLRuleHandler.java
    
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/bitext/BitextPatternRuleLoader.java
    
trunk/languagetool/languagetool-core/src/main/resources/org/languagetool/rules/rules.xsd
    
trunk/languagetool/languagetool-core/src/main/resources/org/languagetool/rules/xx/grammar.xml
    
trunk/languagetool/languagetool-core/src/test/java/org/languagetool/rules/patterns/PatternRuleTest.java
    
trunk/languagetool/languagetool-language-modules/ca/src/main/resources/org/languagetool/rules/ca/grammar.xml

Modified: 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/RuleMatch.java
===================================================================
--- 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/RuleMatch.java
    2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/RuleMatch.java
    2013-01-28 11:20:56 UTC (rev 9248)
@@ -50,12 +50,12 @@
 
   //TODO: remove this one after all rules get their short comments in place
   public RuleMatch(Rule rule, int fromPos, int toPos, String message) {
-    this(rule, fromPos, toPos, message, null, false);
+    this(rule, fromPos, toPos, message, null, false, null);
   }
   
   // TODO: remove this constructor?
   public RuleMatch(Rule rule, int fromPos, int toPos, String message, String 
shortMessage) {
-    this(rule, fromPos, toPos, message, shortMessage, false);
+    this(rule, fromPos, toPos, message, shortMessage, false, null);
   }
 
   /**
@@ -69,14 +69,14 @@
    *    of the match starts with an uppercase character
    */
   public RuleMatch(Rule rule, int fromPos, int toPos, String message, String 
shortMessage, 
-      boolean startWithUppercase) {
+      boolean startWithUppercase, String suggestionsOutMsg) {
     this.rule = rule;
     this.fromPos = fromPos;
     this.toPos = toPos;
     this.message = message;
     this.shortMessage = shortMessage;
     // extract suggestion from <suggestion>...</suggestion> in message:
-    final Matcher matcher = SUGGESTION_PATTERN.matcher(message);
+    final Matcher matcher = 
SUGGESTION_PATTERN.matcher(message+suggestionsOutMsg);
     int pos = 0;
     while (matcher.find(pos)) {
       pos = matcher.end();

Modified: 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRule.java
===================================================================
--- 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRule.java
 2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRule.java
 2013-01-28 11:20:56 UTC (rev 9248)
@@ -45,9 +45,13 @@
 
   private String subId; // because there can be more than one rule in a rule 
group
   private String message;
+  private String suggestionsOutMsg; // extra suggestions outside message
 
   /** Formatted suggestion elements. **/
   private List<Match> suggestionMatches;
+  
+  /** Formatted suggestion elements outside message. **/
+  private List<Match> suggestionMatchesOutMsg;
 
   /**
    * This property is used for short-circuiting evaluation of the elementNo 
list
@@ -87,6 +91,7 @@
     this.message = message;
     this.shortMessage = shortMessage;
     this.elementNo = new ArrayList<Integer>();
+    this.suggestionsOutMsg="";
     String prevName = "";
     String curName = "";
     int cnt = 0;
@@ -116,11 +121,19 @@
       }
     }    
   }  
+  
+  public PatternRule(final String id, final Language language,
+      final List<Element> elements, final String description,
+      final String message, final String shortMessage, final String 
suggestionsOutMsg) {
+    this(id, language, elements, description, message, shortMessage);
+    this.suggestionsOutMsg=suggestionsOutMsg;
+  }
 
   public PatternRule(final String id, final Language language,
       final List<Element> elements, final String description,
-      final String message, final String shortMessage, final boolean isMember) 
{
-    this(id, language, elements, description, message, shortMessage);
+      final String message, final String shortMessage, final String 
suggestionsOutMsg,
+      final boolean isMember) {
+    this(id, language, elements, description, message, shortMessage, 
suggestionsOutMsg);
     this.isMemberOfDisjunctiveSet = isMember;
   }  
 
@@ -135,6 +148,10 @@
   public final String getMessage() {
     return message;
   }
+  
+  public final String getSuggestionsOutMsg() {
+    return suggestionsOutMsg;
+  }
 
   /**
    * Used for testing rules: only one of the set can match.
@@ -190,7 +207,14 @@
     }
     suggestionMatches.add(m);
   }
-
+  
+  public final void addSuggestionMatchOutMsg (final Match m) {
+    if (suggestionMatchesOutMsg == null) {
+      suggestionMatchesOutMsg = new ArrayList<Match>();
+    }
+    suggestionMatchesOutMsg.add(m);
+  }
+  
   /**
    * For testing only.
    */
@@ -209,6 +233,10 @@
   List<Match> getSuggestionMatches() {
     return suggestionMatches;
   }
+  
+  List<Match> getSuggestionMatchesOutMsg() {
+    return suggestionMatchesOutMsg;
+  }
 
   @Override
   public final String toString() {

Modified: 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleHandler.java
===================================================================
--- 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleHandler.java
  2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleHandler.java
  2013-01-28 11:20:56 UTC (rev 9248)
@@ -73,6 +73,8 @@
       language = Language.getLanguageForShortName(languageStr);
     } else if (RULE.equals(qName)) {
       shortMessage = new StringBuilder();
+      message = new StringBuilder();
+      suggestionsOutMsg = new StringBuilder();
       url = new StringBuilder();
       id = attrs.getValue("id");
       if (inRuleGroup) {
@@ -96,6 +98,9 @@
       if (suggestionMatches != null) {
         suggestionMatches.clear();
       }
+      if (suggestionMatchesOutMsg != null) {
+        suggestionMatchesOutMsg.clear();
+      }
       if (attrs.getValue("type") != null) {
         ruleIssueType = attrs.getValue("type");
       }
@@ -134,6 +139,12 @@
       inMessage = true;
       inSuggestion = false;
       message = new StringBuilder();
+    } else if ("suggestion".equals(qName) && !inMessage) {  //suggestions 
outside message      
+        if (YES.equals(attrs.getValue("suppress_misspelled"))) {
+          suggestionsOutMsg.append("<pleasespellme/>");
+        }
+        suggestionsOutMsg.append("<suggestion>");
+        inSuggestion = true;
     } else if ("short".equals(qName)) {
       inShortMessage = true;
       shortMessage = new StringBuilder();
@@ -187,10 +198,11 @@
     if ("category".equals(qName)) {
       categoryIssueType = null;
     } else if (RULE.equals(qName)) {
+      suggestionMatchesOutMsg = 
addLegacyMatches(suggestionMatchesOutMsg,suggestionsOutMsg.toString(),false);
       phraseElementInit();
       if (phraseElementList.isEmpty()) {
         final PatternRule rule = new PatternRule(id, language, elementList,
-                name, message.toString(), shortMessage.toString());
+                name, message.toString(), shortMessage.toString(), 
suggestionsOutMsg.toString());
         prepareRule(rule);
         rules.add(rule);
       } else {
@@ -203,7 +215,7 @@
         for (final ArrayList<Element> phraseElement : phraseElementList) {
           processElement(phraseElement);
           final PatternRule rule = new PatternRule(id, language, phraseElement,
-              name, message.toString(), shortMessage.toString(),
+              name, message.toString(), shortMessage.toString(), 
suggestionsOutMsg.toString(),
               phraseElementList.size() > 1);
           prepareRule(rule);
           rules.add(rule);
@@ -248,8 +260,11 @@
       incorrectExample = new StringBuilder();
       exampleCorrection = new StringBuilder();
     } else if (MESSAGE.equals(qName)) {
-      suggestionMatches = addLegacyMatches();
-      inMessage = false;
+      suggestionMatches = 
addLegacyMatches(suggestionMatches,message.toString(),true);
+      inMessage = false;        
+    } else if ("suggestion".equals(qName) && !inMessage) { //suggestion 
outside message
+      suggestionsOutMsg.append("</suggestion>");      
+      inSuggestion = false;      
     } else if ("short".equals(qName)) {
       inShortMessage = false;
     } else if ("url".equals(qName)) {
@@ -258,6 +273,9 @@
       if (inMessage) {
         suggestionMatches.get(suggestionMatches.size() - 1).
             setLemmaString(match.toString());
+      } else if (inSuggestion && !inMessage) {
+          suggestionMatchesOutMsg.get(suggestionMatchesOutMsg.size() - 1).
+              setLemmaString(match.toString());
       } else if (inToken) {
         tokenReference.setLemmaString(match.toString());
       }
@@ -322,6 +340,14 @@
         suggestionMatches.clear();
       }
     }
+    if (suggestionMatchesOutMsg != null) {
+      for (final Match m : suggestionMatchesOutMsg) {
+        rule.addSuggestionMatchOutMsg(m);
+      }
+      //if (phraseElementList.size() <= 1) {
+      suggestionMatchesOutMsg.clear();
+      //}
+    }
     if (defaultOff) {
       rule.setDefaultOff();
     }
@@ -360,6 +386,8 @@
       match.append(s);
     } else if (inMessage) {
       message.append(s);
+    } else if (inSuggestion && !inMessage) {  //Suggestion outside message
+      suggestionsOutMsg.append(s);
     } else if (inShortMessage) {
       shortMessage.append(s);
     } else if (inUrl) {

Modified: 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java
===================================================================
--- 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java
  2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/PatternRuleMatcher.java
  2013-01-28 11:20:56 UTC (rev 9248)
@@ -113,7 +113,9 @@
         final AnalyzedTokenReadings[] tokens, final int firstMatchToken,
         final int lastMatchToken, final int matchingTokens) throws IOException 
{
       final String errMessage = formatMatches(tokens, tokenPositions,
-          firstMatchToken, rule.getMessage());
+          firstMatchToken, rule.getMessage(), rule.getSuggestionMatches());
+      final String suggestionsOutMsg = formatMatches(tokens, tokenPositions,
+          firstMatchToken, rule.getSuggestionsOutMsg(), 
rule.getSuggestionMatchesOutMsg());
       int correctedStPos = 0;
       if (rule.startPositionCorrection > 0) {
         for (int l = 0; l <= rule.startPositionCorrection; l++) {
@@ -132,7 +134,8 @@
       AnalyzedTokenReadings firstMatchTokenObj = tokens[firstMatchToken + 
correctedStPos];
       boolean startsWithUppercase = StringTools
         .startsWithUppercase(firstMatchTokenObj.getToken())
-        && !matchConvertsCase();
+        && !matchConvertsCase(rule.getSuggestionMatches())
+        && !matchConvertsCase(rule.getSuggestionMatchesOutMsg());
 
       if (firstMatchTokenObj.isSentStart()
           && tokens.length > firstMatchToken + correctedStPos + 1) {
@@ -154,11 +157,13 @@
         // token is not matched
 
         //now do some spell-checking:
-        if (!(errMessage.contains("<pleasespellme/>") && 
errMessage.contains("<mistake/>"))) {
-          final String clearMsg = errMessage.replaceAll("<pleasespellme/>", 
"").replaceAll("<mistake/>", "");
-          return new RuleMatch(rule, fromPos, toPos,
-                  clearMsg, rule.getShortMessage(), startsWithUppercase);
-        }
+      if (!(errMessage.contains("<pleasespellme/>") && errMessage
+          .contains("<mistake/>"))) {
+        final String clearMsg = errMessage.replaceAll("<pleasespellme/>", "")
+            .replaceAll("<mistake/>", "");
+        return new RuleMatch(rule, fromPos, toPos, clearMsg,
+            rule.getShortMessage(), startsWithUppercase, suggestionsOutMsg);
+      }
       } // failed to create any rule match...
       return null;
     }
@@ -169,8 +174,8 @@
    *
    * @return true, if the match converts the case of the token.
    */
-  private boolean matchConvertsCase() {
-    final List<Match> suggestionMatches = rule.getSuggestionMatches();
+  private boolean matchConvertsCase(List<Match> suggestionMatches) {
+    //final List<Match> suggestionMatches = rule.getSuggestionMatches();
     if (suggestionMatches != null && !suggestionMatches.isEmpty()) {
       final int sugStart = rule.getMessage().indexOf(SUGGESTION_START_TAG) + 
SUGGESTION_START_TAG.length();
       for (Match sMatch : suggestionMatches) {
@@ -219,7 +224,8 @@
    * @throws IOException
    */
   private String formatMatches(final AnalyzedTokenReadings[] tokenReadings,
-      final int[] positions, final int firstMatchTok, final String errorMsg)
+      final int[] positions, final int firstMatchTok, final String errorMsg,
+      final List<Match> suggestionMatches)
   throws IOException {
     String errorMessage = errorMsg;
     int matchCounter = 0;
@@ -250,13 +256,13 @@
         if (j <= positions.length) {
           nextTokenPos = firstMatchTok + repTokenPos + positions[j + 1];
         }
-        final List<Match> suggestionMatches = rule.getSuggestionMatches();
+        //final List<Match> suggestionMatches = rule.getSuggestionMatches();
         if (suggestionMatches != null) {
           if (matchCounter < suggestionMatches.size()) {
             numbersToMatches[j] = matchCounter;
             if (suggestionMatches.get(matchCounter) != null) {
               final String[] matches = concatMatches(matchCounter, j,
-                  firstMatchTok + repTokenPos, tokenReadings, nextTokenPos);
+                  firstMatchTok + repTokenPos, tokenReadings, nextTokenPos, 
suggestionMatches);
               final String leftSide = errorMessage.substring(0, backslashPos);
               final String rightSide = errorMessage.substring(backslashPos + 
numLen);
               if (matches.length == 1) {
@@ -351,10 +357,10 @@
    */
   private String[] concatMatches(final int start, final int index,
       final int tokenIndex, final AnalyzedTokenReadings[] tokens,
-      final int nextTokenPos)
+      final int nextTokenPos, final List<Match> suggestionMatches)
   throws IOException {
     String[] finalMatch = null;
-    final List<Match> suggestionMatches = rule.getSuggestionMatches();
+    //final List<Match> suggestionMatches = rule.getSuggestionMatches();
     if (suggestionMatches.get(start) != null) {
       final int len = phraseLen(index);
       final Language language = rule.language;

Modified: 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/XMLRuleHandler.java
===================================================================
--- 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/XMLRuleHandler.java
      2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/XMLRuleHandler.java
      2013-01-28 11:20:56 UTC (rev 9248)
@@ -54,6 +54,7 @@
   protected StringBuilder incorrectExample = new StringBuilder();
   protected StringBuilder exampleCorrection = new StringBuilder();
   protected StringBuilder message = new StringBuilder();
+  protected StringBuilder suggestionsOutMsg = new StringBuilder();
   protected StringBuilder match = new StringBuilder();
   protected StringBuilder elements;
   protected StringBuilder exceptions;
@@ -119,6 +120,8 @@
   protected Match tokenReference;
 
   protected List<Match> suggestionMatches;
+  
+  protected List<Match> suggestionMatchesOutMsg;
 
   protected Locator pLocator;
 
@@ -184,6 +187,7 @@
   protected static final String NO = "no";
   protected static final String PHRASES = "phrases";
   protected static final String MESSAGE = "message";
+  protected static final String SUGGESTION = "suggestion";
 
 
   public List<PatternRule> getRules() {
@@ -332,10 +336,19 @@
         suggestionMatches = new ArrayList<Match>();
       }
       suggestionMatches.add(mWorker);
-      //add incorrect XML character for simplicity
+      // add incorrect XML character for simplicity
       message.append("\u0001\\");
       message.append(attrs.getValue("no"));
       checkNumber(attrs);
+    } else if (inSuggestion && !inMessage) {
+      if (suggestionMatchesOutMsg == null) {
+        suggestionMatchesOutMsg = new ArrayList<Match>();
+      }
+      suggestionMatchesOutMsg.add(mWorker);
+      // add incorrect XML character for simplicity     
+      suggestionsOutMsg.append("\u0001\\");
+      suggestionsOutMsg.append(attrs.getValue("no"));
+      checkNumber(attrs);
     } else if (inToken && attrs.getValue("no") != null) {
       final int refNumber = Integer.parseInt(attrs.getValue("no"));
       checkRefNumber(refNumber);
@@ -445,12 +458,13 @@
    * Adds Match objects for all references to tokens
    * (including '\1' and the like). 
    */
-  protected List<Match> addLegacyMatches() {
-    if (suggestionMatches == null || suggestionMatches.isEmpty()) {
+  protected List<Match> addLegacyMatches(final List <Match> 
existingSugMatches, final String messageStr,
+      boolean inMessage) {
+    if (existingSugMatches == null || existingSugMatches.isEmpty()) {
       return null;
     }
     final List<Match> sugMatch = new ArrayList<Match>();
-    final String messageStr = message.toString();
+    //final String messageStr = message.toString();
     int pos = 0;
     int ind = 0;
     int matchCounter = 0;
@@ -464,8 +478,13 @@
             mWorker.setInMessageOnly(true);
             sugMatch.add(mWorker);
           } else if (messageStr.charAt(pos - 1) == '\u0001') { // real 
suggestion marker
-            sugMatch.add(suggestionMatches.get(matchCounter));
-            message.deleteCharAt(pos - 1 - matchCounter);
+            sugMatch.add(existingSugMatches.get(matchCounter));
+            if (inMessage) {
+              message.deleteCharAt(pos - 1 - matchCounter);
+            }
+            else {
+              suggestionsOutMsg.deleteCharAt(pos - 1 - matchCounter);
+            }
             matchCounter++;
           }
         }
@@ -474,7 +493,7 @@
     }
             
     if (sugMatch.isEmpty()) {
-      return suggestionMatches;
+      return existingSugMatches;
     }
     return sugMatch;
   }

Modified: 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/bitext/BitextPatternRuleLoader.java
===================================================================
--- 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/bitext/BitextPatternRuleLoader.java
      2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/rules/patterns/bitext/BitextPatternRuleLoader.java
      2013-01-28 11:20:56 UTC (rev 9248)
@@ -185,7 +185,7 @@
       for (final ArrayList<Element> phraseElement : phraseElementList) {
         processElement(phraseElement);
         rule = new PatternRule(id, language, phraseElement,
-            name, message.toString(), shortMessage.toString(),
+            name, message.toString(), shortMessage.toString(), "",
             phraseElementList.size() > 1);
         prepareRule(rule);       
       }

Modified: 
trunk/languagetool/languagetool-core/src/main/resources/org/languagetool/rules/rules.xsd
===================================================================
--- 
trunk/languagetool/languagetool-core/src/main/resources/org/languagetool/rules/rules.xsd
    2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-core/src/main/resources/org/languagetool/rules/rules.xsd
    2013-01-28 11:20:56 UTC (rev 9248)
@@ -146,6 +146,7 @@
                        <xs:sequence>
                                <xs:element ref="pattern" />
                                <xs:element ref="message" />
+                               <xs:element ref="suggestion" minOccurs="0" 
maxOccurs="15" />
         <xs:element ref="url" minOccurs="0" maxOccurs="1" />
                                <xs:element ref="short" minOccurs="0" />        
                                                        
                                <xs:element ref="example" minOccurs="2" 
maxOccurs="unbounded" />

Modified: 
trunk/languagetool/languagetool-core/src/main/resources/org/languagetool/rules/xx/grammar.xml
===================================================================
--- 
trunk/languagetool/languagetool-core/src/main/resources/org/languagetool/rules/xx/grammar.xml
       2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-core/src/main/resources/org/languagetool/rules/xx/grammar.xml
       2013-01-28 11:20:56 UTC (rev 9248)
@@ -394,6 +394,47 @@
                <example type="incorrect"><marker>det_plur_fem adj_sing_fem 
subst_plur_fem</marker></example>
        </rule>
     </rulegroup>    
+    <rulegroup id="suggestions_outside_message" name="Test suggestions written 
outside message">
+       <rule>
+               <pattern>
+                       <marker>
+                               <token>blah</token>
+                               <token>and</token>
+                       </marker>
+                       <token>blah</token>     
+               </pattern>
+               <message>Incorrect expression</message>
+               <suggestion>blah or</suggestion>
+               <suggestion>blah xor</suggestion>
+               <example type="incorrect" correction="blah or|blah 
xor"><marker>blah and</marker> blah</example>
+               <example type="correct">blah or blah</example>
+           </rule>
+           <rule>
+               <pattern>
+                       <marker>
+                               <token>blah</token>
+                               <token>and</token>
+                       </marker>
+                       <token>blah</token>     
+               </pattern>
+               <message>Incorrect expression: <suggestion>blah 
or</suggestion></message>
+               <suggestion>blah xor</suggestion>
+               <example type="incorrect" correction="blah or|blah 
xor"><marker>blah and</marker> blah</example>
+               <example type="correct">blah or blah</example>
+           </rule>
+           <rule>
+               <pattern>
+                       <marker>
+                               <token>blah</token>
+                               <token>and</token>
+                       </marker>
+                       <token>blah</token>     
+               </pattern>
+               <message>Incorrect expression: <suggestion><match no="1"/> 
or</suggestion></message>
+               <suggestion>blah <match no="1"/></suggestion>
+               <example type="incorrect" correction="blah or|blah 
blah"><marker>blah and</marker> blah</example>
+               <example type="correct">blah or blah</example>
+           </rule>
+       </rulegroup>    
   </category>
-
 </rules>
\ No newline at end of file

Modified: 
trunk/languagetool/languagetool-core/src/test/java/org/languagetool/rules/patterns/PatternRuleTest.java
===================================================================
--- 
trunk/languagetool/languagetool-core/src/test/java/org/languagetool/rules/patterns/PatternRuleTest.java
     2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-core/src/test/java/org/languagetool/rules/patterns/PatternRuleTest.java
     2013-01-28 11:20:56 UTC (rev 9248)
@@ -477,7 +477,7 @@
           // make sure suggestion is what we expect it to be
           if (suggestedCorrections != null && suggestedCorrections.size() > 0) 
{
             assertTrue("You specified a correction but your message has no 
suggestions in rule " + rule,
-              rule.getMessage().contains("<suggestion>")
+              rule.getMessage().contains("<suggestion>") || 
rule.getSuggestionsOutMsg().contains("<suggestion>")
             );
             assertTrue(lang + ": Incorrect suggestions: "
                 + suggestedCorrections.toString() + " != "

Modified: 
trunk/languagetool/languagetool-language-modules/ca/src/main/resources/org/languagetool/rules/ca/grammar.xml
===================================================================
--- 
trunk/languagetool/languagetool-language-modules/ca/src/main/resources/org/languagetool/rules/ca/grammar.xml
        2013-01-27 22:22:21 UTC (rev 9247)
+++ 
trunk/languagetool/languagetool-language-modules/ca/src/main/resources/org/languagetool/rules/ca/grammar.xml
        2013-01-28 11:20:56 UTC (rev 9248)
@@ -59,7 +59,9 @@
                         <token postag="NC.S.*" postag_regexp="yes"><exception 
postag="N..[PN].*|V.[^P].*|_possible_nompropi" postag_regexp="yes" /><exception 
inflected="yes">ordinal</exception><exception 
regexp="yes">gener|febrer|març|abril|maig|juny|juliol|agost|setembre|octubre|novembre|desembre</exception></token>
                     </marker>
                 </pattern>
-                <message>Error de concordança: <suggestion><match no="2" 
postag="N..P.*" /></suggestion>.</message>
+                <message>Error de concordança.</message>
+                <suggestion><match no="2" postag="N..P.*" /></suggestion>
+                <!-- <suggestion><match no="2" postag="N..P.*" /></suggestion> 
-->
                 <short>Error de concordança</short>
                 <example type="incorrect" correction="homes|hòmens">Trenta-dos 
<marker>home</marker>.</example>
                 <example type="incorrect" correction="anys">en trenta-un 
<marker>any</marker>.</example>
@@ -76,9 +78,10 @@
                         <token postag="A...S.*|V.P..S." 
postag_regexp="yes"><exception postag="A...[PN].*|V.P..P.|_possible_nompropi" 
postag_regexp="yes" /><exception inflected="yes">ordinal</exception></token>
                     </marker>
                 </pattern>
-                <message>Error de concordança: <suggestion><match no="2" 
postag="A...P.*|V.P..P." /></suggestion>.</message>
+                <message>Error de concordança.</message>
+                <suggestion><match no="2" postag="A...P.*|V.P..P." 
/></suggestion>
                 <short>Error de concordança</short>
-                <example type="incorrect">Trenta-dos 
<marker>únic</marker>.</example>
+                <example type="incorrect" 
correction="únics|úniques">Trenta-dos <marker>únic</marker>.</example>
                 <example type="correct">Trenta-dos únics.</example> 
                 <example type="correct">Equival a 136 seguit de 10 
zeros.</example>    
             </rule>

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits

Reply via email to