diff --git a/libmwereader/mwe.cpp b/libmwereader/mwe.cpp index 4e12d3f38dc1a16cb0d37ac594469566ffadb5b3..6facfd33441e833a4fd068d577594dafc954cfff 100644 --- a/libmwereader/mwe.cpp +++ b/libmwereader/mwe.cpp @@ -64,7 +64,7 @@ bool LexicalUnit::IsHere(const Wccl::SentenceContext &sc, Wccl::SentenceContext sc2(sc.get_sentence_ptr()); // fill up positions - foreach(const std::string&varname, condition_->valid_variable_names()){ + BOOST_FOREACH (const std::string&varname, condition_->valid_variable_names()){ if(boost::algorithm::starts_with(varname, "Pos")){ Wccl::Position pos = condition_->get<Wccl::Position>(varname); if(pos.equals(nowhere_)){ @@ -122,7 +122,7 @@ MWEIndex::MWEIndex() : index_(), empty_() void MWEIndex::add_lexicalunit(LexicalUnit::Ptr lu) { - foreach(const std::string& base, lu->get_potential_bases()){ + BOOST_FOREACH (const std::string& base, lu->get_potential_bases()){ value_type::iterator find = index_.find(base); //std::cout << "b:"<<base<<std::endl; if(find == index_.end()){ // not found -> create new one diff --git a/libmwereader/mweparser.cpp b/libmwereader/mweparser.cpp index 6e8ad6cb3de7d83f5b0d0f883920efe423cbd5e1..02ea04bb1bf55a6ecb41ca33b881e71f7e6ba402 100644 --- a/libmwereader/mweparser.cpp +++ b/libmwereader/mweparser.cpp @@ -17,7 +17,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include "mweparser.h" -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <libcorpus2/tagsetmanager.h> @@ -92,7 +92,7 @@ namespace Corpus2 { const std::string &name) const { std::string value; - foreach (const Attribute& a, attributes) { + BOOST_FOREACH (const Attribute& a, attributes) { if (a.name == name) { value = a.value; } @@ -104,7 +104,7 @@ namespace Corpus2 { void MWEParser::parse_mwegroup_attributes(const AttributeList& attributes) { - foreach (const Attribute& a, attributes) { + BOOST_FOREACH (const Attribute& a, attributes) { if (a.name == "name") { group_name_ = a.value; } else if(a.name == "type"){ @@ -179,7 +179,7 @@ namespace Corpus2 { { out << "Forma podstawowa: " << mwe_base_ << "\nZmienne: "; - foreach(str_map::value_type &i, variables_) + BOOST_FOREACH (str_map::value_type &i, variables_) out << i.first << ": " << i.second << ", "; out << "\nWarunek głowy: " << head_cond_ << "\n"; if(with_condition){ diff --git a/libmwereader/mwereader.cpp b/libmwereader/mwereader.cpp index 7112c48ce5cf4e730fc7f3e842cf20d5a07b39fd..1af82271bf3ba403464cf85d7f44cb5f71f85ba0 100644 --- a/libmwereader/mwereader.cpp +++ b/libmwereader/mwereader.cpp @@ -88,11 +88,11 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>( if(lexemes.size() == 0) continue; - foreach(const Lexeme& lex, lexemes){ + BOOST_FOREACH (const Lexeme& lex, lexemes){ if(lex.is_disamb()){ std::string base = lex.lemma_utf8(); const MWEIndex::luvec& potential = mwe_index_.get_potential_lu(base); - foreach(LexicalUnit::Ptr pLU, potential){ + BOOST_FOREACH (LexicalUnit::Ptr pLU, potential){ std::set<int> positions; int head; bool is_here = pLU->IsHere(sc, positions, head); @@ -116,7 +116,7 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>( if(i == head){ Corpus2::Token * t = tokens[i]->clone(); t->set_orth_utf8(new_orth); - foreach(Lexeme& lex, t->lexemes()) + BOOST_FOREACH (Lexeme& lex, t->lexemes()) if(lex.is_disamb()) lex.set_lemma_utf8(new_base); new_sentence->append(t); @@ -132,7 +132,7 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>( { std::string new_orth; std::vector<Token*> &tokens = sentence->tokens(); - foreach(const int &pos, all){ + BOOST_FOREACH (const int &pos, all){ Token* tok = tokens [pos]; new_orth += tok->orth_utf8() + " "; } @@ -149,7 +149,7 @@ bool MWEReader::registered = TokenReader::register_path_reader<MWEReader>( boost::shared_ptr<Chunk> new_chunk = boost::make_shared<Chunk>(); - foreach(Corpus2::Sentence::Ptr sentence, currentChunk->sentences()) + BOOST_FOREACH (Corpus2::Sentence::Ptr sentence, currentChunk->sentences()) new_chunk->append( process_sentence(sentence) ); diff --git a/libwccl/lexicon/lexicon.cpp b/libwccl/lexicon/lexicon.cpp index ec3d15cf4807776aaa892738729d672cc845982f..1045aa579236e32d60f127033b5ec992c970be9c 100644 --- a/libwccl/lexicon/lexicon.cpp +++ b/libwccl/lexicon/lexicon.cpp @@ -18,7 +18,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <libwccl/lexicon/lexicon.h> #include <libpwrutils/util.h> #include <libwccl/exception.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <boost/make_shared.hpp> #include <unicode/unistr.h> @@ -38,7 +38,7 @@ const UnicodeString& Lexicon::translate(const UnicodeString &key) const boost::shared_ptr<StrSet> Lexicon::translate(const StrSet& set) const { boost::shared_ptr<StrSet> ret_set = boost::make_shared<StrSet>(); - foreach(const UnicodeString& s, set.get_value()) { + BOOST_FOREACH (const UnicodeString& s, set.get_value()) { const UnicodeString& v = translate(s); if (!v.isEmpty()) { ret_set->insert(v); diff --git a/libwccl/ops/functions/bool/predicates/and.cpp b/libwccl/ops/functions/bool/predicates/and.cpp index a99d95121d01b56c8e8999fdf231d1f5ef6a3f34..9af2249991e48acf197f27b6d1bf74eb591d91b3 100644 --- a/libwccl/ops/functions/bool/predicates/and.cpp +++ b/libwccl/ops/functions/bool/predicates/and.cpp @@ -16,13 +16,13 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/functions/bool/predicates/and.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { And::BaseRetValPtr And::apply_internal(const FunExecContext& context) const { - foreach(boost::shared_ptr< Function<Bool> > expression, *expressions_) { + BOOST_FOREACH (boost::shared_ptr< Function<Bool> > expression, *expressions_) { if(!(expression->apply(context)->get_value())) { return Predicate::False(context); } diff --git a/libwccl/ops/functions/bool/predicates/nor.cpp b/libwccl/ops/functions/bool/predicates/nor.cpp index ebfb41703fef9506674b5387825813aee62af00e..6821e04da8705d58b0bd9cd1907db9e78fec1bd4 100644 --- a/libwccl/ops/functions/bool/predicates/nor.cpp +++ b/libwccl/ops/functions/bool/predicates/nor.cpp @@ -16,13 +16,13 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/functions/bool/predicates/nor.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { Nor::BaseRetValPtr Nor::apply_internal(const FunExecContext& context) const { - foreach(BoolFunctionPtr expression, *expressions_) { + BOOST_FOREACH (BoolFunctionPtr expression, *expressions_) { if(expression->apply(context)->get_value()) { return Predicate::False(context); } diff --git a/libwccl/ops/functions/bool/predicates/or.cpp b/libwccl/ops/functions/bool/predicates/or.cpp index 28808b9e3be1cef35e8c9c8beae705cf4d1513c0..9a989a215eefd19a0c938c46ea760b344661e569 100644 --- a/libwccl/ops/functions/bool/predicates/or.cpp +++ b/libwccl/ops/functions/bool/predicates/or.cpp @@ -16,13 +16,13 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/functions/bool/predicates/or.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { Or::BaseRetValPtr Or::apply_internal(const FunExecContext& context) const { - foreach(BoolFunctionPtr expression, *expressions_) { + BOOST_FOREACH (BoolFunctionPtr expression, *expressions_) { if(expression->apply(context)->get_value()) { return Predicate::True(context); } diff --git a/libwccl/ops/functions/bool/predicates/pointagreement.cpp b/libwccl/ops/functions/bool/predicates/pointagreement.cpp index 1f708c20ff3ad4487fcac16ab773e93fb0369518..efcac860c111030c3c18b0bfbf1ebf65067510c7 100644 --- a/libwccl/ops/functions/bool/predicates/pointagreement.cpp +++ b/libwccl/ops/functions/bool/predicates/pointagreement.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/functions/bool/predicates/pointagreement.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { @@ -62,11 +62,11 @@ PointAgreement::BaseRetValPtr PointAgreement::apply_internal(const FunExecContex std::swap(t1, t2); } - foreach (const Corpus2::Lexeme& t1_lex, t1->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& t1_lex, t1->lexemes()) { const Corpus2::Tag& t1_tag = t1_lex.tag(); // don't bother checking t2 unless current t1_tag matches enough categories if (attribs->matching_categories(t1_tag) >= min_card) { - foreach (const Corpus2::Lexeme& t2_lex, t2->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& t2_lex, t2->lexemes()) { Corpus2::Tag intersection = t1_tag.get_masked(t2_lex.tag()); // if the intersection matches enough categories we have agreement if (attribs->matching_categories(intersection) >= min_card) { diff --git a/libwccl/ops/functions/bool/predicates/regex.cpp b/libwccl/ops/functions/bool/predicates/regex.cpp index 8246bf849a79770878230b9ad26c3a556f5491fe..9f206990960f15199357d7f1558dfae21ec42f1e 100644 --- a/libwccl/ops/functions/bool/predicates/regex.cpp +++ b/libwccl/ops/functions/bool/predicates/regex.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/functions/bool/predicates/regex.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <libpwrutils/util.h> @@ -91,7 +91,7 @@ Regex::BaseRetValPtr Regex::apply_internal(const FunExecContext& context) const if(set->empty()) { return Predicate::False(context); } - foreach(const UnicodeString& s, set->contents()) { + BOOST_FOREACH (const UnicodeString& s, set->contents()) { UErrorCode status = U_ZERO_ERROR; boost::scoped_ptr<RegexMatcher> matcher(pattern_->matcher(s, status)); if(status != U_ZERO_ERROR) { diff --git a/libwccl/ops/functions/bool/predicates/strongagreement.cpp b/libwccl/ops/functions/bool/predicates/strongagreement.cpp index b6765c6a0b91cc596b9e326b0056fe842bd1e07e..0599e546c5c080f465bd9ca3d9761037bd4da3b4 100644 --- a/libwccl/ops/functions/bool/predicates/strongagreement.cpp +++ b/libwccl/ops/functions/bool/predicates/strongagreement.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/functions/bool/predicates/strongagreement.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { @@ -68,11 +68,11 @@ StrongAgreement::BaseRetValPtr StrongAgreement::apply_internal(const FunExecCont // for each possible agreement between them, // check if remaining tokens meet that agreement too // return true if an agreement met by all tokens is found - foreach (const Corpus2::Lexeme& t1_lex, t1->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& t1_lex, t1->lexemes()) { const Corpus2::Tag& t1_tag = t1_lex.tag(); // don't bother checking t2 unless current t1_tag matches enough categories if (attribs->matching_categories(t1_tag) >= min_card) { - foreach (const Corpus2::Lexeme& t2_lex, t2->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& t2_lex, t2->lexemes()) { Corpus2::Tag inter = t1_tag.get_masked(t2_lex.tag()); // if the intersection matches enough categories we have agreement if (attribs->matching_categories(inter) >= min_card) { @@ -80,7 +80,7 @@ StrongAgreement::BaseRetValPtr StrongAgreement::apply_internal(const FunExecCont bool agreement_met = true; for(int i = abs_left + 1; agreement_met && (i < abs_right); ++i) { agreement_met = false; - foreach(const Corpus2::Lexeme& i_lex, sc.at(i)->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& i_lex, sc.at(i)->lexemes()) { Corpus2::Tag i_inter = i_lex.tag().get_masked(inter); if (attribs->matching_categories(i_inter) >= min_card) { agreement_met = true; diff --git a/libwccl/ops/functions/bool/predicates/weakagreement.cpp b/libwccl/ops/functions/bool/predicates/weakagreement.cpp index 732285d5a9f2b298cbd5b8fef0930106b03ed3f3..e4f7278af18c89fa0deed1c08bca032166079a38 100644 --- a/libwccl/ops/functions/bool/predicates/weakagreement.cpp +++ b/libwccl/ops/functions/bool/predicates/weakagreement.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/functions/bool/predicates/weakagreement.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { @@ -73,18 +73,18 @@ WeakAgreement::BaseRetValPtr WeakAgreement::apply_internal(const FunExecContext& // Specifically, if there is a lexeme that does not // match any of the categories, that means the token // does meet the weak agreement. - foreach (const Corpus2::Lexeme& t1_lex, t1->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& t1_lex, t1->lexemes()) { const Corpus2::Tag& t1_tag = t1_lex.tag(); // don't bother checking t2 unless current t1_tag matches enough categories if (attribs->matching_categories(t1_tag) >= min_card) { - foreach (const Corpus2::Lexeme& t2_lex, t2->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& t2_lex, t2->lexemes()) { Corpus2::Tag inter = t1_tag.get_masked(t2_lex.tag()); // if the intersection matches enough categories we have agreement if (attribs->matching_categories(inter) >= min_card) { // Check if selected agreement is met by all remaining tokens bool agreement_met = true; for(int i = abs_left + 1; agreement_met && (i < abs_right); ++i) { - foreach(const Corpus2::Lexeme& i_lex, sc.at(i)->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& i_lex, sc.at(i)->lexemes()) { // Check if agreement is met, but taking into account // only categories actually matched in current tag, // without requirement to match all categories in the diff --git a/libwccl/ops/functions/setops.h b/libwccl/ops/functions/setops.h index 24abff3d7374c72c6d2ea34d75a209a72fb8296f..32249575147742d65559291757015f20d9cd8e4d 100644 --- a/libwccl/ops/functions/setops.h +++ b/libwccl/ops/functions/setops.h @@ -89,7 +89,7 @@ protected: template <> inline FunctionBase::BaseRetValPtr SetUnion<TSet>::apply_internal(const FunExecContext& context) const { Corpus2::Tag out; - foreach(boost::shared_ptr< Function<TSet> > expression, *expressions_) { + BOOST_FOREACH (boost::shared_ptr< Function<TSet> > expression, *expressions_) { Corpus2::Tag s = expression->apply(context)->get_value(); out.combine_with(s); } @@ -106,7 +106,7 @@ FunctionBase::BaseRetValPtr SetUnion<StrSet>::apply_internal(const FunExecContex for (size_t i = 1; i < expressions_->size(); ++i) { const boost::shared_ptr<const StrSet>& seti = (*expressions_)[i]->apply(context); - foreach (const UnicodeString& s, seti->contents()) { + BOOST_FOREACH (const UnicodeString& s, seti->contents()) { out->insert(s); } } @@ -147,7 +147,7 @@ FunctionBase::BaseRetValPtr SetIntersection<StrSet>::apply_internal(const FunExe const boost::shared_ptr<const StrSet>& smallest_set = (*expressions_)[smallest]->apply(context); //for each element in smallest set - foreach (const UnicodeString& s, smallest_set->contents()) { + BOOST_FOREACH (const UnicodeString& s, smallest_set->contents()) { bool everywhere = true; // find if every other set contains this element for (size_t i = 0; i < expressions_->size() && everywhere; ++i) { diff --git a/libwccl/ops/functions/strset/affix.cpp b/libwccl/ops/functions/strset/affix.cpp index 2067bbe61758cf3e5db7ced312041a772b59997a..16298a600ab97d097fc56cf1af6221b84ee3e409 100644 --- a/libwccl/ops/functions/strset/affix.cpp +++ b/libwccl/ops/functions/strset/affix.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/functions/strset/affix.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { @@ -41,11 +41,11 @@ Affix::BaseRetValPtr Affix::apply_internal(const FunExecContext& context) const const boost::shared_ptr<const StrSet>& set = strset_expr_->apply(context); boost::shared_ptr<StrSet> a_set = boost::shared_ptr<StrSet>(new StrSet()); if(affix_length_ < 0) { - foreach(const UnicodeString& s, set->contents()) { + BOOST_FOREACH (const UnicodeString& s, set->contents()) { a_set->insert(UnicodeString(s).remove(0, s.length() + affix_length_)); } } else { - foreach(const UnicodeString& s, set->contents()) { + BOOST_FOREACH (const UnicodeString& s, set->contents()) { UnicodeString prefixed(s); prefixed.truncate(affix_length_); a_set->insert(prefixed); diff --git a/libwccl/ops/functions/strset/getlemmas.cpp b/libwccl/ops/functions/strset/getlemmas.cpp index 2f15281792af061f165bd7ebb29e0d841229c2f2..70ce49fe907d08c6a1849e90362a5e8a02283bba 100644 --- a/libwccl/ops/functions/strset/getlemmas.cpp +++ b/libwccl/ops/functions/strset/getlemmas.cpp @@ -39,7 +39,7 @@ GetLemmas::BaseRetValPtr GetLemmas::apply_internal(const FunExecContext& context return detail::DefaultFunction<StrSet>()->apply(context); } boost::shared_ptr<StrSet> u_set = boost::make_shared<StrSet>(); - foreach(const Corpus2::Lexeme& lexeme, sc.at(*pos)->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& lexeme, sc.at(*pos)->lexemes()) { u_set->insert(lexeme.lemma()); } return u_set; diff --git a/libwccl/ops/functions/strset/tolower.cpp b/libwccl/ops/functions/strset/tolower.cpp index d7ee4f06b890606946249d465b6472c3d1e7d22f..b4621539563dfc29787708ddd6422259d245ca95 100644 --- a/libwccl/ops/functions/strset/tolower.cpp +++ b/libwccl/ops/functions/strset/tolower.cpp @@ -35,7 +35,7 @@ ToLower::BaseRetValPtr ToLower::apply_internal(const FunExecContext& context) co const boost::shared_ptr<const StrSet >& set = strset_expr_->apply(context); boost::shared_ptr<StrSet > l_set = boost::make_shared<StrSet>(); //TODO: should tolower be a method of StrSet as well? - foreach(const UnicodeString& s, set->contents()) { + BOOST_FOREACH (const UnicodeString& s, set->contents()) { //TODO: what about locale? is default ok? should the context hold it? l_set->insert(UnicodeString(s).toLower()); } diff --git a/libwccl/ops/functions/strset/toupper.cpp b/libwccl/ops/functions/strset/toupper.cpp index 5797a52f6161ce3ff031e606767a15edc54f9fba..c4be599ae9df06d5dbda674508a72738a6b697b0 100644 --- a/libwccl/ops/functions/strset/toupper.cpp +++ b/libwccl/ops/functions/strset/toupper.cpp @@ -35,7 +35,7 @@ ToUpper::BaseRetValPtr ToUpper::apply_internal(const FunExecContext& context) co const boost::shared_ptr<const StrSet >& set = strset_expr_->apply(context); boost::shared_ptr<StrSet > u_set = boost::make_shared<StrSet>(); //TODO: should tolower be a method of StrSet as well? - foreach(const UnicodeString& s, set->contents()) { + BOOST_FOREACH (const UnicodeString& s, set->contents()) { //TODO: what about locale? is default ok? should the context hold it? u_set->insert(UnicodeString(s).toUpper()); } diff --git a/libwccl/ops/functions/tset/agrfilter.cpp b/libwccl/ops/functions/tset/agrfilter.cpp index 8158b894eb9bfa7ca8d790764e6ae1371a9a2521..c41a41fb016d4065a443cdebeb11cc5f3d307aba 100644 --- a/libwccl/ops/functions/tset/agrfilter.cpp +++ b/libwccl/ops/functions/tset/agrfilter.cpp @@ -82,18 +82,18 @@ AgrFilter::BaseRetValPtr AgrFilter::apply_internal(const FunExecContext& context // does meet the weak agreement. // For each agreement we take symbols that define the // agreement, sum them up, apply the filter mask, and return. - foreach (const Corpus2::Lexeme& t1_lex, t1->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& t1_lex, t1->lexemes()) { const Corpus2::Tag& t1_tag = t1_lex.tag(); // don't bother checking t2 unless current t1_tag matches enough categories if (attribs->matching_categories(t1_tag) >= min_card) { - foreach (const Corpus2::Lexeme& t2_lex, t2->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& t2_lex, t2->lexemes()) { Corpus2::Tag inter = t1_tag.get_masked(t2_lex.tag()); // if the intersection matches enough categories we have agreement if (attribs->matching_categories(inter) >= min_card) { // Check if selected agreement is met by all remaining tokens bool agreement_met = true; for(int i = abs_left + 1; agreement_met && (i < abs_right); ++i) { - foreach(const Corpus2::Lexeme& i_lex, sc.at(i)->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& i_lex, sc.at(i)->lexemes()) { // Check if agreement is met, but taking into account // only categories actually matched in current tag, // without requirement to match all categories in the diff --git a/libwccl/ops/functions/tset/catfilter.cpp b/libwccl/ops/functions/tset/catfilter.cpp index 4e09f76731ab7caa114b4c84e14184f394aac8b6..b7843707303ffef998b9158a96208388d7a1dbb0 100644 --- a/libwccl/ops/functions/tset/catfilter.cpp +++ b/libwccl/ops/functions/tset/catfilter.cpp @@ -53,7 +53,7 @@ CatFilter::BaseRetValPtr CatFilter::apply_internal(const FunExecContext& context boost::shared_ptr<TSet> tset = boost::make_shared<TSet>(); const Corpus2::Token* token = sc.at(*pos); - foreach (const Corpus2::Lexeme& lexeme, token->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& lexeme, token->lexemes()) { if (!lexeme.tag().get_masked(selector).is_null()) { tset->combine_with(lexeme.tag()); } diff --git a/libwccl/ops/functions/tset/getsymbols.cpp b/libwccl/ops/functions/tset/getsymbols.cpp index 35b72c2500fe8426164f7462a19d312008340a3f..3079c46eb237cf1e44da8eae38d2d340a2e9b548 100644 --- a/libwccl/ops/functions/tset/getsymbols.cpp +++ b/libwccl/ops/functions/tset/getsymbols.cpp @@ -51,7 +51,7 @@ GetSymbols::BaseRetValPtr GetSymbols::apply_internal(const FunExecContext& conte boost::shared_ptr<TSet> tset = boost::make_shared<TSet>(); const Corpus2::Token* token = sc.at(*pos); - foreach (const Corpus2::Lexeme& lexeme, token->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& lexeme, token->lexemes()) { tset->combine_with(lexeme.tag()); } tset->contents().mask_with(mask_); diff --git a/libwccl/ops/functions/tset/getsymbolsinrange.cpp b/libwccl/ops/functions/tset/getsymbolsinrange.cpp index 1c0ca1af50bc147ef64a83df364f0700d33b86e1..6c309003c2f58549be9e75ca40b10a435f993f88 100644 --- a/libwccl/ops/functions/tset/getsymbolsinrange.cpp +++ b/libwccl/ops/functions/tset/getsymbolsinrange.cpp @@ -57,7 +57,7 @@ GetSymbolsInRange::BaseRetValPtr GetSymbolsInRange::apply_internal(const FunExec boost::shared_ptr<TSet> tset = boost::make_shared<TSet>(); for(int abs_pos = abs_begin; abs_pos <= abs_end; abs_pos++) { const Corpus2::Token* token = sc.at(abs_pos); - foreach (const Corpus2::Lexeme& lexeme, token->lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& lexeme, token->lexemes()) { tset->combine_with(lexeme.tag()); } } diff --git a/libwccl/ops/match/applyoperator.cpp b/libwccl/ops/match/applyoperator.cpp index 7c3b772fc941d24576c5f2c27a913c39e9dc8f7e..0d9afed441fde9f99a6b5c6429a7e414c0cacd05 100644 --- a/libwccl/ops/match/applyoperator.cpp +++ b/libwccl/ops/match/applyoperator.cpp @@ -19,7 +19,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <libwccl/values/match.h> #include <libwccl/ops/match/conditions/conjconditions.h> #include <libwccl/ops/match/matchaction.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { namespace Matching { @@ -62,7 +62,7 @@ void ApplyOperator::execute(const ActionExecContext &context) const should_act = (*apply_conditions_)[i]->apply(context)->get_value(); } if (should_act) { - foreach (const boost::shared_ptr<MatchAction>& action, *actions_) { + BOOST_FOREACH (const boost::shared_ptr<MatchAction>& action, *actions_) { action->execute(context); } } diff --git a/libwccl/ops/match/conditions/conjconditions.cpp b/libwccl/ops/match/conditions/conjconditions.cpp index 0b193c5aba9ed847e98d31dad73d580731b3cfae..540460497658f4da0cea787c166a194b102b76e4 100644 --- a/libwccl/ops/match/conditions/conjconditions.cpp +++ b/libwccl/ops/match/conditions/conjconditions.cpp @@ -17,7 +17,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <libwccl/ops/match/conditions/conjconditions.h> #include <libwccl/values/matchvector.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <sstream> namespace Wccl { @@ -34,7 +34,7 @@ MatchResult ConjConditions::apply(const ActionExecContext& context) const boost::shared_ptr<MatchVector> matches(new MatchVector()); int orig_pos = context.sentence_context().get_position(); - foreach (const boost::shared_ptr<const MatchCondition>& cond, _conditions) { + BOOST_FOREACH (const boost::shared_ptr<const MatchCondition>& cond, _conditions) { MatchResult res = cond->apply(context); if(res.matched()) { matches->append(res.get_match()); diff --git a/libwccl/ops/match/conditions/longest.cpp b/libwccl/ops/match/conditions/longest.cpp index 82ebc5789d5d6a13ff46927c32be66199c9a0d62..c29392838e99abc3d8c61dde21a7c4267bea45f5 100644 --- a/libwccl/ops/match/conditions/longest.cpp +++ b/libwccl/ops/match/conditions/longest.cpp @@ -18,7 +18,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <libwccl/ops/match/conditions/longest.h> #include <libwccl/values/matchvector.h> #include <sstream> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { namespace Matching { @@ -36,7 +36,7 @@ MatchResult Longest::apply(const ActionExecContext& context) const int longest_pos = orig_pos; MatchResult longest; - foreach(const boost::shared_ptr<ConjConditions>& variant, *_variants) { + BOOST_FOREACH (const boost::shared_ptr<ConjConditions>& variant, *_variants) { MatchResult res = variant->apply(context); int cur_pos = context.sentence_context().get_position(); if (res.matched() && longest_pos < cur_pos) { diff --git a/libwccl/ops/match/conditions/oneof.cpp b/libwccl/ops/match/conditions/oneof.cpp index ebfd5eceb28645fb2e764a0472a82ee64635a40f..68d134e0405fbbc5ffb62b77faeeec5f73142334 100644 --- a/libwccl/ops/match/conditions/oneof.cpp +++ b/libwccl/ops/match/conditions/oneof.cpp @@ -18,7 +18,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <libwccl/ops/match/conditions/oneof.h> #include <libwccl/values/matchvector.h> #include <sstream> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { namespace Matching { @@ -33,7 +33,7 @@ OneOf::OneOf(const boost::shared_ptr<std::vector<boost::shared_ptr<ConjCondition MatchResult OneOf::apply(const ActionExecContext& context) const { int orig_pos = context.sentence_context().get_position(); - foreach(const boost::shared_ptr<ConjConditions>& variant, *_variants) { + BOOST_FOREACH (const boost::shared_ptr<ConjConditions>& variant, *_variants) { MatchResult res = variant->apply(context); if (res.matched()) { return res; diff --git a/libwccl/ops/matchrulesequence.cpp b/libwccl/ops/matchrulesequence.cpp index 9dec193146efcb5c9199e52a41e0dcf465cb85a2..8008234084a6fda785c6a86dad30cf74e3d97b9c 100644 --- a/libwccl/ops/matchrulesequence.cpp +++ b/libwccl/ops/matchrulesequence.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/matchrulesequence.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <boost/shared_ptr.hpp> @@ -31,7 +31,7 @@ void MatchRuleSequence::apply_all( "sentence", "Received an empty sentence."); } - foreach (MatchRule& rule, *this) { + BOOST_FOREACH (MatchRule& rule, *this) { rule.apply(sentence); } } diff --git a/libwccl/ops/opsequence.cpp b/libwccl/ops/opsequence.cpp index abbfc7f9a8df6c36ec5e348655331fe3955ee788..45a04597560e69cc8b6ef126b60f1bcc25eba3c2 100644 --- a/libwccl/ops/opsequence.cpp +++ b/libwccl/ops/opsequence.cpp @@ -67,7 +67,7 @@ UntypedOpSequence::UntypedOpSequence(const UntypedOpSequence& seq) : FunctionalOpSequence(seq.name_), ops_(seq.size()) { - foreach(const fun_op_ptr_t& op, seq.ops_) { + BOOST_FOREACH (const fun_op_ptr_t& op, seq.ops_) { ops_.push_back(op->clone_ptr()); } } diff --git a/libwccl/ops/opsequence.h b/libwccl/ops/opsequence.h index 7459b4335ed0e757747cb4c351fa679c044eb5ec..ed3d8528644d0e52d8e8183194386d16011c3be2 100644 --- a/libwccl/ops/opsequence.h +++ b/libwccl/ops/opsequence.h @@ -23,7 +23,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <boost/lexical_cast.hpp> #include <boost/make_shared.hpp> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <libwccl/ops/operator.h> @@ -342,7 +342,7 @@ OpSequence<T>::OpSequence(const OpSequence<T>& seq) : FunctionalOpSequence(seq.name_), ops_(seq.size()) { - foreach(const op_ptr_t& op, seq.ops_) { + BOOST_FOREACH (const op_ptr_t& op, seq.ops_) { ops_.push_back(op->clone_ptr()); } } diff --git a/libwccl/ops/parsedexpression.h b/libwccl/ops/parsedexpression.h index ca65ea34a8c4bf95a10d047be9d25e4cf368c8c8..72865e900b7e62136168358eb226d93cfbfb178d 100644 --- a/libwccl/ops/parsedexpression.h +++ b/libwccl/ops/parsedexpression.h @@ -273,7 +273,7 @@ std::vector<std::string> ParsedExpression::valid_variable_names() const { std::vector<std::string> valid; typedef std::pair<std::string, boost::shared_ptr<Wccl::Value> > v_t; // ja chcę c++1x i auto/decltype - foreach (const v_t& v, variables_->get_all<Wccl::Value>()) { + BOOST_FOREACH (const v_t& v, variables_->get_all<Wccl::Value>()) { valid.push_back(v.first); } return valid; @@ -284,7 +284,7 @@ std::ostream& ParsedExpression::dump_variables( std::ostream &ostream, const Corpus2::Tagset &tagset) const { typedef std::pair<std::string, boost::shared_ptr<Wccl::Value> > v_t; - foreach (const v_t& v, variables_->get_all<Wccl::Value>()) { + BOOST_FOREACH (const v_t& v, variables_->get_all<Wccl::Value>()) { ostream << v.second->make_var_repr(v.first) << "=" << v.second->to_string(tagset) << "\n"; } diff --git a/libwccl/ops/tagactions/delete.cpp b/libwccl/ops/tagactions/delete.cpp index 8da00d62d864d56f649e9ac7b92970feeb5d1ded..aec09de4a93efd8597e2f5062655d03a9af2c033 100644 --- a/libwccl/ops/tagactions/delete.cpp +++ b/libwccl/ops/tagactions/delete.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/tagactions/delete.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <sstream> namespace Wccl { @@ -30,7 +30,7 @@ Bool Delete::execute(const ActionExecContext& context) const std::vector<Corpus2::Lexeme> original(token.lexemes()); std::vector<Corpus2::Lexeme> remaining; token.lexemes().clear(); - foreach (const Corpus2::Lexeme& lexeme, original) { + BOOST_FOREACH (const Corpus2::Lexeme& lexeme, original) { token.add_lexeme(lexeme); if (!condition_->apply(context)->get_value()) { remaining.push_back(lexeme); diff --git a/libwccl/ops/tagactions/mark.cpp b/libwccl/ops/tagactions/mark.cpp index 09b44fef48d068d755210c41fc9dbd69cb7b70d8..4ee214f2f0334a27eeeff901ef1180c1cda37ead 100644 --- a/libwccl/ops/tagactions/mark.cpp +++ b/libwccl/ops/tagactions/mark.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/tagactions/mark.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <libcorpus2/ann/annotatedsentence.h> #include <sstream> diff --git a/libwccl/ops/tagactions/relabel.cpp b/libwccl/ops/tagactions/relabel.cpp index fcda4d34e95bd0e379f66ab847d577bf1b39671e..b63180c0c0f00aeea653522073f04c02eafde281 100644 --- a/libwccl/ops/tagactions/relabel.cpp +++ b/libwccl/ops/tagactions/relabel.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/tagactions/relabel.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <sstream> namespace Wccl { @@ -30,7 +30,7 @@ Bool Relabel::execute(const ActionExecContext& context) const Corpus2::Token& token = *context.sentence_context().at(abs_pos); std::vector<Corpus2::Lexeme> original(token.lexemes()); token.lexemes().clear(); - foreach (Corpus2::Lexeme& lexeme, original) { + BOOST_FOREACH (Corpus2::Lexeme& lexeme, original) { token.add_lexeme(lexeme); if ((lexeme.tag().get_pos() != replace_wclass) && condition_->apply(context)->get_value()) { changed.set_value(true); diff --git a/libwccl/ops/tagactions/select.cpp b/libwccl/ops/tagactions/select.cpp index b4455c26b623e9e5296f33cdcbf24a64ff0fb083..7053bd0e4a2c77b5cdf1e917d4080cb6a9c19658 100644 --- a/libwccl/ops/tagactions/select.cpp +++ b/libwccl/ops/tagactions/select.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/tagactions/select.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <sstream> namespace Wccl { @@ -30,7 +30,7 @@ Bool Select::execute(const ActionExecContext& context) const std::vector<Corpus2::Lexeme> original(token.lexemes()); std::vector<Corpus2::Lexeme> remaining; token.lexemes().clear(); - foreach (const Corpus2::Lexeme& lexeme, original) { + BOOST_FOREACH (const Corpus2::Lexeme& lexeme, original) { token.add_lexeme(lexeme); if (condition_->apply(context)->get_value()) { remaining.push_back(lexeme); diff --git a/libwccl/ops/tagactions/unify.cpp b/libwccl/ops/tagactions/unify.cpp index 3d0333472ec3e7ef51d3325dd546e9f8dc781141..78c93a5125118d5475f34b55f0ff946e00099fb7 100644 --- a/libwccl/ops/tagactions/unify.cpp +++ b/libwccl/ops/tagactions/unify.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/tagactions/unify.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <sstream> namespace Wccl { @@ -49,7 +49,7 @@ Bool Unify::execute(const ActionExecContext& context) const Corpus2::Token& curr_tok = *sc.at(i); std::vector<Corpus2::Lexeme> remaining; std::vector<Corpus2::Lexeme> underspecified; - foreach(Corpus2::Lexeme& lexeme, curr_tok.lexemes()) { + BOOST_FOREACH (Corpus2::Lexeme& lexeme, curr_tok.lexemes()) { if (attribs->matching_categories(lexeme.tag()) > 0) { remaining.push_back(lexeme); } else { @@ -73,9 +73,9 @@ Bool Unify::execute(const ActionExecContext& context) const const std::vector<Corpus2::Lexeme>& prev_rem = remainings[previous]; std::vector<Corpus2::Lexeme> curr_rem; // get only lexemes that agree with a lexeme from previous token - foreach(const Corpus2::Lexeme& curr_lex, remainings[i]) { + BOOST_FOREACH (const Corpus2::Lexeme& curr_lex, remainings[i]) { int curr_match_cats = attribs->matching_categories(curr_lex.tag()); - foreach(const Corpus2::Lexeme& prev_lex, prev_rem) { + BOOST_FOREACH (const Corpus2::Lexeme& prev_lex, prev_rem) { Corpus2::Tag inter = curr_lex.tag().get_masked(prev_lex.tag()); int min_to_match = std::min( curr_match_cats, @@ -110,7 +110,7 @@ Bool Unify::execute(const ActionExecContext& context) const std::vector<Corpus2::Lexeme>& lexemes = sc.at(i + abs_left)->lexemes(); lexemes = remainings[i]; // underspecced lexemes meet agreement too, so leave them in the end, if any - foreach (const Corpus2::Lexeme& lex, underspecifieds[i]) { + BOOST_FOREACH (const Corpus2::Lexeme& lex, underspecifieds[i]) { lexemes.push_back(lex); } } diff --git a/libwccl/ops/tagactions/unmark.cpp b/libwccl/ops/tagactions/unmark.cpp index 2b3e0364cd9ba9ef8f4607c77928053d2089369e..1522496a2f037ac3f9ad04635fa067b57763b7d3 100644 --- a/libwccl/ops/tagactions/unmark.cpp +++ b/libwccl/ops/tagactions/unmark.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/tagactions/unmark.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <libcorpus2/ann/annotatedsentence.h> #include <sstream> diff --git a/libwccl/ops/tagrule.cpp b/libwccl/ops/tagrule.cpp index e8e04656bf0bb4cfb4c25683a12ea08a47e9b27c..cbba9f75ac89f059273fdd54d8e13a9608e022a6 100644 --- a/libwccl/ops/tagrule.cpp +++ b/libwccl/ops/tagrule.cpp @@ -35,7 +35,7 @@ Bool TagRule::execute(SentenceContext &sentence_context) Bool changed(false); ActionExecContext aec(sentence_context, variables_); if(condition_->apply(aec)->get_value()) { - foreach(const boost::shared_ptr<TagAction>& action, *actions_) { + BOOST_FOREACH (const boost::shared_ptr<TagAction>& action, *actions_) { if(action->execute(aec).get_value()) { changed.set_value(true); } @@ -56,7 +56,7 @@ std::string TagRule::to_string(const Corpus2::Tagset &tagset) const { std::ostringstream os; os << "rule(\"" << name_ << "\", " << condition_->to_string(tagset); - foreach(const boost::shared_ptr<TagAction>& action, *actions_) { + BOOST_FOREACH (const boost::shared_ptr<TagAction>& action, *actions_) { os << ", " << action->to_string(tagset); } os << ")"; @@ -65,7 +65,7 @@ std::string TagRule::to_string(const Corpus2::Tagset &tagset) const std::ostream& TagRule::write_to(std::ostream& os) const { os << "rule(\"" << name_ << "\", " << *condition_; - foreach(const boost::shared_ptr<TagAction>& action, *actions_) { + BOOST_FOREACH (const boost::shared_ptr<TagAction>& action, *actions_) { os << ", " << *action; } os << ")"; diff --git a/libwccl/ops/tagrulesequence.cpp b/libwccl/ops/tagrulesequence.cpp index 3fb69ed98b2f3a78a0cc6f107154d5053a4c613e..de496982062ead9205906c4f5f7d6e94a3750113 100644 --- a/libwccl/ops/tagrulesequence.cpp +++ b/libwccl/ops/tagrulesequence.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/ops/tagrulesequence.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { @@ -31,7 +31,7 @@ Bool TagRuleSequence::execute_once(const boost::shared_ptr<Corpus2::Sentence>& s Bool changed(false); SentenceContext sc(sentence); while(sc.is_current_inside()) { - foreach (TagRule& rule, *this) { + BOOST_FOREACH (TagRule& rule, *this) { if (rule.execute(sc).get_value()) { changed.set_value(true); } diff --git a/libwccl/values/matchvector.cpp b/libwccl/values/matchvector.cpp index 361d0f9030f95c899c8034ebfa168e24e5bcf343..20f6748e6fc48db53c8cb7685dd632ecc788be06 100644 --- a/libwccl/values/matchvector.cpp +++ b/libwccl/values/matchvector.cpp @@ -17,7 +17,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <libwccl/values/matchvector.h> #include <libwccl/values/match.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <sstream> #include <libwccl/exception.h> @@ -28,7 +28,7 @@ std::string MatchVector::to_raw_string() const std::stringstream ss; ss << "MATCH("; bool comma = false; - foreach (const boost::shared_ptr<Match>& m, matches_) { + BOOST_FOREACH (const boost::shared_ptr<Match>& m, matches_) { if (comma) { ss << ","; } @@ -82,7 +82,7 @@ int MatchVector::last_token(const boost::shared_ptr<Corpus2::AnnotatedSentence>& bool MatchVector::empty() const { - foreach (const boost::shared_ptr<Match>& m, matches_) { + BOOST_FOREACH (const boost::shared_ptr<Match>& m, matches_) { if (!m->empty()) { return false; } diff --git a/libwccl/values/strset.cpp b/libwccl/values/strset.cpp index b2101b063650050f0e1978f1ae60de9d0dddb1cc..5409c0bd9f7a8fdb065842597bddce0062b280b5 100644 --- a/libwccl/values/strset.cpp +++ b/libwccl/values/strset.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/values/strset.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <libpwrutils/util.h> #include <sstream> #include <boost/algorithm/string.hpp> @@ -129,7 +129,7 @@ bool StrSet::intersects(const StrSet &other) const { //the larger than it is to do the opposite, hence the &?: below. const value_type& smaller = size() < other.size() ? set_ : other.set_; const value_type& bigger = size() < other.size() ? other.set_ : set_; - foreach (const UnicodeString& u, smaller) { + BOOST_FOREACH (const UnicodeString& u, smaller) { if (bigger.find(u) != bigger.end()) { return true; } @@ -142,7 +142,7 @@ bool StrSet::is_subset_of(const StrSet &other) const if (size() > other.size()) { return false; } - foreach (const UnicodeString& u, set_) { + BOOST_FOREACH (const UnicodeString& u, set_) { if (other.set_.find(u) == other.set_.end()) { return false; } diff --git a/libwccl/values/tset.cpp b/libwccl/values/tset.cpp index a310c0c46dd27b2263f84b2d988882a08e65b236..bbb7050bfe0e9dd1163e3f89f98e360dbed9715a 100644 --- a/libwccl/values/tset.cpp +++ b/libwccl/values/tset.cpp @@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. */ #include <libwccl/values/tset.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <libpwrutils/bitset.h> #include <boost/algorithm/string.hpp> @@ -46,7 +46,7 @@ std::string TSet::var_repr(const std::string &var_name) int TSet::categories_count(const Corpus2::Tagset& tagset) const { int cats = (tag_.get_pos().any()) ? 1 : 0; - foreach (const Corpus2::mask_t& mask, tagset.all_attribute_masks()) { + BOOST_FOREACH (const Corpus2::mask_t& mask, tagset.all_attribute_masks()) { if (tag_.get_values_for(mask).any()) { ++cats; } diff --git a/libwccl/variables.cpp b/libwccl/variables.cpp index 3c90ae683cf75cce70f480683822e0dcf4ca7940..195287c3744ab7fbc5bca264ec1f00790e256418 100644 --- a/libwccl/variables.cpp +++ b/libwccl/variables.cpp @@ -97,7 +97,7 @@ struct resethelper template<typename T> void operator()(const boost::mpl::always<T>&) { typedef std::pair< std::string, boost::shared_ptr<T> > v_t; - foreach (const v_t& a, v.get_all<T>()) { + BOOST_FOREACH (const v_t& a, v.get_all<T>()) { *a.second = T(); } } @@ -124,7 +124,7 @@ struct clonehelper void operator()(const boost::mpl::always<T>&) { vto.access<T>() = vfrom.get_all<T>(); typedef typename detail::Vmap<T>::map_t::value_type value_type; - foreach (const value_type& a, vto.access<T>()) { + BOOST_FOREACH (const value_type& a, vto.access<T>()) { vto.vars.put(a.first, *a.second); } } diff --git a/libwccl/wcclfile.cpp b/libwccl/wcclfile.cpp index 5bc41508e47b509399f1b102a97abb08ca79a62b..88265298ace16a90d598bf77975d19995a26b35e 100644 --- a/libwccl/wcclfile.cpp +++ b/libwccl/wcclfile.cpp @@ -22,7 +22,7 @@ namespace Wccl { FunctionalOpSequence::name_op_v_t WcclFile::gen_all_op_pairs() { FunctionalOpSequence::name_op_v_t v; - foreach(const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) { + BOOST_FOREACH (const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) { s->add_name_op_pairs_untyped(v); } return v; @@ -31,7 +31,7 @@ FunctionalOpSequence::name_op_v_t WcclFile::gen_all_op_pairs() FunctionalOpSequence::name_op_v_c_t WcclFile::gen_all_op_pairs() const { FunctionalOpSequence::name_op_v_c_t v; - foreach(const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) { + BOOST_FOREACH (const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) { s->add_name_op_pairs_untyped(v); } return v; @@ -72,12 +72,12 @@ boost::shared_ptr<const Matching::MatchRuleSequence> WcclFile::get_match_rules_p std::ostream& WcclFile::write_to(std::ostream& os) const { if (has_lexicons()) { - foreach(const Lexicons::map_t::value_type& v, lexicons_->get_lexicons()) { + BOOST_FOREACH (const Lexicons::map_t::value_type& v, lexicons_->get_lexicons()) { os << "import(\"" << v.second->file_name() << ", \"" << v.second->name() << "\")\n"; } } - foreach(const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) { + BOOST_FOREACH (const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) { os << s->to_string(tagset_) << '\n'; } if (has_tag_rules()) { diff --git a/libwccl/wcclfileopsections.h b/libwccl/wcclfileopsections.h index eb6a843341f0e0dee4112c85442cbd233745be40..4f242adcb5d7f3bed66a5d946e8090ab51bdd4e7 100644 --- a/libwccl/wcclfileopsections.h +++ b/libwccl/wcclfileopsections.h @@ -20,7 +20,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <libwccl/ops/opsequence.h> #include <boost/unordered_map.hpp> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> namespace Wccl { @@ -117,7 +117,7 @@ template<class T> inline std::vector<std::string> WcclFileOpSections<T>::section_names() const { std::vector<std::string> v; - foreach(const ptr_t& section, sections_) { + BOOST_FOREACH (const ptr_t& section, sections_) { v.push_back(section->name()); } return v; @@ -158,7 +158,7 @@ const T& WcclFileOpSections<T>::get_section(const std::string& name) const template<class T> inline typename T::name_op_v_t& WcclFileOpSections<T>::add_name_op_pairs(name_op_v_t& pairs) { - foreach(const ptr_t& section, sections_) { + BOOST_FOREACH (const ptr_t& section, sections_) { section->add_name_op_pairs(pairs); } return pairs; @@ -167,7 +167,7 @@ typename T::name_op_v_t& WcclFileOpSections<T>::add_name_op_pairs(name_op_v_t& p template<class T> inline typename T::name_op_v_c_t& WcclFileOpSections<T>::add_name_op_pairs(name_op_v_c_t& pairs) const { - foreach(const ptr_t& section, sections_) { + BOOST_FOREACH (const ptr_t& section, sections_) { section->add_name_op_pairs(pairs); } return pairs; @@ -177,7 +177,7 @@ template<class T> inline typename T::name_op_v_t WcclFileOpSections<T>::gen_name_op_pairs() { name_op_v_t pairs; - foreach(const ptr_t& section, sections_) { + BOOST_FOREACH (const ptr_t& section, sections_) { section->add_name_op_pairs(pairs); } return pairs; @@ -187,7 +187,7 @@ template<class T> inline typename T::name_op_v_c_t WcclFileOpSections<T>::gen_name_op_pairs() const { name_op_v_c_t pairs; - foreach(const ptr_t& section, sections_) { + BOOST_FOREACH (const ptr_t& section, sections_) { section->add_name_op_pairs(pairs); } return pairs; diff --git a/tests/datadriven.cpp b/tests/datadriven.cpp index dfc993c830395f1c0f425453f3dc13f6c5593b79..d94dbeb363580bf0f768c0ffef02489c5d6c45ff 100644 --- a/tests/datadriven.cpp +++ b/tests/datadriven.cpp @@ -18,7 +18,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include "datadriven.h" #include <libpwrutils/util.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <libpwrutils/pathsearch.h> #include <libcorpus2/util/settings.h> #include <libcorpus2/tagsetmanager.h> @@ -182,7 +182,7 @@ int init_subdir(const path& dir, std::string ps, std::vector<compare_test>& test } } } - foreach (const std::string& s, txt_tests) { + BOOST_FOREACH (const std::string& s, txt_tests) { compare_test c; c.in_file = s; c.search_path = dir; @@ -194,7 +194,7 @@ int init_subdir(const path& dir, std::string ps, std::vector<compare_test>& test << " in " << dir << " [" << ps << "]" ); - foreach (const path& s, subdirs) { + BOOST_FOREACH (const path& s, subdirs) { count += init_subdir(s, ps, tests); } return count; @@ -222,7 +222,7 @@ void init_data_suite(boost::unit_test::test_suite *ts, const std::string& path) } std::vector<compare_test> compares; init_subdir(subdir_name, "", compares); - foreach (const compare_test& ci, compares) { + BOOST_FOREACH (const compare_test& ci, compares) { std::string rel_path = boost::algorithm::replace_first_copy( ci.in_file.string(), subdir_name, ""); std::string name = "data_test:" + rel_path; diff --git a/tests/datarule.cpp b/tests/datarule.cpp index 9b3ee31eee507f764106fa8b4f93683a484394aa..b265ae2479ff113252adb14d030184b9eba31f11 100644 --- a/tests/datarule.cpp +++ b/tests/datarule.cpp @@ -20,7 +20,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <antlr/RecognitionException.hpp> #include <libpwrutils/util.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <libpwrutils/pathsearch.h> #include <libcorpus2/util/settings.h> #include <libcorpus2/tagsetmanager.h> @@ -148,7 +148,7 @@ void check_sentences(int sentence_i, const Corpus2::Tagset& tagset, expected_annotated = boost::dynamic_pointer_cast<Corpus2::AnnotatedSentence>(expected_sentence); if (expected_annotated) { BOOST_REQUIRE(annotated); - foreach (const Corpus2::AnnotatedSentence::chan_map_t::value_type& v, expected_annotated->all_channels()) { + BOOST_FOREACH (const Corpus2::AnnotatedSentence::chan_map_t::value_type& v, expected_annotated->all_channels()) { std::string channel_name = v.first; BOOST_REQUIRE_MESSAGE(annotated->has_channel(channel_name), "Expected channel " + channel_name); const Corpus2::AnnotationChannel& expected_channel = v.second; @@ -237,7 +237,7 @@ int init_subdir(const path& dir, std::string ps, std::vector<rule_compare_test>& } } } - foreach (const path& s, txt_tests) { + BOOST_FOREACH (const path& s, txt_tests) { path o = s; o.replace_extension(".out.xml"); if (boost::filesystem::is_regular_file(o)) { @@ -257,7 +257,7 @@ int init_subdir(const path& dir, std::string ps, std::vector<rule_compare_test>& << " in " << dir << " [" << ps << "]" ); - foreach (const path& s, subdirs) { + BOOST_FOREACH (const path& s, subdirs) { count += init_subdir(s, ps, tests, status); } return count; @@ -292,7 +292,7 @@ void init_data_rule_suite(boost::unit_test::test_suite *ts, const std::string& p } std::vector<rule_compare_test> compares; init_subdir(subdir_name, "", compares); - foreach (const rule_compare_test& ci, compares) { + BOOST_FOREACH (const rule_compare_test& ci, compares) { std::string rel_path = boost::algorithm::replace_first_copy( ci.rule_file.string(), subdir_name, ""); std::string name = "rule_data_test:" + rel_path; diff --git a/tests/varaccess.cpp b/tests/varaccess.cpp index 8e13b6534d3a1947cdf4dade448908bd4f8f4d97..9a296a7e8e492ec887734868fbfb9e9b10b9bff7 100644 --- a/tests/varaccess.cpp +++ b/tests/varaccess.cpp @@ -21,7 +21,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <libwccl/variables.h> #include <libwccl/values/position.h> -#include <libpwrutils/foreach.h> +#include <boost/foreach.hpp> #include <iostream> @@ -52,7 +52,7 @@ BOOST_FIXTURE_TEST_CASE(access, VAfx) vnames.push_back("b"); vnames.push_back("c"); vnames.push_back("bb"); - foreach (const std::string vn, vnames) { + BOOST_FOREACH (const std::string vn, vnames) { VariableAccessor<Bool> a1 = v->create_accessor<Bool>(vn); BOOST_CHECK(v->get_fast(a1) == v->get<Bool>(vn)); v->set("a", Bool(false)); diff --git a/tests/variables.cpp b/tests/variables.cpp index 04da61b669dbe16b936bb665607c5f468e8ec8e7..5a1c5d30a906f6a285beef07051f4ca7657ed467 100644 --- a/tests/variables.cpp +++ b/tests/variables.cpp @@ -166,7 +166,7 @@ BOOST_FIXTURE_TEST_CASE(del_variable, Vfix) BOOST_FIXTURE_TEST_CASE(get_all, Vfix) { std::set<std::string> names; - foreach (const detail::Vmap<Value>::map_t::value_type& a, v.get_all<Bool>()) { + BOOST_FOREACH (const detail::Vmap<Value>::map_t::value_type& a, v.get_all<Bool>()) { names.insert(a.first); } std::set<std::string> expected; @@ -174,7 +174,7 @@ BOOST_FIXTURE_TEST_CASE(get_all, Vfix) expected.insert("b2"); BOOST_CHECK_EQUAL_COLLECTIONS(names.begin(), names.end(), expected.begin(), expected.end()); names.clear(); - foreach (const detail::Vmap<Value>::map_t::value_type& a, v.get_all<Value>()) { + BOOST_FOREACH (const detail::Vmap<Value>::map_t::value_type& a, v.get_all<Value>()) { names.insert(a.first); } expected.insert("p1"); @@ -199,7 +199,7 @@ BOOST_FIXTURE_TEST_CASE(clone, Vfix) BOOST_CHECK_EQUAL(v.size<Value>(), copy->size<Value>()); BOOST_CHECK_EQUAL(v.size<Bool>(), copy->size<Bool>()); BOOST_CHECK_EQUAL(v.size<Position>(), copy->size<Position>()); - foreach (const detail::Vmap<Value>::map_t::value_type& a, v.get_all<Value>()) { + BOOST_FOREACH (const detail::Vmap<Value>::map_t::value_type& a, v.get_all<Value>()) { boost::shared_ptr<Value> orig = a.second; std::string name = a.first; boost::shared_ptr<Value> other = copy->get<Value>(name); @@ -207,7 +207,7 @@ BOOST_FIXTURE_TEST_CASE(clone, Vfix) BOOST_CHECK(orig != other); BOOST_CHECK_EQUAL(orig->to_raw_string(), other->to_raw_string()); } - foreach (const detail::Vmap<Bool>::map_t::value_type& a, v.get_all<Bool>()) { + BOOST_FOREACH (const detail::Vmap<Bool>::map_t::value_type& a, v.get_all<Bool>()) { boost::shared_ptr<Bool> orig = a.second; std::string name = a.first; boost::shared_ptr<Bool> other = copy->get<Bool>(name); @@ -215,7 +215,7 @@ BOOST_FIXTURE_TEST_CASE(clone, Vfix) BOOST_CHECK(orig != other); BOOST_CHECK_EQUAL(orig->get_value(), other->get_value()); } - foreach (const detail::Vmap<Position>::map_t::value_type& a, v.get_all<Position>()) { + BOOST_FOREACH (const detail::Vmap<Position>::map_t::value_type& a, v.get_all<Position>()) { boost::shared_ptr<Position> orig = a.second; std::string name = a.first; boost::shared_ptr<Position> other = copy->get<Position>(name); diff --git a/wccl-apps/wccl-features.cpp b/wccl-apps/wccl-features.cpp index fa43f86cdc9551130d0345362e9cb65105084880..5f891b6cb5ef676780ff138ecd7594a52e55437c 100644 --- a/wccl-apps/wccl-features.cpp +++ b/wccl-apps/wccl-features.cpp @@ -190,7 +190,7 @@ int FeatureRunner::load_operator_string(const std::string &line) Corpus2::Tag tag = tagset_.parse_symbol_string(what[2]); std::vector<std::string> sym = tagset_.tag_to_symbol_string_vector(tag, false); std::set<Corpus2::Tag> t; - foreach (const std::string& s, sym) { + BOOST_FOREACH (const std::string& s, sym) { t.insert(tagset_.parse_symbol(s)); } tset_ops_.insert(std::make_pair(name, std::make_pair(t, @@ -216,17 +216,17 @@ void FeatureRunner::print_header_body(const std::string& attribute_prefix, bool nos /*=false*/) { if (!nos) { - foreach (const str_ops_map_t::value_type v, str_ops_) { + BOOST_FOREACH (const str_ops_map_t::value_type v, str_ops_) { std::cout << "@ATTRIBUTE " << attribute_prefix << v.first << " string\n"; } } - foreach (const bool_ops_map_t::value_type v, bool_ops_) { + BOOST_FOREACH (const bool_ops_map_t::value_type v, bool_ops_) { std::cout << "@ATTRIBUTE " << attribute_prefix << v.first << " {0,1}\n"; } - foreach (const tset_ops_map_t::value_type v, tset_ops_) { - foreach (const Corpus2::Tag& tag, v.second.first) { + BOOST_FOREACH (const tset_ops_map_t::value_type v, tset_ops_) { + BOOST_FOREACH (const Corpus2::Tag& tag, v.second.first) { std::cout << "@ATTRIBUTE " << attribute_prefix << v.first << "_" << tagset_.tag_to_symbol_string(tag) << " {0,1}\n"; @@ -241,7 +241,7 @@ void FeatureRunner::print_header_foot() void FeatureRunner::print_data(const std::vector<std::vector<std::string> > &data) { - foreach (const std::vector<std::string>& feats, data) { + BOOST_FOREACH (const std::vector<std::string>& feats, data) { std::cout << boost::algorithm::join(feats, ",") << "\n"; } } @@ -281,7 +281,7 @@ void FeatureRunner::do_sentence( assert(!sfeats.empty()); std::vector<std::string>& feats = sfeats[sc.get_position()]; if (!nos) { - foreach (const str_ops_map_t::value_type v, str_ops_) { + BOOST_FOREACH (const str_ops_map_t::value_type v, str_ops_) { boost::shared_ptr<const Wccl::StrSet> s = v.second->apply(sc); assert(s); if (s->contents().empty()) { @@ -294,7 +294,7 @@ void FeatureRunner::do_sentence( } } } - foreach (const bool_ops_map_t::value_type v, bool_ops_) { + BOOST_FOREACH (const bool_ops_map_t::value_type v, bool_ops_) { boost::shared_ptr<const Wccl::Bool> b = v.second->apply(sc); assert(b); if (*b) { @@ -303,10 +303,10 @@ void FeatureRunner::do_sentence( feats.push_back("0"); } } - foreach (const tset_ops_map_t::value_type v, tset_ops_) { + BOOST_FOREACH (const tset_ops_map_t::value_type v, tset_ops_) { boost::shared_ptr<const Wccl::TSet> t = v.second.second->apply(sc); assert(t); - foreach (const Corpus2::Tag& tag, v.second.first) { + BOOST_FOREACH (const Corpus2::Tag& tag, v.second.first) { if (!tag.get_masked(t->contents()).is_null()) { feats.push_back("1"); } else { @@ -358,7 +358,7 @@ void FeatureRunner::do_files(std::vector<std::string>& files, bool first) int processed = 0; do { std::vector<Corpus2::Sentence::Ptr> sentences; - foreach (const boost::shared_ptr<Corpus2::TokenReader>& r, readers) { + BOOST_FOREACH (const boost::shared_ptr<Corpus2::TokenReader>& r, readers) { Corpus2::Sentence::Ptr s = r->get_next_sentence(); if (s) { sentences.push_back(s); @@ -385,7 +385,7 @@ void FeatureRunner::do_files(std::vector<std::string>& files, bool first) for (size_t i = 0; i < gold_size; ++i) { std::set<Corpus2::Tag> gold_tags; const Corpus2::Token& gold_token = *(*sentences[0])[i]; - foreach (const Corpus2::Lexeme& gl, gold_token.disamb_lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& gl, gold_token.disamb_lexemes()) { gold_tags.insert(gl.tag()); } int wci = 0; @@ -393,7 +393,7 @@ void FeatureRunner::do_files(std::vector<std::string>& files, bool first) for (size_t si = 1; si < sentences.size(); ++si) { const Corpus2::Token& token = *(*sentences[si])[i]; bool wc = false; - foreach (const Corpus2::Lexeme& gl, token.lexemes()) { + BOOST_FOREACH (const Corpus2::Lexeme& gl, token.lexemes()) { if (gold_tags.find(gl.tag()) != gold_tags.end()) { wc = true; wci = si; @@ -406,7 +406,7 @@ void FeatureRunner::do_files(std::vector<std::string>& files, bool first) typedef std::pair<Corpus2::Tag, int> pp; int mv = 0; bool tie = false; - foreach (const pp& p, v) { + BOOST_FOREACH (const pp& p, v) { if (p.second == mv) { tie = true; } else if (p.second > mv) { @@ -494,7 +494,7 @@ int main(int argc, char** argv) return 0; } - foreach (const std::string& f, files) { + BOOST_FOREACH (const std::string& f, files) { if (f == "-") { corpus_stdin = true; } else if (boost::algorithm::ends_with(f, ".xml")) { @@ -510,7 +510,7 @@ int main(int argc, char** argv) try { const Corpus2::Tagset& tagset = Corpus2::get_named_tagset(tagset_load); FeatureRunner runner(tagset); - foreach (const std::string& f, operator_strings) { + BOOST_FOREACH (const std::string& f, operator_strings) { if (boost::algorithm::ends_with(f, ".ccl")) { if (!runner.load_more_operators(f)) { std::cerr << "Warning: error while parsing " << f << "\n"; diff --git a/wccl-apps/wccl-rules.cpp b/wccl-apps/wccl-rules.cpp index 5acc2801fa6d496ff3d254c6eed1925b5ee7dfcd..0f73b64de284dc79cd3625b9b22d67df629a15c4 100644 --- a/wccl-apps/wccl-rules.cpp +++ b/wccl-apps/wccl-rules.cpp @@ -138,7 +138,7 @@ void RuleRunner::apply_rules(boost::shared_ptr<Corpus2::TokenReader> reader, { Corpus2::TokenTimer& timer = Corpus2::global_timer(); while (boost::shared_ptr<Corpus2::Chunk> c = reader->get_next_chunk()) { - foreach (boost::shared_ptr<Corpus2::Sentence>& s, c->sentences()) { + BOOST_FOREACH (boost::shared_ptr<Corpus2::Sentence>& s, c->sentences()) { boost::shared_ptr<Corpus2::AnnotatedSentence> as; as = boost::dynamic_pointer_cast<Corpus2::AnnotatedSentence>(s); if (!as) { @@ -147,7 +147,7 @@ void RuleRunner::apply_rules(boost::shared_ptr<Corpus2::TokenReader> reader, return; } - foreach (boost::shared_ptr<Wccl::WcclFile>& f, parsed_files_) { + BOOST_FOREACH (boost::shared_ptr<Wccl::WcclFile>& f, parsed_files_) { if (f->has_tag_rules()) { if (tag_rule_iterations_ == 0) { f->get_tag_rules_ptr()->execute_once(as); @@ -253,7 +253,7 @@ int main(int argc, char** argv) return 0; } - foreach (const std::string& f, files) { + BOOST_FOREACH (const std::string& f, files) { if (f == "-") { corpus_stdin = true; } else if (boost::algorithm::ends_with(f, ".xml")) { @@ -285,7 +285,7 @@ int main(int argc, char** argv) if (!search_path.empty()) { runner.set_search_path(search_path); } - foreach (const std::string& file, ccl_files) { + BOOST_FOREACH (const std::string& file, ccl_files) { std::pair<int,int> res = runner.load_more_rules(file); if (res.first == 0 && res.second == 0) { std::cerr << "Warning: no rules loaded from " << file << "\n"; @@ -298,7 +298,7 @@ int main(int argc, char** argv) boost::shared_ptr<Corpus2::TokenWriter> writer; writer = Corpus2::TokenWriter::create_stream_writer(output_format, std::cout, tagset); boost::shared_ptr<Corpus2::TokenReader> reader; - foreach (std::string cf, corpora_files) { + BOOST_FOREACH (std::string cf, corpora_files) { reader = Corpus2::TokenReader::create_path_reader(input_format, tagset, cf); reader->set_option("ann"); runner.apply_rules(reader, writer); diff --git a/wccl-apps/wccl-run.cpp b/wccl-apps/wccl-run.cpp index dd9209b8eecb294e95553a9d360c4926dd39fc4f..d61dc4defd6e9493d11b2f8cd0d2f9d466d99a9e 100644 --- a/wccl-apps/wccl-run.cpp +++ b/wccl-apps/wccl-run.cpp @@ -140,7 +140,7 @@ bool Runner::load_more_operators(const std::string& filename) boost::filesystem::path p(filename); std::string prefix = ""; //p.stem() + ":"; Wccl::UntypedOpSequence::name_op_v_t pairs = retOp->gen_all_op_pairs(); - foreach (const Wccl::UntypedOpSequence::name_op_pair_t v, pairs) { + BOOST_FOREACH (const Wccl::UntypedOpSequence::name_op_pair_t v, pairs) { std::string opname = v.first; if (opname == filter_op_name_) { filter_op_ = v.second; @@ -199,7 +199,7 @@ void Runner::do_operator_variables(const boost::shared_ptr<Wccl::FunctionalOpera std::vector<UnicodeString>& out, bool variables) { if (variables) { - foreach (const std::string& varname, op->valid_variable_names()) { + BOOST_FOREACH (const std::string& varname, op->valid_variable_names()) { out.push_back((*op)[varname].to_string_u(tagset_)); } } @@ -230,7 +230,7 @@ void Runner::do_sentence(const boost::shared_ptr<Corpus2::Sentence>& sentence, out.push_back(UnicodeString::fromUTF8(filter_op_name_)); if (output_variables) { boost::shared_ptr<Wccl::FunctionalOperator> o = filter_op_; - foreach (const std::string& varname, o->valid_variable_names()) { + BOOST_FOREACH (const std::string& varname, o->valid_variable_names()) { const Wccl::Value& value = (*o)[varname]; std::string label = "(" + filter_op_name_ + ")" + value.make_var_repr(varname); out.push_back(UnicodeString::fromUTF8(label)); @@ -241,7 +241,7 @@ void Runner::do_sentence(const boost::shared_ptr<Corpus2::Sentence>& sentence, out.push_back(UnicodeString::fromUTF8(op_names_[i])); if (output_variables) { boost::shared_ptr<Wccl::FunctionalOperator> o = ops_[i]; - foreach (const std::string& varname, o->valid_variable_names()) { + BOOST_FOREACH (const std::string& varname, o->valid_variable_names()) { const Wccl::Value& value = (*o)[varname]; std::string label = "(" + op_names_[i] + ")" + value.make_var_repr(varname); out.push_back(UnicodeString::fromUTF8(label)); @@ -283,7 +283,7 @@ void Runner::do_sentence(const boost::shared_ptr<Corpus2::Sentence>& sentence, do_operator_variables(filter_op_, out, output_variables); } - foreach (const boost::shared_ptr<Wccl::FunctionalOperator>& o, ops_) { + BOOST_FOREACH (const boost::shared_ptr<Wccl::FunctionalOperator>& o, ops_) { o->clean(); boost::shared_ptr<const Wccl::Value> v = o->base_apply(sc); UnicodeString vstr = v->to_string_u(tagset_); @@ -296,14 +296,14 @@ void Runner::do_sentence(const boost::shared_ptr<Corpus2::Sentence>& sentence, void Runner::output_tabular(const std::vector<std::vector<UnicodeString> >& outputs) { std::vector<int> lengths(outputs[0].size()); - foreach (const std::vector< UnicodeString >& line, outputs) { + BOOST_FOREACH (const std::vector< UnicodeString >& line, outputs) { if (line.empty()) continue; for (size_t i = 0; i < line.size(); ++i) { lengths[i] = std::max(lengths[i], line[i].length()); } } - foreach (const std::vector< UnicodeString >& line, outputs) { + BOOST_FOREACH (const std::vector< UnicodeString >& line, outputs) { if (!line.empty()) { for (size_t i = 0; i < line.size() - 1; ++i) { UnicodeString u = line[i]; @@ -440,7 +440,7 @@ int main(int argc, char** argv) return 0; } - foreach (const std::string& f, files) { + BOOST_FOREACH (const std::string& f, files) { if (f == "-") { corpus_stdin = true; } else if (boost::algorithm::ends_with(f, ".xml")) { @@ -469,7 +469,7 @@ int main(int argc, char** argv) runner.set_filter_op(filter_op_name, filter_op_value); } runner.set_aggregate_output(aggregate); - foreach (const std::string& f, operator_strings) { + BOOST_FOREACH (const std::string& f, operator_strings) { if (boost::algorithm::ends_with(f, ".ccl")) { size_t sz = runner.size(); if (!runner.load_more_operators(f)) { @@ -483,7 +483,7 @@ int main(int argc, char** argv) } } if (runner.size() > 0) { - foreach (const std::string& f, corpora_files) { + BOOST_FOREACH (const std::string& f, corpora_files) { runner.run(Corpus2::TokenReader::create_path_reader( input_format, tagset, f), first); }