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:
authorHieu Hoang <fishandfrolick@gmail.com>2012-05-30 16:04:02 +0400
committerHieu Hoang <fishandfrolick@gmail.com>2012-05-30 16:04:02 +0400
commitd25805858df34eb944f2c2db6b47c21d960136d8 (patch)
tree4d713ea9784f7dd69937615b1031258f33e20b63 /scripts
parent45870348ff4f8860b9a9b35a4d20952023ead4d7 (diff)
xcode build supports threads. move 'using namespace' out from .h file to stop namespace pollution
Diffstat (limited to 'scripts')
-rw-r--r--scripts/training/phrase-extract/SentenceAlignmentWithSyntax.cpp2
-rw-r--r--scripts/training/phrase-extract/hierarchical.h14
-rw-r--r--scripts/training/phrase-extract/relax-parse.h4
-rw-r--r--scripts/training/phrase-extract/tables-core.cpp2
-rw-r--r--scripts/training/phrase-extract/tables-core.h26
5 files changed, 23 insertions, 25 deletions
diff --git a/scripts/training/phrase-extract/SentenceAlignmentWithSyntax.cpp b/scripts/training/phrase-extract/SentenceAlignmentWithSyntax.cpp
index 39c95c221..06dc3919f 100644
--- a/scripts/training/phrase-extract/SentenceAlignmentWithSyntax.cpp
+++ b/scripts/training/phrase-extract/SentenceAlignmentWithSyntax.cpp
@@ -27,6 +27,8 @@
#include "XmlException.h"
#include "XmlTree.h"
+using namespace std;
+
bool SentenceAlignmentWithSyntax::processTargetSentence(const char * targetString, int sentenceID)
{
if (!m_options.targetSyntax) {
diff --git a/scripts/training/phrase-extract/hierarchical.h b/scripts/training/phrase-extract/hierarchical.h
index 40f6744ff..61c899013 100644
--- a/scripts/training/phrase-extract/hierarchical.h
+++ b/scripts/training/phrase-extract/hierarchical.h
@@ -14,22 +14,20 @@
#include <set>
#include <vector>
-using namespace std;
-
// HPhraseVertex represents a point in the alignment matrix
-typedef pair <int, int> HPhraseVertex;
+typedef std::pair <int, int> HPhraseVertex;
// Phrase represents a bi-phrase; each bi-phrase is defined by two points in the alignment matrix:
// bottom-left and top-right
-typedef pair<HPhraseVertex, HPhraseVertex> HPhrase;
+typedef std::pair<HPhraseVertex, HPhraseVertex> HPhrase;
-// HPhraseVector is a vector of phrases
+// HPhraseVector is a std::vector of phrases
// the bool value indicates if the associated phrase is within the length limit or not
-typedef vector < HPhrase > HPhraseVector;
+typedef std::vector < HPhrase > HPhraseVector;
// SentenceVertices represents all vertices that have the same positioning of all extracted phrases
-// The key of the map is the English index and the value is a set of the foreign ones
-typedef map <int, set<int> > HSenteceVertices;
+// The key of the std::map is the English index and the value is a std::set of the foreign ones
+typedef std::map <int, std::set<int> > HSenteceVertices;
#endif /* HIERARCHICAL_H_ */
diff --git a/scripts/training/phrase-extract/relax-parse.h b/scripts/training/phrase-extract/relax-parse.h
index cdde3f16c..ae5994641 100644
--- a/scripts/training/phrase-extract/relax-parse.h
+++ b/scripts/training/phrase-extract/relax-parse.h
@@ -31,8 +31,6 @@
#include "SyntaxTree.h"
#include "XmlTree.h"
-using namespace std;
-
#define LINE_MAX_LENGTH 1000000
bool leftBinarizeFlag = false;
@@ -41,7 +39,7 @@ char SAMTLevel = 0;
// functions
void init(int argc, char* argv[]);
-void store( SyntaxTree &tree, vector<string> &words );
+void store( SyntaxTree &tree, std::vector<std::string> &words );
void LeftBinarize( SyntaxTree &tree, ParentNodes &parents );
void RightBinarize( SyntaxTree &tree, ParentNodes &parents );
void SAMT( SyntaxTree &tree, ParentNodes &parents );
diff --git a/scripts/training/phrase-extract/tables-core.cpp b/scripts/training/phrase-extract/tables-core.cpp
index de50f5024..93ad8b6a1 100644
--- a/scripts/training/phrase-extract/tables-core.cpp
+++ b/scripts/training/phrase-extract/tables-core.cpp
@@ -5,6 +5,8 @@
#define TABLE_LINE_MAX_LENGTH 1000
#define UNKNOWNSTR "UNK"
+using namespace std;
+
// as in beamdecoder/tables.cpp
vector<string> tokenize( const char* input )
{
diff --git a/scripts/training/phrase-extract/tables-core.h b/scripts/training/phrase-extract/tables-core.h
index 2db8086e5..1899b4d77 100644
--- a/scripts/training/phrase-extract/tables-core.h
+++ b/scripts/training/phrase-extract/tables-core.h
@@ -12,18 +12,16 @@
#include <map>
#include <cmath>
-using namespace std;
+extern std::vector<std::string> tokenize( const char*);
-extern vector<string> tokenize( const char*);
-
-typedef string WORD;
+typedef std::string WORD;
typedef unsigned int WORD_ID;
class Vocabulary
{
public:
- map<WORD, WORD_ID> lookup;
- vector< WORD > vocab;
+ std::map<WORD, WORD_ID> lookup;
+ std::vector< WORD > vocab;
WORD_ID storeIfNew( const WORD& );
WORD_ID getWordID( const WORD& );
inline WORD &getWord( WORD_ID id ) {
@@ -31,14 +29,14 @@ public:
}
};
-typedef vector< WORD_ID > PHRASE;
+typedef std::vector< WORD_ID > PHRASE;
typedef unsigned int PHRASE_ID;
class PhraseTable
{
public:
- map< PHRASE, PHRASE_ID > lookup;
- vector< PHRASE > phraseTable;
+ std::map< PHRASE, PHRASE_ID > lookup;
+ std::vector< PHRASE > phraseTable;
PHRASE_ID storeIfNew( const PHRASE& );
PHRASE_ID getPhraseID( const PHRASE& );
void clear();
@@ -47,21 +45,21 @@ public:
}
};
-typedef vector< pair< PHRASE_ID, double > > PHRASEPROBVEC;
+typedef std::vector< std::pair< PHRASE_ID, double > > PHRASEPROBVEC;
class TTable
{
public:
- map< PHRASE_ID, vector< pair< PHRASE_ID, double > > > ttable;
- map< PHRASE_ID, vector< pair< PHRASE_ID, vector< double > > > > ttableMulti;
+ std::map< PHRASE_ID, std::vector< std::pair< PHRASE_ID, double > > > ttable;
+ std::map< PHRASE_ID, std::vector< std::pair< PHRASE_ID, std::vector< double > > > > ttableMulti;
};
class DTable
{
public:
- map< int, double > dtable;
+ std::map< int, double > dtable;
void init();
- void load( const string& );
+ void load( const std::string& );
double get( int );
};