Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt Include
IN:_include_webapi_detect_language_intro
IN:_include_webapi_detect_language_intro
nopaneltrue

The detect_language command is available since the release of WebSpellChecker v5.5.8 in March 2020. It detects the language(s) of a given text. This functionality is built on top of the Compact Language Detector 2 (CLD2) library. It can detect over 80 languages.

Info

Command name: detect_language

#ParameterPossible
Values
valuesDefault
Value
valueDescription
1
format
  • json
  • xml
jsonThe response format for output data.
3
text
  • plain text

A piece of text which will be sent for language detection.

The text has to be in the UTF-8 encoding. Any found tags in the text will be interpreted as plan text as well.
Note
Avoid using # and & symbols in the text.
4tokens
  • Array of strings, e.g. ["This is a sentence number 1.", "This is a sentence number 2."]

 


2

A piece of text separated in tokens that will be sent for check. The text should be presented as an array of strings. Right now each string is a token which equals one sentence.

Note

You can use either tokens or text at a time in a request. However, using text is more common.

18
customerid
  • your-service-id value

A special service ID value (activation key) that has to be passed to a request query. It's obtained upon subscription to the Cloud services (paid or trial).

WarningApplicable only for the Cloud version

3format
  • json
  • xml
jsonThe response format for output data.

Response structure

#NameDescription
1LangShortCode

A language short code. 

Supported languages

2LangNameA full name of a detected language.
3ProportionThe proportion ration of the detected language in the text.

Example 1.1

Code Block
titleRequest URL (GET): 
http(s)://svc.webspellchecker.net/spellcheck31/script/ssrv.fcgiapi?cmd=detect_language&text=this sampl text demonstrates the work of the Web API service.&customerid=[your-service-id]

...

  • Command: detect_language

  • Text: this sampl text demonstrates the work of the Web API service.

Request Responseresponse:

Code Block
languagejs
themeEmacs
{
    "LanguageLangShortCode": "en_US",
	"LangName": "American English",
	"Proportion": 0.98
}