|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once |
|
|
|
|
|
#include "Trie.h" |
|
|
#include "moses/TranslationModel/PhraseDictionary.h" |
|
|
#include "moses/InputType.h" |
|
|
#include "moses/NonTerminal.h" |
|
|
#include "moses/TranslationModel/fuzzy-match/FuzzyMatchWrapper.h" |
|
|
#include "moses/TranslationModel/PhraseDictionaryNodeMemory.h" |
|
|
#include "moses/TranslationModel/PhraseDictionaryMemory.h" |
|
|
|
|
|
namespace Moses |
|
|
{ |
|
|
class PhraseDictionaryNodeMemory; |
|
|
class ChartParser; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PhraseDictionaryFuzzyMatch : public PhraseDictionary |
|
|
{ |
|
|
friend std::ostream& operator<<(std::ostream&, const PhraseDictionaryFuzzyMatch&); |
|
|
friend class RuleTableLoader; |
|
|
|
|
|
public: |
|
|
PhraseDictionaryFuzzyMatch(const std::string &line); |
|
|
~PhraseDictionaryFuzzyMatch(); |
|
|
void Load(AllOptions::ptr const& opts); |
|
|
|
|
|
const PhraseDictionaryNodeMemory &GetRootNode(long translationId) const; |
|
|
|
|
|
ChartRuleLookupManager *CreateRuleLookupManager( |
|
|
const ChartParser &parser, |
|
|
const ChartCellCollectionBase &, |
|
|
std::size_t); |
|
|
void InitializeForInput(ttasksptr const& ttask); |
|
|
void CleanUpAfterSentenceProcessing(const InputType& source); |
|
|
|
|
|
void SetParameter(const std::string& key, const std::string& value); |
|
|
|
|
|
TO_STRING(); |
|
|
|
|
|
protected: |
|
|
TargetPhraseCollection::shared_ptr |
|
|
GetOrCreateTargetPhraseCollection(PhraseDictionaryNodeMemory &rootNode |
|
|
, const Phrase &source |
|
|
, const TargetPhrase &target |
|
|
, const Word *sourceLHS); |
|
|
|
|
|
PhraseDictionaryNodeMemory &GetOrCreateNode(PhraseDictionaryNodeMemory &rootNode |
|
|
, const Phrase &source |
|
|
, const TargetPhrase &target |
|
|
, const Word *sourceLHS); |
|
|
|
|
|
void SortAndPrune(PhraseDictionaryNodeMemory &rootNode); |
|
|
PhraseDictionaryNodeMemory &GetRootNode(const InputType &source); |
|
|
|
|
|
std::map<long, PhraseDictionaryNodeMemory> m_collection; |
|
|
std::vector<std::string> m_config; |
|
|
|
|
|
tmmt::FuzzyMatchWrapper *m_FuzzyMatchWrapper; |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|