Skip to content

A Python wrapper to mophologically expand terms using the UniMorph knowledge base. Lemmatises the input term and re-inflects the lemma to all possible surface forms.

Notifications You must be signed in to change notification settings

sumpe/morphological_expander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morphological Expansion Tool

A Python wrapper to morphologically expand terms using the UniMorph knowledge base. Lemmatizes the input term and re-inflects the lemma to all possible surface forms.

How to get started

Clone or download this repository to your own machine. No external libraries are required, so no installation is needed as long as the folder named 'resources' is included. The tool currently works for Swedish, French and Spanish. This may be extended by adding the UniMorph file of the desired language in 'resources'. (There is an initial blank line which must be removed).

Python3 must of course be installed. Support for Python2 is to be discontinued and its use should not be encouraged. No special effort has therefore been made to make this package backwards compatable with Python2.

Usage

Runs with Python3 from the command line. Takes two arguments, the word to be re-inflected and the corresponding language code (ISO 639). If no code is provided, Swedish (sv) is taken as the default.

The functionality can also be used in an interactive python session, by importing the library in the normal way:
import morphological_expander
OR
from morphological_expander import *
There are some issues with supplying non ascii characters through a bash shell.

Example

Input:

$ python3 morphological_expander.py abstraktioner

Output:

Expanding abstraktioner. No language code provided. Default is Swedish (sv).
abstraktion
abstraktions
abstraktionen
abstraktioner
abstraktionens
abstraktioners
abstraktionerna
abstraktionernas

Adding New Languages

The library can be run with any of the raw resources from UniMorph, if the relevant file is added to the resources folder in the cloned repository. However, there is an initial blank line which must first be removed.

About

A Python wrapper to mophologically expand terms using the UniMorph knowledge base. Lemmatises the input term and re-inflects the lemma to all possible surface forms.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages