code: public static String correctText(String contents, JLanguageTool lt) throws IOException {
      List<RuleMatch> ruleMatches = lt.check(contents);
      if (ruleMatches.isEmpty()) {
        return contents;  
      }    
      return correctTextFromMatches(contents, ruleMatches);    
    }
docs: Automatically applies suggestions to the text, as suggested
  by the rules that match.
  Note: if there is more than one suggestion, always the first
  one is applied, and others are ignored silently.
  
  @param contents String to be corrected
  @param lt Initialized LanguageTool object
  @return Corrected text as String.