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
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/Phrase.cpp
parentb6cc320b72aec8fd035521864c35052182b52851 (diff)
templatize Comparer for unordered maps/set
Diffstat (limited to 'moses/Phrase.cpp')
-rw-r--r--moses/Phrase.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/moses/Phrase.cpp b/moses/Phrase.cpp
index d97f6d712..5661fec28 100644
--- a/moses/Phrase.cpp
+++ b/moses/Phrase.cpp
@@ -254,6 +254,15 @@ int Phrase::Compare(const Phrase &other) const
return 0;
}
+size_t Phrase::hash() const
+{
+ size_t seed = 0;
+ for (size_t i = 0; i < GetSize(); ++i) {
+ boost::hash_combine(seed, GetWord(i));
+ }
+ return seed;
+}
+
bool Phrase::operator== (const Phrase &other) const {
size_t thisSize = GetSize()
,compareSize = other.GetSize();