WordNet MU Brno API
original: http://nlp.fi.muni.cz/trac/deb2/wiki/WordNetApi
Contents |
[edit] API for Wordnet/Cornetto server
Replace servername with actual address of the server.
For more info about JSON, see http://www.json.org/
[edit] Web interface
Open servername/dictionary?action=listPreview in browser. Accepts the same queries as DEBVisDic.
[edit] Getting the list of available dictionaries for the user
Request: servername/doc?action=init
Response: JSON encoded hash with following structure
{
"slovniky" => {
client_package_id => {
"id" => client package id,
"dict" => dictionary code,
"prava" => access rights r/w,
"nazov" => package name,
"dicslookup" => array of package names to allow lookups to,
"eqtags" => array of eqtags+dictionaries,
"dicsreload" => array of dictionaries to refresh,
"key" => dictionary key tag
}
}
}
[edit] Querying dictionary
Request: servername/dictionary_code?action=queryList&word=search_query
search_query::
search query, must be URL encoded UTF-8
Response: JSON encoded array of hashes with following structure
{
"value" => entry ID,
"label" => information about an entry, depends on dictionary, usually contains PoS, literals
}
Query types:
* word - search for entries containing whole word in literals * word:number - search for entries containg whole word with sense number * [*]word[*] - search for word substring - * can be put at the beginning/end of the word or at both of them * xml_element=value - search for value of xml_element, for example SYNSET.POS=n * xml_element=dictionary_code2:entry_id2:xml_element2 - search for xml_element with value from xml_element2 of entry_id2 in dictionary_code2
[edit] Display entry
Request: servername/dictionary_code?action=runQuery&query=entry_id&outtype=output_type[&arg=argument][&nojson=1][&default=1]
entry_id:: ID of displayed entry output_type:: output type of entry, possible values: * plain - plain form of XML entry from database * xml - coloured, foldable XML representation for display in browser * html - HTML representation of entry, use default XSLT template, it's possible to specify other template with optional arg argument * tree - array representation of tree, arg specifies tree direction - ILR for normal tree, RILR for reversed tree * editor - hash representation of XML for editor tab arg:: depends on output_type. For html optionally specifies other than default template. For tree specifies tree direction. nojson:: by default response is JSON encoded, by setting nojson=1 response is not encoded default:: optional argument for html output type - with default=1 HTML is displayed with default styles, otherwise style set in client is used
Response: by default JSON encoded, depends on output type
[edit] Display subtree of an entry
Request: servername/dictionary_code?action=subtree&query=entry_id&arg=argument
entry_id:: ID of displayed entry arg:: specifies tree direction - ILR for normal tree, RILR for reversed tree
Response: JSON encoded array with tree structure (same as for basic tree in display) - only direct descendants of entry are returned
[edit] Display full subtree of an entry
Request: servername/dictionary_code?action=subtree&query=entry_id&arg=argument
entry_id:: ID of displayed entry arg:: specifies tree direction - ILR for normal tree, RILR for reversed tree
Response: JSON encoded array with tree structure (same as for basic tree in display) - display all descendants of entry
[edit] Save entry
Request: servername/dictionary_code?action=save&id=entry_id&data=encoded data
entry_id:: ID of saved entry encoded data:: JSON and URL UTF-8 encoded hash representation of an entry (same as returned for editor)
[edit] Delete entry
Request: servername/dictionary_code?action=delete&id=entry_id
entry_id:: ID of entry