Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cclutils
Manage
Activity
Members
Labels
Plan
Issues
1
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
cclutils
Commits
038e8a00
Commit
038e8a00
authored
5 years ago
by
Arkadiusz Janz
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 'develop'
Master merged See merge request ajanz/cclutils!2
parents
72657010
e5564824
2 merge requests
!3
Develop
,
!2
Master merged
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cclutils/_annotations.py
+1
-1
1 addition, 1 deletion
cclutils/_annotations.py
cclutils/_base.py
+8
-10
8 additions, 10 deletions
cclutils/_base.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
10 additions
and
12 deletions
cclutils/_annotations.py
+
1
−
1
View file @
038e8a00
...
...
@@ -87,7 +87,7 @@ def set_attribute(token, key, value):
if
not
token
.
has_metadata
():
token
.
create_metadata
()
metadata
=
token
.
get_metadata
()
metadata
.
set_attribute
(
_try_encode
(
key
)
,
_try_encode
(
value
)
)
metadata
.
set_attribute
(
key
,
value
)
def
set_attributes
(
token
,
items
):
...
...
This diff is collapsed.
Click to expand it.
cclutils/_base.py
+
8
−
10
View file @
038e8a00
...
...
@@ -162,21 +162,21 @@ def get_tagset(tagset):
def
read_chunks_it
(
filepath
,
tagset
=
'
nkjp
'
):
"""
Returns a iterable chunk 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 chunk generator.
a
n
iterable chunk generator.
"""
tagset
=
get_tagset
(
tagset
)
reader
=
corpus2
.
TokenReader_create_path_reader
(
'
ccl
'
,
tagset
,
filepath
)
while
True
:
chunk
=
reader
.
get_next_chunk
()
if
not
chunk
:
break
yield
chunk
...
...
@@ -190,14 +190,14 @@ def read_sentences_it(filepath, tagset='nkjp'):
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.
"""
tagset
=
get_tagset
(
tagset
)
reader
=
corpus2
.
TokenReader_create_path_reader
(
'
ccl
'
,
tagset
,
filepath
)
while
True
:
sentence
=
reader
.
get_next_sentence
()
...
...
@@ -205,6 +205,4 @@ def read_sentences_it(filepath, tagset='nkjp'):
break
yield
sentence
del
reader
del
reader
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
038e8a00
...
...
@@ -6,7 +6,7 @@ setup(
author
=
'
Arkadiusz Janz, Anna Gut, Dominik Kaszewski
'
,
description
=
'''
A convenient API based on Corpus2 library for analyzing textual
corpora in CCL format.
'''
,
version
=
'
1.0.
0
'
,
version
=
'
1.0.
2
'
,
packages
=
[
'
cclutils
'
],
zip_safe
=
False
)
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