Skip to main content

Morphological analysis using ZulMorph

Reason this release was yanked:

Wrong license in metadata

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.

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]"
  ]
}

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/

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.0.tar.gz (13.8 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.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zulmorph-1.0.0.tar.gz
  • Upload date:
  • Size: 13.8 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.0.tar.gz
Algorithm Hash digest
SHA256 248c814c3bf4816b171ddbc3d200120397b4f3bca82da6a11bd089c1e62b6778
MD5 4861a04a1de7e8b620178909b931f7ee
BLAKE2b-256 89401318a7e1bab77626ca78c0904cc36affa42cb79a38fbf9cb57b1911b22b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zulmorph-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1465dcf71132d3292cafee77ac45c6791c6cff0ac373f2fc15bbc86171a9b144
MD5 3d80ec22e22a95d72a63789f23b28a2b
BLAKE2b-256 2f924b5412df3fda137499caaae81091edea70852e3bf236f0a87de648bad79e

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