Revision: 7494
http://languagetool.svn.sourceforge.net/languagetool/?rev=7494&view=rev
Author: jaumeortola
Date: 2012-06-24 21:10:48 +0000 (Sun, 24 Jun 2012)
Log Message:
-----------
[ca] Fixed some false alarms.
Modified Paths:
--------------
trunk/JLanguageTool/src/java/org/languagetool/rules/ca/ComplexAdjectiveConcordanceRule.java
trunk/JLanguageTool/src/resource/ca/disambiguation.xml
trunk/JLanguageTool/src/rules/ca/grammar.xml
trunk/JLanguageTool/src/test/org/languagetool/rules/ca/ComplexAdjectiveConcordanceRuleTest.java
Modified:
trunk/JLanguageTool/src/java/org/languagetool/rules/ca/ComplexAdjectiveConcordanceRule.java
===================================================================
---
trunk/JLanguageTool/src/java/org/languagetool/rules/ca/ComplexAdjectiveConcordanceRule.java
2012-06-24 20:58:51 UTC (rev 7493)
+++
trunk/JLanguageTool/src/java/org/languagetool/rules/ca/ComplexAdjectiveConcordanceRule.java
2012-06-24 21:10:48 UTC (rev 7494)
@@ -46,20 +46,19 @@
private static final Pattern NOM_FS = Pattern.compile("N.[FC][SN].*");
private static final Pattern NOM_MP = Pattern.compile("N.[MC][PN].*");
private static final Pattern NOM_FP = Pattern.compile("N.[FC][PN].*");
- private static final Pattern DET_CS = Pattern.compile("D[DA0I]0CS0");
- private static final Pattern DET_MS = Pattern.compile("D[DA0I]0MS0");
- private static final Pattern DET_FS = Pattern.compile("D[DA0I]0FS0");
- private static final Pattern DET_MP = Pattern.compile("D[DA0I]0MP0");
- private static final Pattern DET_FP = Pattern.compile("D[DA0I]0FP0");
- private static final Pattern GN_MS =
Pattern.compile("N.[MC][SN].*|D[DA0I]0MS0");
- private static final Pattern GN_FS =
Pattern.compile("N.[FC][SN].*|D[DA0I]0FS0");
- private static final Pattern GN_MP =
Pattern.compile("N.[MC][PN].*|D[DA0I]0MP0");
- private static final Pattern GN_FP =
Pattern.compile("N.[FC][PN].*|D[DA0I]0FP0");
- private static final Pattern GN_CP =
Pattern.compile("N.[FMC][PN].*|D[DA0I]0[FM]P0");
- private static final Pattern GN_CS =
Pattern.compile("N.[FMC][SN].*|D[DA0I]0[FM]S0");
+ private static final Pattern DET_CS = Pattern.compile("D[NDA0I]0CS0");
+ private static final Pattern DET_MS = Pattern.compile("D[NDA0I]0MS0");
+ private static final Pattern DET_FS = Pattern.compile("D[NDA0I]0FS0");
+ private static final Pattern DET_MP = Pattern.compile("D[NDA0I]0MP0");
+ private static final Pattern DET_FP = Pattern.compile("D[NDA0I]0FP0");
+ private static final Pattern GN_MS =
Pattern.compile("N.[MC][SN].*|D[NDA0I]0MS0");
+ private static final Pattern GN_FS =
Pattern.compile("N.[FC][SN].*|D[NDA0I]0FS0");
+ private static final Pattern GN_MP =
Pattern.compile("N.[MC][PN].*|D[NDA0I]0MP0");
+ private static final Pattern GN_FP =
Pattern.compile("N.[FC][PN].*|D[NDA0I]0FP0");
+ private static final Pattern GN_CP =
Pattern.compile("N.[FMC][PN].*|D[NDA0I]0[FM]P0");
+ private static final Pattern GN_CS =
Pattern.compile("N.[FMC][SN].*|D[NDA0I]0[FM]S0");
private static final Pattern ADJECTIU =
Pattern.compile("AQ.*|V.P.*|PX.*");
- private static final Pattern PARTICIPI = Pattern.compile("V.P.*");
private static final Pattern ADJECTIU_MS =
Pattern.compile("A..[MC][SN].*|V.P..SM|PX.MS.*");
private static final Pattern ADJECTIU_FS =
Pattern.compile("A..[FC][SN].*|V.P..SF|PX.FS.*");
private static final Pattern ADJECTIU_MP =
Pattern.compile("A..[MC][PN].*|V.P..PM|PX.MP.*");
@@ -74,11 +73,12 @@
private static final Pattern UPPERCASE =
Pattern.compile("\\p{Lu}[\\p{Ll}\u00B7]*");
private static final Pattern COORDINACIO = Pattern.compile(",|i|o");
private static final Pattern COORDINACIO_IONI =
Pattern.compile("i|o|ni");
- private static final Pattern KEEP_COUNT =
Pattern.compile("AQ.*|N.*|D[AID].*|SPS.*|R.*|V.P.*");
+ private static final Pattern KEEP_COUNT =
Pattern.compile("A.*|N.*|D[NAID].*|SPS.*|R.*|V.P.*");
private static final Pattern KEEP_COUNT2 = Pattern.compile(",|i|o|ni");
private static final Pattern PREPOSICIONS = Pattern.compile("SPS.*");
private static final Pattern VERB_AUXILIAR = Pattern.compile("V[AS].*");
private static final Pattern EXCEPCIONS_PARTICIPI =
Pattern.compile("atès|atés|atesa|atesos|ateses|donat|donats|donada|donades");
+ private static final Pattern EXCEPCIONS_PREVIA =
Pattern.compile("volt(a|es)|vegad(a|es)|cops?|termes?|paraul(a|es)|mots?|vocables?");
public ComplexAdjectiveConcordanceRule(ResourceBundle messages) throws
IOException {
@@ -89,7 +89,7 @@
@Override
public String getId() {
- return "COMPLEX_ADJECTIVE_CONCORDANCE";
+ return "CONCORDANCES_ADJECTIU_POSPOSAT";
}
@Override
@@ -106,10 +106,10 @@
{
final String token=tokens[i].getToken();
final String prevToken=tokens[i-1].getToken();
- String prevPrevToken="";
- if (i > 2) {
- prevPrevToken = tokens[i-2].getToken();
- }
+// String prevPrevToken="";
+// if (i > 2) {
+// prevPrevToken = tokens[i-2].getToken();
+// }
String nextToken="";
if (i < tokens.length-1) {
nextToken = tokens[i+1].getToken();
@@ -124,7 +124,7 @@
Pattern adjPattern = null;
Matcher isUpperCase = UPPERCASE.matcher(token);
- //Counts nouns and determiners before the
adjective (-maxLocalWords ).
+ //Counts nouns and determiners before the
adjectives.
//Takes care of acceptable combinations.
int maxLevels=4;
int[] cNt = new int[maxLevels];
@@ -224,23 +224,18 @@
}
}
- //exception: una vegada + participi
- if (!isException &&
matchPostagRegexp(tokens[i],PARTICIPI) &&
-
((prevPrevToken.equalsIgnoreCase("una")&&prevToken.equals("vegada"))
-
||(prevPrevToken.equalsIgnoreCase("una")&&prevToken.equals("volta"))
-
||(prevPrevToken.equalsIgnoreCase("un")&&prevToken.equals("cop")))) {
+ //exception: una vegada + participi, a vegades,
etc.
+ if (!isException &&
matchRegexp(prevToken,EXCEPCIONS_PREVIA)) {
isException=true;}
//exceptions: llevat de, tret de, majúsucula
inicial
if ( !isException && ( ((token.equals("tret")
|| token.equals("llevat") ) && nextToken.equals("de"))
- || token.equals("primer") ||
token.equals("junts")
- || prevToken.equals("terme") ||
prevToken.equals("paraula") || prevToken.equals("mot")
- || prevToken.equals("termes")
|| prevToken.equals("paraules") || prevToken.equals("mots")
+ || token.equals("primer") ||
token.equals("junts")
|| isUpperCase.matches() ) ) {
isException=true;}
//exceptions: atès, atesos..., donat, donats...
- if ( !isException &&
matchPostagRegexp(tokens[i],EXCEPCIONS_PARTICIPI) ) {
+ if ( !isException &&
matchRegexp(token,EXCEPCIONS_PARTICIPI) ) {
isException=true;}
//exceptions: segur que
Modified: trunk/JLanguageTool/src/resource/ca/disambiguation.xml
===================================================================
--- trunk/JLanguageTool/src/resource/ca/disambiguation.xml 2012-06-24
20:58:51 UTC (rev 7493)
+++ trunk/JLanguageTool/src/resource/ca/disambiguation.xml 2012-06-24
21:10:48 UTC (rev 7494)
@@ -356,7 +356,7 @@
<rule>
<pattern>
<marker>
- <token postag="V.[IS].*" postag_regexp="yes"
inflected="yes" skip="12">fer<exception scope="next"
regexp="yes">,|que</exception></token>
+ <token postag="V.[IS].*" postag_regexp="yes"
inflected="yes" skip="12">fer<exception scope="next"
regexp="yes">,|que|en</exception><exception postag="V.*"
postag_regexp="yes"/></token>
</marker>
<token postag="NC.*" postag_regexp="yes" inflected="yes"
regexp="yes">segon|minut|hora|dia|setmana|mes|(tri|quadri|se)mestre|any|lustre|dècada|segle|mil·leni|moment|instant|temps</token>
</pattern>
@@ -583,15 +583,27 @@
<match no="1" postag_regexp="yes" postag="[^D].*"></match>
</disambig>
</rule>
- <rule id="nom_vocals" name="el nom de les vocals">
- <pattern>
- <token regexp="yes">la|una</token>
- <marker>
- <token regexp="yes">a|e|i|o|u</token>
- </marker>
- </pattern>
- <disambig action="filter" postag="N.*" />
- </rule>
+ <rulegroup id="nom_vocals" name="el nom de les vocals">
+ <rule>
+ <pattern>
+ <token regexp="yes">la</token>
+ <marker>
+ <token regexp="yes">a|e|i|o|u</token>
+ </marker>
+ </pattern>
+ <disambig action="filter" postag="N.*" />
+ </rule>
+ <rule>
+ <pattern>
+ <token regexp="yes">una</token>
+ <marker>
+ <token regexp="yes">a|e|u</token>
+ </marker>
+ </pattern>
+ <disambig action="filter" postag="N.*" />
+ </rule>
+
+ </rulegroup>
<rule id="nN" name="no Nom">
<!-- paraules comunes que no solen ser noms gairebé mai (es,...) -->
<pattern>
@@ -4160,7 +4172,7 @@
<marker>
<and>
<token postag="N.*" postag_regexp="yes"></token>
- <token postag="V.P.*|AQ.*" postag_regexp="yes"><exception
postag="_GN.*|SPS00|V.[MIS].*" postag_regexp="yes" /></token>
+ <token postag="V.P.*|AQ.*" postag_regexp="yes"><exception
postag="_GN.*|SPS00|V.[GMIS].*" postag_regexp="yes" /></token>
</and>
</marker>
</pattern>
@@ -4305,7 +4317,7 @@
<token postag="V.[MSI].*|_GV_" postag_regexp="yes"><exception
postag="PP.*|P0.*" postag_regexp="yes"/></token>
<marker>
<and>
- <token postag="A.*|V.P.*" postag_regexp="yes"><exception
postag="_GN_.*" postag_regexp="yes" /></token>
+ <token postag="A.*|V.P.*" postag_regexp="yes"><exception
postag="_GN.*" postag_regexp="yes" /></token>
<token postag="V.[SI].*" postag_regexp="yes"><exception
postag="_GV_" /></token>
</and>
</marker>
@@ -4320,7 +4332,7 @@
<token postag="V.[SI].*" postag_regexp="yes"><exception
postag="_GV_" /></token>
</and>
</marker>
- <token postag="V.[MSI].*|PP.*|P0.*" postag_regexp="yes"><exception
postag="_GV_" postag_regexp="yes"/><exception
regexp="yes">jo|tu|ella?|nosaltres|vosaltres|elle?s|vost[èé]s?|vós</exception></token>
+ <token postag="V.[MSI].*|PP.*|P0.*" postag_regexp="yes"><exception
postag="_GN.*" postag_regexp="yes"/><exception
regexp="yes">jo|tu|ella?|nosaltres|vosaltres|elle?s|vost[èé]s?|vós</exception></token>
</pattern>
<disambig action="filter" postag="A.*|V.P.*"></disambig>
</rule>
Modified: trunk/JLanguageTool/src/rules/ca/grammar.xml
===================================================================
--- trunk/JLanguageTool/src/rules/ca/grammar.xml 2012-06-24 20:58:51 UTC
(rev 7493)
+++ trunk/JLanguageTool/src/rules/ca/grammar.xml 2012-06-24 21:10:48 UTC
(rev 7494)
@@ -2,8 +2,8 @@
<?xml-stylesheet type="text/xsl" href="../print.xsl" title="Pretty print" ?>
<?xml-stylesheet type="text/css" href="../rules.css" title="Easy editing
stylesheet" ?>
<!--
-Catalan Grammar and Typo Rules for LanguageTool
-Copyright (C) 2012 Jaume Ortolà i Font
+Catalan Grammar and Typo Rules for LanguageTool Copyright
+(C) 2012 Jaume Ortolà i Font
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,7 +19,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-$Id$
+ $Id$
-->
<rules lang="ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../rules.xsd">
<unification feature="nombre">
@@ -2032,7 +2032,7 @@
<!--alguna falsa alarma?-->
<rule>
<pattern>
- <token>coma</token>
+ <token>coma<exception postag="N.*"
postag_regexp="yes"/></token>
</pattern>
<message>Potser és: <suggestion>com a</suggestion>.</message>
<short>Confusió.</short>
@@ -3860,7 +3860,7 @@
</rule>
</rulegroup>
</category>
- <category name="A1) Exigeix formes del català central" default="on">
+ <category name="A1) Exigeix formes del català central" default="off">
<!-- Evita formes no valencianes -->
<rulegroup id="EVITA_ACCENTUACIO_VALENCIANA" name="Evita l'accentuació
valenciana no general (café, sotmés, conéixer, térbol)">
<rule>
Modified:
trunk/JLanguageTool/src/test/org/languagetool/rules/ca/ComplexAdjectiveConcordanceRuleTest.java
===================================================================
---
trunk/JLanguageTool/src/test/org/languagetool/rules/ca/ComplexAdjectiveConcordanceRuleTest.java
2012-06-24 20:58:51 UTC (rev 7493)
+++
trunk/JLanguageTool/src/test/org/languagetool/rules/ca/ComplexAdjectiveConcordanceRuleTest.java
2012-06-24 21:10:48 UTC (rev 7494)
@@ -42,6 +42,8 @@
public void testRule() throws IOException {
// correct sentences:
+ assertCorrect("des de la tradicional divisió en dos regnes
establida per Linnaeus");
+ assertCorrect("aquestes activitats avui residuals donada ja la
manca de territori");
assertCorrect("instruments de càlcul basats en boles anomenats
yupana.");
assertCorrect("El rei ha trobat l'excusa i l'explicació
adequades.");
assertCorrect("El rei ha trobat l'excusa i l'explicació
adequada.");
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