Select Git revision
wcclfile.h 22.16 KiB
/*
Copyright (C) 2011 Adam Wardyński, Tomasz Śniatowski, Paweł Kędzia,
Adam Radziszewski, Bartosz Broda
Part of the WCCL project
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
See the LICENSE and COPYING files for more details.
*/
#ifndef LIBWCCL_WCCLFILE_H
#define LIBWCCL_WCCLFILE_H
#include <libwccl/values/bool.h>
#include <libwccl/values/match.h>
#include <libwccl/values/position.h>
#include <libwccl/values/strset.h>
#include <libwccl/values/tset.h>
#include <libwccl/wcclfileopsections.h>
#include <libwccl/ops/tagrulesequence.h>
#include <libwccl/ops/matchrulesequence.h>
#include <libwccl/lexicon/lexicons.h>
#include <libwccl/exception.h>
#include <libpwrutils/pathsearch.h>
namespace Wccl {
/**
* Class representing contents of parsed WCCL files
* - imported lexicons, any typed and untyped named
* operator sections, up to one tag rules section,
* and up to one match rules section.
*/
class WcclFile
: WcclFileOpSections<UntypedOpSequence>,
WcclFileOpSections<OpSequence<StrSet> >,
WcclFileOpSections<OpSequence<TSet> >,
WcclFileOpSections<OpSequence<Bool> >,
WcclFileOpSections<OpSequence<Position> >,
WcclFileOpSections<OpSequence<Match> >
{
public:
WcclFile(const Corpus2::Tagset& tagset, const std::string& search_path);
/////////////////////
// Untyped and typed operator sections: @X:"sectioname" ( op1; op2 )
/////////////////////
/**
* @returns All untyped sections from the WCCL file: @"name" ( anyop0; ...; anyopN )
*/
const std::vector<boost::shared_ptr<UntypedOpSequence> >& untyped_sections();
/**
* @returns All sections of given type T from the WCCL file: @T:"name" ( op<T>0; ...; op<T>N )
*/
template<class T>
const typename std::vector<boost::shared_ptr<OpSequence<T> > >& sections();
/**
* @returns True if the WCCL file contains untyped section of given name.
* False otherwise.
*/
bool has_untyped_section(const std::string& name) const;