Revision: 7302
http://languagetool.svn.sourceforge.net/languagetool/?rev=7302&view=rev
Author: dnaber
Date: 2012-06-09 09:12:49 +0000 (Sat, 09 Jun 2012)
Log Message:
-----------
[ca] more tests (Jaume Ortola i Font)
Modified Paths:
--------------
trunk/JLanguageTool/src/test/org/languagetool/rules/HunspellRuleTest.java
Added Paths:
-----------
trunk/JLanguageTool/src/test/org/languagetool/tokenizers/ca/
trunk/JLanguageTool/src/test/org/languagetool/tokenizers/ca/CatalanWordTokenizerTest.java
Modified:
trunk/JLanguageTool/src/test/org/languagetool/rules/HunspellRuleTest.java
===================================================================
--- trunk/JLanguageTool/src/test/org/languagetool/rules/HunspellRuleTest.java
2012-06-09 08:59:00 UTC (rev 7301)
+++ trunk/JLanguageTool/src/test/org/languagetool/rules/HunspellRuleTest.java
2012-06-09 09:12:49 UTC (rev 7302)
@@ -32,32 +32,51 @@
public class HunspellRuleTest {
- @Test
- public void testRule() throws UnsatisfiedLinkError,
UnsupportedOperationException, IOException {
-
- HunspellRule rule =
- new
HunspellRule(TestTools.getMessages("Polish"), Language.POLISH);
-
- RuleMatch[] matches;
- JLanguageTool langTool = new JLanguageTool(Language.POLISH);
-
-
- // correct sentences:
- assertEquals(0, rule.match(langTool.getAnalyzedSentence("To jest
test bez jakiegokolwiek błędu.")).length);
- assertEquals(0, rule.match(langTool.getAnalyzedSentence("Żółw na
starość wydziela dziwną woń.")).length);
- assertEquals(0,
rule.match(langTool.getAnalyzedSentence(",")).length);
-
- //incorrect sentences:
-
- matches = rule.match(langTool.getAnalyzedSentence("Zolw"));
- // check match positions:
- assertEquals(1, matches.length);
- assertEquals(0, matches[0].getFromPos());
- assertEquals(4, matches[0].getToPos());
- assertEquals("Żółw", matches[0].getSuggestedReplacements().get(0));
-
- assertEquals(1,
rule.match(langTool.getAnalyzedSentence("aõh")).length);
- assertEquals(0,
rule.match(langTool.getAnalyzedSentence("a")).length);
- }
+ @Test
+ public void testRule() throws UnsatisfiedLinkError,
UnsupportedOperationException, IOException {
+ HunspellRule rule =
+ new HunspellRule(TestTools.getMessages("Polish"), Language.POLISH);
+
+ RuleMatch[] matches;
+ JLanguageTool langTool = new JLanguageTool(Language.POLISH);
+
+
+ // correct sentences:
+ assertEquals(0, rule.match(langTool.getAnalyzedSentence("To jest test bez
jakiegokolwiek błędu.")).length);
+ assertEquals(0, rule.match(langTool.getAnalyzedSentence("Żółw na starość
wydziela dziwną woń.")).length);
+ assertEquals(0, rule.match(langTool.getAnalyzedSentence(",")).length);
+
+ //incorrect sentences:
+
+ matches = rule.match(langTool.getAnalyzedSentence("Zolw"));
+ // check match positions:
+ assertEquals(1, matches.length);
+ assertEquals(0, matches[0].getFromPos());
+ assertEquals(4, matches[0].getToPos());
+ assertEquals("Żółw", matches[0].getSuggestedReplacements().get(0));
+
+ assertEquals(1, rule.match(langTool.getAnalyzedSentence("aõh")).length);
+ assertEquals(0, rule.match(langTool.getAnalyzedSentence("a")).length);
+
+ // Catalan
+ HunspellRule catRule =
+ new HunspellRule(TestTools.getMessages("Catalan"),
Language.CATALAN);
+ JLanguageTool catTool = new JLanguageTool(Language.CATALAN);
+
+ // correct sentences:
+ assertEquals(0, catRule.match(catTool.getAnalyzedSentence("Allò que més
l'interessa.")).length);
+ // checks that "WORDCHARS '" is added to Hunspell .aff file
+ assertEquals(0, catRule.match(catTool.getAnalyzedSentence("Porta'n
quatre.")).length);
+ assertEquals(0, catRule.match(catTool.getAnalyzedSentence(",")).length);
+
+ //incorrect sentences:
+ matches = catRule.match(catTool.getAnalyzedSentence("Pecra"));
+ // check match positions:
+ assertEquals(1, matches.length);
+ assertEquals(0, matches[0].getFromPos());
+ assertEquals(5, matches[0].getToPos());
+ assertEquals("Pera", matches[0].getSuggestedReplacements().get(0));
+ }
+
}
Added:
trunk/JLanguageTool/src/test/org/languagetool/tokenizers/ca/CatalanWordTokenizerTest.java
===================================================================
---
trunk/JLanguageTool/src/test/org/languagetool/tokenizers/ca/CatalanWordTokenizerTest.java
(rev 0)
+++
trunk/JLanguageTool/src/test/org/languagetool/tokenizers/ca/CatalanWordTokenizerTest.java
2012-06-09 09:12:49 UTC (rev 7302)
@@ -0,0 +1,36 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2012 Jaume Ortolà
+ *
+ * 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.tokenizers.ca;
+
+import junit.framework.TestCase;
+
+import java.util.List;
+
+public class CatalanWordTokenizerTest extends TestCase {
+
+ public void testTokenize() {
+ CatalanWordTokenizer wordTokenizer = new CatalanWordTokenizer();
+ List<String> tokens = wordTokenizer.tokenize("Emporta-te'ls a
l'observatori dels mars");
+ assertEquals(tokens.size(), 13);
+ assertEquals("[Emporta, -te, 'ls, , a, , l', observatori, , de, ls, ,
mars]",
+ tokens.toString());
+ }
+
+}
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