summaryrefslogtreecommitdiff
path: root/python/cdec/decoder.pxd
diff options
context:
space:
mode:
Diffstat (limited to 'python/cdec/decoder.pxd')
-rw-r--r--python/cdec/decoder.pxd35
1 files changed, 35 insertions, 0 deletions
diff --git a/python/cdec/decoder.pxd b/python/cdec/decoder.pxd
new file mode 100644
index 00000000..b68b836e
--- /dev/null
+++ b/python/cdec/decoder.pxd
@@ -0,0 +1,35 @@
+from libcpp.string cimport string
+from libcpp.vector cimport vector
+from hypergraph cimport Hypergraph
+from grammar cimport Grammar
+from utils cimport *
+
+cdef extern from "decoder/ff_register.h":
+ void register_feature_functions()
+
+cdef extern from "decoder/decoder.h":
+ cdef cppclass SentenceMetadata:
+ pass
+
+ cdef cppclass DecoderObserver:
+ DecoderObserver()
+
+ cdef cppclass Decoder:
+ Decoder(istream* config_file) nogil
+ bint Decode(string& inp, DecoderObserver* observer) nogil
+
+ # 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)
+ variables_map& GetConf()
+
+ # add grammar rules (currently only supported by SCFG decoders)
+ void AddSupplementalGrammarFromString(string& grammar_str) nogil
+ void AddSupplementalGrammar(shared_ptr[Grammar] grammar) nogil
+
+cdef extern from "observer.h":
+ cdef cppclass BasicObserver(DecoderObserver):
+ Hypergraph* hypergraph
+ BasicObserver()