Class RemoteLanguageTool
java.lang.Object
org.languagetool.remote.RemoteLanguageTool
Check a text using a remote LanguageTool server via HTTP or HTTPS.
Our public HTTPS API and its restrictions are documented
in our wiki.
- Since:
- 3.4
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidappend(StringBuilder params, String paramName, String paramValue) private RemoteResultcheck(String text, CheckConfiguration config) private StringgetConfigurationInfo(String urlParameters) (package private) HttpURLConnectiongetConnection(byte[] postData, URL url) private RemoteRuleMatchintprivate Stringprivate ObjectgetRequired(Map<String, Object> elem, String propertyName) private StringgetRequiredString(Map<String, Object> elem, String propertyName) private StringgetUrlParams(String text, CheckConfiguration config) getValueList(Map<String, Object> match, String propertyName) private RemoteResultparseJson(InputStream inputStream) private StringreadStream(InputStream stream, String encoding)
-
Field Details
-
V2_CHECK
- See Also:
-
V2_MAXTEXTLENGTH
- See Also:
-
V2_CONFIGINFO
- See Also:
-
mapper
private final com.fasterxml.jackson.databind.ObjectMapper mapper -
serverBaseUrl
-
-
Constructor Details
-
RemoteLanguageTool
- Parameters:
serverBaseUrl- for examplehttps://languagetool.org/api(not ending in slash)
-
-
Method Details
-
check
- Parameters:
text- the text to be checkedlangCode- the language code likeenoren-US- note that for some languages (like English) you need to specify the country code (likeUSorGB) to get spell checking
-
check
- Parameters:
text- the text to be checked
-
getUrlParams
-
append
-
encode
-
check
-
getConfigurationInfo
-
getMaxTextLength
public int getMaxTextLength() -
getConnection
-
readStream
- Throws:
IOException
-
parseJson
- Throws:
XMLStreamExceptionIOException
-
getMatch
-
getRequired
-
getRequiredString
-
getOrNull
-
getValueList
-