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
fe947b88
Commit
fe947b88
authored
May 22, 2020
by
Arkadiusz Janz
Browse files
Options
Downloads
Patches
Plain Diff
Update README.md
parent
9a6169dc
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
README.md
+47
-1
47 additions, 1 deletion
README.md
with
47 additions
and
1 deletion
README.md
+
47
−
1
View file @
fe947b88
...
...
@@ -3,7 +3,8 @@
A convenient API based on Corpus2 library for reading, writing, and processing
textual corpora represented as CCL (XML) documents.
#### IO
IO
======
###### Read CCL file
...
...
@@ -47,3 +48,48 @@ specify the tagset:
```
python
cclutils
.
write
(
document
,
'
./out.xml
'
,
rel_path
=
'
./out.rel.xml
'
,
tagset
=
'
spacy
'
)
```
###### Get tagset object
```
python
tagset
=
cclutils
.
get_tagset
(
'
nkjp
'
)
tagset
=
cclutils
.
get_tagset
(
'
spacy
'
)
...
```
Document structure
==================
CCL format specifies basic segmentation structure, mainly paragraphs (
```<chunk>```
),
sentences (
```<sentence>```
), and tokens (
```<token>```
). To iterate the document we
can use special API functions:
```
python
document
=
cclutils
.
read
(
'
./example.xml
'
)
for
paragraph
in
document
.
paragraphs
():
...
for
sentence
in
paragraph
.
sentences
():
...
for
token
in
sentence
.
tokens
():
...
```
We can also create a generator for iterating only the tokens in a more Pythonic way:
```
python
document
=
cclutils
.
read
(
'
./example.xml
'
)
# tokens is a generator:
tokens
=
(
token
for
paragraph
in
document
.
paragraphs
()
for
sentence
in
paragraph
.
sentences
()
for
token
in
sentence
.
tokens
())
```
Token manipulation
==================
1.
Get Part-of-Speech (simple)
```
python
tagset
=
cclutils
.
get_tagset
(
'
nkjp
'
)
...
pos
=
get_pos
(
token
,
tagset
)
```
\ No newline at end of file
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