Skip to main content

Morphological analysis using ZulMorph

Project description

ZulMorph Morphological Analyser

A morphological analyser for Zulu

Authors

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: zulmorph-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 e4348fd19cdc56897a296cb8543d5161507cb306a2ba6ef300acc0968141a2ae
MD5 0eef931e70edba299a5d00dd68bde967
BLAKE2b-256 e3d338853a8917657bf4d4931e371612d10add3c524a81b89bf2feb18beda311

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zulmorph-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dfc0ca63affed0f79c2905a1a2f78d3d2252d00e4a374062a1c3e181eca762a7
MD5 ea764646334fb27def10dad4164afc43
BLAKE2b-256 5fde6dddf29ba9067d475ce746d16b9d49521e06c80ab1ecfef4b928b7b8398c

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