Package org.languagetool.remote
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 void
append
(StringBuilder params, String paramName, String paramValue) private RemoteResult
check
(String text, CheckConfiguration config) private String
getConfigurationInfo
(String urlParameters) (package private) HttpURLConnection
getConnection
(byte[] postData, URL url) private RemoteRuleMatch
int
private String
private Object
getRequired
(Map<String, Object> elem, String propertyName) private String
getRequiredString
(Map<String, Object> elem, String propertyName) private String
getUrlParams
(String text, CheckConfiguration config) getValueList
(Map<String, Object> match, String propertyName) private RemoteResult
parseJson
(InputStream inputStream) private String
readStream
(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 likeen
oren-US
- note that for some languages (like English) you need to specify the country code (likeUS
orGB
) 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:
XMLStreamException
IOException
-
getMatch
-
getRequired
-
getRequiredString
-
getOrNull
-
getValueList
-