mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-06 19:49:41 +03:00
71 lines
2.2 KiB
C++
71 lines
2.2 KiB
C++
#pragma once
|
|
|
|
#include <boost/unordered_set.hpp>
|
|
#include "moses/InputType.h"
|
|
#include "moses/BaseManager.h"
|
|
|
|
#include "KBestExtractor.h"
|
|
|
|
namespace Moses
|
|
{
|
|
namespace Syntax
|
|
{
|
|
|
|
// Common base class for Moses::Syntax managers.
|
|
class Manager : public BaseManager
|
|
{
|
|
public:
|
|
Manager(ttasksptr const& ttask);
|
|
|
|
// Virtual functions from Moses::BaseManager that are implemented the same
|
|
// way for all Syntax managers.
|
|
void OutputBest(OutputCollector *collector) const;
|
|
void OutputNBest(OutputCollector *collector) const;
|
|
void OutputUnknowns(OutputCollector *collector) const;
|
|
|
|
// Virtual functions from Moses::BaseManager that are no-ops for all Syntax
|
|
// managers.
|
|
void OutputAlignment(OutputCollector *collector) const {}
|
|
void OutputDetailedTreeFragmentsTranslationReport(
|
|
OutputCollector *collector) const {}
|
|
void OutputLatticeSamples(OutputCollector *collector) const {}
|
|
void OutputSearchGraph(OutputCollector *collector) const {}
|
|
// void OutputSearchGraphHypergraph() const {}
|
|
|
|
void
|
|
OutputSearchGraphAsHypergraph
|
|
( std::string const& fname, size_t const precision ) const
|
|
{ }
|
|
|
|
void OutputSearchGraphSLF() const {}
|
|
void OutputWordGraph(OutputCollector *collector) const {}
|
|
void OutputDetailedTranslationReport(OutputCollector *collector) const {}
|
|
|
|
void CalcDecoderStatistics() const {}
|
|
|
|
// Syntax-specific virtual functions that derived classes must implement.
|
|
virtual void ExtractKBest(
|
|
std::size_t k,
|
|
std::vector<boost::shared_ptr<KBestExtractor::Derivation> > &kBestList,
|
|
bool onlyDistinct=false) const = 0;
|
|
virtual const SHyperedge *GetBestSHyperedge() const = 0;
|
|
|
|
protected:
|
|
boost::unordered_set<Word> m_oovs;
|
|
|
|
private:
|
|
// Syntax-specific helper functions used to implement OutputNBest.
|
|
void OutputNBestList(OutputCollector *collector,
|
|
const KBestExtractor::KBestVec &nBestList,
|
|
long translationId) const;
|
|
|
|
std::size_t OutputAlignmentNBest(Alignments &retAlign,
|
|
const KBestExtractor::Derivation &d,
|
|
std::size_t startTarget) const;
|
|
|
|
std::size_t CalcSourceSize(const KBestExtractor::Derivation &d) const;
|
|
};
|
|
|
|
} // Syntax
|
|
} // Moses
|