Skip to main content

Morphological analysis using ZulMorph

Project description

ZulMorph Morphological Analyser

A morphological analyser for Zulu

Overview

ZulMorph is a finite state morphological analyser for Zulu, originally developed using the Xerox finite state tools lexc and xfst and compiled here with Foma. This Python package is aimed at facilitating inclusion of ZulMorph in larger NLP pipelines.

Zulu words in their surface form are analysed to their base form. Any meaningful word can be input, and the output will be one or more complete morphological analyses of that word.

Authors and attribution

Please cite the output of ZulMorph as follows:

Pretorius, L. and Bosch, S. (2018). ZulMorph: Finite state morphological analyser for Zulu [Software]. Web demo at https://portal.sadilar.org/FiniteState/demo/zulmorph/

Documentation

The tagset and additional documentation can be viewed here.

Installation

pip install zulmorph

Usage

Command line

As a command line tool, ZulMorph can be used as follows.

usage: zulmorph [-h] [-f FST] {t,f} input [input ...]

Uses ZulMorph to morphologically analyse isiZulu tokens.

positional arguments:
  {t,f}       indicate if input is [t]oken(s) or [f]ilename(s) (token per
              line)
  input

options:
  -h, --help  show this help message and exit
  -f FST      path to FST (.fom) (default: zul.fom)

Example with tokens:

zulmorph t indoda iyahamba > output.json

This will produce a file containing the following.

{
  "indoda": [
    "i[NPrePre][9]n[BPre][9]doda.9-6[NStem]"
  ],
  "iyahamba": [
    "i[SC][9]ya[LongPres]hamb[VRoot]a[VT]",
    "i[SC][4]ya[LongPres]hamb[VRoot]a[VT]"
  ]
}

Example with filenames:

zulmorph f tokens.1.txt tokens.2.txt > output.json

Python library

Usage as part of a Python program is as follows.

from zulmorph import zulmorph as zm

zm.analyse_token("iyahamba")

This produces a list of strings representing the analyses.

['i[SC][9]ya[LongPres]hamb[VRoot]a[VT]',
 'i[SC][4]ya[LongPres]hamb[VRoot]a[VT]']

Multiple tokens can be provided. This produces a dictionary where the keys are tokens and their values are lists of analyses. The order of the keys follow the order of the tokens in the list, ignoring any duplications that may occur.

from zulmorph import zulmorph as zm

zm.analyse_tokens(["indoda","iyahamba"])

Output:

{
  "indoda": [
    "i[NPrePre][9]n[BPre][9]doda.9-6[NStem]"
  ],
  "iyahamba": [
    "i[SC][9]ya[LongPres]hamb[VRoot]a[VT]",
    "i[SC][4]ya[LongPres]hamb[VRoot]a[VT]"
  ]
}

License

See LICENSE distributed with this package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zulmorph-1.0.4.tar.gz (772.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zulmorph-1.0.4-py3-none-any.whl (768.5 kB view details)

Uploaded Python 3

File details

Details for the file zulmorph-1.0.4.tar.gz.

File metadata

  • Download URL: zulmorph-1.0.4.tar.gz
  • Upload date:
  • Size: 772.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zulmorph-1.0.4.tar.gz
Algorithm Hash digest
SHA256 a1e25e0f6ab9c6eea3ebea18b6e58ddd426258b9e968d779d5386dff6c4ab3b4
MD5 7e6a78c3eaf7897d84021878952aae40
BLAKE2b-256 909f3764eff1d9b84dab07dac6ebe2d4d906778ff7fb6592ab68713f46f572e7

See more details on using hashes here.

File details

Details for the file zulmorph-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: zulmorph-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 768.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zulmorph-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9754c271890c102466f50de9d9fad9165aa5e95e3797378596d6abb454f9314a
MD5 190a2af4a4de38c30f2c9993d3571cfb
BLAKE2b-256 19a40394359d4b73dbbf9e06e722bec73f95a33402b45d026009eec1574e9fe2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page