#ifndef _TRANSLATION_TABLE_ #define _TRANSLATION_TABLE_ #include #include #include #include #include using namespace std; namespace fs = boost::filesystem; class Alignment; class DataArray; typedef boost::hash > PairHash; class TranslationTable { public: TranslationTable( shared_ptr source_data_array, shared_ptr target_data_array, shared_ptr alignment); virtual ~TranslationTable(); virtual double GetTargetGivenSourceScore(const string& source_word, const string& target_word); virtual double GetSourceGivenTargetScore(const string& source_word, const string& target_word); void WriteBinary(const fs::path& filepath) const; protected: TranslationTable(); private: void IncreaseLinksCount( unordered_map& source_links_count, unordered_map& target_links_count, unordered_map, int, PairHash>& links_count, int source_word_id, int target_word_id) const; shared_ptr source_data_array; shared_ptr target_data_array; unordered_map, pair, PairHash> translation_probabilities; }; #endif