diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-05-07 18:41:18 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-05-07 18:41:18 +0400 |
commit | 42e07d23a8d5ecc04d4500f862a2c3076e05e985 (patch) | |
tree | 47b0f52a2d993c4baef31c9da857688f91a027af /scripts/ems | |
parent | 1c8e2a2eb7f7b359b05eba6ae4be0b4052078346 (diff) |
Clean up including headers; delete using namespace std in headers.
Diffstat (limited to 'scripts/ems')
-rw-r--r-- | scripts/ems/biconcor/Alignment.cpp | 2 | ||||
-rw-r--r-- | scripts/ems/biconcor/PhrasePair.cpp | 5 | ||||
-rw-r--r-- | scripts/ems/biconcor/PhrasePair.h | 24 | ||||
-rw-r--r-- | scripts/ems/biconcor/PhrasePairCollection.cpp | 9 | ||||
-rw-r--r-- | scripts/ems/biconcor/PhrasePairCollection.h | 22 | ||||
-rw-r--r-- | scripts/ems/biconcor/SuffixArray.cpp | 2 | ||||
-rw-r--r-- | scripts/ems/biconcor/TargetCorpus.cpp | 1 | ||||
-rw-r--r-- | scripts/ems/biconcor/Vocabulary.cpp | 1 | ||||
-rw-r--r-- | scripts/ems/biconcor/Vocabulary.h | 26 |
9 files changed, 50 insertions, 42 deletions
diff --git a/scripts/ems/biconcor/Alignment.cpp b/scripts/ems/biconcor/Alignment.cpp index a109f8352..89696c036 100644 --- a/scripts/ems/biconcor/Alignment.cpp +++ b/scripts/ems/biconcor/Alignment.cpp @@ -1,4 +1,6 @@ #include "Alignment.h" + +#include <fstream> #include <string> #include <stdlib.h> #include <cstring> diff --git a/scripts/ems/biconcor/PhrasePair.cpp b/scripts/ems/biconcor/PhrasePair.cpp index b5330a5fb..9273101bd 100644 --- a/scripts/ems/biconcor/PhrasePair.cpp +++ b/scripts/ems/biconcor/PhrasePair.cpp @@ -1,5 +1,10 @@ #include "PhrasePair.h" + +#include <iostream> +#include "TargetCorpus.h" +#include "Alignment.h" #include "Vocabulary.h" +#include "SuffixArray.h" using namespace std; diff --git a/scripts/ems/biconcor/PhrasePair.h b/scripts/ems/biconcor/PhrasePair.h index 861a09bcf..23b811078 100644 --- a/scripts/ems/biconcor/PhrasePair.h +++ b/scripts/ems/biconcor/PhrasePair.h @@ -1,16 +1,10 @@ #pragma once -#include <string> -#include <stdlib.h> -#include <cstring> -#include <fstream> -#include <sstream> -#include <iostream> -#include "SuffixArray.h" -#include "TargetCorpus.h" -#include "Alignment.h" +#include <iosfwd> -using namespace std; +class Alignment; +class SuffixArray; +class TargetCorpus; class PhrasePair { @@ -23,7 +17,7 @@ private: Alignment *m_alignment; INDEX m_sentence_id; char m_target_length; - SuffixArray::INDEX m_source_position; + INDEX m_source_position; char m_source_start, m_source_end; char m_target_start, m_target_end; char m_start_null, m_end_null; @@ -48,8 +42,8 @@ public: {} ~PhrasePair () {} - void PrintTarget( ostream* out ); - void Print( ostream* out, int width ); - void PrintHTML( ostream* out ); - void PrintClippedHTML( ostream* out, int width ); + void PrintTarget( std::ostream* out ); + void Print( std::ostream* out, int width ); + void PrintHTML( std::ostream* out ); + void PrintClippedHTML( std::ostream* out, int width ); }; diff --git a/scripts/ems/biconcor/PhrasePairCollection.cpp b/scripts/ems/biconcor/PhrasePairCollection.cpp index 224bfd498..76f84dbb3 100644 --- a/scripts/ems/biconcor/PhrasePairCollection.cpp +++ b/scripts/ems/biconcor/PhrasePairCollection.cpp @@ -1,9 +1,16 @@ #include "PhrasePairCollection.h" -#include <string> + #include <stdlib.h> #include <cstring> #include <algorithm> +#include "Vocabulary.h" +#include "SuffixArray.h" +#include "TargetCorpus.h" +#include "Alignment.h" +#include "PhrasePair.h" +#include "Mismatch.h" + using namespace std; PhrasePairCollection::PhrasePairCollection( SuffixArray *sa, TargetCorpus *tc, Alignment *a ) diff --git a/scripts/ems/biconcor/PhrasePairCollection.h b/scripts/ems/biconcor/PhrasePairCollection.h index 913030167..2b2b8e633 100644 --- a/scripts/ems/biconcor/PhrasePairCollection.h +++ b/scripts/ems/biconcor/PhrasePairCollection.h @@ -1,11 +1,13 @@ #pragma once -#include "Vocabulary.h" -#include "SuffixArray.h" -#include "TargetCorpus.h" -#include "Alignment.h" -#include "PhrasePair.h" -#include "Mismatch.h" +#include <vector> +#include <string> + +class Alignment; +class PhrasePair; +class SuffixArray; +class TargetCorpus; +class Mismatch; class PhrasePairCollection { @@ -16,8 +18,8 @@ private: SuffixArray *m_suffixArray; TargetCorpus *m_targetCorpus; Alignment *m_alignment; - vector< vector<PhrasePair*> > m_collection; - vector< Mismatch* > m_mismatch, m_unaligned; + std::vector<std::vector<PhrasePair*> > m_collection; + std::vector< Mismatch* > m_mismatch, m_unaligned; int m_size; int m_max_lookup; int m_max_pp_target; @@ -27,14 +29,14 @@ public: PhrasePairCollection ( SuffixArray *, TargetCorpus *, Alignment * ); ~PhrasePairCollection (); - bool GetCollection( const vector< string > sourceString ); + bool GetCollection( const std::vector<std::string > sourceString ); void Print(); void PrintHTML(); }; // sorting helper struct CompareBySize { - bool operator()(const vector<PhrasePair*> a, const vector<PhrasePair*> b ) const { + bool operator()(const std::vector<PhrasePair*> a, const std::vector<PhrasePair*> b ) const { return a.size() > b.size(); } }; diff --git a/scripts/ems/biconcor/SuffixArray.cpp b/scripts/ems/biconcor/SuffixArray.cpp index 0fc0933d5..140060734 100644 --- a/scripts/ems/biconcor/SuffixArray.cpp +++ b/scripts/ems/biconcor/SuffixArray.cpp @@ -1,4 +1,6 @@ #include "SuffixArray.h" + +#include <fstream> #include <string> #include <stdlib.h> #include <cstring> diff --git a/scripts/ems/biconcor/TargetCorpus.cpp b/scripts/ems/biconcor/TargetCorpus.cpp index 75f647164..75de789e9 100644 --- a/scripts/ems/biconcor/TargetCorpus.cpp +++ b/scripts/ems/biconcor/TargetCorpus.cpp @@ -1,5 +1,6 @@ #include "TargetCorpus.h" +#include <fstream> #include <string> #include <stdlib.h> #include <cstring> diff --git a/scripts/ems/biconcor/Vocabulary.cpp b/scripts/ems/biconcor/Vocabulary.cpp index 53064b280..43d7cdfcd 100644 --- a/scripts/ems/biconcor/Vocabulary.cpp +++ b/scripts/ems/biconcor/Vocabulary.cpp @@ -1,5 +1,6 @@ // $Id: Vocabulary.cpp 1565 2008-02-22 14:42:01Z bojar $
#include "Vocabulary.h"
+#include <fstream>
namespace {
diff --git a/scripts/ems/biconcor/Vocabulary.h b/scripts/ems/biconcor/Vocabulary.h index 15ccf27fd..3a8399e07 100644 --- a/scripts/ems/biconcor/Vocabulary.h +++ b/scripts/ems/biconcor/Vocabulary.h @@ -3,43 +3,37 @@ #pragma once #include <iostream> -#include <fstream> -#include <assert.h> -#include <stdlib.h> +#include <cstdlib> #include <string> -#include <queue> #include <map> -#include <cmath> #include <vector> -using namespace std; - #define SAFE_GETLINE(_IS, _LINE, _SIZE, _DELIM) { \ _IS.getline(_LINE, _SIZE, _DELIM); \ if(_IS.fail() && !_IS.bad() && !_IS.eof()) _IS.clear(); \ if (_IS.gcount() == _SIZE-1) { \ - cerr << "Line too long! Buffer overflow. Delete lines >=" \ + std::cerr << "Line too long! Buffer overflow. Delete lines >=" \ << _SIZE << " chars or raise MAX_LENGTH in phrase-extract/tables-core.cpp" \ - << endl; \ - exit(1); \ + << std::endl; \ + std::exit(1); \ } \ } -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& ); - vector<WORD_ID> Tokenize( const char[] ); + std::vector<WORD_ID> Tokenize( const char[] ); inline WORD &GetWord( WORD_ID id ) const { WORD &i = (WORD&) vocab[ id ]; return i; } - void Save(const string& fileName ); - void Load(const string& fileName ); + void Save(const std::string& fileName ); + void Load(const std::string& fileName ); }; |