Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
corpus2
Commits
930fb98d
Commit
930fb98d
authored
Feb 9, 2012
by
Adam Wardynski
Browse files
Options
Downloads
Patches
Plain Diff
Conditional poliqarp build.
parent
322d9805
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcorpus2_whole/io/documentreader.cpp
+13
-14
13 additions, 14 deletions
libcorpus2_whole/io/documentreader.cpp
with
13 additions
and
14 deletions
libcorpus2_whole/io/documentreader.cpp
+
13
−
14
View file @
930fb98d
...
@@ -17,8 +17,9 @@ or FITNESS FOR A PARTICULAR PURPOSE.
...
@@ -17,8 +17,9 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#include
<libcorpus2_whole/io/documentreader.h>
#include
<libcorpus2_whole/io/documentreader.h>
#include
<libcorpus2_whole/io/cclrelreader.h>
#include
<libcorpus2_whole/io/cclrelreader.h>
#ifdef WITH_POLIQARP
#include
<libcorpus2_whole/io/poliqarpdocumentreader.h>
#include
<libcorpus2_whole/io/poliqarpdocumentreader.h>
#endif
namespace
Corpus2
{
namespace
Corpus2
{
...
@@ -27,33 +28,34 @@ namespace whole{
...
@@ -27,33 +28,34 @@ 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_
==
"document"
)
{
corpus_file
.
open
(
corpus_file_path
.
c_str
());
#ifdef WITH_POLIQARP
}
else
if
(
corpus_type_
==
"poliqarp"
)
{
reader
=
boost
::
shared_ptr
<
PoliqarpDocumentReader
>
(
reader
=
boost
::
shared_ptr
<
PoliqarpDocumentReader
>
(
new
PoliqarpDocumentReader
(
tagset_
,
corpus_path_
));
new
PoliqarpDocumentReader
(
tagset_
,
corpus_path_
));
}
#endif
else
if
(
corpus_type_
==
"document"
)
{
}
else
{
corpus_file
.
open
(
corpus_file_path
.
c_str
());
}
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
;
#ifdef WITH_POLIQARP
if
(
corpus_type_
==
"poliqarp"
)
{
if
(
corpus_type_
==
"poliqarp"
)
{
return
this
->
reader
->
read
();
return
this
->
reader
->
read
();
}
}
#endif
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
();
}
}
else
{
else
{
return
boost
::
make_shared
<
Document
>
(
"End"
);
return
boost
::
make_shared
<
Document
>
(
"End"
);
}
}
}
}
throw
Corpus2Error
(
corpus_type_
+
" is an unknown reader type!"
);
}
}
...
@@ -77,9 +79,6 @@ boost::shared_ptr<DocumentReaderI> DocumentReader::get_cclrel_reader(std::string
...
@@ -77,9 +79,6 @@ boost::shared_ptr<DocumentReaderI> DocumentReader::get_cclrel_reader(std::string
return
boost
::
shared_ptr
<
CclRelReader
>
(
return
boost
::
shared_ptr
<
CclRelReader
>
(
new
CclRelReader
(
tagset_
,
ann_path
,
rel_path
));
new
CclRelReader
(
tagset_
,
ann_path
,
rel_path
));
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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