diff options
author | Hieu Hoang <fishandfrolick@gmail.com> | 2013-06-10 21:11:55 +0400 |
---|---|---|
committer | Hieu Hoang <fishandfrolick@gmail.com> | 2013-06-10 21:11:55 +0400 |
commit | abe6bb7c2257cce6ed746e54fdd97fbf1f1ef3aa (patch) | |
tree | 5cff23f9434a2bd500ee55c4839e753cc119388c /moses/TranslationModel/CompactPT | |
parent | 96d116dba09f4c29fbbfa1edd3d52a31a4b74b49 (diff) |
refactor parsing of feature functiona args
Diffstat (limited to 'moses/TranslationModel/CompactPT')
7 files changed, 20 insertions, 20 deletions
diff --git a/moses/TranslationModel/CompactPT/LexicalReorderingTableCreator.cpp b/moses/TranslationModel/CompactPT/LexicalReorderingTableCreator.cpp index 655ed01ca..7e60dec7d 100644 --- a/moses/TranslationModel/CompactPT/LexicalReorderingTableCreator.cpp +++ b/moses/TranslationModel/CompactPT/LexicalReorderingTableCreator.cpp @@ -428,7 +428,7 @@ void CompressionTaskReordering::operator()() while(scoresNum < m_encodedScores.size()) { std::string scores = m_encodedScores[scoresNum]; std::string compressedScores - = m_creator.CompressEncodedScores(scores); + = m_creator.CompressEncodedScores(scores); std::string dummy; PackedItem packedItem(scoresNum, dummy, compressedScores, 0); diff --git a/moses/TranslationModel/CompactPT/MmapAllocator.h b/moses/TranslationModel/CompactPT/MmapAllocator.h index 7cd6dd49e..6ff890c88 100644 --- a/moses/TranslationModel/CompactPT/MmapAllocator.h +++ b/moses/TranslationModel/CompactPT/MmapAllocator.h @@ -57,26 +57,26 @@ public: MmapAllocator() throw() : m_file_ptr(std::tmpfile()), m_file_desc(fileno(m_file_ptr)), m_page_size(sysconf(_SC_PAGE_SIZE)), m_map_size(0), m_data_ptr(0), - m_data_offset(0), m_fixed(false), m_count(new size_t(0)) - { } + m_data_offset(0), m_fixed(false), m_count(new size_t(0)) { + } MmapAllocator(std::FILE* f_ptr) throw() : m_file_ptr(f_ptr), m_file_desc(fileno(m_file_ptr)), m_page_size(sysconf(_SC_PAGE_SIZE)), m_map_size(0), m_data_ptr(0), - m_data_offset(0), m_fixed(false), m_count(new size_t(0)) - { } + m_data_offset(0), m_fixed(false), m_count(new size_t(0)) { + } MmapAllocator(std::FILE* f_ptr, size_t data_offset) throw() : m_file_ptr(f_ptr), m_file_desc(fileno(m_file_ptr)), m_page_size(sysconf(_SC_PAGE_SIZE)), m_map_size(0), m_data_ptr(0), - m_data_offset(data_offset), m_fixed(true), m_count(new size_t(0)) - { } + m_data_offset(data_offset), m_fixed(true), m_count(new size_t(0)) { + } MmapAllocator(std::string fileName) throw() : m_file_ptr(std::fopen(fileName.c_str(), "wb+")), m_file_desc(fileno(m_file_ptr)), m_page_size(sysconf(_SC_PAGE_SIZE)), m_map_size(0), m_data_ptr(0), - m_data_offset(0), m_fixed(false), m_count(new size_t(0)) - { } + m_data_offset(0), m_fixed(false), m_count(new size_t(0)) { + } MmapAllocator(const MmapAllocator& c) throw() : m_file_ptr(c.m_file_ptr), m_file_desc(c.m_file_desc), diff --git a/moses/TranslationModel/CompactPT/PhraseDecoder.cpp b/moses/TranslationModel/CompactPT/PhraseDecoder.cpp index 085a7337c..a15f301bb 100644 --- a/moses/TranslationModel/CompactPT/PhraseDecoder.cpp +++ b/moses/TranslationModel/CompactPT/PhraseDecoder.cpp @@ -61,7 +61,7 @@ PhraseDecoder::~PhraseDecoder() inline unsigned PhraseDecoder::GetSourceSymbolId(std::string& symbol) { boost::unordered_map<std::string, unsigned>::iterator it - = m_sourceSymbolsMap.find(symbol); + = m_sourceSymbolsMap.find(symbol); if(it != m_sourceSymbolsMap.end()) return it->second; @@ -200,7 +200,7 @@ TargetPhraseVectorPtr PhraseDecoder::CreateTargetPhraseCollection(const Phrase & if(m_coding == PREnc) { std::pair<TargetPhraseVectorPtr, size_t> cachedPhraseColl - = m_decodingCache.Retrieve(sourcePhrase); + = m_decodingCache.Retrieve(sourcePhrase); // Has been cached and is complete or does not need to be completed if(cachedPhraseColl.first != NULL && (!topLevel || cachedPhraseColl.second == 0)) @@ -255,7 +255,7 @@ TargetPhraseVectorPtr PhraseDecoder::DecodeCollection( if(m_coding == REnc) { for(size_t i = 0; i < sourcePhrase.GetSize(); i++) { std::string sourceWord - = sourcePhrase.GetWord(i).GetString(*m_input, false); + = sourcePhrase.GetWord(i).GetString(*m_input, false); unsigned idx = GetSourceSymbolId(sourceWord); sourceWords.push_back(idx); } diff --git a/moses/TranslationModel/CompactPT/PhraseDictionaryCompact.cpp b/moses/TranslationModel/CompactPT/PhraseDictionaryCompact.cpp index 64cfc24cf..90125ffbf 100644 --- a/moses/TranslationModel/CompactPT/PhraseDictionaryCompact.cpp +++ b/moses/TranslationModel/CompactPT/PhraseDictionaryCompact.cpp @@ -106,7 +106,7 @@ PhraseDictionaryCompact::GetTargetPhraseCollection(const Phrase &sourcePhrase) c // Retrieve target phrase collection from phrase table TargetPhraseVectorPtr decodedPhraseColl - = m_phraseDecoder->CreateTargetPhraseCollection(sourcePhrase, true); + = m_phraseDecoder->CreateTargetPhraseCollection(sourcePhrase, true); if(decodedPhraseColl != NULL && decodedPhraseColl->size()) { TargetPhraseVectorPtr tpv(new TargetPhraseVector(*decodedPhraseColl)); diff --git a/moses/TranslationModel/CompactPT/PhraseTableCreator.cpp b/moses/TranslationModel/CompactPT/PhraseTableCreator.cpp index fc3b056c6..33dcf3f8b 100644 --- a/moses/TranslationModel/CompactPT/PhraseTableCreator.cpp +++ b/moses/TranslationModel/CompactPT/PhraseTableCreator.cpp @@ -426,7 +426,7 @@ void PhraseTableCreator::AddTargetSymbolId(std::string& symbol) unsigned PhraseTableCreator::GetSourceSymbolId(std::string& symbol) { boost::unordered_map<std::string, unsigned>::iterator it - = m_sourceSymbolsMap.find(symbol); + = m_sourceSymbolsMap.find(symbol); if(it != m_sourceSymbolsMap.end()) return it->second; @@ -437,7 +437,7 @@ unsigned PhraseTableCreator::GetSourceSymbolId(std::string& symbol) unsigned PhraseTableCreator::GetTargetSymbolId(std::string& symbol) { boost::unordered_map<std::string, unsigned>::iterator it - = m_targetSymbolsMap.find(symbol); + = m_targetSymbolsMap.find(symbol); if(it != m_targetSymbolsMap.end()) return it->second; @@ -451,7 +451,7 @@ unsigned PhraseTableCreator::GetOrAddTargetSymbolId(std::string& symbol) boost::mutex::scoped_lock lock(m_mutex); #endif boost::unordered_map<std::string, unsigned>::iterator it - = m_targetSymbolsMap.find(symbol); + = m_targetSymbolsMap.find(symbol); if(it != m_targetSymbolsMap.end()) return it->second; @@ -1200,7 +1200,7 @@ void CompressionTask::operator()() while(collectionNum < m_encodedCollections.size()) { std::string collection = m_encodedCollections[collectionNum]; std::string compressedCollection - = m_creator.CompressEncodedCollection(collection); + = m_creator.CompressEncodedCollection(collection); std::string dummy; PackedItem packedItem(collectionNum, dummy, compressedCollection, 0); diff --git a/moses/TranslationModel/CompactPT/PhraseTableCreator.h b/moses/TranslationModel/CompactPT/PhraseTableCreator.h index fd5fc1581..b92df1697 100644 --- a/moses/TranslationModel/CompactPT/PhraseTableCreator.h +++ b/moses/TranslationModel/CompactPT/PhraseTableCreator.h @@ -143,7 +143,7 @@ public: return data; else { typename std::vector<DataType>::iterator it - = std::lower_bound(m_bestVec.begin(), m_bestVec.end(), data); + = std::lower_bound(m_bestVec.begin(), m_bestVec.end(), data); if(it != m_bestVec.end()) return *it; else diff --git a/moses/TranslationModel/CompactPT/TargetPhraseCollectionCache.h b/moses/TranslationModel/CompactPT/TargetPhraseCollectionCache.h index 3eac0226a..c7f245370 100644 --- a/moses/TranslationModel/CompactPT/TargetPhraseCollectionCache.h +++ b/moses/TranslationModel/CompactPT/TargetPhraseCollectionCache.h @@ -75,8 +75,8 @@ public: typedef CacheMap::const_iterator const_iterator; TargetPhraseCollectionCache(size_t max = 5000, float tolerance = 0.2) - : m_max(max), m_tolerance(tolerance) - {} + : m_max(max), m_tolerance(tolerance) { + } iterator Begin() { return m_phraseCache.begin(); |