Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
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
corpus2
Commits
da6bd398
Commit
da6bd398
authored
Apr 18, 2012
by
Adam Radziszewski
Browse files
Options
Downloads
Patches
Plain Diff
fix par spacing in text extractor script
parent
717ff7bc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/corptext.py
+8
-11
8 additions, 11 deletions
utils/corptext.py
with
8 additions
and
11 deletions
utils/corptext.py
+
8
−
11
View file @
da6bd398
...
...
@@ -17,12 +17,11 @@ def go():
parser
.
add_option
(
'
-t
'
,
'
--tagset
'
,
type
=
'
string
'
,
action
=
'
store
'
,
dest
=
'
tagset
'
,
default
=
'
nkjp
'
,
help
=
'
set the tagset used in input; default: nkjp
'
)
parser
.
add_option
(
'
-s
'
,
'
--sent-sep
'
,
type
=
'
string
'
,
action
=
'
store
'
,
dest
=
'
sent_sep
'
,
default
=
''
,
help
=
'
set the sentence separator; default: (empty)
'
)
parser
.
add_option
(
'
-p
'
,
'
--par-sep
'
,
type
=
'
string
'
,
action
=
'
store
'
,
dest
=
'
par_sep
'
,
default
=
'
\n\n
'
,
help
=
'
set the sentence separator; default: (two newlines)
'
)
help
=
'
set the paragraph separator; default: (two newlines)
'
)
parser
.
add_option
(
'
--ignore-ns-sent
'
,
action
=
'
store_true
'
,
default
=
False
,
dest
=
'
ignore_ns_sent
'
,
help
=
'
ignore no-space markers on sent boundaries
'
)
(
options
,
args
)
=
parser
.
parse_args
()
if
len
(
args
)
!=
2
:
print
'
Need to provide input and output.
'
...
...
@@ -38,19 +37,17 @@ def go():
first
=
True
while
True
:
par
=
rdr
.
get_next_chunk
()
if
options
.
par_sep
:
first
=
True
# if non-empty par separator, skip pre-spaces
parfirst
=
True
if
not
par
:
break
for
sent
in
par
.
sentences
():
if
options
.
sent_sep
:
first
=
True
# if non-empty sent sep, skip pre-spaces
sentfirst
=
True
# if non-empty sent sep, skip pre-spaces
for
tok
in
sent
.
tokens
():
if
not
first
and
tok
.
after_space
():
if
not
par
first
and
((
sentfirst
and
options
.
ignore_ns_sent
)
or
tok
.
after_space
()
)
:
out
.
write
(
'
'
)
out
.
write
(
unicode
(
tok
.
orth
()))
first
=
False
out
.
write
(
options
.
sent_sep
)
sent
first
=
False
parfirst
=
False
out
.
write
(
options
.
par_sep
)
if
__name__
==
'
__main__
'
:
...
...
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