Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
corpus2
Commits
cd5e51ab
Commit
cd5e51ab
authored
13 years ago
by
Paweł Kędzia
Browse files
Options
Downloads
Patches
Plain Diff
Added CorpusReader
parent
7d492649
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libcorpus2_whole/io/corpusreader.cpp
+34
-0
34 additions, 0 deletions
libcorpus2_whole/io/corpusreader.cpp
libcorpus2_whole/io/corpusreader.h
+47
-0
47 additions, 0 deletions
libcorpus2_whole/io/corpusreader.h
with
81 additions
and
0 deletions
libcorpus2_whole/io/corpusreader.cpp
0 → 100644
+
34
−
0
View file @
cd5e51ab
#include
<libcorpus2_whole/io/corpusreader.h>
#include
<libcorpus2_whole/io/poliqarpcorpusreader.h>
#include
<libcorpus2_whole/io/documentcorpusreader.h>
namespace
Corpus2
{
namespace
whole
{
CorpusReader
::
CorpusReader
(
const
Tagset
&
tagset
,
const
std
::
string
&
corpus_type
)
:
corpus_type_
(
corpus_type
),
tagset_
(
tagset
)
{
//
}
boost
::
shared_ptr
<
Corpus
>
CorpusReader
::
read
(
const
std
::
string
&
corpus_file_path
)
{
boost
::
shared_ptr
<
CorpusReaderI
>
reader
=
this
->
get_corpus_reader_by_type
();
return
reader
->
read
(
corpus_file_path
);
}
//
boost
::
shared_ptr
<
CorpusReaderI
>
CorpusReader
::
get_corpus_reader_by_type
()
{
if
(
corpus_type_
==
"poliqarp"
)
{
return
boost
::
shared_ptr
<
PoliqarpCorpusReader
>
(
new
PoliqarpCorpusReader
(
tagset_
));
}
else
if
(
corpus_type_
==
"document"
)
{
return
boost
::
shared_ptr
<
DocumentCorpusReader
>
(
new
DocumentCorpusReader
(
tagset_
));
}
throw
Corpus2Error
(
corpus_type_
+
" is unknown reader type!"
);
}
}
// whole ns
}
// Corpus2 ns
This diff is collapsed.
Click to expand it.
libcorpus2_whole/io/corpusreader.h
0 → 100644
+
47
−
0
View file @
cd5e51ab
#ifndef LIBCORPUS2_WHOLE_CORPUSREADER_H
#define LIBCORPUS2_WHOLE_CORPUSREADER_H
#include
<string>
#include
<libcorpus2_whole/corpus.h>
#include
<libcorpus2_whole/io/reader_i.h>
namespace
Corpus2
{
namespace
whole
{
class
CorpusReader
{
public:
/**
* @arg corpus_type may be:
* - document (contains relations)
* - poliqarp
*/
CorpusReader
(
const
Tagset
&
tagset
,
const
std
::
string
&
corpus_type
);
/**
* Reads corpus from given path
* @arg corpus_file Path to file contains paths to corpus files.
* Depend on corpus type, each line in this file should contains only
* path to one document from corpus or path to (in particular DocReader)
* relations and annotatons (in one line, first is path to annotations
* and second are relations -- these paths, should be separated by semicolon)
* @return Readed corpus
*/
boost
::
shared_ptr
<
Corpus
>
read
(
const
std
::
string
&
corpus_file
);
private:
/// Returns reader based on corpus type (poliqarp/document)
boost
::
shared_ptr
<
CorpusReaderI
>
get_corpus_reader_by_type
();
private:
/// Type of corpus, sets only once in constructor
const
std
::
string
&
corpus_type_
;
/// Tagset to use, sets only onece in constructor
const
Tagset
&
tagset_
;
};
}
// whole ns
}
// Corpus2 ns
#endif // LIBCORPUS2_WHOLE_CORPUSREADER_H
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment