Skip to content
Snippets Groups Projects
Commit 9ea332d4 authored by Bartosz Broda's avatar Bartosz Broda
Browse files

add bool ops simple indexing

parent 97bff541
Branches
No related merge requests found
......@@ -14,7 +14,32 @@ namespace Corpus2 {
MWEBuilder::MWEBuilder(const Tagset& tagset)
: tagset_(tagset), parser_(tagset)
{
}
MWEBuilder::BoolOpPtr MWEBuilder::get_head_condition(
const std::string & headcond)
{
return get_condition(headcond, head_conditions_);
}
MWEBuilder::BoolOpPtr MWEBuilder::get_mwe_condition(
const std::string &cond)
{
return get_condition(cond, main_conditions_);
}
MWEBuilder::BoolOpPtr MWEBuilder::get_condition(
const std::string & cond, value_type& where)
{
value_type::iterator search = where.find(cond);
if(search != where.end())
return search->second;
BoolOpPtr op = parser_.parseBoolOperator(cond);
where[cond] = op;
return op;
}
MWEParser::MWEParser(MWEIndex &index)
......@@ -29,7 +54,10 @@ namespace Corpus2 {
void MWEParser::create_mwe()
{
MWEBuilder::BoolOpPtr main = mwe_builder_->get_mwe_condition(
wccl_operator_);
MWEBuilder::BoolOpPtr head = mwe_builder_->get_head_condition(
head_cond_);
}
std::string MWEParser::get_attribute(const AttributeList& attributes,
......
......@@ -6,7 +6,7 @@
#include <boost/unordered_map.hpp>
#include <libwccl/parser/Parser.h>
#include <libwccl/ops/operator.h>
#include "mwe.h"
namespace Corpus2 {
......@@ -14,11 +14,18 @@ namespace Corpus2 {
class MWEBuilder
{
public:
typedef boost::shared_ptr<Wccl::Operator<Wccl::Bool> > BoolOpPtr;
MWEBuilder(const Tagset& tagset);
BoolOpPtr get_head_condition(const std::string &);
BoolOpPtr get_mwe_condition(const std::string &);
private:
typedef boost::unordered_map<std::string, std::string> value_type;
typedef boost::unordered_map<std::string, BoolOpPtr> value_type;
BoolOpPtr get_condition(const std::string & cond, value_type& where);
const Tagset& tagset_;
/// str -> ptr to ccl operator
......
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