knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(unimorphR)
unimorphR provides an R wrapper around the Python package unimorph, a command line interface to the UniMorph project. This essentially includes three functionalities: downloading morphological paradigm data from the UniMorph project; getting the features and lemma of an already inflected word; and returning the inflected forms of a given lemma.
You can install the development version of unimorphR with:
devtools::install_github("b05102139/unimorphR")
Data in the UniMorph project can be manually downloaded thus:
library(unimorphR) download_unimorph("fra")
This data can then be loaded into R:
french_paradigms <- load_dataset("fra") french_paradigms[87:89,]
To analyze an inflected word, analyze_word
is the function to use, where the word and language must be specified:
library(unimorphR) analyze_word("fought", lang="eng")
And to return the forms of a given lemma, use inflect_word
:
inflect_word("attack", lang="eng")
It is also possible to specify a specific form to return, based on the features desired:
inflect_word("attack", lang="eng", features = "V;V.PTCP;PRS")
Please refer to the original UniMorph project for more details (and please cite them if you use this code in a paper)!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.