From 98e13188c40adf13b73ca994d3410f3e87d20355 Mon Sep 17 00:00:00 2001 From: Victor Chahuneau Date: Mon, 4 Jun 2012 02:16:59 -0400 Subject: Python module: initial version --- python/src/decoder.pxd | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 python/src/decoder.pxd (limited to 'python/src/decoder.pxd') diff --git a/python/src/decoder.pxd b/python/src/decoder.pxd new file mode 100644 index 00000000..ab858841 --- /dev/null +++ b/python/src/decoder.pxd @@ -0,0 +1,37 @@ +from libcpp.string cimport string +from libcpp.vector cimport vector +from hypergraph cimport Hypergraph +from utils cimport istream, weight_t + +cdef extern from "decoder/ff_register.h": + cdef void register_feature_functions() + +cdef extern from "decoder/decoder.h": + cdef cppclass SentenceMetadata: + pass + + cdef cppclass DecoderObserver: + DecoderObserver() + + cdef cppclass Decoder: + Decoder(int argc, char** argv) + Decoder(istream* config_file) + bint Decode(string input, DecoderObserver* observer) + + # access this to either *read* or *write* to the decoder's last + # weight vector (i.e., the weights of the finest past) + vector[weight_t]& CurrentWeightVector() + + void SetId(int id) + #const boost::program_options::variables_map& GetConf() const { return conf } + + # add grammar rules (currently only supported by SCFG decoders) + # that will be used on subsequent calls to Decode. rules should be in standard + # text format. This function does NOT read from a file. + void SetSupplementalGrammar(string grammar) + void SetSentenceGrammarFromString(string grammar_str) + +cdef extern from "observer.h": + cdef cppclass BasicObserver(DecoderObserver): + Hypergraph* hypergraph + BasicObserver() -- cgit v1.2.3