Revision: 6499
http://languagetool.svn.sourceforge.net/languagetool/?rev=6499&view=rev
Author: dnaber
Date: 2012-02-11 01:33:11 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
bugfix: the "fromx" position in the XML output was wrong sometimes - adapting
the test cases, I think they were wrong
Modified Paths:
--------------
trunk/JLanguageTool/CHANGES.txt
trunk/JLanguageTool/src/java/org/languagetool/JLanguageTool.java
trunk/JLanguageTool/src/test/org/languagetool/JLanguageToolTest.java
Modified: trunk/JLanguageTool/CHANGES.txt
===================================================================
--- trunk/JLanguageTool/CHANGES.txt 2012-02-10 20:06:46 UTC (rev 6498)
+++ trunk/JLanguageTool/CHANGES.txt 2012-02-11 01:33:11 UTC (rev 6499)
@@ -19,6 +19,8 @@
-fixed some false alarms
-added a few new rules
+ -bugfix: the "fromx" position in the XML output was wrong sometimes
+
-GUI: errors are now marked with red background instead of red font
so whitespace problems can easily be spotted
Modified: trunk/JLanguageTool/src/java/org/languagetool/JLanguageTool.java
===================================================================
--- trunk/JLanguageTool/src/java/org/languagetool/JLanguageTool.java
2012-02-10 20:06:46 UTC (rev 6498)
+++ trunk/JLanguageTool/src/java/org/languagetool/JLanguageTool.java
2012-02-11 01:33:11 UTC (rev 6499)
@@ -517,7 +517,7 @@
// calculate matching column:
final int lineBreakPos = sentence.indexOf('\n');
if (lineBreakPos == -1) {
- columnCount += sentence.length() -1;
+ columnCount += sentence.length();
} else {
if (lineBreakPos == 0) {
columnCount = sentence.length();
Modified: trunk/JLanguageTool/src/test/org/languagetool/JLanguageToolTest.java
===================================================================
--- trunk/JLanguageTool/src/test/org/languagetool/JLanguageToolTest.java
2012-02-10 20:06:46 UTC (rev 6498)
+++ trunk/JLanguageTool/src/test/org/languagetool/JLanguageToolTest.java
2012-02-11 01:33:11 UTC (rev 6499)
@@ -76,6 +76,17 @@
assertEquals("[I, can, detailed, give, more, you]",
tool.getUnknownWords().toString());
}
+ public void testPositionsWithGerman() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(Language.GERMAN);
+ tool.activateDefaultPatternRules();
+ final List<RuleMatch> matches = tool.check("Stundenkilometer");
+ assertEquals(1, matches.size());
+ final RuleMatch match = matches.get(0);
+ // TODO: values should be either 0-based or 1-based, it should not be
mixed up!
+ assertEquals(0, match.getLine());
+ assertEquals(1, match.getColumn());
+ }
+
public void testDutch() throws IOException {
final JLanguageTool tool = new JLanguageTool(Language.DUTCH);
tool.activateDefaultPatternRules();
@@ -117,24 +128,24 @@
assertEquals("[Polish, This, is]", tool.getUnknownWords().toString());
//check positions relative to sentence ends
matches = tool.check("To jest tekst.\nTest 1. To jest linia w której nie
ma przecinka.");
- assertEquals(16, matches.get(0).getColumn());
+ assertEquals(17, matches.get(0).getColumn());
//with a space...
matches = tool.check("To jest tekst. \nTest 1. To jest linia w której nie
ma przecinka.");
assertEquals(16, matches.get(0).getColumn());
matches = tool.check("To jest tekst. Test 1. To jest linia w której nie ma
przecinka.");
- assertEquals(30, matches.get(0).getColumn());
+ assertEquals(32, matches.get(0).getColumn());
//recheck with the -b mode...
final Language lang = Language.POLISH;
lang.getSentenceTokenizer().setSingleLineBreaksMarksParagraph(true);
tool = new JLanguageTool(lang);
tool.activateDefaultPatternRules();
matches = tool.check("To jest tekst.\nTest 1. To jest linia w której nie
ma przecinka.");
- assertEquals(16, matches.get(0).getColumn());
+ assertEquals(17, matches.get(0).getColumn());
//with a space...
matches = tool.check("To jest tekst. \nTest 1. To jest linia w której nie
ma przecinka.");
- assertEquals(16, matches.get(0).getColumn());
+ assertEquals(17, matches.get(0).getColumn());
matches = tool.check("To jest tekst. To jest linia w której nie ma
przecinka.");
- assertEquals(23, matches.get(0).getColumn());
+ assertEquals(24, matches.get(0).getColumn());
}
public void testSlovenian() throws IOException {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Languagetool-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs