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 supports over 80 languages.
  • In a single request it can detect and return up to 3 languages with a proportion ration of each language in the text. 
  • To reach the better and more accurate result, it is recommended to split your text into sentences and send as separate requests. 
  • If the language is not detected, it will be returned as Unknown.

Command name: detect_language

Entry point
https://your_host_name:443/virtual_directory/api?
#ParameterPossible valuesDefault valueDescription
1text
  • plain text

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

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

Response structure

#NameDescription
1LangShortCode

A language short code. 

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

Example 1.1

Request URL (GET): 
https://your_host_name:443/virtual_directory/api?cmd=detect_language&text=This sampl text demonstrates the work of the detect language command of Web API service.

Parameters:

  • Command: detect_language

  • Text: This sampl text demonstrates the work of the detect language command of Web API service.

Request response:

{
    "LangShortCode": "en_US",
	"LangName": "American English",
	"Proportion": 0.98
}
  • No labels