Files
hfst-optimized-lookup-python
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
hfst_lookup: perform lookup on a fast transducer format This is a standalone package for performing transducer lookup (transformation) using a specialised file format. The format is fast, but the pure Python implementation is not very fast. This package also provides a fast C++ implementation with SWIG bindings - you can use either one. INSTALLATION You can either install the package or just run it in the directory it comes in. To install, use the standard setup.py. See python setup.py --help You probably just want (as root) python setup.py install You'll need Python's setuptools to be installed for this to work. To install the SWIG-bound C++ code, you'll need a C++ compiler and SWIG. cd swig swig -c++ -python hfst_lookup.i python setup.py build_ext --inplace Should build the module in the local directory. You can run it there, or again install it with python setup.py install RUNNING For the pure Python package you'll need the Python interpreter (2.7.x), a transducer in a special fast-lookup format (made with separate hfst tools) and this package. You can look for prebuilt transducers in hfst's Sourceforge page, http://hfst.sf.net. The commandline and utility are both provided by hfst_lookup.py. To run the lookup utility, type ./hfst_lookup.py [name of transducer] or python hfst_lookup.py [name of transducer] If you load hfst_lookup as a module, you can use the class OlTransducer from it to load and run transducers, like so: my_transducer = OlTransducer(filename) for result in my_transducer.analyse(string_to_analyse): print result The results are (string, weight) pairs (Unicode strings and floating point numbers).