blob: 52af6297c2f0d1524f819d1c1d030ed996771a0c (
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
38
39
40
41
42
43
44
45
46
47
|
from libcpp.vector cimport vector
from libcpp.string cimport string
from utils cimport *
from hypergraph cimport Hypergraph
cdef extern from "mteval/ns.h":
cdef cppclass SufficientStats:
SufficientStats()
SufficientStats(SufficientStats&)
unsigned size()
float operator[](unsigned i)
void swap(SufficientStats& other)
SufficientStats add "operator+" (SufficientStats&, SufficientStats&)
cdef cppclass SegmentEvaluator:
void Evaluate(vector[WordID]& hyp, SufficientStats* out)
cdef cppclass EvaluationMetric:
string& MetricId()
bint IsErrorMetric()
float ComputeScore(SufficientStats& stats)
string DetailedScore(SufficientStats& stats)
shared_ptr[SegmentEvaluator] CreateSegmentEvaluator(vector[vector[WordID]]& refs)
ComputeSufficientStatistics(vector[WordID]& hyp,
vector[WordID]& refs,
SufficientStats* out)
cdef extern from "mteval/ns.h" namespace "EvaluationMetric":
EvaluationMetric* Instance(string& metric_id)
EvaluationMetric* Instance() # IBM_BLEU
cdef extern from "training/candidate_set.h" namespace "training":
cdef cppclass Candidate "const training::Candidate":
vector[WordID] ewords
FastSparseVector[weight_t] fmap
SufficientStats eval_feats
cdef cppclass CandidateSet:
CandidateSet()
unsigned size()
Candidate& operator[](unsigned i)
void ReadFromFile(string& file)
void WriteToFile(string& file)
void AddKBestCandidates(Hypergraph& hg,
unsigned kbest_size,
SegmentEvaluator* scorer)
|