mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-24 04:12:47 +03:00
use astyle 2.01. It's on Edinburgh server and doesn't screw up enum
This commit is contained in:
parent
05ead45e71
commit
6d61db28fa
@ -77,7 +77,7 @@ public:
|
||||
|
||||
/** Max score decoding */
|
||||
virtual void MaxModel(const AvgWeightVector& wv, std::vector<ValType>* stats)
|
||||
= 0;
|
||||
= 0;
|
||||
|
||||
/** Calculate bleu on training set */
|
||||
ValType Evaluate(const AvgWeightVector& wv);
|
||||
|
@ -71,7 +71,7 @@ int main(int argc, char **argv)
|
||||
sourcePhrase.CreateFromString(Input, input, line, NULL);
|
||||
|
||||
TargetPhraseVectorPtr decodedPhraseColl
|
||||
= pdc.GetTargetPhraseCollectionRaw(sourcePhrase);
|
||||
= pdc.GetTargetPhraseCollectionRaw(sourcePhrase);
|
||||
|
||||
if(decodedPhraseColl != NULL) {
|
||||
if(reportCounts)
|
||||
|
@ -295,11 +295,11 @@ ConfusionNet::
|
||||
CreateTranslationOptionCollection() const
|
||||
{
|
||||
size_t maxNoTransOptPerCoverage
|
||||
= StaticData::Instance().GetMaxNoTransOptPerCoverage();
|
||||
= StaticData::Instance().GetMaxNoTransOptPerCoverage();
|
||||
float translationOptionThreshold
|
||||
= StaticData::Instance().GetTranslationOptionThreshold();
|
||||
= StaticData::Instance().GetTranslationOptionThreshold();
|
||||
TranslationOptionCollection *rv
|
||||
= new TranslationOptionCollectionConfusionNet
|
||||
= new TranslationOptionCollectionConfusionNet
|
||||
(*this, maxNoTransOptPerCoverage, translationOptionThreshold);
|
||||
assert(rv);
|
||||
return rv;
|
||||
|
@ -237,7 +237,7 @@ void DecodeStepTranslation::ProcessLEGACY(const TranslationOption &inputPartialT
|
||||
const size_t tableLimit = phraseDictionary->GetTableLimit();
|
||||
|
||||
const TargetPhraseCollectionWithSourcePhrase *phraseColl
|
||||
= phraseDictionary->GetTargetPhraseCollectionLEGACY(toc->GetSource(),sourceWordsRange);
|
||||
= phraseDictionary->GetTargetPhraseCollectionLEGACY(toc->GetSource(),sourceWordsRange);
|
||||
|
||||
|
||||
if (phraseColl != NULL) {
|
||||
|
@ -179,7 +179,7 @@ void SparseReordering::AddFeatures(
|
||||
for (size_t id = 0; id < clusterMaps->size(); ++id) {
|
||||
const ClusterMap& clusterMap = (*clusterMaps)[id];
|
||||
boost::unordered_map<const Factor*, const Factor*>::const_iterator clusterIter
|
||||
= clusterMap.second.find(wordFactor);
|
||||
= clusterMap.second.find(wordFactor);
|
||||
if (clusterIter != clusterMap.second.end()) {
|
||||
SparseReorderingFeatureKey key(id, type, clusterIter->second, true, position, side, reoType);
|
||||
FeatureMap::const_iterator fmi = m_featureMap.find(key);
|
||||
|
@ -311,7 +311,7 @@ void SoftSourceSyntacticConstraintsFeature::EvaluateWithSourceContext(const Inpu
|
||||
prevTreeInputLabelsIt != prevTreeInputLabels.end(); ++prevTreeInputLabelsIt) {
|
||||
if (*prevTreeInputLabelsIt != outputDefaultNonTerminal) {
|
||||
boost::unordered_map<const Factor*,size_t>::const_iterator foundPrevTreeInputLabel
|
||||
= m_sourceLabelIndexesByFactor.find((*prevTreeInputLabelsIt)[0]);
|
||||
= m_sourceLabelIndexesByFactor.find((*prevTreeInputLabelsIt)[0]);
|
||||
if (foundPrevTreeInputLabel != m_sourceLabelIndexesByFactor.end()) {
|
||||
size_t prevTreeInputLabelIndex = foundPrevTreeInputLabel->second;
|
||||
treeInputLabelsRHS[nonTerminalNumber].insert(prevTreeInputLabelIndex);
|
||||
@ -334,7 +334,7 @@ void SoftSourceSyntacticConstraintsFeature::EvaluateWithSourceContext(const Inpu
|
||||
treeInputLabelsIt != treeInputLabels.end(); ++treeInputLabelsIt) {
|
||||
if (*treeInputLabelsIt != outputDefaultNonTerminal) {
|
||||
boost::unordered_map<const Factor*,size_t>::const_iterator foundTreeInputLabel
|
||||
= m_sourceLabelIndexesByFactor.find((*treeInputLabelsIt)[0]);
|
||||
= m_sourceLabelIndexesByFactor.find((*treeInputLabelsIt)[0]);
|
||||
if (foundTreeInputLabel != m_sourceLabelIndexesByFactor.end()) {
|
||||
size_t treeInputLabelIndex = foundTreeInputLabel->second;
|
||||
treeInputLabelsLHS.insert(treeInputLabelIndex);
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
m_nameMap.reset(new NameValueMap());
|
||||
|
||||
typename NameValueMap::iterator it
|
||||
= m_nameMap->find(m_ff->GetScoreProducerDescription());
|
||||
= m_nameMap->find(m_ff->GetScoreProducerDescription());
|
||||
|
||||
if(it == m_nameMap->end()) {
|
||||
std::pair<typename NameValueMap::iterator, bool> ret;
|
||||
@ -60,7 +60,7 @@ public:
|
||||
<< m_ff->GetScoreProducerDescription());
|
||||
|
||||
typename NameValueMap::const_iterator it
|
||||
= m_nameMap->find(m_ff->GetScoreProducerDescription());
|
||||
= m_nameMap->find(m_ff->GetScoreProducerDescription());
|
||||
|
||||
UTIL_THROW_IF2(it == m_nameMap->end(),
|
||||
"No features stored for: "
|
||||
|
@ -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);
|
||||
assert(static_cast<size_t>(p.first->second)<data.size());
|
||||
return p.first->second;
|
||||
|
@ -662,7 +662,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;
|
||||
}
|
||||
@ -680,7 +680,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;
|
||||
}
|
||||
|
@ -247,12 +247,12 @@ void ChartRuleLookupManagerOnDisk::GetChartRuleCollection(
|
||||
|
||||
std::vector<float> weightT = staticData.GetWeights(&m_dictionary);
|
||||
targetPhraseCollection
|
||||
= tpcollBerkeleyDb->ConvertToMoses(m_inputFactorsVec
|
||||
,m_outputFactorsVec
|
||||
,m_dictionary
|
||||
,weightT
|
||||
,m_dbWrapper.GetVocab()
|
||||
,true);
|
||||
= tpcollBerkeleyDb->ConvertToMoses(m_inputFactorsVec
|
||||
,m_outputFactorsVec
|
||||
,m_dictionary
|
||||
,weightT
|
||||
,m_dbWrapper.GetVocab()
|
||||
,true);
|
||||
|
||||
delete tpcollBerkeleyDb;
|
||||
m_cache[tpCollFilePos] = targetPhraseCollection;
|
||||
|
@ -430,7 +430,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);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ PhraseDictionaryCompact::GetTargetPhraseCollectionNonCacheLEGACY(const Phrase &s
|
||||
|
||||
// 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;
|
||||
@ -1218,7 +1218,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);
|
||||
|
@ -142,7 +142,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
|
||||
|
@ -201,7 +201,7 @@ const TargetPhraseCollection *PhraseDictionaryOnDisk::GetTargetPhraseCollectionN
|
||||
|
||||
const OnDiskPt::TargetPhraseCollection *targetPhrasesOnDisk = ptNode->GetTargetPhraseCollection(m_tableLimit, wrapper);
|
||||
TargetPhraseCollection *targetPhrases
|
||||
= targetPhrasesOnDisk->ConvertToMoses(m_input, m_output, *this, weightT, vocab, false);
|
||||
= targetPhrasesOnDisk->ConvertToMoses(m_input, m_output, *this, weightT, vocab, false);
|
||||
|
||||
delete targetPhrasesOnDisk;
|
||||
|
||||
|
@ -119,11 +119,11 @@ enum DistortionOrientationOptions {
|
||||
|
||||
enum InputTypeEnum {
|
||||
SentenceInput = 0
|
||||
,ConfusionNetworkInput = 1
|
||||
,WordLatticeInput = 2
|
||||
,TreeInputType = 3
|
||||
,WordLatticeInput2 = 4
|
||||
, TabbedSentenceInput = 5
|
||||
,ConfusionNetworkInput = 1
|
||||
,WordLatticeInput = 2
|
||||
,TreeInputType = 3
|
||||
,WordLatticeInput2 = 4
|
||||
, TabbedSentenceInput = 5
|
||||
|
||||
};
|
||||
|
||||
@ -137,27 +137,27 @@ enum XmlInputType {
|
||||
|
||||
enum DictionaryFind {
|
||||
Best = 0
|
||||
,All = 1
|
||||
,All = 1
|
||||
};
|
||||
|
||||
enum SearchAlgorithm {
|
||||
Normal = 0
|
||||
,CubePruning = 1
|
||||
//,CubeGrowing = 2
|
||||
,CYKPlus = 3
|
||||
,NormalBatch = 4
|
||||
,ChartIncremental = 5
|
||||
,CubePruning = 1
|
||||
//,CubeGrowing = 2
|
||||
,CYKPlus = 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 {
|
||||
|
@ -211,7 +211,7 @@ void PhraseOrientation::InsertPhraseVertices(HSentenceVertices & topLeft,
|
||||
const std::string PhraseOrientation::GetOrientationInfoString(int startF, int endF, REO_DIR direction) const
|
||||
{
|
||||
boost::unordered_map< std::pair<int,int> , std::pair<int,int> >::const_iterator foundMinMax
|
||||
= m_minAndMaxAlignedToSourceSpan.find( std::pair<int,int>(startF,endF) );
|
||||
= m_minAndMaxAlignedToSourceSpan.find( std::pair<int,int>(startF,endF) );
|
||||
|
||||
if ( foundMinMax != m_minAndMaxAlignedToSourceSpan.end() ) {
|
||||
int startE = (foundMinMax->second).first;
|
||||
@ -261,7 +261,7 @@ const std::string PhraseOrientation::GetOrientationInfoString(int startF, int st
|
||||
PhraseOrientation::REO_CLASS PhraseOrientation::GetOrientationInfo(int startF, int endF, REO_DIR direction) const
|
||||
{
|
||||
boost::unordered_map< std::pair<int,int> , std::pair<int,int> >::const_iterator foundMinMax
|
||||
= m_minAndMaxAlignedToSourceSpan.find( std::pair<int,int>(startF,endF) );
|
||||
= m_minAndMaxAlignedToSourceSpan.find( std::pair<int,int>(startF,endF) );
|
||||
|
||||
if ( foundMinMax != m_minAndMaxAlignedToSourceSpan.end() ) {
|
||||
int startE = (foundMinMax->second).first;
|
||||
|
@ -2633,11 +2633,11 @@ public:
|
||||
enum {
|
||||
bufcapacitybytes =
|
||||
#ifdef PUGIXML_MEMORY_OUTPUT_STACK
|
||||
PUGIXML_MEMORY_OUTPUT_STACK
|
||||
PUGIXML_MEMORY_OUTPUT_STACK
|
||||
#else
|
||||
10240
|
||||
10240
|
||||
#endif
|
||||
,
|
||||
,
|
||||
bufcapacity = bufcapacitybytes / (sizeof(char_t) + 4)
|
||||
};
|
||||
|
||||
|
@ -131,7 +131,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++) {
|
||||
@ -149,7 +149,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++) {
|
||||
|
@ -11,8 +11,8 @@ my $version = `astyle --version 2> /dev/stdout`;
|
||||
chomp($version);
|
||||
print STDERR "version=$version";
|
||||
|
||||
if ($version ne "Artistic Style Version 2.03") {
|
||||
print STDERR "\nMust be astyle version 2.03. Quitting\n";
|
||||
if ($version ne "Artistic Style Version 2.01") {
|
||||
print STDERR "\nMust be astyle version 2.01. Quitting\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
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