Revision: 8323
http://languagetool.svn.sourceforge.net/languagetool/?rev=8323&view=rev
Author: jaumeortola
Date: 2012-11-09 12:35:09 +0000 (Fri, 09 Nov 2012)
Log Message:
-----------
[ca] Fixed some false alarms. Remove unused files.
Modified Paths:
--------------
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ca/disambiguation.xml
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ca/multiwords.txt
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/grammar.xml
Removed Paths:
-------------
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ca/AccentuacioReplaceRule.java
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ca/CastellanismesReplaceRule.java
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/accentuacio.txt
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/castellanismes.txt
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ca/AccentuacioReplaceRuleTest.java
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ca/CastellanismesReplaceRuleTest.java
Deleted:
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ca/AccentuacioReplaceRule.java
===================================================================
---
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ca/AccentuacioReplaceRule.java
2012-11-09 12:30:34 UTC (rev 8322)
+++
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ca/AccentuacioReplaceRule.java
2012-11-09 12:35:09 UTC (rev 8323)
@@ -1,97 +0,0 @@
-/* LanguageTool, a natural language style checker
- * Copyright (C) 2005 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.rules.ca;
-
-import java.io.IOException;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.languagetool.rules.AbstractSimpleReplaceRule;
-
-/**
- * A rule that matches words or phrases which should not be used and suggests
- * correct ones instead.
- *
- * Catalan implementations for accentuation errors.
- * This is basically the same as CastellanismesReplaceRule.java
- * with a different error message.
- *
- * Loads the list of words from <code>rules/ca/accentuacio.txt</code>.
- *
- * TODO: Some of the entries are proper names (Greek gods, etc.), which
- * aren't currently checked.
- *
- * @author Jimmy O'Regan
- *
- * Based on pl/SimpleReplaceRule.java
- */
-public class AccentuacioReplaceRule extends AbstractSimpleReplaceRule {
-
- public static final String CATALAN_ACCENTUACIO_REPLACE_RULE =
"CA_ACCENTUACIO_REPLACE";
-
- private static final String FILE_NAME = "/ca/accentuacio.txt";
- // locale used on case-conversion
- private static final Locale CA_LOCALE = new Locale("ca");
-
- @Override
- public final String getFileName() {
- return FILE_NAME;
- }
-
- public AccentuacioReplaceRule(final ResourceBundle messages) throws
IOException {
- super(messages);
- }
-
- @Override
- public final String getId() {
- return CATALAN_ACCENTUACIO_REPLACE_RULE;
- }
-
- @Override
- public String getDescription() {
- return "Errors d'accentuació";
- }
-
- @Override
- public String getShort() {
- return "Accentuació";
- }
-
- @Override
- public String getSuggestion() {
- return " es un error d'accentuació, cal dir: ";
- }
-
- /**
- * use case-insensitive matching.
- */
- @Override
- public boolean isCaseSensitive() {
- return false;
- }
-
- /**
- * locale used on case-conversion
- */
- @Override
- public Locale getLocale() {
- return CA_LOCALE;
- }
-
-}
Deleted:
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ca/CastellanismesReplaceRule.java
===================================================================
---
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ca/CastellanismesReplaceRule.java
2012-11-09 12:30:34 UTC (rev 8322)
+++
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ca/CastellanismesReplaceRule.java
2012-11-09 12:35:09 UTC (rev 8323)
@@ -1,92 +0,0 @@
-/* LanguageTool, a natural language style checker
- * Copyright (C) 2005 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.rules.ca;
-
-import java.io.IOException;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.languagetool.rules.AbstractSimpleReplaceRule;
-
-/**
- * A rule that matches words or phrases which should not be used and suggests
- * correct ones instead.
- *
- * Catalan implementations for Castelianisms, kept separate for an individual
- * error message.
- * Loads the list of words from <code>rules/ca/castellanismes.txt</code>.
- *
- * @author Jimmy O'Regan
- *
- * Based on pl/SimpleReplaceRule.java
- */
-public class CastellanismesReplaceRule extends AbstractSimpleReplaceRule {
-
- public static final String CATALAN_CASTELLANISMES_REPLACE_RULE =
"CA_CASTELLANISMES_REPLACE";
-
- private static final String FILE_NAME = "/ca/castellanismes.txt";
- // locale used on case-conversion
- private static final Locale caLocale = new Locale("ca");
-
- @Override
- public final String getFileName() {
- return FILE_NAME;
- }
-
- public CastellanismesReplaceRule(final ResourceBundle messages) throws
IOException {
- super(messages);
- }
-
- @Override
- public final String getId() {
- return CATALAN_CASTELLANISMES_REPLACE_RULE;
- }
-
- @Override
- public String getDescription() {
- return "Barbarismes (Castellanismes)";
- }
-
- @Override
- public String getShort() {
- return "Castellanismes";
- }
-
- @Override
- public String getSuggestion() {
- return " es un castellanisme, cal dir: ";
- }
-
- /**
- * use case-insensitive matching.
- */
- @Override
- public boolean isCaseSensitive() {
- return false;
- }
-
- /**
- * locale used on case-conversion
- */
- @Override
- public Locale getLocale() {
- return caLocale;
- }
-
-}
Modified:
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ca/disambiguation.xml
===================================================================
---
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ca/disambiguation.xml
2012-11-09 12:30:34 UTC (rev 8322)
+++
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ca/disambiguation.xml
2012-11-09 12:35:09 UTC (rev 8323)
@@ -825,7 +825,7 @@
</marker>
<token postag="D.*|NC.*|_GN.*" postag_regexp="yes"></token>
</pattern>
- <disambig action="filter" postag="SPS00" />
+ <disambig action="filter" postag="SPS00|.*LOC_ADV.*" />
</rule>
</rulegroup>
<rulegroup id="nom_vocals" name="el nom de les vocals">
@@ -3002,7 +3002,7 @@
<token postag="N.*|A.*" postag_regexp="yes"><exception
postag="N.*|A.*" postag_regexp="yes" negate_pos="yes" /></token>
<marker>
<and>
- <token postag="V.[NIS].*"
postag_regexp="yes"><exception>gran</exception></token>
+ <token postag="V.[NIS].*" postag_regexp="yes"><exception
regexp="yes">gran|doble</exception></token>
<token postag="NC.*|A.*|V.P.*"
postag_regexp="yes"><exception postag="_GN.*|PX.*|D.*|SPS.*"
postag_regexp="yes" /></token>
</and>
</marker>
@@ -7300,6 +7300,19 @@
<disambig action="add"><wd
pos="ignore_concordance"></wd></disambig>
</rule>
</rulegroup>
+ <rule id="adj_ignore_concordance" name="adjectiu que ja acomopanya un nom">
+ <pattern>
+ <unify>
+ <feature id="genere"/>
+ <feature id="nombre"/>
+ <token postag="N.*" postag_regexp="yes"/>
+ <marker>
+ <token postag="A.*" postag_regexp="yes"/>
+ </marker>
+ </unify>
+ </pattern>
+ <disambig action="add"><wd pos="ignore_concordance"></wd></disambig>
+ </rule>
<rulegroup id="tot_toponim" name="tot + topònim">
<rule>
<pattern>
Modified:
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ca/multiwords.txt
===================================================================
---
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ca/multiwords.txt
2012-11-09 12:30:34 UTC (rev 8322)
+++
trunk/JLanguageTool/src/main/resources/org/languagetool/resource/ca/multiwords.txt
2012-11-09 12:35:09 UTC (rev 8323)
@@ -145,6 +145,7 @@
En certa manera LOC_ADV
En comú LOC_ADV
En conill LOC_ADV
+En contra LOC_ADV
En creu LOC_ADV
En dejú LOC_ADV
En detall LOC_ADV
@@ -377,6 +378,7 @@
en certa manera LOC_ADV
en comú LOC_ADV
en conill LOC_ADV
+en contra LOC_ADV
en creu LOC_ADV
en dejú LOC_ADV
en detall LOC_ADV
Deleted:
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/accentuacio.txt
===================================================================
---
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/accentuacio.txt
2012-11-09 12:30:34 UTC (rev 8322)
+++
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/accentuacio.txt
2012-11-09 12:35:09 UTC (rev 8323)
@@ -1,226 +0,0 @@
-# @author Jimmy O'Regan
-# Based on material provided by Luis Villarejo, Universitat Oberta de Catalunya
-alfíl=alfil
-amít=amit
-beisbòl=beisbol
-cautxu=cautxú
-cèltiber=celtiber
-cèntigram=centigram
-ciclòp=ciclop
-Cistèr=Cister
-críquet=criquet
-elít=elit
-filantròp=filantrop
-fluòr=fluor
-futbòl=futbol
-handbòl=handbol
-hàndicap=handicap
-hèctogram=hectogram
-hòquei=hoquei
-ibèr=iber
-ínterval=interval
-lèvogir=levogir
-línier=linier
-míl·ligram=mil·ligram
-mísantrop=misantrop
-oboe=oboè
-ovàl=oval
-pelica=pelicà
-pivot=pivot
-pívot=pivot
-polícrom=policrom
-pòlicrom=policrom
-políglot=poliglot
-pòliglot=poliglot
-quefír=quefir
-radàr=radar
-sahraui=sahrauí
-sovièt=soviet
-taiga=taigà
-timpa=timpà
-tiquèt=tiquet
-tuàreg=tuareg
-urdu=urdú
-xandàll=xandall
-xassis=xassís
-zenít=zenit
-Àdam=Adam
-Artúr=Artur
-Ausias=Ausiàs
-Boris=Borís
-Elísabet=Elisabet
-Guifre=Guifré
-Raímon=Raimon
-Biarrítz=Biarritz
-Carpàts=Carpats
-Múnic=Munic
-Tíbet=Tibet
-Zúric=Zuric
-àcne=acne
-aerostat=aeròstat
-almoravit=almoràvit
-alveol=alvèol
-anèmone=anemone
-anglofob=anglòfob
-apoplexía=apoplexia
-astur=àstur
-atmosfèra=atmosfera
-augur=àugur
-auríga=auriga
-bantú=bantu
-bíosfera=biosfera
-bronquiol=bronquíol
-centigrad=centígrad
-cèntilitre=centilitre
-cònclave=conclave
-cònsola=consola
-cotiledon=cotilèdon
-dínamo=dinamo
-endòsmosi=endosmosi
-èpiclesi=epiclesi
-èxegesi=exegesi
-èxosmosi=exosmosi
-gurú=guru
-hèctolitre=hectolitre
-hèmiplegia=hemiplegia
-kàrate=karate
-letàrgia=letargia
-líbido=libido
-ligur=lígur
-mèdul·la=medul·la
-megalit=megàlit
-mil·lilitre=mil·lilitre
-mímesi=mimesi
-missil=míssil
-nucleol=nuclèol
-omoplat=omòplat
-osmosi=osmosi
-paraplegia=paraplegia
-picnic=pícnic
-poliester=polièster
-prensil=prènsil
-quadriga=quadriga
-quilolitre=quilolitre
-reostat=reòstat
-reptil=rèptil
-rupia=rupia
-sicomor=sicòmor
-sinergia=sinergia
-termit=tèrmit
-termostat=termòstat
-textil=tèxtil
-torticoli=torticoli
-tulipa=tulipa
-vacuol=vacúol
-viking=víking
-vimet=vímet
-zoofit=zoòfit
-zulú=zulu
-Agamemnon=Agamèmnon
-Aristídes=Aristides
-Arquimèdes=Arquimedes
-Astàrte=Astarte
-Cerber=Cèrber
-Ciriac=Ciríac
-Didac=Dídac
-Edip=Èdip
-Eol=Èol
-Esquil=Èsquil
-Espartac=Espàrtac
-Ganimèdes=Ganimedes
-Herodot=Heròdot
-Igor=Ígor
-Jafet=Jàfet
-Jason=Jàson
-Karamazov=Karamàzov
-Kefren=Kefren
-Lacedemon=Lacedèmon
-Vercingetorix=Vercingetòrix
-Aneu=Àneu
-Èfes=Efes
-Eufràtes=Eufrates
-Ilúro=Iluro
-Kharkov=Khàrkov
-Kiev=Kíev
-Màli=Mali
-Marraqueix=Marràqueix
-Negueb=Nègueb
-Ravenna=Ravenna
-Samaria=Samaria
-Sebastopol=Sebastòpol
-Subur=Súbur
-Tarent=Tàrent
-Ucraina=Ucraïna
-anode=ànode
-antropofagia=antropofàgia
-areola=arèola
-aureola=aurèola
-autolisi=autòlisi
-catode=càtode
-diode=díode
-dioptria=diòptria
-eczema=èczema
-electrode=elèctrode
-electrolisi=electròlisi
-endospora=endòspora
-enema=ènema
-epode=èpode
-especimen=espècimen
-exospora=exòspora
-gameta=gàmeta
-isobara=isòbara
-marqueting=màrqueting
-metopa=mètopa
-olimpiada=olimpíada
-patxuli=pàtxuli
-pentode=pèntode
-periode=període
-pneumonia=pneumònia
-quadriceps=quàdriceps
-rubeola=rubèola
-tetrode=tètrode
-triode=tríode
-video=vídeo
-zoospora=zoòspora
-Artemis=Àrtemis
-Astiages=Astíages
-Atila=Àtila
-Cibele=Cíbele
-Damocles=Dàmocles
-Esquines=Èsquines
-Eumenes=Èumenes
-Fafila=Fàfila
-Favila=Fàvila
-Heracles=Hèracles
-Lascaris=Làscaris
-Pericles=Pèricles
-Praxiteles=Praxíteles
-Proserpina=Prosèrpina
-Sennaquerib=Sennàquerib
-Setabis=Sètabis
-Suintila=Suíntila
-Ulfila=Úlfila
-Vitiza=Vítiza
-Barcino=Bàrcino
-Bassora=Bàssora
-Betulo=Bètulo
-Brindisi=Bríndisi
-Ecbatana=Ecbàtana
-Egara=Ègara
-Etiopia=Etiòpia
-Helsinki=Hèlsinki
-Himalaia=Himàlaia
-Itaca=Ítaca
-Katmandu=Kàtmandu
-Ladoga=Làdoga
-Larissa=Làrissa
-Larnaca=Làrnaca
-Megara=Mègara
-Mikonos=Míkonos
-Otranto=Òtranto
-Sahara=Sàhara
-Samosata=Samòsata
-Sicoris=Sícoris
-Tarraco=Tàrraco
-Toquio=Tòquio
-Umbria=Úmbria
Deleted:
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/castellanismes.txt
===================================================================
---
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/castellanismes.txt
2012-11-09 12:30:34 UTC (rev 8322)
+++
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/castellanismes.txt
2012-11-09 12:35:09 UTC (rev 8323)
@@ -1,59 +0,0 @@
-# @author Jimmy O'Regan
-#
-# Castellanismes
-#
-# FIXME: Add full conjugation for verbs?
-#
-# FIMXE Multiwords... check Romanian?
-# crucigrama=mots encreuats
-# jabalí=porc senglar
-# quiròfan=sala d'operacions
-#
-# FIXME: Needs its own rule:
-# pues=doncs
-# (pua, pues)
-#
-
-acera=vorera
-aconteixement=esdeveniment
-ajedrès=escacs
-alemà=alemany
-aleman=alemany
-antes=abans
-assunto=assumpte
-averiguar=esbrinar
-barco=vaixell
-bueno=bé
-carinyo=afecte
-desaigüe=desguàs
-después=després
-disfrutar=gaudir
-enfermetat=malaltia
-enfermetats=malalties
-entonses=aleshores
-gasto=despesa
-garantitzar=garantir
-gelos=gelosia
-hasta=fins
-huelga=vaga
-inglès=anglès
-làmpara=làmpada
-lavadora=rentadora
-mantequilla=mantega
-parxe=pegat
-quadro=quadre
-recado=encàrrec
-reflexar=reflectir
-sello=segell
-sombra=ombra
-tamany=mida
-tonto=babau
-urbano=urbà
-verbena=revetlla
-vivenda=habitatge
-xarco=toll
-# acronyms
-máx=màx
-cód=cod
-admón=adm
-dña=sra
Modified:
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/grammar.xml
===================================================================
---
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/grammar.xml
2012-11-09 12:30:34 UTC (rev 8322)
+++
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/ca/grammar.xml
2012-11-09 12:35:09 UTC (rev 8323)
@@ -580,7 +580,7 @@
<unify negate="yes">
<feature id="nombre" />
<feature id="genere" />
- <token postag="A.*|PX.*"
postag_regexp="yes"><exception postag="complement.*"
postag_regexp="yes"/></token>
+ <token postag="A.*|PX.*"
postag_regexp="yes"><exception postag="complement.*|ignore_concordance"
postag_regexp="yes"/></token>
<token postag="N.M.*" postag_regexp="yes"><exception
postag="A.*|V.[PIS].*|ignore_concordance" postag_regexp="yes" /><exception
inflected="yes">numeral</exception></token>
</unify>
</pattern>
@@ -602,7 +602,7 @@
<unify negate="yes">
<feature id="nombre" />
<feature id="genere" />
- <token postag="A.*|PX.*"
postag_regexp="yes"><exception postag="complement.*"
postag_regexp="yes"/></token>
+ <token postag="A.*|PX.*"
postag_regexp="yes"><exception postag="complement.*|ignore_concordance"
postag_regexp="yes"/></token>
<token postag="N.F.*" postag_regexp="yes"><exception
postag="A.*|V.[PIS].*|ignore_concordance" postag_regexp="yes" /><exception
inflected="yes">numeral</exception><exception>ca</exception></token>
</unify>
</pattern>
Deleted:
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ca/AccentuacioReplaceRuleTest.java
===================================================================
---
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ca/AccentuacioReplaceRuleTest.java
2012-11-09 12:30:34 UTC (rev 8322)
+++
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ca/AccentuacioReplaceRuleTest.java
2012-11-09 12:35:09 UTC (rev 8323)
@@ -1,81 +0,0 @@
-/* LanguageTool, a natural language style checker
- * Copyright (C) 2005 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.rules.ca;
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-import org.languagetool.JLanguageTool;
-import org.languagetool.Language;
-import org.languagetool.TestTools;
-import org.languagetool.rules.RuleMatch;
-
-/**
- *
- * Simple tests for rules/ca/AccentuacioSimpleReplaceRule class
- *
- * @author Ionuț Păduraru
- */
-public class AccentuacioReplaceRuleTest extends TestCase {
-
- private AccentuacioReplaceRule rule;
- private JLanguageTool langTool;
-
- protected void setUp() throws Exception {
- super.setUp();
- rule = new AccentuacioReplaceRule(TestTools.getMessages("ca"));
- langTool = new JLanguageTool(Language.CATALAN);
- }
-
- public void testRule() throws IOException {
-
- // correct sentences:
- assertEquals(0, rule.match(langTool.getAnalyzedSentence("Tot
està bé.")).length);
-
- // incorrect sentences:
-
- // at the beginning of a sentence (Romanian replace rule is
case-sensitive)
- checkSimpleReplaceRule("Pneumonia vírica.", "Pneumònia");
- // inside sentence
- checkSimpleReplaceRule("Supercopa d'Europa de futbòl.",
"futbol");
- }
-
- /**
- * Check if a specific replace rule applies.
- *
- * @param sentence
- * the sentence containing the incorrect/misspeled word.
- * @param word
- * the word that is correct (the suggested replacement).
- * @throws IOException
- */
- private void checkSimpleReplaceRule(String sentence, String word)
- throws IOException {
- RuleMatch[] matches;
- matches = rule.match(langTool.getAnalyzedSentence(sentence));
- assertEquals("Invalid matches.length while checking sentence: "
- + sentence, 1, matches.length);
- assertEquals("Invalid replacement count while checking
sentence: "
- + sentence, 1,
matches[0].getSuggestedReplacements().size());
- assertEquals("Invalid suggested replacement while checking
sentence: "
- + sentence, word,
matches[0].getSuggestedReplacements().get(0));
- }
-}
Deleted:
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ca/CastellanismesReplaceRuleTest.java
===================================================================
---
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ca/CastellanismesReplaceRuleTest.java
2012-11-09 12:30:34 UTC (rev 8322)
+++
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ca/CastellanismesReplaceRuleTest.java
2012-11-09 12:35:09 UTC (rev 8323)
@@ -1,81 +0,0 @@
-/* LanguageTool, a natural language style checker
- * Copyright (C) 2005 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.rules.ca;
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-import org.languagetool.JLanguageTool;
-import org.languagetool.Language;
-import org.languagetool.TestTools;
-import org.languagetool.rules.RuleMatch;
-
-/**
- *
- * Simple tests for rules/ca/SimpleReplaceRule class
- *
- * @author Ionuț Păduraru
- */
-public class CastellanismesReplaceRuleTest extends TestCase {
-
- private CastellanismesReplaceRule rule;
- private JLanguageTool langTool;
-
- protected void setUp() throws Exception {
- super.setUp();
- rule = new
CastellanismesReplaceRule(TestTools.getMessages("ca"));
- langTool = new JLanguageTool(Language.CATALAN);
- }
-
- public void testRule() throws IOException {
-
- // correct sentences:
- assertEquals(0, rule.match(langTool.getAnalyzedSentence("Tot
està bé.")).length);
-
- // incorrect sentences:
-
- // at the beginning of a sentence (Romanian replace rule is
case-sensitive)
- checkSimpleReplaceRule("Después de la mort de Lenin.",
"Després");
- // inside sentence
- checkSimpleReplaceRule("Un any después.", "després");
- }
-
- /**
- * Check if a specific replace rule applies.
- *
- * @param sentence
- * the sentence containing the incorrect/misspeled word.
- * @param word
- * the word that is correct (the suggested replacement).
- * @throws IOException
- */
- private void checkSimpleReplaceRule(String sentence, String word)
- throws IOException {
- RuleMatch[] matches;
- matches = rule.match(langTool.getAnalyzedSentence(sentence));
- assertEquals("Invalid matches.length while checking sentence: "
- + sentence, 1, matches.length);
- assertEquals("Invalid replacement count wile checking sentence:
"
- + sentence, 1,
matches[0].getSuggestedReplacements().size());
- assertEquals("Invalid suggested replacement while checking
sentence: "
- + sentence, word,
matches[0].getSuggestedReplacements().get(0));
- }
-}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits