blob: eb9febbbae30a4754c8ccaee6e8e1e585429834d (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#pragma once
#ifndef COMPACTIFY_H_
#define COMPACTIFY_H_
#include "NumberedSet.h"
#include "Tool.h"
#include <set>
#include <vector>
namespace moses {
class Options;
// Tool for converting a rule table into a more compact format.
class Compactify : public Tool {
public:
Compactify() : Tool("compactify") {}
virtual int main(int, char *[]);
private:
typedef unsigned int SymbolIDType;
typedef unsigned int PhraseIDType;
typedef unsigned int AlignmentSetIDType;
typedef std::vector<std::string> StringPhrase;
typedef std::vector<SymbolIDType> SymbolPhrase;
typedef std::pair<int, int> AlignmentPair;
typedef std::set<AlignmentPair> AlignmentSet;
typedef NumberedSet<std::string, SymbolIDType> SymbolSet;
typedef NumberedSet<SymbolPhrase, PhraseIDType> PhraseSet;
typedef NumberedSet<AlignmentSet, AlignmentSetIDType> AlignmentSetSet;
void processOptions(int, char *[], Options &) const;
// Given the string representations of a source or target LHS and RHS, encode
// the symbols using the given SymbolSet and create a SymbolPhrase object.
// The LHS index is the first element of the SymbolPhrase.
void encodePhrase(const std::string &, const StringPhrase &,
SymbolSet &, SymbolPhrase &) const;
};
} // namespace moses
#endif
|