mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-20 23:58:15 +03:00
Garbage collect uncalled AddEquivPhrase function
This commit is contained in:
parent
82d40e4044
commit
5a841e6619
@ -109,21 +109,6 @@ public:
|
||||
uniqSrcPhr.clear();
|
||||
}
|
||||
|
||||
void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase) {
|
||||
std::cerr << "AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase)" << std::endl;
|
||||
CHECK(GetTargetPhraseCollection(source)==0);
|
||||
|
||||
VERBOSE(2, "adding unk source phrase "<<source<<"\n");
|
||||
std::pair<MapSrc2Tgt::iterator,bool> p
|
||||
=m_cache.insert(std::make_pair(source,static_cast<TargetPhraseCollection const*>(0)));
|
||||
if(p.second || p.first->second==0) {
|
||||
TargetPhraseCollection *ptr=new TargetPhraseCollection;
|
||||
ptr->Add(new TargetPhrase(targetPhrase));
|
||||
p.first->second=ptr;
|
||||
m_tgtColls.push_back(ptr);
|
||||
} else VERBOSE(2, "WARNING: you added an already existing phrase!\n");
|
||||
}
|
||||
|
||||
TargetPhraseCollection const*
|
||||
GetTargetPhraseCollection(Phrase const &src) const {
|
||||
|
||||
|
@ -74,7 +74,6 @@ public:
|
||||
//! find list of translations that can translates a portion of src. Used by confusion network decoding
|
||||
virtual const TargetPhraseCollection *GetTargetPhraseCollection(InputType const& src,WordsRange const& range) const;
|
||||
//! Create entry for translation of source to targetPhrase
|
||||
virtual void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase)=0;
|
||||
virtual void InitializeForInput(InputType const& source) = 0;
|
||||
|
||||
//! Create a sentence-specific manager for SCFG rule lookup.
|
||||
|
@ -26,7 +26,6 @@ public:
|
||||
// functions below required by base class
|
||||
const TargetPhraseCollection* GetTargetPhraseCollection(const Phrase& src) const;
|
||||
void InitializeForInput(const InputType& i);
|
||||
void AddEquivPhrase(const Phrase &, const TargetPhrase &) {}
|
||||
void CleanUp();
|
||||
void insertSnt(string&, string&, string&);
|
||||
void deleteSnt(unsigned, unsigned);
|
||||
|
@ -179,12 +179,6 @@ TargetPhraseCollection *PhraseDictionaryMemory::CreateTargetPhraseCollection(con
|
||||
return currNode->CreateTargetPhraseCollection();
|
||||
}
|
||||
|
||||
void PhraseDictionaryMemory::AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase)
|
||||
{
|
||||
TargetPhraseCollection &phraseColl = *CreateTargetPhraseCollection(source);
|
||||
phraseColl.Add(new TargetPhrase(targetPhrase));
|
||||
}
|
||||
|
||||
const TargetPhraseCollection *PhraseDictionaryMemory::GetTargetPhraseCollection(const Phrase &source) const
|
||||
{
|
||||
// exactly like CreateTargetPhraseCollection, but don't create
|
||||
|
@ -57,8 +57,6 @@ public:
|
||||
|
||||
const TargetPhraseCollection *GetTargetPhraseCollection(const Phrase &source) const;
|
||||
|
||||
void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase);
|
||||
|
||||
// for mert
|
||||
virtual void InitializeForInput(InputType const&) {
|
||||
/* Don't do anything source specific here as this object is shared between threads.*/
|
||||
|
@ -73,17 +73,6 @@ const TargetPhraseCollection *PhraseDictionaryOnDisk::GetTargetPhraseCollection(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PhraseDictionaryOnDisk::AddEquivPhrase(const Phrase& /* source */, const TargetPhrase& /*targetPhrase */)
|
||||
{
|
||||
CHECK(false); // TODO
|
||||
}
|
||||
|
||||
|
||||
//! Create entry for translation of source to targetPhrase
|
||||
void PhraseDictionaryOnDisk::AddEquivPhrase(const Phrase& /* source */, TargetPhrase * /* targetPhrase */)
|
||||
{
|
||||
}
|
||||
|
||||
void PhraseDictionaryOnDisk::InitializeForInput(const InputType& /* input */)
|
||||
{
|
||||
// Nothing to do: sentence-specific state is stored in ChartRuleLookupManager
|
||||
|
@ -76,11 +76,6 @@ public:
|
||||
//! find list of translations that can translates src. Only for phrase input
|
||||
virtual const TargetPhraseCollection *GetTargetPhraseCollection(const Phrase& src) const;
|
||||
|
||||
void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase);
|
||||
|
||||
//! Create entry for translation of source to targetPhrase
|
||||
virtual void AddEquivPhrase(const Phrase &source, TargetPhrase *targetPhrase);
|
||||
|
||||
void InitializeForInput(const InputType& input);
|
||||
void CleanUp();
|
||||
|
||||
|
@ -60,12 +60,6 @@ class PhraseDictionarySCFG : public PhraseDictionary
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Required by PhraseDictionary.
|
||||
void AddEquivPhrase(const Phrase &, const TargetPhrase &)
|
||||
{
|
||||
CHECK(false);
|
||||
}
|
||||
|
||||
void InitializeForInput(const InputType& i);
|
||||
|
||||
void CleanUp();
|
||||
|
@ -84,11 +84,6 @@ PhraseDictionaryTreeAdaptor::GetTargetPhraseCollection(InputType const& src,Word
|
||||
}
|
||||
}
|
||||
|
||||
void PhraseDictionaryTreeAdaptor::
|
||||
AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase)
|
||||
{
|
||||
imp->AddEquivPhrase(source,targetPhrase);
|
||||
}
|
||||
void PhraseDictionaryTreeAdaptor::EnableCache()
|
||||
{
|
||||
imp->useCache=1;
|
||||
|
@ -56,10 +56,6 @@ public:
|
||||
TargetPhraseCollection const* GetTargetPhraseCollection(Phrase const &src) const;
|
||||
TargetPhraseCollection const* GetTargetPhraseCollection(InputType const& src,WordsRange const & srcRange) const;
|
||||
|
||||
|
||||
// this function can be only used for UNKNOWN source phrases
|
||||
void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase);
|
||||
|
||||
std::string GetScoreProducerDescription(unsigned idx=0) const;
|
||||
std::string GetScoreProducerWeightShortName(unsigned idx=0) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user