Starting from version 1.5, OpenFst has offered a native Python module, making the use of external wrappers like PyFst unnecessary. This has been greatly helpful since PyFst doesn't support Python 3.
-
Download OpenFst 1.5.4 or above from http://openfst.cs.nyu.edu/twiki/bin/view/FST/FstDownload
-
Unzip, untar:
$ tar xzvf openfst-1.5.4.tar.gz
-
$ ./configure --enable-python --enable-far
- --enable-far will make OpenFst install the library files needed for the Python OpenFst extension.
- --enable-python will install the
pywrapfst
Python module, but not neccessarily to the Python version you intend to use. You may need to set the global Python version to 2.7, for example usingpyenv
.
-
$ ./make
-
$ ./make install
Say you want to use Python 3.6:
$ virtualenv -p $(which python3.6) venv
$ source venv/bin/activate
$ export CFLAGS="-std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7"
-std=c++11
makes the compiler use the correct C standard for OpenFst-stdlib=libc++
makes the compiler use the standard C library OpenFst uses
$ pip install openfst
See http://www.openfst.org/twiki/bin/view/FST/PythonExtension
If we run into installation issues with
make
, can we do to fix?