Command name: grammar_check
Here is a list of all possible parameters and values that can be used with the grammar_check command.
# | Parameter | Possible values | Default value | Description |
---|---|---|---|---|
1 | format |
| json | The response format for the output data. |
2 | callback |
| A callback function name that will be used to manipulate with the JSON data received from the server. Such approach enables sharing of data bypassing same-origin policy. It can be used only along with “format=json”. | |
3 | text |
| A piece of text which will be sent for check. The text has to be in the UTF-8 encoding. Any found tags in the text will be interpreted as a plan text as well. | |
4 | slang |
| en_US | A short code of a language which will be used for grammar checking. The grammar checking option is available for specific list of languages that are marked with the green color: Supported languages |
Example 3.1 [GET]: Grammar check request (Output in XML)
Request URL (GET):
https://svc.webspellchecker.net/api?cmd=grammar_check&format=xml&text=web API provides a gramar checking command that will help you builds a custom solution.&slang=en_US&customerid=[your-service-id]
Parameters:
- Command: grammar_check
- Format: xml
- Text: web API provides a gramar checking command that will help you builds a custom solution.
- Language: en_US
Request response:
<grammar_check> <grammar_problem> <sentence>web API provides a gramar checking command that will help you builds a custom solution</sentence> <matches> <match> <message>This sentence does not start with an uppercase letter</message> <offset>0</offset> <length>3</length> <rule> <id>UPPERCASE_SENTENCE_START</id> </rule> <suggestions> <suggestion>Web</suggestion> </suggestions> </match> </matches> </grammar_problem> </grammar_check>
Example 3.2 [GET]: Grammar check request (Output in JSON)
Request URL (GET):
https://svc.webspellchecker.net/api?cmd=grammar_check&format=json&text=web API provides a gramar checking command that will help you builds a custom solution.&slang=en_US&customerid=[your-service-id]
Parameters:
- Command: grammar_check
- Format: json
- Text: web API provides a gramar checking command that will help you builds a custom solution.
- Language: en_US
Request response:
[ { "sentence": "web API provides a gramar checking command that will help you builds a custom solution", "matches": [ { "message": "This sentence does not start with an uppercase letter", "offset": 0, "length": 3, "rule": { "id": "UPPERCASE_SENTENCE_START" }, "suggestions": [ "Web" ] } ] } ]
Example 3.3 [POST]: Grammar check request (Output in JSON)
Here we use the same request and parameters as described in example above but form it as a POST request.
Request URL (POST):
https://svc.webspellchecker.net/api?
Body (Raw):
cmd=grammar_check&format=json&text=web API provides a gramar checking command that will help you builds a custom solution.&slang=en_US&customerid=[your-service-id]
Request response:
[ { "sentence": "web API provides a gramar checking command that will help you builds a custom solution", "matches": [ { "message": "This sentence does not start with an uppercase letter", "offset": 0, "length": 3, "rule": { "id": "UPPERCASE_SENTENCE_START" }, "suggestions": [ "Web" ] } ] } ]