Skip to content
Snippets Groups Projects
Commit 3bb719c0 authored by Pawel Orlowicz's avatar Pawel Orlowicz
Browse files

handling both 'text' and 'txt' for plain text input

parent 464c7793
Branches
Tags
No related merge requests found
......@@ -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)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment