mosesdecoder/moses/TranslationModel/ProbingPT/ProbingPT.h
2014-03-19 12:59:55 +00:00

57 lines
1.4 KiB
C++

#pragma once
#include <boost/bimap.hpp>
#include "../PhraseDictionary.h"
class QueryEngine;
class target_text;
namespace Moses
{
class ChartParser;
class ChartCellCollectionBase;
class ChartRuleLookupManager;
class ProbingPT : public PhraseDictionary
{
friend std::ostream& operator<<(std::ostream&, const ProbingPT&);
public:
ProbingPT(const std::string &line);
~ProbingPT();
void Load();
void InitializeForInput(InputType const& source);
// for phrase-based model
void GetTargetPhraseCollectionBatch(const InputPathList &inputPathQueue) const;
// for syntax/hiero model (CKY+ decoding)
ChartRuleLookupManager* CreateRuleLookupManager(const ChartParser&, const ChartCellCollectionBase&);
TO_STRING();
protected:
QueryEngine *m_engine;
typedef boost::bimap<const Factor *, uint64_t> SourceVocabMap;
mutable SourceVocabMap m_sourceVocabMap;
typedef boost::bimap<const Factor *, unsigned int> TargetVocabMap;
mutable TargetVocabMap m_vocabMap;
TargetPhraseCollection *CreateTargetPhrase(const Phrase &sourcePhrase) const;
TargetPhrase *CreateTargetPhrase(const Phrase &sourcePhrase, const target_text &probingTargetPhrase) const;
const Factor *GetFactor(uint64_t probingId) const;
uint64_t GetProbingId(const Factor *factor) const;
std::vector<uint64_t> ConvertToProbingPhrase(const Phrase &sourcePhrase, bool &ok) const;
uint64_t m_unkId;
};
} // namespace Moses