From 7d492649c8f9078ebef99038138f0000ded97c41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <Pawel.Kedzia@pwr.wroc.pl>
Date: Thu, 29 Dec 2011 12:22:31 +0100
Subject: [PATCH] Added PoliqarpCorpusReader

---
 libcorpus2_whole/io/poliqarpcorpusreader.cpp | 28 ++++++++++++++++++++
 libcorpus2_whole/io/poliqarpcorpusreader.h   | 28 ++++++++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 libcorpus2_whole/io/poliqarpcorpusreader.cpp
 create mode 100644 libcorpus2_whole/io/poliqarpcorpusreader.h

diff --git a/libcorpus2_whole/io/poliqarpcorpusreader.cpp b/libcorpus2_whole/io/poliqarpcorpusreader.cpp
new file mode 100644
index 0000000..2bf5786
--- /dev/null
+++ b/libcorpus2_whole/io/poliqarpcorpusreader.cpp
@@ -0,0 +1,28 @@
+#include <libcorpus2_whole/io/poliqarpcorpusreader.h>
+
+namespace Corpus2 {
+namespace whole{
+
+PoliqarpCorpusReader::PoliqarpCorpusReader(const Tagset& tagset)
+	: tagset_(tagset)
+{
+	//
+}
+
+boost::shared_ptr<Corpus> PoliqarpCorpusReader::read(const std::string& corpus_file)
+{
+	boost::shared_ptr<Document> doc;
+	boost::shared_ptr<Corpus> corpus = boost::make_shared<Corpus>(corpus_file);
+
+	this->pq_doc_reader_ = boost::shared_ptr<PoliqarpDocumentReader>(
+			new PoliqarpDocumentReader(tagset_, corpus_file));
+
+	while ((doc = this->pq_doc_reader_->read())) {
+		corpus->add_document(doc);
+	}
+
+	return corpus;
+}
+
+} // whole ns
+} // Corpus2 ns
diff --git a/libcorpus2_whole/io/poliqarpcorpusreader.h b/libcorpus2_whole/io/poliqarpcorpusreader.h
new file mode 100644
index 0000000..c5134b3
--- /dev/null
+++ b/libcorpus2_whole/io/poliqarpcorpusreader.h
@@ -0,0 +1,28 @@
+#ifndef LIBCORPUS2_WHOLE_POLIQARPCORPUSREADER_H
+#define LIBCORPUS2_WHOLE_POLIQARPCORPUSREADER_H
+
+#include <string>
+#include <boost/shared_ptr.hpp>
+#include <libcorpus2_whole/corpus.h>
+#include <libcorpus2_whole/io/poliqarpdocumentreader.h>
+#include <libcorpus2_whole/io/reader_i.h>
+
+namespace Corpus2 {
+namespace whole {
+
+class PoliqarpCorpusReader : public CorpusReaderI
+{
+public:
+	PoliqarpCorpusReader(const Tagset& tagset);
+
+	boost::shared_ptr<Corpus> read(const std::string& corpus_file);
+
+private:
+	const Tagset& tagset_;
+	boost::shared_ptr<PoliqarpDocumentReader> pq_doc_reader_;
+};
+
+} // whole ns
+} // Corpus2 ns
+
+#endif // LIBCORPUS2_WHOLE_POLIQARPCORPUSREADER_H
-- 
GitLab