diff options
author | MosesAdmin <hieuhoang@gmail.com> | 2015-06-04 15:41:46 +0300 |
---|---|---|
committer | MosesAdmin <hieuhoang@gmail.com> | 2015-06-04 15:41:46 +0300 |
commit | 5696a59ae46862221901226cfd232b18ddf74357 (patch) | |
tree | 149350997bd1fa8b7a18ea88eeb9bb02c9a97251 /phrase-extract | |
parent | 0e11919ffb7093939e0402725a6fc6a319691633 (diff) |
daily automatic beautifier
Diffstat (limited to 'phrase-extract')
-rw-r--r-- | phrase-extract/SyntaxNode.h | 3 | ||||
-rw-r--r-- | phrase-extract/SyntaxNodeCollection.cpp | 4 | ||||
-rw-r--r-- | phrase-extract/SyntaxNodeCollection.h | 4 | ||||
-rw-r--r-- | phrase-extract/consolidate-main.cpp | 22 | ||||
-rw-r--r-- | phrase-extract/extract-ghkm/AlignmentGraph.cpp | 2 | ||||
-rw-r--r-- | phrase-extract/extract-ghkm/ExtractGHKM.cpp | 24 | ||||
-rw-r--r-- | phrase-extract/extract-main.cpp | 14 | ||||
-rw-r--r-- | phrase-extract/filter-rule-table/FilterRuleTable.cpp | 2 | ||||
-rw-r--r-- | phrase-extract/score-main.cpp | 16 |
9 files changed, 47 insertions, 44 deletions
diff --git a/phrase-extract/SyntaxNode.h b/phrase-extract/SyntaxNode.h index f38e94713..49e2eb695 100644 --- a/phrase-extract/SyntaxNode.h +++ b/phrase-extract/SyntaxNode.h @@ -22,7 +22,8 @@ #include <map> #include <string> -namespace MosesTraining { +namespace MosesTraining +{ struct SyntaxNode { typedef std::map<std::string, std::string> AttributeMap; diff --git a/phrase-extract/SyntaxNodeCollection.cpp b/phrase-extract/SyntaxNodeCollection.cpp index 0a344fcd7..70f52317e 100644 --- a/phrase-extract/SyntaxNodeCollection.cpp +++ b/phrase-extract/SyntaxNodeCollection.cpp @@ -42,7 +42,7 @@ void SyntaxNodeCollection::Clear() } SyntaxNode *SyntaxNodeCollection::AddNode(int startPos, int endPos, - const std::string &label) + const std::string &label) { SyntaxNode* newNode = new SyntaxNode(label, startPos, endPos); m_nodes.push_back( newNode ); @@ -57,7 +57,7 @@ bool SyntaxNodeCollection::HasNode( int startPos, int endPos ) const } const std::vector< SyntaxNode* >& SyntaxNodeCollection::GetNodes( - int startPos, int endPos ) const + int startPos, int endPos ) const { NodeIndex::const_iterator startIndex = m_index.find( startPos ); if (startIndex == m_index.end() ) diff --git a/phrase-extract/SyntaxNodeCollection.h b/phrase-extract/SyntaxNodeCollection.h index 8de151c55..405a77c5f 100644 --- a/phrase-extract/SyntaxNodeCollection.h +++ b/phrase-extract/SyntaxNodeCollection.h @@ -51,7 +51,9 @@ public: const std::vector< SyntaxNode* >& GetNodes( int startPos, int endPos ) const; //! Get a vector of pointers to all SyntaxNodes (unordered). - const std::vector< SyntaxNode* >& GetAllNodes() { return m_nodes; }; + const std::vector< SyntaxNode* >& GetAllNodes() { + return m_nodes; + }; size_t GetNumWords() const { return m_numWords; diff --git a/phrase-extract/consolidate-main.cpp b/phrase-extract/consolidate-main.cpp index d52e8797b..5964bf686 100644 --- a/phrase-extract/consolidate-main.cpp +++ b/phrase-extract/consolidate-main.cpp @@ -73,17 +73,17 @@ int main(int argc, char* argv[]) if (argc < 4) { std::cerr << - "syntax: " - "consolidate phrase-table.direct " - "phrase-table.indirect " - "phrase-table.consolidated " - "[--Hierarchical] [--OnlyDirect] [--PhraseCount] " - "[--GoodTuring counts-of-counts-file] " - "[--KneserNey counts-of-counts-file] [--LowCountFeature] " - "[--SourceLabels source-labels-file] " - "[--PartsOfSpeech parts-of-speech-file] " - "[--MinScore id:threshold[,id:threshold]*]" - << std::endl; + "syntax: " + "consolidate phrase-table.direct " + "phrase-table.indirect " + "phrase-table.consolidated " + "[--Hierarchical] [--OnlyDirect] [--PhraseCount] " + "[--GoodTuring counts-of-counts-file] " + "[--KneserNey counts-of-counts-file] [--LowCountFeature] " + "[--SourceLabels source-labels-file] " + "[--PartsOfSpeech parts-of-speech-file] " + "[--MinScore id:threshold[,id:threshold]*]" + << std::endl; exit(1); } const std::string fileNameDirect = argv[1]; diff --git a/phrase-extract/extract-ghkm/AlignmentGraph.cpp b/phrase-extract/extract-ghkm/AlignmentGraph.cpp index 7c179295f..9dba71331 100644 --- a/phrase-extract/extract-ghkm/AlignmentGraph.cpp +++ b/phrase-extract/extract-ghkm/AlignmentGraph.cpp @@ -219,7 +219,7 @@ Node *AlignmentGraph::CopyParseTree(const SyntaxTree *root) if (nodeType == TREE) { float score = 0.0f; SyntaxNode::AttributeMap::const_iterator p = - root->value().attributes.find("pcfg"); + root->value().attributes.find("pcfg"); if (p != root->value().attributes.end()) { score = std::atof(p->second.c_str()); } diff --git a/phrase-extract/extract-ghkm/ExtractGHKM.cpp b/phrase-extract/extract-ghkm/ExtractGHKM.cpp index c96cda146..777e56f52 100644 --- a/phrase-extract/extract-ghkm/ExtractGHKM.cpp +++ b/phrase-extract/extract-ghkm/ExtractGHKM.cpp @@ -232,7 +232,7 @@ int ExtractGHKM::Main(int argc, char *argv[]) // Initialize phrase orientation scoring object PhraseOrientation phraseOrientation(sourceTokens.size(), - targetXmlTreeParser.words().size(), alignment); + targetXmlTreeParser.words().size(), alignment); // Write the rules, subject to scope pruning. const std::vector<Node *> &targetNodes = graph.GetTargetNodes(); @@ -413,21 +413,21 @@ void ExtractGHKM::ProcessOptions(int argc, char *argv[], << "\nThe parse tree is assumed to contain part-of-speech preterminal nodes.\n" << "\n" << "For the composed rule constraints: rule depth is the " - "maximum distance from the\nrule's root node to a sink " - "node, not counting preterminal expansions or word\n" - "alignments. Rule size is the measure defined in DeNeefe " - "et al (2007): the\nnumber of non-part-of-speech, non-leaf " - "constituent labels in the target tree.\nNode count is the " - "number of target tree nodes (excluding target words).\n" + "maximum distance from the\nrule's root node to a sink " + "node, not counting preterminal expansions or word\n" + "alignments. Rule size is the measure defined in DeNeefe " + "et al (2007): the\nnumber of non-part-of-speech, non-leaf " + "constituent labels in the target tree.\nNode count is the " + "number of target tree nodes (excluding target words).\n" << "\n" << "Scope pruning (Hopkins and Langmead, 2010) is applied to both minimal and\ncomposed rules.\n" << "\n" << "Unaligned source words are attached to the tree using the " - "following heuristic:\nif there are aligned source words to " - "both the left and the right of an unaligned\nsource word " - "then it is attached to the lowest common ancestor of its " - "nearest\nsuch left and right neighbours. Otherwise, it is " - "attached to the root of the\nparse tree.\n" + "following heuristic:\nif there are aligned source words to " + "both the left and the right of an unaligned\nsource word " + "then it is attached to the lowest common ancestor of its " + "nearest\nsuch left and right neighbours. Otherwise, it is " + "attached to the root of the\nparse tree.\n" << "\n" << "Unless the --AllowUnary option is given, unary rules containing no lexical\nsource items are eliminated using the method described in Chung et al. (2011).\nThe parsing algorithm used in Moses is unable to handle such rules.\n" << "\n" diff --git a/phrase-extract/extract-main.cpp b/phrase-extract/extract-main.cpp index eb44b83d1..70d4cad35 100644 --- a/phrase-extract/extract-main.cpp +++ b/phrase-extract/extract-main.cpp @@ -87,13 +87,13 @@ class ExtractTask { public: ExtractTask( - size_t id, SentenceAlignment &sentence, - PhraseExtractionOptions &initoptions, - Moses::OutputFileStream &extractFile, - Moses::OutputFileStream &extractFileInv, - Moses::OutputFileStream &extractFileOrientation, - Moses::OutputFileStream &extractFileContext, - Moses::OutputFileStream &extractFileContextInv): + size_t id, SentenceAlignment &sentence, + PhraseExtractionOptions &initoptions, + Moses::OutputFileStream &extractFile, + Moses::OutputFileStream &extractFileInv, + Moses::OutputFileStream &extractFileOrientation, + Moses::OutputFileStream &extractFileContext, + Moses::OutputFileStream &extractFileContextInv): m_sentence(sentence), m_options(initoptions), m_extractFile(extractFile), diff --git a/phrase-extract/filter-rule-table/FilterRuleTable.cpp b/phrase-extract/filter-rule-table/FilterRuleTable.cpp index 32d2019cf..89e59b3e9 100644 --- a/phrase-extract/filter-rule-table/FilterRuleTable.cpp +++ b/phrase-extract/filter-rule-table/FilterRuleTable.cpp @@ -137,7 +137,7 @@ void FilterRuleTable::ReadTestSet( continue; } sentences.push_back( - boost::shared_ptr<SyntaxTree>(parser.Parse(line).release())); + boost::shared_ptr<SyntaxTree>(parser.Parse(line).release())); } } diff --git a/phrase-extract/score-main.cpp b/phrase-extract/score-main.cpp index 185c0ae9e..cf28f90b9 100644 --- a/phrase-extract/score-main.cpp +++ b/phrase-extract/score-main.cpp @@ -131,14 +131,14 @@ int main(int argc, char* argv[]) ScoreFeatureManager featureManager; if (argc < 4) { std::cerr << - "syntax: score extract lex phrase-table [--Inverse] [--Hierarchical] " - "[--LogProb] [--NegLogProb] [--NoLex] [--GoodTuring] [--KneserNey] " - "[--NoWordAlignment] [--UnalignedPenalty] " - "[--UnalignedFunctionWordPenalty function-word-file] " - "[--MinCountHierarchical count] [--PartsOfSpeech] [--PCFG] " - "[--TreeFragments] [--SourceLabels] [--SourceLabelCountsLHS] " - "[--TargetPreferenceLabels] [--UnpairedExtractFormat] " - "[--ConditionOnTargetLHS] [--CrossedNonTerm]" << std::endl; + "syntax: score extract lex phrase-table [--Inverse] [--Hierarchical] " + "[--LogProb] [--NegLogProb] [--NoLex] [--GoodTuring] [--KneserNey] " + "[--NoWordAlignment] [--UnalignedPenalty] " + "[--UnalignedFunctionWordPenalty function-word-file] " + "[--MinCountHierarchical count] [--PartsOfSpeech] [--PCFG] " + "[--TreeFragments] [--SourceLabels] [--SourceLabelCountsLHS] " + "[--TargetPreferenceLabels] [--UnpairedExtractFormat] " + "[--ConditionOnTargetLHS] [--CrossedNonTerm]" << std::endl; std::cerr << featureManager.usage() << std::endl; exit(1); } |