get rid of weights in translation model

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3471 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
hieuhoang1972 2010-09-15 16:49:49 +00:00
parent fb8b0eb180
commit e9b355ed8c
14 changed files with 0 additions and 107 deletions

View File

@ -61,10 +61,6 @@ class PhraseDictionary: public Dictionary {
size_t GetTableLimit() const { return m_tableLimit; }
DecodeType GetDecodeType() const { return Translate; }
const PhraseDictionaryFeature* GetFeature() const;
/** set/change translation weights and recalc weighted score for each translation.
* TODO This may be redundant now we use ScoreCollection
*/
virtual void SetWeightTransModel(const std::vector<float> &weightT)=0;
//! find list of translations that can translates src. Only for phrase input
virtual const TargetPhraseCollection *GetTargetPhraseCollection(const Phrase& src) const=0;

View File

@ -45,9 +45,6 @@ void PhraseDictionaryDynSuffixArray::InitializeForInput(const InputType& input)
void PhraseDictionaryDynSuffixArray::CleanUp() {
m_biSA->CleanUp();
}
void PhraseDictionaryDynSuffixArray::SetWeightTransModel(const std::vector<float, std::allocator<float> >&) {
return;
}
const TargetPhraseCollection *PhraseDictionaryDynSuffixArray::GetTargetPhraseCollection(const Phrase& src) const {
TargetPhraseCollection *ret = new TargetPhraseCollection();

View File

@ -22,7 +22,6 @@ public:
, const LMList &languageModels
, float weightWP);
// functions below required by base class
void SetWeightTransModel(const std::vector<float, std::allocator<float> >&);
const TargetPhraseCollection* GetTargetPhraseCollection(const Phrase& src) const;
void InitializeForInput(const InputType& i);
void AddEquivPhrase(const Phrase &, const TargetPhrase &){}

View File

@ -177,17 +177,6 @@ PhraseDictionaryMemory::~PhraseDictionaryMemory()
{
}
void PhraseDictionaryMemory::SetWeightTransModel(const vector<float> &weightT)
{
PhraseDictionaryNode::iterator iterDict;
for (iterDict = m_collection.begin() ; iterDict != m_collection.end() ; ++iterDict)
{
PhraseDictionaryNode &phraseDictionaryNode = iterDict->second;
// recursively set weights in nodes
phraseDictionaryNode.SetWeightTransModel(this, weightT);
}
}
TO_STRING_BODY(PhraseDictionaryMemory);
// friend

View File

@ -60,7 +60,6 @@ public:
void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase);
// for mert
void SetWeightTransModel(const std::vector<float> &weightT);
virtual void InitializeForInput(InputType const&)
{/* Don't do anything source specific here as this object is shared between threads.*/}

View File

@ -64,31 +64,5 @@ const PhraseDictionaryNode *PhraseDictionaryNode::GetChild(const Word &word) con
return NULL;
}
void PhraseDictionaryNode::SetWeightTransModel(
const PhraseDictionaryMemory *phraseDictionary,
const std::vector<float> &weightT)
{
// recursively set weights
NodeMap::iterator iterNodeMap;
for (iterNodeMap = m_map.begin() ; iterNodeMap != m_map.end() ; ++iterNodeMap)
{
iterNodeMap->second.SetWeightTransModel(phraseDictionary, weightT);
}
// set wieghts for this target phrase
if (m_targetPhraseCollection == NULL)
return;
TargetPhraseCollection::iterator iterTargetPhrase;
for (iterTargetPhrase = m_targetPhraseCollection->begin();
iterTargetPhrase != m_targetPhraseCollection->end();
++iterTargetPhrase)
{
TargetPhrase &targetPhrase = **iterTargetPhrase;
targetPhrase.SetWeights(phraseDictionary->GetFeature(), weightT);
}
}
}

View File

@ -68,9 +68,6 @@ public:
m_targetPhraseCollection = new TargetPhraseCollection();
return m_targetPhraseCollection;
}
// for mert
void SetWeightTransModel(const PhraseDictionaryMemory *phraseDictionary
, const std::vector<float> &weightT);
// iterators
typedef NodeMap::iterator iterator;

View File

@ -90,34 +90,6 @@ const PhraseDictionaryNodeSCFG *PhraseDictionaryNodeSCFG::GetChild(const Word &s
return (p == m_nonTermMap.end()) ? NULL : &p->second;
}
void PhraseDictionaryNodeSCFG::SetWeightTransModel(const PhraseDictionary *phraseDictionary
, const std::vector<float> &weightT)
{
// recursively set weights
for (TerminalMap::iterator p = m_sourceTermMap.begin(); p != m_sourceTermMap.end(); ++p)
{
p->second.SetWeightTransModel(phraseDictionary, weightT);
}
for (NonTerminalMap::iterator p = m_nonTermMap.begin(); p != m_nonTermMap.end(); ++p)
{
p->second.SetWeightTransModel(phraseDictionary, weightT);
}
// set weights for this target phrase
if (m_targetPhraseCollection == NULL)
return;
TargetPhraseCollection::iterator iterTargetPhrase;
for (iterTargetPhrase = m_targetPhraseCollection->begin();
iterTargetPhrase != m_targetPhraseCollection->end();
++iterTargetPhrase)
{
TargetPhrase &targetPhrase = **iterTargetPhrase;
targetPhrase.SetWeights(phraseDictionary->GetFeature(), weightT);
}
}
std::ostream& operator<<(std::ostream &out, const PhraseDictionaryNodeSCFG &node)
{
out << node.GetTargetPhraseCollection();

View File

@ -78,10 +78,6 @@ public:
return *m_targetPhraseCollection;
}
// for mert
void SetWeightTransModel(const PhraseDictionary *phraseDictionary
, const std::vector<float> &weightT);
TO_STRING();
};

View File

@ -65,13 +65,6 @@ bool PhraseDictionaryOnDisk::Load(const std::vector<FactorType> &input
return true;
}
// PhraseDictionary impl
// for mert
void PhraseDictionaryOnDisk::SetWeightTransModel(const std::vector<float> &weightT)
{
assert(false);
}
//! find list of translations that can translates src. Only for phrase input
const TargetPhraseCollection *PhraseDictionaryOnDisk::GetTargetPhraseCollection(const Phrase& src) const
{

View File

@ -81,8 +81,6 @@ public:
{ return "BerkeleyPt"; }
// PhraseDictionary impl
// for mert
void SetWeightTransModel(const std::vector<float> &weightT);
//! find list of translations that can translates src. Only for phrase input
virtual const TargetPhraseCollection *GetTargetPhraseCollection(const Phrase& src) const;

View File

@ -281,12 +281,6 @@ PhraseDictionarySCFG::~PhraseDictionarySCFG()
CleanUp();
}
void PhraseDictionarySCFG::SetWeightTransModel(const vector<float> &weightT)
{
m_collection.SetWeightTransModel(this, weightT);
}
void PhraseDictionarySCFG::CleanUp()
{
//RemoveAllInColl(m_chartTargetPhraseColl);

View File

@ -85,13 +85,6 @@ PhraseDictionaryTreeAdaptor::GetTargetPhraseCollection(InputType const& src,Word
}
}
void PhraseDictionaryTreeAdaptor::
SetWeightTransModel(const std::vector<float> &weightT)
{
CleanUp();
imp->m_weights=weightT;
}
void PhraseDictionaryTreeAdaptor::
AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase)
{

View File

@ -56,10 +56,6 @@ class PhraseDictionaryTreeAdaptor : public PhraseDictionary {
TargetPhraseCollection const* GetTargetPhraseCollection(InputType const& src,WordsRange const & srcRange) const;
// change model scaling factors
void SetWeightTransModel(const std::vector<float> &weightT);
// this function can be only used for UNKNOWN source phrases
void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase);