UAlbertaALTLab / plains-cree-fsts

Mirror of the source code for the Plains Cree morphological analyzer/generator.
https://github.com/giellalt/lang-crk
Other
2 stars 1 forks source link

Example of generating multiple inflections #3

Closed aaronfay closed 5 years ago

aaronfay commented 5 years ago

@eddieantonio you mentioned it's possible to generate multiple inflections simultaneously, can you provide an example of how to do so?

eddieantonio commented 5 years ago

Using the hfst-optimized-lookup command, you can pipe in analyses, one per line.

Say you have a file called conjugations.txt:

mîcisow+V+AI+Ind+Prs+1Sg
mîcisow+V+AI+Ind+Prs+2Sg
mîcisow+V+AI+Ind+Prs+3Sg
PV/e+mîcisow+V+AI+Cnj+Prs+1Sg
PV/e+mîcisow+V+AI+Cnj+Prs+2Sg
PV/e+mîcisow+V+AI+Cnj+Prs+3Sg

You can pipe this into hfst-optimized-lookup:

$ cat conjugations.txt | hfst-optimized-lookup --silent crk-normative-generator.hfstol
mîcisow+V+AI+Ind+Prs+1Sg    nimîcison

mîcisow+V+AI+Ind+Prs+2Sg    kimîcison

mîcisow+V+AI+Ind+Prs+3Sg    mîcisow

PV/e+mîcisow+V+AI+Cnj+Prs+1Sg   ê-mîcisoyân

PV/e+mîcisow+V+AI+Cnj+Prs+2Sg   ê-mîcisoyan

PV/e+mîcisow+V+AI+Cnj+Prs+3Sg   ê-mîcisot

You can use the two-column output to map the input to the generated word form. This is useful, since some analyses have multiple possible word forms (e.g., cactus+Pl in English can be "cactuses" or "cacti").

I'll write some documentation about this README soon!