public synchronized List < GrammarError > grammarErrors ( String text , String language ) { requireValidHandle ( ) ; List < GrammarError > errorList = new ArrayList < GrammarError > ( ) ; if ( ! isValidInput ( text ) ) { return errorList ; } int offset = 0 ; for ( String paragraph : text . replace ( "\r" , "\n" ) . split ( "\\n" ) ) { appendErrorsFromParagraph ( errorList , paragraph , offset , language ) ; offset += paragraph . length ( ) + 1 ; } return errorList ; }
Check the given text for grammar errors and return a list of GrammarError objects representing the errors that were found . Unlike the C based API this method accepts multiple paragraphs separated by newline characters .