mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 15:00:33 +03:00
beautify
This commit is contained in:
parent
3eba5782c2
commit
310b26f989
@ -65,7 +65,7 @@ int main(int argc, char **argv)
|
||||
sourcePhrase.CreateFromString(Input, input, line, "||dummy_string||", NULL);
|
||||
|
||||
TargetPhraseVectorPtr decodedPhraseColl
|
||||
= pdc.GetTargetPhraseCollectionRaw(sourcePhrase);
|
||||
= pdc.GetTargetPhraseCollectionRaw(sourcePhrase);
|
||||
|
||||
if(decodedPhraseColl != NULL) {
|
||||
if(reportCounts)
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
LabelId add(const Key& k) {
|
||||
std::pair<typename M::iterator,bool> p
|
||||
=m.insert(std::make_pair(k,data.size()));
|
||||
=m.insert(std::make_pair(k,data.size()));
|
||||
if(p.second) data.push_back(k);
|
||||
CHECK(static_cast<size_t>(p.first->second)<data.size());
|
||||
return p.first->second;
|
||||
|
@ -948,7 +948,7 @@ const TranslationOptionList* StaticData::FindTransOptListInCache(const DecodeGra
|
||||
boost::mutex::scoped_lock lock(m_transOptCacheMutex);
|
||||
#endif
|
||||
std::map<std::pair<std::pair<size_t, std::string>, Phrase>, std::pair<TranslationOptionList*,clock_t> >::iterator iter
|
||||
= m_transOptCache.find(key);
|
||||
= m_transOptCache.find(key);
|
||||
if (iter == m_transOptCache.end())
|
||||
return NULL;
|
||||
iter->second.second = clock(); // update last used time
|
||||
|
@ -673,7 +673,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
std::map< std::string, std::set< std::string > >::const_iterator lookupIgnoreFF
|
||||
= m_weightSettingIgnoreFF.find( m_currentWeightSetting );
|
||||
= m_weightSettingIgnoreFF.find( m_currentWeightSetting );
|
||||
if (lookupIgnoreFF == m_weightSettingIgnoreFF.end()) {
|
||||
return false;
|
||||
}
|
||||
@ -691,7 +691,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
std::map< std::string, std::set< size_t > >::const_iterator lookupIgnoreDP
|
||||
= m_weightSettingIgnoreDP.find( m_currentWeightSetting );
|
||||
= m_weightSettingIgnoreDP.find( m_currentWeightSetting );
|
||||
if (lookupIgnoreDP == m_weightSettingIgnoreDP.end()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -234,12 +234,12 @@ void ChartRuleLookupManagerOnDisk::GetChartRuleCollection(
|
||||
|
||||
std::vector<float> weightT = staticData.GetWeights(&m_dictionary);
|
||||
targetPhraseCollection
|
||||
= tpcollBerkeleyDb->ConvertToMoses(m_inputFactorsVec
|
||||
,m_outputFactorsVec
|
||||
,m_dictionary
|
||||
,weightT
|
||||
,m_filePath
|
||||
, m_dbWrapper.GetVocab());
|
||||
= tpcollBerkeleyDb->ConvertToMoses(m_inputFactorsVec
|
||||
,m_outputFactorsVec
|
||||
,m_dictionary
|
||||
,weightT
|
||||
,m_filePath
|
||||
, m_dbWrapper.GetVocab());
|
||||
|
||||
delete tpcollBerkeleyDb;
|
||||
m_cache[tpCollFilePos] = targetPhraseCollection;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ PhraseDictionaryCompact::GetTargetPhraseCollection(const Phrase &sourcePhrase) c
|
||||
|
||||
// Retrieve target phrase collection from phrase table
|
||||
TargetPhraseVectorPtr decodedPhraseColl
|
||||
= m_phraseDecoder->CreateTargetPhraseCollection(sourcePhrase, true, true);
|
||||
= m_phraseDecoder->CreateTargetPhraseCollection(sourcePhrase, true, true);
|
||||
|
||||
if(decodedPhraseColl != NULL && decodedPhraseColl->size()) {
|
||||
TargetPhraseVectorPtr tpv(new TargetPhraseVector(*decodedPhraseColl));
|
||||
|
@ -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;
|
||||
@ -1212,7 +1212,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);
|
||||
|
@ -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
|
||||
|
@ -108,28 +108,28 @@ enum DistortionOrientationOptions {
|
||||
|
||||
enum PhraseTableImplementation {
|
||||
Memory = 0
|
||||
,Binary = 1
|
||||
,OnDisk = 2
|
||||
//,GlueRule = 3
|
||||
//,Joshua = 4
|
||||
//,MemorySourceLabel = 5
|
||||
,SCFG = 6
|
||||
//,BerkeleyDb = 7
|
||||
,SuffixArray = 8
|
||||
,Hiero = 9
|
||||
,ALSuffixArray = 10
|
||||
,FuzzyMatch = 11
|
||||
,Compact = 12
|
||||
,Interpolated = 13
|
||||
,DSuffixArray = 14
|
||||
,Binary = 1
|
||||
,OnDisk = 2
|
||||
//,GlueRule = 3
|
||||
//,Joshua = 4
|
||||
//,MemorySourceLabel = 5
|
||||
,SCFG = 6
|
||||
//,BerkeleyDb = 7
|
||||
,SuffixArray = 8
|
||||
,Hiero = 9
|
||||
,ALSuffixArray = 10
|
||||
,FuzzyMatch = 11
|
||||
,Compact = 12
|
||||
,Interpolated = 13
|
||||
,DSuffixArray = 14
|
||||
};
|
||||
|
||||
enum InputTypeEnum {
|
||||
SentenceInput = 0
|
||||
,ConfusionNetworkInput = 1
|
||||
,WordLatticeInput = 2
|
||||
,TreeInputType = 3
|
||||
,WordLatticeInput2 = 4
|
||||
,ConfusionNetworkInput = 1
|
||||
,WordLatticeInput = 2
|
||||
,TreeInputType = 3
|
||||
,WordLatticeInput2 = 4
|
||||
|
||||
};
|
||||
|
||||
@ -142,7 +142,7 @@ enum XmlInputType {
|
||||
|
||||
enum DictionaryFind {
|
||||
Best = 0
|
||||
,All = 1
|
||||
,All = 1
|
||||
};
|
||||
|
||||
enum ParsingAlgorithm {
|
||||
@ -152,22 +152,22 @@ enum ParsingAlgorithm {
|
||||
|
||||
enum SearchAlgorithm {
|
||||
Normal = 0
|
||||
,CubePruning = 1
|
||||
,CubeGrowing = 2
|
||||
,ChartDecoding= 3
|
||||
,NormalBatch = 4
|
||||
,ChartIncremental = 5
|
||||
,CubePruning = 1
|
||||
,CubeGrowing = 2
|
||||
,ChartDecoding= 3
|
||||
,NormalBatch = 4
|
||||
,ChartIncremental = 5
|
||||
};
|
||||
|
||||
enum SourceLabelOverlap {
|
||||
SourceLabelOverlapAdd = 0
|
||||
,SourceLabelOverlapReplace = 1
|
||||
,SourceLabelOverlapDiscard = 2
|
||||
,SourceLabelOverlapReplace = 1
|
||||
,SourceLabelOverlapDiscard = 2
|
||||
};
|
||||
|
||||
enum WordAlignmentSort {
|
||||
NoSort = 0
|
||||
,TargetOrder = 1
|
||||
,TargetOrder = 1
|
||||
};
|
||||
|
||||
enum FormatType {
|
||||
|
@ -137,7 +137,7 @@ void LeftBinarize( SyntaxTree &tree, ParentNodes &parents )
|
||||
const SplitPoints &point = *p;
|
||||
if (point.size() > 3) {
|
||||
const vector< SyntaxNode* >& topNodes
|
||||
= tree.GetNodes( point[0], point[point.size()-1]-1);
|
||||
= tree.GetNodes( point[0], point[point.size()-1]-1);
|
||||
string topLabel = topNodes[0]->GetLabel();
|
||||
|
||||
for(size_t i=2; i<point.size()-1; i++) {
|
||||
@ -155,7 +155,7 @@ void RightBinarize( SyntaxTree &tree, ParentNodes &parents )
|
||||
if (point.size() > 3) {
|
||||
int endPoint = point[point.size()-1]-1;
|
||||
const vector< SyntaxNode* >& topNodes
|
||||
= tree.GetNodes( point[0], endPoint);
|
||||
= tree.GetNodes( point[0], endPoint);
|
||||
string topLabel = topNodes[0]->GetLabel();
|
||||
|
||||
for(size_t i=1; i<point.size()-2; i++) {
|
||||
|
10
symal/cmd.h
10
symal/cmd.h
@ -33,14 +33,14 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__STDC__)
|
||||
int DeclareParams(char *, ...);
|
||||
int DeclareParams(char *, ...);
|
||||
#else
|
||||
int DeclareParams();
|
||||
int DeclareParams();
|
||||
#endif
|
||||
|
||||
int GetParams(int *n, char ***a,char *CmdFileName),
|
||||
SPrintParams(),
|
||||
PrintParams();
|
||||
int GetParams(int *n, char ***a,char *CmdFileName),
|
||||
SPrintParams(),
|
||||
PrintParams();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user