Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cclutils
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arkadiusz Janz
cclutils
Commits
72657010
Commit
72657010
authored
Jun 03, 2020
by
Piotr Wątorski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sentence/chunk generators - fix
parent
d46fe12a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
cclutils/_base.py
cclutils/_base.py
+8
-9
No files found.
cclutils/_base.py
View file @
72657010
...
...
@@ -162,13 +162,14 @@ def get_tagset(tagset):
def
read_chunks_it
(
filepath
,
tagset
=
'nkjp'
):
""" Returns a iterable
sentence
generator.
""" Returns a iterable
chunk
generator.
Args:
filepath: a path to CCL file
tagset: the name of the tagset that is used in the document or a tagset object itself.
Returns: a iterable sentence generator.
Returns:
a iterable chunk generator.
"""
tagset
=
get_tagset
(
tagset
)
reader
=
corpus2
.
TokenReader_create_path_reader
(
'ccl'
,
tagset
,
filepath
)
...
...
@@ -176,10 +177,9 @@ def read_chunks_it(filepath, tagset='nkjp'):
while
True
:
chunk
=
reader
.
get_next_chunk
()
if
chunk
:
yield
chunk
else
:
if
not
chunk
:
break
yield
chunk
del
reader
...
...
@@ -200,11 +200,10 @@ def read_sentences_it(filepath, tagset='nkjp'):
while
True
:
sentence
=
reader
.
get_next_sentence
()
if
sentence
:
yield
sentence
else
:
if
not
sentence
:
break
yield
sentence
del
reader
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment