Skip to content

Commit

Permalink
Fix parser when a file path points to one file
Browse files Browse the repository at this point in the history
  • Loading branch information
clovis authored Apr 12, 2019
1 parent 65a6b0f commit cc686ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/textpair/xml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ def __init__(self, file_path, output_path="./", cores=4, words_to_keep="all", de
os.system("mkdir -p {}/texts".format(output_path))
self.text_path = str(Path(output_path).joinpath("texts"))
self.metadata_path = str(Path(output_path).joinpath("metadata/metadata.json"))
files = glob(str(Path(file_path).joinpath("*")))
if os.path.isfile(file_path):
files = [file_path]
else:
files = glob(str(Path(file_path).joinpath("*")))
self.files = list(zip(range(len(files)), files))
self.workers = cores
self.debug = debug
Expand Down

0 comments on commit cc686ba

Please sign in to comment.