Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wcrft2
Manage
Activity
Members
Labels
Plan
Issues
0
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
Syntactic Tools
Morphological
wcrft2
Commits
3bb719c0
Commit
3bb719c0
authored
12 years ago
by
Pawel Orlowicz
Browse files
Options
Downloads
Patches
Plain Diff
handling both 'text' and 'txt' for plain text input
parent
464c7793
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wcrft/corpio.py
+4
-3
4 additions, 3 deletions
wcrft/corpio.py
with
4 additions
and
3 deletions
wcrft/corpio.py
+
4
−
3
View file @
3bb719c0
...
...
@@ -23,7 +23,8 @@ import corpus2, wccl, maca
import
config
import
codecs
,
os
PLAIN_TEXT_FORMAT
=
'
txt
'
PLAIN_TEXT_FORMAT
=
'
text
'
PLAIN_TEXT_FORMAT_ALT
=
'
txt
'
PREMORPH_TEXT_FORMAT
=
'
premorph
'
format_help
=
"""
...
...
@@ -45,7 +46,7 @@ def get_reader(in_path, tagset, input_format, maca_config = ''):
"""
Creates a reader using the options. If in_path evaluates to False,
will create a stdin reader.
"""
if
in_path
:
if
input_format
==
PLAIN_TEXT_FORMAT
:
if
input_format
==
PLAIN_TEXT_FORMAT
or
input_format
==
PLAIN_TEXT_FORMAT_ALT
:
return
maca
.
PlainTextReader
.
create_file_reader
(
in_path
,
maca_config
)
elif
input_format
==
PREMORPH_TEXT_FORMAT
:
return
maca
.
PremorphTextReader
.
create_file_reader
(
in_path
,
maca_config
)
...
...
@@ -53,7 +54,7 @@ def get_reader(in_path, tagset, input_format, maca_config = ''):
return
corpus2
.
TokenReader
.
create_path_reader
(
input_format
,
tagset
,
in_path
)
else
:
if
input_format
==
PLAIN_TEXT_FORMAT
:
if
input_format
==
PLAIN_TEXT_FORMAT
or
input_format
==
PLAIN_TEXT_FORMAT_ALT
:
return
maca
.
PlainTextReader
.
create_stream_reader
(
maca_config
)
elif
input_format
==
PREMORPH_TEXT_FORMAT
:
return
maca
.
PremorphTextReader
.
create_stream_reader
(
maca_config
)
...
...
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