00001 // 00002 // SentenceAlignment.h 00003 // fuzzy-match 00004 // 00005 // Created by Hieu Hoang on 25/07/2012. 00006 // Copyright 2012 __MyCompanyName__. All rights reserved. 00007 // 00008 00009 #ifndef fuzzy_match_SentenceAlignment_h 00010 #define fuzzy_match_SentenceAlignment_h 00011 00012 #include <sstream> 00013 #include <vector> 00014 #include "Vocabulary.h" 00015 #include "util/string_stream.hh" 00016 00017 namespace tmmt 00018 { 00019 00020 struct SentenceAlignment { 00021 int count; 00022 std::vector< WORD_ID > target; 00023 std::vector< std::pair<int,int> > alignment; 00024 00025 SentenceAlignment() { 00026 } 00027 00028 std::string getTargetString(const Vocabulary &vocab) const; 00029 00030 std::string getAlignmentString() const { 00031 util::StringStream strme; 00032 for (size_t i = 0; i < alignment.size(); ++i) { 00033 const std::pair<int,int> &alignPair = alignment[i]; 00034 strme << alignPair.first << "-" << alignPair.second << " "; 00035 } 00036 return strme.str(); 00037 } 00038 00039 }; 00040 00041 } 00042 00043 #endif