9.9. mollom.detectLanguage


The Mollom XML-RPC API interface has been deprecated, and is included here for archival purposes.

To develop clients and services that connect to Mollom, use the Mollom REST API.

Required Name Type Description
required public_key string Site public key
required time string Site server time in this format: yyyy-MM-dd'T'HH:mm:ss-.SSSZ
required hash string HMAC-SHA1 digest
required nonce string One time nonce
required text string Text on which to run language detection
returns languages struct containing pairs of language and confidence values See example below.

This call has been deprecated in favor of mollom.checkContent with 'language' in the checks field.

Given a very limited amount of text (minimum of 15 characters), Mollom can detect its probable language (out of approximately 75 languages) with a high degree of accuracy. This feature can be used to prevent the use of foreign languages on your site, or to automatically segment the content of users based on their posting language. Note that the text passed to mollom.detectLanguage() for analysis should be free of all markup (including HTML, BB-code, etc.).

The Language Detection API consists of an XML-RPC method called mollom.detectLanguage(). A sample result from the call is shown below.

Each value in the returned result is a struct (see example) that contains two named values: language and confidence. "language" is a string representing either a two-character ISO-639-1 code (if no ISO-639-1 code is available, a ISO-639-3 three letter language code is returned), while "confidence" is a numeric double representing Mollom's confidence in the accuracy of its assessment. Multiple pairs of language and confidence elements may be returned; if so, the elements are arranged in descending order of confidence.

If the language cannot be determined, "zxx" code is returned as the value of the language element, and is defined as "no linguistic content, not applicable".

If the text is determined to be too random to be a known language, "und" code is returned as the value of the language element, and is defined as "undetermined".

Results returned by this method resemble the following snippet:

<?xml version="1.0"?>