Mollom has a Language Detection API which isn't documented (yet) in the official API documentation. Mollom is able to detect the language of text (out of approx. 75 languages) with high accuracy based on a very limited number of characters (min. 15 characters). This could be used to prevent the use of foreign languages on your site, or to segment content or users based on language.
The Language Detection API consists of one XML-RPC method called mollom.detectLanguage(). The result is an associative XML-RPC array of languages and their confidence (in structs), sorted by confidence, with the most likely language being returned first. The language is returned as a two-character ISO-639-1 code or if no ISO-639-1 code is available, a ISO-639-3 three letter language code. The confidence value is a double between 0 and 1. If the language cannot be detected, the "zxx" code is returned (defined as "no linguistic content, not applicable"). If the text was detected as being too random to be a known language, the "und" code is returned (defined as "undetermined"). The given text should contain no markup of any kind (HTML, BB-code, ...).
Attached patch adds some basic tests for the Mollom Language Detection API. Once this patch is committed, we can figure out if there is a good UI for this. Right now, I'm thinking it might not be something to expose in the Mollom module's UI, but other contributed modules might be able to take advantage of it in clever ways.
| Comment | File | Size | Author |
|---|---|---|---|
| mollom-language-detection.patch | 3.34 KB | dries |
Comments
Comment #1
dries commentedI committed this to CVS HEAD.