mosesdecoder/contrib/python
2012-09-18 11:39:39 +02:00
..
binpt query results can now be sorted and pruned 2012-09-18 11:39:39 +02:00
examples i) check for invalid paths; ii) added sample data; iii) added --with-cmph in setup.py 2012-09-14 12:51:31 +02:00
example.py query results can now be sorted and pruned 2012-09-18 11:39:39 +02:00
README.md i) check for invalid paths; ii) added sample data; iii) added --with-cmph in setup.py 2012-09-14 12:51:31 +02:00
setup.py i) check for invalid paths; ii) added sample data; iii) added --with-cmph in setup.py 2012-09-14 12:51:31 +02:00

Python interface to Moses

The idea is to have some of Moses' internals exposed to Python (inspired on pycdec).

What's been interfaced?

  • Binary phrase table:

      Moses::PhraseDictionaryTree.h
    

Building

  1. Build the python extension

    python setup.py build_ext -i [--with-cmph]
    
  2. Check the example code

    echo "casa" | python example.py examples/phrase-table 5 1
    echo "essa casa" | python example.py examples/phrase-table 5 1
    

Changing the code

If you want to add your changes you are going to have to recompile the cython code.

  1. Compile the cython code (use Cython 0.16): this will generate binpt/binpt.cpp

    cython --cplus binpt/binpt.pyx