REPRODUCIBLE EXAMPLES
Usage notebook
Examples from Morphkit usage examples (Greek and Latin), version 1.1.
The notebook demonstrates both individual processing stages and the single-call interface. Running the examples requires Morphkit, its dependencies, and access to a Morpheus API endpoint. Replace the notebook’s original host address with an endpoint available in your environment.
Greek query
Convert Unicode Greek to Beta Code and retrieve the raw Morpheus response:
import beta_code
import morphkit
word = beta_code.greek_to_beta_code("του")
api_endpoint = "HOST:PORT" # replace with your endpoint
raw = morphkit.get_word_blocks(word, api_endpoint)Parse and annotate
parse_word_block returns a pair: the raw word and a list of parse dictionaries. The overall result groups analyses at the queried word level.
blocks = morphkit.split_into_raw_blocks(raw)
parsed = [morphkit.parse_word_block(block) for block in blocks]
for raw_word, parse_list in parsed:
for parse in parse_list:
parse["pos"] = morphkit.analyse_pos(parse)
parse["morph"] = morphkit.analyse_morph_tag(parse)The orchestrating function performs the stages and returns a structured word-level dictionary:
result = morphkit.analyse_word_with_morpheus(word, api_endpoint)
# result contains the word, block count, and analysesNotebook topics
- Full and compact Morpheus responses
- Greek block splitting, parsing, POS determination, and SP-tag generation
- Basic Latin retrieval and parsing
- Tag decoding and weighted comparison
- Ordering analyses by a reference lemma and morphological tag
See the complete Jupyter notebook in the repository.
Morphkit