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 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
{
    "swagger": "2.0",
    "info": {
        "title": "LanguageTool API",
        "description": "Check texts for style and grammar issues with LanguageTool. Please consider the following default limitations:<ul><li>your daily request limit depending on <a href='https://languagetool.org/editor/settings/api'>your plan</a> <li>maximum number of requests per minute: 20 (free) / 80 (Premium) <li>maximum number of characters per minute: 75,000 (free) / 300,000 (Premium) <li>maximum number of characters per request: 20,000 (free) / 60,000 (Premium) <li>for the free version, also consider the <a href='https://dev.languagetool.org/public-http-api'>limitations documented here</a> <li><b>Note:</b> any parameters or outputs not part of this documentation are internal and must not be relied on</ul> Need more generous limits? Just <a href='https://languagetool.org/proofreading-api'>contact us</a>.",
        "version": "1.1.2"
    },
    "host": "localhost:8010",
    "schemes": [
        "https"
    ],
    "basePath": "/v2",
    "produces": [
        "application/json"
    ],
    "paths": {
        "/check": {
            "post": {
                "summary": "Check a text",
                "description": "The main feature - check a text with LanguageTool for possible style and grammar issues.",
                "parameters": [
                    {
                        "name": "text",
                        "in": "formData",
                        "type": "string",
                        "description": "The text to be checked. This or 'data' is required.",
                        "required": false
                    },
                    {
                        "name": "data",
                        "in": "formData",
                        "type": "string",
                        "description": "The text to be checked, given as a JSON document that specifies what's text and what's markup. This or 'text' is required. Markup will be ignored when looking for errors. Example text: <pre>A &lt;b>test&lt;/b></pre>JSON for the example text: <pre>{\"annotation\":[\n {\"text\": \"A \"},\n {\"markup\": \"&lt;b>\"},\n {\"text\": \"test\"},\n {\"markup\": \"&lt;/b>\"}\n]}</pre> <p>If you have markup that should be interpreted as whitespace, like <tt>&lt;p&gt;</tt> in HTML, you can have it interpreted like this: <pre>{\"markup\": \"&lt;p&gt;\", \"interpretAs\": \"\\n\\n\"}</pre><p>The 'data' feature is not limited to HTML or XML, it can be used for any kind of markup. Entities will need to be expanded in this input.",
                        "required": false
                    },
                    {
                        "name": "language",
                        "in": "formData",
                        "type": "string",
                        "description": "A language code like `en-US`, `de-DE`, `fr`, or `auto` to guess the language automatically (see `preferredVariants` below). For languages with variants (English, German, Portuguese) spell checking will only be activated when you specify the variant, e.g. `en-GB` instead of just `en`.",
                        "required": true
                    },
                    {
                        "name": "username",
                        "in": "formData",
                        "type": "string",
                        "description": "Set to get Premium API access: Your username/email as used to log in at languagetool.org."
                    },
                    {
                        "name": "apiKey",
                        "in": "formData",
                        "type": "string",
                        "format": "password",
                        "description": "Set to get Premium API access: <a target='_blank' href='https://languagetool.org/editor/settings/api'>your API key</a>"
                    },
                    {
                        "name": "dicts",
                        "in": "formData",
                        "type": "string",
                        "description": "Comma-separated list of dictionaries to include words from; uses special default dictionary if this is unset"
                    },
                    {
                        "name": "motherTongue",
                        "in": "formData",
                        "type": "string",
                        "description": "A language code of the user's native language, enabling false friends checks for some language pairs."
                    },
                    {
                        "name": "preferredVariants",
                        "in": "formData",
                        "type": "string",
                        "description": "Comma-separated list of preferred language variants. The language detector used with `language=auto` can detect e.g. English, but it cannot decide whether British English or American English is used. Thus this parameter can be used to specify the preferred variants like `en-GB` and `de-AT`. Only available with `language=auto`. You should set variants for at least German and English, as otherwise the spell checking will not work for those, as no spelling dictionary can be selected for just `en` or `de`."
                    },
                    {
                        "name": "enabledRules",
                        "in": "formData",
                        "type": "string",
                        "description": "IDs of rules to be enabled, comma-separated"
                    },
                    {
                        "name": "disabledRules",
                        "in": "formData",
                        "type": "string",
                        "description": "IDs of rules to be disabled, comma-separated"
                    },
                    {
                        "name": "enabledCategories",
                        "in": "formData",
                        "type": "string",
                        "description": "IDs of categories to be enabled, comma-separated"
                    },
                    {
                        "name": "disabledCategories",
                        "in": "formData",
                        "type": "string",
                        "description": "IDs of categories to be disabled, comma-separated"
                    },
                    {
                        "name": "enabledOnly",
                        "in": "formData",
                        "type": "boolean",
                        "default": false,
                        "description": "If true, only the rules and categories whose IDs are specified with `enabledRules` or `enabledCategories` are enabled."
                    },
                    {
                        "name": "level",
                        "in": "formData",
                        "type": "string",
                        "enum": ["default", "picky"],
                        "description": "If set to `picky`, additional rules will be activated, i.e. rules that you might only find useful when checking formal text."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "the result of checking the text",
                        "schema": {
                            "properties": {
                                "software": {
                                    "type": "object",
                                    "required": [
                                        "name",
                                        "version",
                                        "buildDate",
                                        "apiVersion"
                                    ],
                                    "properties": {
                                        "name": {
                                            "type": "string",
                                            "description": "Usually 'LanguageTool'."
                                        },
                                        "version": {
                                            "type": "string",
                                            "description": "A version string like '3.3' or '3.4-SNAPSHOT'."
                                        },
                                        "buildDate": {
                                            "type": "string",
                                            "description": "Date when the software was built, e.g. '2016-05-25'."
                                        },
                                        "apiVersion": {
                                            "type": "integer",
                                            "description": "Version of this API response. We don't expect to make incompatible changes, so this can also be increased for newly added fields."
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "An optional warning, e.g. when the API format is not stable."
                                        },
                                        "premium": {
                                            "type": "boolean",
                                            "description": "true if you're using a Premium account with all the premium text checks (since LanguageTool 4.2)"
                                        }
                                    }
                                },
                                "language": {
                                    "type": "object",
                                    "description": "The language used for checking the text.",
                                    "required": [
                                        "name",
                                        "code",
                                        "detectedLanguage"
                                    ],
                                    "properties": {
                                        "name": {
                                            "type": "string",
                                            "description": "Language name like 'French' or 'English (US)'."
                                        },
                                        "code": {
                                            "type": "string",
                                            "description": "ISO 639-1 code like 'en', 'en-US', or 'ca-ES-valencia'"
                                        },
                                        "detectedLanguage": {
                                            "type": "object",
                                            "description": "The automatically detected text language (might be different from the language actually used for checking).",
                                            "required": [
                                                "name",
                                                "code"
                                            ],
                                            "properties": {
                                                "name": {
                                                    "type": "string",
                                                    "description": "Language name like 'French' or 'English (US)'."
                                                },
                                                "code": {
                                                    "type": "string",
                                                    "description": "ISO 639-1 code like 'en', 'en-US', or 'ca-ES-valencia'."
                                                }
                                            }
                                        }
                                    }
                                },
                                "matches": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "required": [
                                            "message",
                                            "offset",
                                            "length",
                                            "replacements",
                                            "context",
                                            "sentence"
                                        ],
                                        "properties": {
                                            "message": {
                                                "type": "string",
                                                "description": "Message about the error displayed to the user."
                                            },
                                            "shortMessage": {
                                                "type": "string",
                                                "description": "An optional shorter version of 'message'."
                                            },
                                            "offset": {
                                                "type": "integer",
                                                "description": "The 0-based character offset of the error in the text."
                                            },
                                            "length": {
                                                "type": "integer",
                                                "description": "The length of the error in characters."
                                            },
                                            "replacements": {
                                                "type": "array",
                                                "description": "Replacements that might correct the error. The array can be empty, in this case there is no suggested replacement.",
                                                "items": {
                                                    "type": "object",
                                                    "properties": {
                                                        "value": {
                                                            "type": "string",
                                                            "description": "the replacement string"
                                                        }
                                                    }
                                                }
                                            },
                                            "context": {
                                                "type": "object",
                                                "required": [
                                                    "text",
                                                    "offset",
                                                    "length"
                                                ],
                                                "properties": {
                                                    "text": {
                                                        "type": "string",
                                                        "description": "Context of the error, i.e. the error and some text to the left and to the left."
                                                    },
                                                    "offset": {
                                                        "type": "integer",
                                                        "description": "The 0-based character offset of the error in the context text."
                                                    },
                                                    "length": {
                                                        "type": "integer",
                                                        "description": "The length of the error in characters in the context."
                                                    }
                                                }
                                            },
                                            "sentence": {
                                                "type": "string",
                                                "description": "The sentence the error occurred in (since LanguageTool 4.0 or later)"
                                            },
                                            "rule": {
                                                "type": "object",
                                                "required": [
                                                    "id",
                                                    "description",
                                                    "category"
                                                ],
                                                "properties": {
                                                    "id": {
                                                        "type": "string",
                                                        "description": "An rule's identifier that's unique for this language."
                                                    },
                                                    "subId": {
                                                        "type": "string",
                                                        "description": "An optional sub identifier of the rule, used when several rules are grouped."
                                                    },
                                                    "description": {
                                                        "type": "string"
                                                    },
                                                    "urls": {
                                                        "type": "array",
                                                        "description": "An optional array of URLs with a more detailed description of the error.",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "value": {
                                                                    "type": "string",
                                                                    "description": "the URL"
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "issueType": {
                                                        "type": "string",
                                                        "description": "The <a href=\"http://www.w3.org/International/multilingualweb/lt/drafts/its20/its20.html#lqissue-typevalues\">Localization Quality Issue Type</a>. This is not defined for all languages, in which case it will always be 'Uncategorized'."
                                                    },
                                                    "category": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "string",
                                                                "description": "A category's identifier that's unique for this language."
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "description": "A short description of the category."
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/languages": {
            "get": {
                "summary": "Get a list of supported languages.",
                "responses": {
                    "200": {
                        "description": "An array of language objects.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "required": [
                                    "name",
                                    "code",
                                    "longCode"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "a language name like 'French' or 'English (Australia)'"
                                    },
                                    "code": {
                                        "type": "string",
                                        "description": "a language code like 'en'"
                                    },
                                    "longCode": {
                                        "type": "string",
                                        "description": "a language code like 'en-US' or 'ca-ES-valencia'"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/words": {
            "get": {
                "summary": "List words in dictionaries",
                "description": "List words in the user's personal dictionaries.",
                "parameters": [
                    {
                        "name": "offset",
                        "in": "query",
                        "type": "integer",
                        "description": "Offset of where to start in the list of words. Defaults to 0."
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "type": "integer",
                        "description": "Maximum number of words to return. Defaults to 10."
                    },
                    {
                        "name": "username",
                        "in": "query",
                        "type": "string",
                        "description": "Your username as used to log in at languagetool.org.",
                        "required": true
                    },
                    {
                        "name": "apiKey",
                        "in": "query",
                        "type": "string",
                        "format": "password",
                        "description": "Your API key.",
                        "required": true
                    },
                    {
                        "name": "dicts",
                        "in": "query",
                        "type": "string",
                        "description": "Comma-separated list of dictionaries to include words from; uses special default dictionary if this is unset"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "the user's words from the given user dictionaries",
                        "schema": {
                            "properties": {
                                "words": {
                                    "type": "array",
                                    "description": "array of words",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/words/add": {
            "post": {
                "summary": "Add word to a dictionary",
                "description": "Add a word to one of the user's personal dictionaries. Please note that this feature is considered to be used for personal dictionaries which typically contain not more than a few hundred items per user. Adding more can have adverse effects on performance for every single text check. If this becomes an issue for you, contact us. Experimental user dictionary caching can be enabled by us on a per-account basis.",
                "parameters": [
                    {
                        "name": "word",
                        "in": "formData",
                        "type": "string",
                        "description": "The word to be added. Must not be a phrase, i.e. cannot contain white space. The word is added to a global dictionary that applies to all languages.",
                        "required": true
                    },
                    {
                        "name": "username",
                        "in": "formData",
                        "type": "string",
                        "description": "Your username as used to log in at languagetool.org.",
                        "required": true
                    },
                    {
                        "name": "apiKey",
                        "in": "formData",
                        "type": "string",
                        "format": "password",
                        "description": "Your API key.",
                        "required": true
                    },
                    {
                        "name": "dict",
                        "in": "formData",
                        "type": "string",
                        "description": "Name of the dictionary to add the word to; non-existent dictionaries are created after calling this; if unset, adds to special default dictionary"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "the result of adding the word",
                        "schema": {
                            "properties": {
                                "added": {
                                    "type": "boolean",
                                    "description": "true if the word has been added. false means the word hasn't been added because it had been added before."
                                }
                            }
                        }
                    }
                }
            }
        },
        "/words/delete": {
            "post": {
                "summary": "Remove word from a dictionary",
                "description": "Remove a word from one of the user's personal dictionaries.",
                "parameters": [
                    {
                        "name": "word",
                        "in": "formData",
                        "type": "string",
                        "description": "The word to be removed.",
                        "required": true
                    },
                    {
                        "name": "username",
                        "in": "formData",
                        "type": "string",
                        "description": "Your username as used to log in at languagetool.org.",
                        "required": true
                    },
                    {
                        "name": "apiKey",
                        "in": "formData",
                        "type": "string",
                        "format": "password",
                        "description": "Your API key.",
                        "required": true
                    },
                    {
                        "name": "dict",
                        "in": "formData",
                        "type": "string",
                        "description": "Name of the dictionary to remove the word from; if the dictionary is empty upon calling this, it is deleted; if unset, removes from special default dictionary"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "the result of removing the word",
                        "schema": {
                            "properties": {
                                "deleted": {
                                    "type": "boolean",
                                    "description": "true if the word has been removed. false means the word hasn't been removed because it was not in the dictionary."
                                }
                            }
                        }
                    }
                }
            }
        }

    }
}