Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/moses/FF
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-10-18 03:02:38 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-10-18 03:02:38 +0300
commit55698d15bca43c13371f3b12b080685a0e1ac4c2 (patch)
tree213862625aab9a67da6bd04a526dc8cd165ea635 /moses/FF
parentb6cc320b72aec8fd035521864c35052182b52851 (diff)
templatize Comparer for unordered maps/set
Diffstat (limited to 'moses/FF')
-rw-r--r--moses/FF/GlobalLexicalModel.cpp4
-rw-r--r--moses/FF/GlobalLexicalModel.h6
2 files changed, 6 insertions, 4 deletions
diff --git a/moses/FF/GlobalLexicalModel.cpp b/moses/FF/GlobalLexicalModel.cpp
index 30cf4444d..d47aeb981 100644
--- a/moses/FF/GlobalLexicalModel.cpp
+++ b/moses/FF/GlobalLexicalModel.cpp
@@ -43,7 +43,7 @@ GlobalLexicalModel::~GlobalLexicalModel()
// delete words in the hash data structure
DoubleHash::const_iterator iter;
for(iter = m_hash.begin(); iter != m_hash.end(); iter++ ) {
- boost::unordered_map< const Word*, float, WordComparer, WordComparer>::const_iterator iter2;
+ boost::unordered_map< const Word*, float, UnorderedComparer<Word>, UnorderedComparer<Word> >::const_iterator iter2;
for(iter2 = iter->second.begin(); iter2 != iter->second.end(); iter2++ ) {
delete iter2->first; // delete input word
}
@@ -134,7 +134,7 @@ float GlobalLexicalModel::ScorePhrase( const TargetPhrase& targetPhrase ) const
sum += inputWordHash->second;
}
- set< const Word*, WordComparer > alreadyScored; // do not score a word twice
+ boost::unordered_set< const Word*, UnorderedComparer<Word>, UnorderedComparer<Word> > alreadyScored; // do not score a word twice
for(size_t inputIndex = 0; inputIndex < input.GetSize(); inputIndex++ ) {
const Word& inputWord = input.GetWord( inputIndex );
if ( alreadyScored.find( &inputWord ) == alreadyScored.end() ) {
diff --git a/moses/FF/GlobalLexicalModel.h b/moses/FF/GlobalLexicalModel.h
index 9889b1824..51284863d 100644
--- a/moses/FF/GlobalLexicalModel.h
+++ b/moses/FF/GlobalLexicalModel.h
@@ -33,8 +33,10 @@ class InputType;
*/
class GlobalLexicalModel : public StatelessFeatureFunction
{
- typedef boost::unordered_map< const Word*, boost::unordered_map< const Word*, float, WordComparer, WordComparer >, WordComparer, WordComparer > DoubleHash;
- typedef boost::unordered_map< const Word*, float, WordComparer, WordComparer > SingleHash;
+ typedef boost::unordered_map< const Word*,
+ boost::unordered_map< const Word*, float, UnorderedComparer<Word> , UnorderedComparer<Word> >,
+ UnorderedComparer<Word>, UnorderedComparer<Word> > DoubleHash;
+ typedef boost::unordered_map< const Word*, float, UnorderedComparer<Word>, UnorderedComparer<Word> > SingleHash;
typedef std::map< const TargetPhrase*, float > LexiconCache;
struct ThreadLocalStorage {