在Python中使用FST库
我该如何安装 OpenFST?
我一直是这样做的:
wget http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.4.1.tar.gz
tar -zxvf openfst-1.4.1.tar.gz
cd openfst-1.4.1
./configure
make
make install
还有其他安装方法吗?
其实我最终想要的是在Python中使用OpenFST,我一直在用这个封装库: https://github.com/vchahun/pyfst
在安装了 OpenFST
之后,安装 pyfst
时遇到了以下问题。有人知道怎么解决吗?:
$ sudo pip install pyfst
....
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/pyfst/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-O7BSyr-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/pyfst
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.5', 'console_scripts', 'pip')()
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.5-py2.7.egg/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.5-py2.7.egg/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)
但是有没有纯Python版本的OpenFST?
2 个回答
0
我找到一个纯Python写的有限状态机工具,叫做 PyFoma,它的功能和OpenFST差不多。以下是他们文档中的一段话:
PyFoma
PyFoma是一个开源(Apache许可)的包,用于有限状态自动机和转换器的建模和学习。它完全用Python实现,没有任何外部依赖。
4
自从OpenFST 1.5版本发布以来,它现在包含了一个Python的封装工具。在1.5.3版本中,这个封装工具比之前一些独立的OpenFST Python封装要强大得多。我不知道有没有纯Python写的FST实现。目前似乎没有什么知名的。