diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-03-20 15:37:54 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-03-20 15:37:54 -0400 |
commit | 41c404d0139dc705835e65f04b82df369792546b (patch) | |
tree | 545b9467ff01af2ca350b02ada8f1497d509a2c4 /extools | |
parent | 4a129e055387baf922f30f1502c6b6efad7dd8eb (diff) |
make c++11 compatible
Diffstat (limited to 'extools')
-rw-r--r-- | extools/extract.cc | 8 | ||||
-rw-r--r-- | extools/featurize_grammar.cc | 6 | ||||
-rw-r--r-- | extools/sentence_pair.cc | 5 |
3 files changed, 9 insertions, 10 deletions
diff --git a/extools/extract.cc b/extools/extract.cc index f6c121b4..49542fed 100644 --- a/extools/extract.cc +++ b/extools/extract.cc @@ -131,16 +131,16 @@ lookup_and_append(const map<K, V> &dict, const K &key, V &output) // phrases if there is more than one annotation. // TODO: support source annotation void Extract::AnnotatePhrasesWithCategoryTypes(const WordID default_cat, - const map< tuple<short,short,short,short>, vector<WordID> > &types, + const map< boost::tuple<short,short,short,short>, vector<WordID> > &types, vector<ParallelSpan>* phrases) { const int num_unannotated_phrases = phrases->size(); // have to use num_unannotated_phrases since we may grow the vector for (int i = 0; i < num_unannotated_phrases; ++i) { ParallelSpan& phrase = (*phrases)[i]; vector<WordID> cats; - lookup_and_append(types, make_tuple(phrase.i1, phrase.i2, phrase.j1, phrase.j2), cats); - lookup_and_append(types, make_tuple((short)-1, (short)-1, phrase.j1, phrase.j2), cats); - lookup_and_append(types, make_tuple(phrase.i1, phrase.i2, (short)-1, (short)-1), cats); + lookup_and_append(types, boost::make_tuple(phrase.i1, phrase.i2, phrase.j1, phrase.j2), cats); + lookup_and_append(types, boost::make_tuple((short)-1, (short)-1, phrase.j1, phrase.j2), cats); + lookup_and_append(types, boost::make_tuple(phrase.i1, phrase.i2, (short)-1, (short)-1), cats); if (cats.empty() && default_cat != 0) { cats = vector<WordID>(1, default_cat); } diff --git a/extools/featurize_grammar.cc b/extools/featurize_grammar.cc index ebae9fdc..78175202 100644 --- a/extools/featurize_grammar.cc +++ b/extools/featurize_grammar.cc @@ -136,8 +136,8 @@ class FERegistry { public: FERegistry() {} boost::shared_ptr<FeatureExtractor> Create(const std::string& ffname) const { - map<string, shared_ptr<FEFactoryBase> >::const_iterator it = reg_.find(ffname); - shared_ptr<FeatureExtractor> res; + map<string, boost::shared_ptr<FEFactoryBase> >::const_iterator it = reg_.find(ffname); + boost::shared_ptr<FeatureExtractor> res; if (it == reg_.end()) { cerr << "I don't know how to create feature " << ffname << endl; } else { @@ -147,7 +147,7 @@ class FERegistry { } void DisplayList(ostream* out) const { bool first = true; - for (map<string, shared_ptr<FEFactoryBase> >::const_iterator it = reg_.begin(); + for (map<string, boost::shared_ptr<FEFactoryBase> >::const_iterator it = reg_.begin(); it != reg_.end(); ++it) { if (first) {first=false;} else {*out << ' ';} *out << it->first; diff --git a/extools/sentence_pair.cc b/extools/sentence_pair.cc index d5ebe48f..7d60715a 100644 --- a/extools/sentence_pair.cc +++ b/extools/sentence_pair.cc @@ -71,8 +71,7 @@ int AnnotatedParallelSentence::ReadAlignmentPoint(const char* buf, exit(1); } (*b) = 0; - //TODO: is this what is intended? parses as A && B || C && D. - while(ch < end && (c == 0 && (!permit_col || (permit_col && buf[ch] != ':')) || c != 0 && buf[ch] != '-')) { + while((ch < end) && (c == 0 && (!permit_col || (permit_col && buf[ch] != ':')) || c != 0 && buf[ch] != '-')) { if ((buf[ch] < '0') || (buf[ch] > '9')) { cerr << "Alignment point badly formed 4: " << string(buf, start, end-start) << endl << buf << endl << buf[ch] << endl; exit(1); @@ -151,7 +150,7 @@ void AnnotatedParallelSentence::ParseSpanLabel(const char* buf, int start, int e exit(1); } // cerr << a << " " << b << " " << string(buf,c,end-c) << endl; - span_types[make_tuple(a,b,c,d)].push_back(-TD::Convert(string(buf, ch, end-ch))); + span_types[boost::make_tuple(a,b,c,d)].push_back(-TD::Convert(string(buf, ch, end-ch))); } // INPUT FORMAT |