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
99388c53
Commit
99388c53
authored
13 years ago
by
Adam Radziszewski
Browse files
Options
Downloads
Patches
Plain Diff
add has_more to readers
parent
bca77ee2
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libcorpus2/io/reader.cpp
+16
-0
16 additions, 0 deletions
libcorpus2/io/reader.cpp
libcorpus2/io/reader.h
+11
-0
11 additions, 0 deletions
libcorpus2/io/reader.h
swig/libcorpustokenreader.i
+1
-0
1 addition, 0 deletions
swig/libcorpustokenreader.i
with
28 additions
and
0 deletions
libcorpus2/io/reader.cpp
+
16
−
0
View file @
99388c53
...
...
@@ -222,6 +222,22 @@ boost::shared_ptr<Chunk> BufferedChunkReader::get_next_chunk()
}
}
bool
BufferedChunkReader
::
has_more
()
{
ensure_more
();
return
!
chunk_buf_
.
empty
();
}
bool
BufferedSentenceReader
::
has_more
()
{
if
(
sentence_buf_
!=
NULL
)
{
return
true
;
}
sentence_buf_
=
actual_next_sentence
();
return
(
sentence_buf_
!=
NULL
);
}
BufferedSentenceReader
::
BufferedSentenceReader
(
const
Tagset
&
tagset
)
:
TokenReader
(
tagset
),
chunkify_
(
true
)
,
sentence_buf_
(),
token_buf_
()
...
...
This diff is collapsed.
Click to expand it.
libcorpus2/io/reader.h
+
11
−
0
View file @
99388c53
...
...
@@ -90,6 +90,13 @@ public:
*/
virtual
boost
::
shared_ptr
<
Chunk
>
get_next_chunk
()
=
0
;
/**
* Checks if there is anything left to be returned. Non-const because it
* might read ahead and fill the buffer.
*/
virtual
bool
has_more
()
=
0
;
/**
* General option setter.
*/
...
...
@@ -297,6 +304,8 @@ public:
boost
::
shared_ptr
<
Chunk
>
get_next_chunk
();
bool
has_more
();
void
set_option
(
const
std
::
string
&
option
)
{
TokenReader
::
set_option
(
option
);
}
...
...
@@ -332,6 +341,8 @@ public:
Sentence
::
Ptr
get_next_sentence
();
bool
has_more
();
boost
::
shared_ptr
<
Chunk
>
get_next_chunk
();
void
set_option
(
const
std
::
string
&
option
)
{
...
...
This diff is collapsed.
Click to expand it.
swig/libcorpustokenreader.i
+
1
−
0
View file @
99388c53
...
...
@@ -61,6 +61,7 @@ namespace Corpus2 {
virtual Token* get_next_token() = 0;
virtual Sentence::Ptr get_next_sentence() = 0;
virtual boost::shared_ptr<Chunk> get_next_chunk() = 0;
virtual bool has_more() = 0;
/* --------------------------------------------------------------------- */
virtual void set_option(const std::string& option);
...
...
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