|
|
|
|
|
#ifndef moses_PhraseDictionaryTree_h |
|
#define moses_PhraseDictionaryTree_h |
|
|
|
#include <string> |
|
#include <vector> |
|
#include <iostream> |
|
|
|
#ifdef WITH_THREADS |
|
#include <boost/thread/mutex.hpp> |
|
#endif |
|
|
|
#include "moses/TypeDef.h" |
|
#include "moses/PrefixTree.h" |
|
#include "moses/File.h" |
|
#include "moses/ObjectPool.h" |
|
#include "moses/FF/LexicalReordering/LexicalReorderingTable.h" |
|
#include "moses/LVoc.h" |
|
#include "moses/TypeDef.h" |
|
#include "moses/Util.h" |
|
|
|
namespace Moses |
|
{ |
|
|
|
class Phrase; |
|
class Word; |
|
class ConfusionNet; |
|
class PDTimp; |
|
|
|
typedef PrefixTreeF<LabelId,OFF_T> PTF; |
|
|
|
|
|
struct StringTgtCand { |
|
typedef std::vector<std::string const*> Tokens; |
|
Tokens tokens; |
|
Scores scores; |
|
Tokens fnames; |
|
std::vector<FValue> fvalues; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class PhraseDictionaryTree |
|
{ |
|
PDTimp *imp; |
|
|
|
PhraseDictionaryTree(const PhraseDictionaryTree&); |
|
void operator=(const PhraseDictionaryTree&); |
|
public: |
|
PhraseDictionaryTree(); |
|
|
|
void NeedAlignmentInfo(bool a); |
|
|
|
void PrintWordAlignment(bool a); |
|
bool PrintWordAlignment(); |
|
|
|
|
|
virtual ~PhraseDictionaryTree(); |
|
|
|
size_t GetSize() const { |
|
return 0; |
|
} |
|
|
|
|
|
|
|
|
|
int Create(std::istream& in,const std::string& outFileNamePrefix); |
|
|
|
int Read(const std::string& fileNamePrefix); |
|
|
|
|
|
void FreeMemory() const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
void PrintTargetCandidates(const std::vector<std::string>& src, |
|
std::ostream& out) const; |
|
|
|
|
|
void GetTargetCandidates(const std::vector<std::string>& src, |
|
std::vector<StringTgtCand>& rv) const; |
|
|
|
|
|
|
|
void GetTargetCandidates(const std::vector<std::string>& src, |
|
std::vector<StringTgtCand>& rv, |
|
std::vector<std::string>& wa) const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PrefixPtr |
|
{ |
|
PPimp* imp; |
|
friend class PDTimp; |
|
public: |
|
PrefixPtr(PPimp* x=0) : imp(x) {} |
|
operator bool() const; |
|
}; |
|
|
|
|
|
PrefixPtr GetRoot() const; |
|
|
|
|
|
|
|
PrefixPtr Extend(PrefixPtr p,const std::string& s) const; |
|
|
|
|
|
|
|
void GetTargetCandidates(PrefixPtr p, |
|
std::vector<StringTgtCand>& rv) const; |
|
void GetTargetCandidates(PrefixPtr p, |
|
std::vector<StringTgtCand>& rv, |
|
std::vector<std::string>& wa) const; |
|
|
|
|
|
|
|
void PrintTargetCandidates(PrefixPtr p,std::ostream& out) const; |
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
#endif |
|
|