diff --git a/libcorpus2_whole/io/poliqarpcorpusreader.cpp b/libcorpus2_whole/io/poliqarpcorpusreader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2bf578647636f46a51950f79e30c9e47a6da771b --- /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 0000000000000000000000000000000000000000..c5134b3fa839daae449e6bc0d09dda23b72e89da --- /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