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.3.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.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zulmorph-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 38ef5505deda75d10bd140ef6098822798a5ab174e4b5296823456e13e78e1d4
MD5 ad7927d5a11a431609d6dcb04f56d455
BLAKE2b-256 1f6a29d7b62ff81f06bf1331895986a6c3c051591583674808fcfa41281d1776

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zulmorph-1.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5af2e3a51e937ba509014bf8fb0210663b9d69b061e86551cdddf05cdfd4add8
MD5 2a8ceefcb0ab2251387090bc609b8714
BLAKE2b-256 aec2d207def67b27df9ce9996cbf74ec7c57700752539a9483de15e398ca6e41

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