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

SymbolHasher.h « Syntax « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c758d70175941d71b6adbe5d04ca734dd3d55a7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include <boost/functional/hash.hpp>

#include "moses/Factor.h"
#include "moses/Word.h"

namespace Moses
{
namespace Syntax
{

// Assumes that only the first factor is relevant.  i.e. factored decoding will
// *not* work in moses_chart unless this is changed (among other things).
class SymbolHasher
{
public:
  std::size_t operator()(const Word &s) const {
    const Factor *f = s[0];
    return hash_value(*f);
  }
};

}  // namespace Syntax
}  // namespace Moses