Skip to content
Snippets Groups Projects
Commit 47a70582 authored by Adam Wardynski's avatar Adam Wardynski
Browse files

to_string for llook now writes right pos first.

parent 0b8578f7
Branches
No related merge requests found
...@@ -17,4 +17,24 @@ bool LeftLook::iterate( ...@@ -17,4 +17,24 @@ bool LeftLook::iterate(
return false; return false;
} }
std::string LeftLook::to_string(const Corpus2::Tagset& tagset) const
{
std::ostringstream ss;
ss << name(tagset) << "("
<< right_pos_expr_->to_string(tagset) << ", "
<< left_pos_expr_->to_string(tagset) << ", "
<< Position::var_repr(iter_var_acc_.get_name()) << ", "
<< evaluating_expr_->to_string(tagset) << ")";
return ss.str();
}
std::ostream& LeftLook::write_to(std::ostream& os) const
{
return os << raw_name() << "("
<< *right_pos_expr_ << ", "
<< *left_pos_expr_ << ", "
<< Position::var_repr(iter_var_acc_.get_name()) << ", "
<< *evaluating_expr_ << ")";
}
} /* end ns Wccl */ } /* end ns Wccl */
...@@ -29,6 +29,12 @@ public: ...@@ -29,6 +29,12 @@ public:
return "llook"; return "llook";
} }
/**
* @returns String reperesentation of LeftLook Operator:
* llook(right_pos_expr, left_pos_expr, variable, eval_expr, min_matches)
*/
std::string to_string(const Corpus2::Tagset& tagset) const;
protected: protected:
/** /**
* @returns True if, when scanning right-to-left, * @returns True if, when scanning right-to-left,
...@@ -46,6 +52,15 @@ protected: ...@@ -46,6 +52,15 @@ protected:
int right, int right,
Position &p, Position &p,
const FunExecContext &context) const; const FunExecContext &context) const;
/**
* Writes raw string reperesentation of LeftLook operator, in form of
* llook(raw_right_p_expr, raw_left_p_expr, var, raw_eval_expr, min_matches)
* @note This version doesn't require a Tagset, but may
* be incomplete and/or contain internal info.
* @returns Stream written to.
*/
std::ostream& write_to(std::ostream& ostream) const;
}; };
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment