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

PhraseDictionaryTreeAdaptor.h « src « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e539e71c8bbe338bb5a1fbbb2c2626fa3c3091a7 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// $Id$

#ifndef PHRASEDICTIONARYTREEADAPTOR_H_
#define PHRASEDICTIONARYTREEADAPTOR_H_
#include <vector>
#include "TypeDef.h"
#include "PhraseDictionary.h"
#include "TargetPhraseCollection.h"

class Phrase;
class PDTAimp;
class WordsRange;
class InputType;

class PhraseDictionaryTreeAdaptor : public PhraseDictionaryBase {
	typedef PhraseDictionaryBase MyBase;
	PDTAimp *imp;
	friend class PDTAimp;
 public:
	PhraseDictionaryTreeAdaptor(size_t noScoreComponent,unsigned numInputScores);
	virtual ~PhraseDictionaryTreeAdaptor();

	// enable/disable caching
	// you enable caching if you request the target candidates for a source phrase multiple times
	// if you do caching somewhere else, disable it
	// good settings for current Moses: disable for first factor, enable for other factors
	// default: enable	

	void EnableCache();
	void DisableCache();

	// initialize ...
	void Create(const std::vector<FactorType> &input
							, const std::vector<FactorType> &output
							, FactorCollection &factorCollection
							, const std::string &filePath
							, const std::vector<float> &weight
							, size_t maxTargetPhrase
							, const LMList &languageModels
							, float weightWP

							);

	// get translation candidates for a given source phrase
	// returns null pointer if nothing found
	TargetPhraseCollection const* GetTargetPhraseCollection(Phrase const &src) const;
	TargetPhraseCollection const* GetTargetPhraseCollection(InputType const& src,WordsRange const & srcRange) const;

	// clean up temporary memory etc.
	void CleanUp();

	void InitializeForInput(InputType const& source);

	// 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);
};
#endif