Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Bertoldi <bertoldi@fbk.eu>2014-01-15 19:49:57 +0400
committerNicola Bertoldi <bertoldi@fbk.eu>2014-01-15 19:49:57 +0400
commite452a13062400b09ff95af971c1424ac34cf1930 (patch)
tree11b52a2f1228f4e64fb31d061d7e564970140fd7 /OnDiskPt
parentbd83999264407dd7970736ee3e70a6b39fb19014 (diff)
beautify
Diffstat (limited to 'OnDiskPt')
-rw-r--r--OnDiskPt/OnDiskWrapper.cpp54
-rw-r--r--OnDiskPt/OnDiskWrapper.h10
-rw-r--r--OnDiskPt/Phrase.cpp4
3 files changed, 35 insertions, 33 deletions
diff --git a/OnDiskPt/OnDiskWrapper.cpp b/OnDiskPt/OnDiskWrapper.cpp
index 0120802ac..12adffd03 100644
--- a/OnDiskPt/OnDiskWrapper.cpp
+++ b/OnDiskPt/OnDiskWrapper.cpp
@@ -59,28 +59,28 @@ bool OnDiskWrapper::OpenForLoad(const std::string &filePath)
{
m_fileSource.open((filePath + "/Source.dat").c_str(), ios::in | ios::binary);
UTIL_THROW_IF(!m_fileSource.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/Source.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/Source.dat");
m_fileTargetInd.open((filePath + "/TargetInd.dat").c_str(), ios::in | ios::binary);
UTIL_THROW_IF(!m_fileTargetInd.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/TargetInd.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/TargetInd.dat");
m_fileTargetColl.open((filePath + "/TargetColl.dat").c_str(), ios::in | ios::binary);
UTIL_THROW_IF(!m_fileTargetColl.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/TargetColl.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/TargetColl.dat");
m_fileVocab.open((filePath + "/Vocab.dat").c_str(), ios::in);
UTIL_THROW_IF(!m_fileVocab.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/Vocab.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/Vocab.dat");
m_fileMisc.open((filePath + "/Misc.dat").c_str(), ios::in);
UTIL_THROW_IF(!m_fileMisc.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/Misc.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/Misc.dat");
// set up root node
LoadMisc();
@@ -124,46 +124,46 @@ void OnDiskWrapper::BeginSave(const std::string &filePath
m_fileSource.open((filePath + "/Source.dat").c_str(), ios::out | ios::in | ios::binary | ios::ate | ios::trunc);
UTIL_THROW_IF(!m_fileSource.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/Source.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/Source.dat");
m_fileTargetInd.open((filePath + "/TargetInd.dat").c_str(), ios::out | ios::binary | ios::ate | ios::trunc);
UTIL_THROW_IF(!m_fileTargetInd.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/TargetInd.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/TargetInd.dat");
m_fileTargetColl.open((filePath + "/TargetColl.dat").c_str(), ios::out | ios::binary | ios::ate | ios::trunc);
UTIL_THROW_IF(!m_fileTargetColl.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/TargetColl.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/TargetColl.dat");
m_fileVocab.open((filePath + "/Vocab.dat").c_str(), ios::out | ios::ate | ios::trunc);
UTIL_THROW_IF(!m_fileVocab.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/Vocab.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/Vocab.dat");
m_fileMisc.open((filePath + "/Misc.dat").c_str(), ios::out | ios::ate | ios::trunc);
UTIL_THROW_IF(!m_fileMisc.is_open(),
- util::FileOpenException,
- "Couldn't open file " << filePath << "/Misc.dat");
+ util::FileOpenException,
+ "Couldn't open file " << filePath << "/Misc.dat");
// offset by 1. 0 offset is reserved
char c = 0xff;
m_fileSource.write(&c, 1);
UTIL_THROW_IF2(1 != m_fileSource.tellp(),
- "Couldn't write to stream m_fileSource");
+ "Couldn't write to stream m_fileSource");
m_fileTargetInd.write(&c, 1);
UTIL_THROW_IF2(1 != m_fileTargetInd.tellp(),
- "Couldn't write to stream m_fileTargetInd");
+ "Couldn't write to stream m_fileTargetInd");
m_fileTargetColl.write(&c, 1);
UTIL_THROW_IF2(1 != m_fileTargetColl.tellp(),
- "Couldn't write to stream m_fileTargetColl");
+ "Couldn't write to stream m_fileTargetColl");
// set up root node
UTIL_THROW_IF2(GetNumCounts() != 1,
- "Not sure what this is...");
+ "Not sure what this is...");
vector<float> counts(GetNumCounts());
counts[0] = DEFAULT_COUNT;
@@ -212,8 +212,8 @@ UINT64 OnDiskWrapper::GetMisc(const std::string &key) const
std::map<std::string, UINT64>::const_iterator iter;
iter = m_miscInfo.find(key);
UTIL_THROW_IF2(iter == m_miscInfo.end()
- , "Couldn't find value for key " << key
- );
+ , "Couldn't find value for key " << key
+ );
return iter->second;
}
@@ -238,7 +238,7 @@ Word *OnDiskWrapper::ConvertFromMoses(const std::vector<Moses::FactorType> &fact
break;
}
UTIL_THROW_IF2(factor == NULL,
- "Expecting factor " << factorType << " at position " << ind);
+ "Expecting factor " << factorType << " at position " << ind);
strme << "|" << factor->GetString();
} // for (size_t factorType
diff --git a/OnDiskPt/OnDiskWrapper.h b/OnDiskPt/OnDiskWrapper.h
index a31c473fa..5b7cdfe01 100644
--- a/OnDiskPt/OnDiskWrapper.h
+++ b/OnDiskPt/OnDiskWrapper.h
@@ -61,10 +61,12 @@ public:
, int numSourceFactors, int numTargetFactors, int numScores);
void EndSave();
- Vocab &GetVocab()
- { return m_vocab; }
- const Vocab &GetVocab() const
- { return m_vocab; }
+ Vocab &GetVocab() {
+ return m_vocab;
+ }
+ const Vocab &GetVocab() const {
+ return m_vocab;
+ }
size_t GetSourceWordSize() const;
size_t GetTargetWordSize() const;
diff --git a/OnDiskPt/Phrase.cpp b/OnDiskPt/Phrase.cpp
index a09c99fe5..c1933338b 100644
--- a/OnDiskPt/Phrase.cpp
+++ b/OnDiskPt/Phrase.cpp
@@ -35,8 +35,8 @@ void Phrase::AddWord(WordPtr word)
void Phrase::AddWord(WordPtr word, size_t pos)
{
- UTIL_THROW_IF2(!(pos < m_words.size()),
- "Trying to get word " << pos << " when phrase size is " << m_words.size());
+ UTIL_THROW_IF2(!(pos < m_words.size()),
+ "Trying to get word " << pos << " when phrase size is " << m_words.size());
m_words.insert(m_words.begin() + pos + 1, word);
}