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

add antrl dependencies in tester

parent 44625c67
No related branches found
No related tags found
No related merge requests found
......@@ -25,13 +25,15 @@ include_directories(${LibXML++_INCLUDE_DIRS})
link_directories(${LibXML++_LIBRARY_DIRS})
set(LIBS ${LIBS} ${LibXML++_LIBRARIES})
set(LIBS ${LIBS} corpus2 wccl)
add_library(corpus2_mwereader SHARED mwereader.cpp mwe.cpp mweparser.cpp)
target_link_libraries(corpus2_mwereader corpus2)
target_link_libraries(corpus2_mwereader ${LIBS})
add_executable(mwertest mwertest.cpp mweparser.cpp)
target_link_libraries(mwertest corpus2_mwereader ${LIBS})
target_link_libraries(mwertest corpus2_mwereader ${LIBS} antlr)
set_target_properties(corpus2_mwereader PROPERTIES
VERSION "${libmwereader_major}.${libmwereader_minor}"
......
......@@ -3,6 +3,7 @@
#include <libpwrutils/foreach.h>
#include <libcorpus2/tagsetmanager.h>
#include <libxml++/libxml++.h>
#include <libxml2/libxml/parser.h>
#include <boost/make_shared.hpp>
......@@ -11,7 +12,7 @@
namespace Corpus2 {
MWEBuilder::MWEBuilder(const Tagset& tagset)
: tagset_(tagset)
: tagset_(tagset), parser_(tagset)
{
}
......@@ -21,6 +22,16 @@ namespace Corpus2 {
{
}
MWEParser::~MWEParser()
{
// TODO: something to do?
}
void MWEParser::create_mwe()
{
}
std::string MWEParser::get_attribute(const AttributeList& attributes,
const std::string &name) const
{
......@@ -96,9 +107,7 @@ namespace Corpus2 {
state_ = MWEGROUP;
} else if(state_ == MWE && name == "MWE"){
state_ = INSTANCES;
// TODO: tworzenie jednostki
print_current_mwe(true);
create_mwe();
} else if(state_ == VAR && name == "var"){
state_ = MWE;
variables_[var_name_] = finish_get_text();
......
......@@ -5,6 +5,8 @@
#include <libcorpus2/io/sax.h>
#include <boost/unordered_map.hpp>
#include <libwccl/parser/Parser.h>
#include "mwe.h"
namespace Corpus2 {
......@@ -13,23 +15,29 @@ class MWEBuilder
{
public:
MWEBuilder(const Tagset& tagset);
typedef boost::unordered_map<std::string, std::string> value_type;
private:
typedef boost::unordered_map<std::string, std::string> value_type;
const Tagset& tagset_;
/// str -> ptr to ccl operator
value_type main_conditions_;
/// str -> ptr to ccl operator
value_type head_conditions_;
Wccl::Parser parser_;
};
class MWEParser : public BasicSaxParser
{
public:
MWEParser(MWEIndex &index);
~MWEParser();
protected:
void create_mwe();
typedef std::map<std::string, std::string> str_map;
void on_start_element(const Glib::ustring &name,
const AttributeList& attributes);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment