Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cclutils
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
cclutils
Commits
72657010
"README.md" did not exist on "72b7a9186640bbef9b5231a5cc27e5d58c9973e2"
Commit
72657010
authored
Jun 3, 2020
by
Piotr Wątorski
Browse files
Options
Downloads
Patches
Plain Diff
Sentence/chunk generators - fix
parent
d46fe12a
No related branches found
No related tags found
1 merge request
!1
Sentence/chunk generators
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cclutils/_base.py
+8
-9
8 additions, 9 deletions
cclutils/_base.py
with
8 additions
and
9 deletions
cclutils/_base.py
+
8
−
9
View file @
72657010
...
@@ -162,13 +162,14 @@ def get_tagset(tagset):
...
@@ -162,13 +162,14 @@ def get_tagset(tagset):
def
read_chunks_it
(
filepath
,
tagset
=
'
nkjp
'
):
def
read_chunks_it
(
filepath
,
tagset
=
'
nkjp
'
):
"""
Returns a iterable
sentence
generator.
"""
Returns a iterable
chunk
generator.
Args:
Args:
filepath: a path to CCL file
filepath: a path to CCL file
tagset: the name of the tagset that is used in the document or a tagset object itself.
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
)
tagset
=
get_tagset
(
tagset
)
reader
=
corpus2
.
TokenReader_create_path_reader
(
'
ccl
'
,
tagset
,
filepath
)
reader
=
corpus2
.
TokenReader_create_path_reader
(
'
ccl
'
,
tagset
,
filepath
)
...
@@ -176,10 +177,9 @@ def read_chunks_it(filepath, tagset='nkjp'):
...
@@ -176,10 +177,9 @@ def read_chunks_it(filepath, tagset='nkjp'):
while
True
:
while
True
:
chunk
=
reader
.
get_next_chunk
()
chunk
=
reader
.
get_next_chunk
()
if
chunk
:
if
not
chunk
:
yield
chunk
else
:
break
break
yield
chunk
del
reader
del
reader
...
@@ -201,10 +201,9 @@ def read_sentences_it(filepath, tagset='nkjp'):
...
@@ -201,10 +201,9 @@ def read_sentences_it(filepath, tagset='nkjp'):
while
True
:
while
True
:
sentence
=
reader
.
get_next_sentence
()
sentence
=
reader
.
get_next_sentence
()
if
sentence
:
if
not
sentence
:
yield
sentence
else
:
break
break
yield
sentence
del
reader
del
reader
...
...
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