morphkit.get_word_blocks

morphkit.get_word_blocks(word_beta: str, api_endpoint: str, language: str = 'greek', output: str = 'full', debug: bool = False) str[source]

Retrieve the raw word blocks data for a given beta-code word from a Morpheus endpoint.

Args:

word_beta (str):

The input word in beta-code format to look up. Backslashes in the input string need to be escaped: e.g., ‘a)nh/r’ -> ‘a)nh/r'

api_endpoint (str):

IP adress & port of the Morpheus API endpoint (e.g., ‘192.168.0.5:1315’).

language (str):

Optional argument. Defaults to greek. Sets the language of the word to analyse. It can be set to greek or latin.

output {str}:

Optional argument. Defaults to full. Output format of the Analytic block. Either full for the internal database format, or compact for a brief output.

debug (bool):

Optional argument. Defaults to False. If set to True, prints the constructed URL and response size.

Returns:

str:

The plain text response containing the word blocks for the requested beta-code form.

Raises:

ValueError:

The language parameter is invalid (only ‘greek’ and ‘latin’ are allowed).

ValueError:

The api_endpoint parameter is malformed (format should be ‘host(IP or name):port’).

requests.HTTPError:

HTTP request failed (non-2xx status code).

Example:

api_endpoint = "10.10.0.10:1315"
blocs=morphkit.get_word_blocks('sune/rxomai', api_endpoint)