NU IT
Northwestern University Information Technology
MorphAdorner Northwestern
 
MorphAdorner Server Services: Language Recognizer Service

Service name: languagerecognizer
Service description: Find probable languages for a text.
HTTP methods allowed: GET, POST, OPTIONS
POST accepts as input: application/x-www-form-urlencoded
HTTP return codes: 200: service succeeded
400: service failed with an error

Query parameters

    media Result format. One of json, xml, html, text .
    text Text to be processed.
    includeInputText Allowed values are true to include the input text in the output and false to not include the input text.

Sample POST form

<form accept-charset="UTF-8" method="post" action="languagerecognizer"
      target="_blank"
      name="languagerecognizer">
<table cellpadding="0" cellspacing="5">
<tr>
<td><strong>Text:</strong></td>
<td colspan="2">
<textarea name="text" rows="15" cols="76"></textarea>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="checkbox" name="includeInputText" value="true"
       checked="checked"/>
Include input text in results
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td>
&nbsp;
</td>
</tr>
<tr>
<td valign="top">
<strong>Results format:</strong>
</td>
<td>
<input type="radio" name="media" value="json">JSON format</input><br />
<input type="radio" name="media" value="xml" checked="checked">XML format</input><br />
<input type="radio" name="media" value="html">HTML format</input><br />
<input type="radio" name="media" value="text">Text format</input>
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td>
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="recognize" value="Recognize" />
</td>
</tr>
</table>
</form>

Output

Here is sample language recognizer output for the traditional French song "Au claire de la lune." The JSON and XML LanguageRecognizerResult objects echo the input text and provide the most probably languages as a list of language entries with the ISO language code given as languageCode, the displayable language name as languageName, and the language probability score as score. The HTML and text versions do not echo the input text, and provide the languages and associated scores in a format suitable for display.

Au clair de la lune
Mon ami Pierrot
Prête-moi ta plume
Pour écrire un mot
Ma chandelle est morte
Je n'ai plus de feu
Ouvre-moi ta porte
Pour l'amour de Dieu.

JSON output

{
  "LanguageRecognizerResult": {
    "text": "Au clair de la lune\r\nMon ami Pierrot\r\nPr\u00eate-moi ta plume\r\nPour \u00e9crire un mot\r\nMa chandelle est morte\r\nJe n'ai plus de feu\r\nOuvre-moi ta porte\r\nPour l'amour de Dieu.",
    "languages": [
      {
        "language": {
          "languageCode": "fr",
          "languageName": "French",
          "score": 0.99999693379
        }
      }
    ]
  }
}

XML output

<?xml version="1.0"?>
<LanguageRecognizerResult>
    <text>Au clair de la lune
    Mon ami Pierrot
    Pr&#xEA;te-moi ta plume
    Pour &#xE9;crire un mot
    Ma chandelle est morte
    Je n'ai plus de feu
    Ouvre-moi ta porte
    Pour l'amour de Dieu.</text>
    <languages>
        <language>
            <languageCode>fr</languageCode>
            <languageName>French</languageName>
            <score>0.9999969337900039</score>
        </language>
    </languages>
</LanguageRecognizerResult>

HTML output (source)

<h3>1 language identified.</h3>
<table border="0">
<tr>
<th align="left">Language</th>
<th align="left">Score</th>
</tr>
<tr>
<td valign="top" align="left"><strong>fr (French)</strong></td>
<td valign="top" align="left">1.0000</td>
</tr>
</table>

HTML output (display)

1 language identified.

Language Score
fr (French) 1.0000

Text output

1 language identified.
Language	Score
fr (French)	1.0000
Home
 
Announcements and News
 
Documentation
 
Download MorphAdorner
 
Glossary
 
Helpful References
 
Licenses
 
Server
 
Talks
 
Tech Talk