21 template<
typename RefData>
22 typename RefData::ErrorStats::Error
ComputeError (RefData& refData,
24 typename RefData::ErrorStats aggregate;
25 for (std::vector<Sid>::const_iterator sit = lats.
ids.begin();
26 sit != lats.
ids.end(); ++sit) {
28 tracer <<
"sentence s=" << *sit <<
'\n';
32 cerr <<
"ERROR: invalid vector lattice for sentence s=" << *sit
37 typename RefData::ErrorStats es = refData.ComputeErrorStats (*sit, h);
39 tracer <<
"best hypothesis=" << h <<
" " << es <<
'\n';
41 aggregate = aggregate + es;
46 return aggregate.ComputeError();
49 template<
typename RefData>
52 typename RefData::ErrorStats::Error error = ComputeError<RefData> (refData,
61 virtual std::string
operator() (
const std::vector<std::string>& refFilenames,
69 template<
typename RefData>
72 virtual std::string
operator() (
const std::vector<std::string>& refFilenames,
76 refData.LoadRefData (refFilenames);
77 return Score (refData, lats, lambda);
RefData::ErrorStats::Error ComputeError(RefData &refData, const TuneSet &lats, const PARAMS &lambda)
TupleArcFst * GetVectorLattice(const Sid s, const bool use_cache) const
std::vector< Wid > Sentence
Sentence GetBestHypothesis(const TupleArcFst *, const PARAMS &)
std::string Score(RefData &refData, const TuneSet &lats, const PARAMS &lambda)
virtual std::string operator()(const std::vector< std::string > &refFilenames, const TuneSet &lats, const PARAMS &lambda)=0