fork(1) download
  1. import org.languagetool.rules.*;
  2. import org.languagetool.*;
  3. import org.languagetool.language.BritishEnglish;
  4.  
  5. import java.io.IOException;
  6. import java.util.List;
  7. import java.io.BufferedReader;
  8. import java.io.FileReader;
  9.  
  10.  
  11. public class Language1 {
  12.  
  13. public static void main(String[] args) throws IOException{
  14. JLanguageTool langTool = new JLanguageTool(new BritishEnglish());
  15. langTool.activateDefaultPatternRules();
  16. JLanguageTool.addRule(WordRepeatRule);
  17. BufferedReader br= new BufferedReader(new FileReader("testData"));
  18. String sCurrentLine;
  19. while ((sCurrentLine = br.readLine()) != null)
  20. {
  21. List<RuleMatch> matches = langTool.check(sCurrentLine);
  22.  
  23.  
  24. for (RuleMatch match : matches)
  25. {
  26. System.out.println("Potential error at line " +
  27. match.getLine() + ", column " +
  28. match.getColumn() + ": " + match.getMessage());
  29. System.out.println("Suggested correction: " +
  30. match.getSuggestedReplacements());
  31. }
  32.  
  33. }
  34. }
  35.  
  36. }
  37.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:11: error: class Language1 is public, should be declared in a file named Language1.java
public class Language1 {
       ^
Main.java:1: error: package org.languagetool.rules does not exist
import org.languagetool.rules.*;
^
Main.java:2: error: package org.languagetool does not exist
import org.languagetool.*;
^
Main.java:3: error: package org.languagetool.language does not exist
import org.languagetool.language.BritishEnglish;
                                ^
Main.java:14: error: cannot find symbol
		JLanguageTool langTool = new JLanguageTool(new BritishEnglish());
		^
  symbol:   class JLanguageTool
  location: class Language1
Main.java:14: error: cannot find symbol
		JLanguageTool langTool = new JLanguageTool(new BritishEnglish());
		                             ^
  symbol:   class JLanguageTool
  location: class Language1
Main.java:14: error: cannot find symbol
		JLanguageTool langTool = new JLanguageTool(new BritishEnglish());
		                                               ^
  symbol:   class BritishEnglish
  location: class Language1
Main.java:16: error: cannot find symbol
		JLanguageTool.addRule(WordRepeatRule);
		                      ^
  symbol:   variable WordRepeatRule
  location: class Language1
Main.java:16: error: cannot find symbol
		JLanguageTool.addRule(WordRepeatRule);
		^
  symbol:   variable JLanguageTool
  location: class Language1
Main.java:21: error: cannot find symbol
		List<RuleMatch> matches = langTool.check(sCurrentLine);
		     ^
  symbol:   class RuleMatch
  location: class Language1
Main.java:24: error: cannot find symbol
		for (RuleMatch match : matches) 
		     ^
  symbol:   class RuleMatch
  location: class Language1
11 errors
stdout
Standard output is empty