Skip to main content

Spellcheck

For some use cases, grammar and phrase-level edits may not be necessary. If your application only requires spellcheck, the Sapling Spellcheck endpoint is a faster, cheaper solution.

warning

The Spellcheck endpoint does not provide grammar and phrase-level suggestions, unlike the Edits endpoint.

info

The results you get with neural_spellcheck set to true should match those from pasting the text on https://sapling.ai/utilities/spelling

If the results do not match, check that you're not adding additional newlines or adding unnecessary character escaping (e.g. \\r or \\n) in your request.

The Spellcheck endpoint supports additional languages that the edits endpoint does not.

In addition, Sapling offers custom dictionaries for industries including:

  • Medical / healthcare
  • Biomedical applications
  • Speech transcriptions (outputs of automatic speech recognition [ASR] systems)
  • Localization / translations (outputs of machine translation systems)

Please contact us if your language is not supported or if you're interested in the custom dictionaries.

Request Spellcheck POST

Sometimes you may want to only perform spellcheck without grammar edits.

In that case, use the Spellcheck endpoint. https://api.sapling.ai/api/v1/spellcheck

For those who only wish to spellcheck medical terms, use the /api/v1/medical-spellcheck endpoint instead.

HTTP method: POST

The Spellcheck endpoint takes the same arguments as the edits endpoint. However, it does not return an error_type or general_error_type field. Where possible, the Spellcheck endpoint will also only return edits for individual words, while the Edits endpoint will suggest phrase-level edits.

Sample Code

curl -X POST https://api.sapling.ai/api/v1/spellcheck \
-H "Content-Type: application/json" \
-d '{"key":"<api-key>", "text":"There are speling mistakes here.", "session_id": "test session"}'

Request Arguments

key: String
32-character API key

text: String
Text to process for edits.

min_length: Integer
Minimum character length of words to suggest corrections for. Setting this too low will result in much higher false positives. The default value is 3.

session_id: String
Unique name or UUID of document or portion of text that is being checked.

multiple_edits: Optional Boolean
Default is false. If true, will return candidates field containing list of other potential corrections for each error.

neural_spellcheck: Optional Boolean
Default for API keys created from 2024-06-20 onwards is true (was previously false). If true, endpoint backend will use more contextual neural (GPT-style) model to make spelling suggestions. We recommend the neural model but it is currently only available for a subset of languages [da, de, en, es, fi, fr, id, it, nl, no, pl, pt, sv, tl, tr] and with multiple_edits=false. However, it can be used in combination with the non-neural model with multiple_edits=true.

operations: Optional List of Strings
Default is []. Possible operations are described in the Postprocess documentation. This will run postprocessing on outputs before returning results so you can enforce stricter capitalization, punctuation, and whitespace removal.

lang: Optional String
Supported languages are:

  • auto: Autodetect language
  • en: English
  • ar: عربي
  • bg: български
  • ca: català
  • cs: čeština
  • da: dansk
  • de: Deutsch
  • el: Ελληνικά
  • es: español
  • et: eesti keel
  • fa: فارسی
  • fi: suomi
  • fr: français (fr-fr and fr-ca coming soon)
  • he: עִבְרִית
  • hi: हिन्दी",
  • hr: hrvatski,
  • hu: magyar nyelv
  • id: bahasa Indonesia
  • is: íslenska
  • it: italiano
  • jp/ja: 日本語
  • ko: 한국어
  • lt: lietuvių kalba
  • lv: latviešu valoda
  • nl: Nederlands
  • no: norsk
  • pl: polski
  • pt: português
  • ro: limba română
  • ru: русский
  • sk: slovenčina
  • sq: shqip
  • sr: srpski
  • sv: svenska
  • th: ภาษาไทย
  • tl: Tagalog / ᜆᜄᜎᜓᜄ᜔
  • tr: Türkçe
  • uk: Українська мова
  • vi: Tiếng Việt
  • zh: 中文

variety: Optional String

Supported Varieties

This option is currently available for: English, Chinese (中文). Specifies regional English/Chinese spelling options. The setting defaults to the configuration in the Sapling dashboard.

Supported varieties:

English:

  • us-variety: American English
  • gb-variety: British English
  • au-variety: Australian English
  • ca-variety: Canadian English
  • null-variety: Don’t suggest any changes based on English variety

Chinese (中文)

  • s-variety: Simplified Chinese
  • t-variety: Traditional Chinese