wiki:XmlRpcDetectLanguage

DetectLanguage

Intro

detect language for given strings


Description

struct DetectLanguage(string $token, array($text, $text, ...) $data)

Given an array of strings data the function will return a structure with detected languages for all the strings given as parameters.


Parameters

struct(
  (string) [token],
  array(
    (string) [text],
    (string) [text], ...
  ) [data]
)
token (required)
token string identifying user's session, taken from LogIn output structure.
data
  • array of strings you want language detected for.
  • these strings should be gzipped (without header) and then base64-encoded (to improve transfer speed and save bandwidth).
  • strings should be at least 4096 bytes long for good results - but you can send the whole subtitle contents.

Return Values

Output is returned in this structure:

  struct(
    (string) [status],
    struct(
      (string) [<md5>],
      (string) [<md5>], ...
    ) [data],
    (double) [seconds]
  )

and contains these elements:

status
function result code, see list of status codes
data
contains a structure holding in key the MD5 of the unpacked input string and in value its detected 3-letter language code
seconds
time taken to execute this command on server

Implementations

There are currently no available sample implementations.


Changelog

Version 1: created this function


Examples

Input

<methodCall>
 <methodName>DetectLanguage</methodName>
 <params>
  <param>
   <value><string>gi6jqoote1ofl5fafu8657mfr1</string></value>
  </param>
  <param>
   <value>
    <array>
     <data>
      <value><string>eNpLyUstVshKVUjMSVXILnpYnFepkJL6CQBfNwj/</string></value>
      
      ... more gzipped and then base64-encoded strings go here (if any) ...
      
     </data>
    </array>
   </value>
  </param>
 </params>
</methodCall>

Output

<methodResponse>
 <params>
  <param>
   <value>
    <struct>
     <member>
      <name>status</name>
      <value><string>200 OK</string></value>
     </member>
     <member>
      <name>data</name>
      <value>
       <struct>
        <member>
         <name>dfaffb9aa53bc5e9694fd962b9968b7e</name>
         <value><string>cze</string></value>
        </member>
        
        ... more language detect results go here (if any) ...
        
       </struct>
      </value>
     </member>
     <member>
      <name>seconds</name>
      <value><double>0.425</double></value>
     </member>
    </struct>
   </value>
  </param>
 </params>
</methodResponse>

Notes

  • if you get a descriptive language name instead of the 3-letter language code please contact us with input/output parameters (for example scots)
  • more info about language detection can be found at Statistical Text Analysis

See also


Comments

add your comments, hints and suggestions here if you like ...


[Prev] Home [Next]

Last modified 15 years ago Last modified on Oct 11, 2008, 4:57:33 PM