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

ZulMorph requires that FOMA be installed. See instructions here.

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.5.tar.gz (772.5 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.5-py3-none-any.whl (768.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zulmorph-1.0.5.tar.gz
  • Upload date:
  • Size: 772.5 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.5.tar.gz
Algorithm Hash digest
SHA256 d35ccb604f46d52ed70e0ed99da37f12e8661602c82646d8b6f105f6c4a87c82
MD5 635558b09ce50bd1bd53d7a05e71ab06
BLAKE2b-256 9c6f3bf27a9aad0390d0cfbcce6f9ce0ef245c02dc9a1bd795623155bb65c479

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zulmorph-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 768.6 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6bc287f79d8d87e50e5d6f63ea01d969a812718eb958a918642cb53ba518a103
MD5 5eaee74e37bf453074e709ca976ac7a1
BLAKE2b-256 b1acadb0a9b82c9eadd08e852c8ed5960341bb01ce82a0099196dccdf6c17a45

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