Pynini is a Python extension module which allows the user to compile, optimize, and apply grammar rules. Rules can be compiled into weighted finite state transducers, pushdown transducers, or multi-pushdown transducers. For general information and a detailed tutorial, see pynini.opengrm.org.
Pynini is primarily developed by Kyle Gorman with the help of contributors. If you use Pynini in your research, we would appreciate if you cite the following paper:
K. Gorman. 2016. Pynini: A Python library for weighted finite-state grammar compilation. In Proc. ACL Workshop on Statistical NLP and Weighted Automata, 75-80.
(Note that some of the code samples in the paper are now out of date.)
Pynini depends on:
- A standards-compliant C++ 11 compiler (GCC >= 4.8 or Clang >= 700)
- The most recent version of OpenFst (at the time of
writing, 1.7.2) built with the
scriptextensions (i.e., built with
./configure --enable-grm) and headers
- Python 2.7 or 3.6+ and headers
It is tested with: Debian Linux 4.18.10 on x86_64, GCC 7.3.0, Cython 0.29.2 and Python 2.7.13 and Python 3.7.1.
python setup.py install. Depending on your environment, you
may need to be superuser while running this command for installation to
To confirm successful installation, execute
python setup.py test.
Python 3 support
Python 3 support is available as of Pynini 2.0.0.
Pynini is released under the Apache license. See
LICENSE for more
Interested in contributing?
CONTRIBUTING for more information.
This is not an official Google product.