summaryrefslogtreecommitdiff
path: root/extractor/translation_table.h
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-02-14 23:17:15 +0000
committerPaul Baltescu <pauldb89@gmail.com>2013-02-14 23:17:15 +0000
commit9a026ba2db8fa7723374109e6a4a8dcaff8733cd (patch)
tree34a60703a53ada76e7213da5940e86d6f476f1e4 /extractor/translation_table.h
parent252fb164c208ec8f3005f8a652eb3b48c0644e3d (diff)
Working version of the grammar extractor.
Diffstat (limited to 'extractor/translation_table.h')
-rw-r--r--extractor/translation_table.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/extractor/translation_table.h b/extractor/translation_table.h
index acf94af7..157ad3af 100644
--- a/extractor/translation_table.h
+++ b/extractor/translation_table.h
@@ -3,13 +3,12 @@
#include <memory>
#include <string>
-#include <tr1/unordered_map>
+#include <unordered_map>
#include <boost/filesystem.hpp>
#include <boost/functional/hash.hpp>
using namespace std;
-using namespace tr1;
namespace fs = boost::filesystem;
class Alignment;
@@ -24,15 +23,27 @@ class TranslationTable {
shared_ptr<DataArray> target_data_array,
shared_ptr<Alignment> alignment);
- double GetTargetGivenSourceScore(const string& source_word,
- const string& target_word);
+ virtual ~TranslationTable();
- double GetSourceGivenTargetScore(const string& source_word,
- const string& target_word);
+ 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<int, int>& source_links_count,
+ unordered_map<int, int>& target_links_count,
+ unordered_map<pair<int, int>, int, PairHash>& links_count,
+ int source_word_id,
+ int target_word_id) const;
+
shared_ptr<DataArray> source_data_array;
shared_ptr<DataArray> target_data_array;
unordered_map<pair<int, int>, pair<double, double>, PairHash>