summaryrefslogtreecommitdiff
path: root/python/src/decoder.pxd
blob: 660bcb39139bcfaddd52987216fa6954d57ac32f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from libcpp.string cimport string
from libcpp.vector cimport vector
from hypergraph cimport Hypergraph
from utils cimport istream, weight_t, variables_map

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(int argc, char** argv)
        Decoder(istream* config_file)
        bint Decode(string& inp, 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)
        variables_map& GetConf()

        # 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()