Skip to content
Snippets Groups Projects
Commit 322d9805 authored by Lukasz Bilenkij's avatar Lukasz Bilenkij
Browse files

whitespaces

parent 74bd35b7
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2010 Tomasz Śniatowski, Adam Radziszewski, Paweł Kędzia
Part of the libcorpus2 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.
*/
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <libcorpus2_whole/io/documentreader.h> #include <libcorpus2_whole/io/documentreader.h>
#include <libcorpus2_whole/io/cclrelreader.h> #include <libcorpus2_whole/io/cclrelreader.h>
#include <libcorpus2_whole/io/poliqarpdocumentreader.h> #include <libcorpus2_whole/io/poliqarpdocumentreader.h>
...@@ -14,37 +27,30 @@ namespace whole{ ...@@ -14,37 +27,30 @@ namespace whole{
DocumentReader::DocumentReader(const Tagset& tagset, const std::string& corpus_type, const std::string& corpus_file_path) DocumentReader::DocumentReader(const Tagset& tagset, const std::string& corpus_type, const std::string& corpus_file_path)
: corpus_type_(corpus_type), tagset_(tagset), corpus_path_(corpus_file_path) : corpus_type_(corpus_type), tagset_(tagset), corpus_path_(corpus_file_path)
{ {
if (corpus_type_ == "poliqarp") if (corpus_type_ == "poliqarp") {
{
reader = boost::shared_ptr<PoliqarpDocumentReader>( reader = boost::shared_ptr<PoliqarpDocumentReader>(
new PoliqarpDocumentReader(tagset_, corpus_path_)); new PoliqarpDocumentReader(tagset_, corpus_path_));
} }
else if (corpus_type_ == "document") else if (corpus_type_ == "document") {
{
corpus_file.open(corpus_file_path.c_str()); corpus_file.open(corpus_file_path.c_str());
} }
else else {
throw Corpus2Error(corpus_type_ + " is an unknown reader type!"); throw Corpus2Error(corpus_type_ + " is an unknown reader type!");
}
} }
boost::shared_ptr<Document> DocumentReader::read() boost::shared_ptr<Document> DocumentReader::read()
{ {
std::string line; std::string line;
if (corpus_type_ == "poliqarp") if (corpus_type_ == "poliqarp") {
{
return this->reader->read(); return this->reader->read();
} }
if (corpus_type_ == "document") if (corpus_type_ == "document") {
{ if (std::getline(corpus_file, line)) {
if (std::getline(corpus_file, line))
{
return get_cclrel_reader(line)->read(); return get_cclrel_reader(line)->read();
//return Document("End");
} }
else else {
{
return boost::make_shared<Document>("End"); return boost::make_shared<Document>("End");
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment