Skip to content

Commit

Permalink
utils.py: moved dictionary_path to if block
Browse files Browse the repository at this point in the history
  • Loading branch information
singh-lokendra committed Aug 1, 2019
1 parent 8dc6f91 commit 817cbdd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apertium/utils.py
Expand Up @@ -56,18 +56,19 @@ def execute_pipeline(inp: str, commands: List[List[str]]) -> str:
input_file_name, output_file_name = input_file.name, output_file.name

arg = command[1][1] if len(command) >= 3 else ''
dictionary_path = command[-1]
text = end.decode()
input_file.write(text)
input_file.close()

if 'lt-proc' == command[0]:
dictionary_path = command[-1]
lttoolbox.LtLocale.tryToSetLocale()
fst = lttoolbox.FST(dictionary_path)
if not fst.valid():
raise ValueError('FST Invalid')
fst.lt_proc(arg, input_file_name, output_file_name)
elif 'lrx-proc' == command[0]:
dictionary_path = command[-1]
lextools.LtLocale.tryToSetLocale()
lrx = lextools.LRXProc(dictionary_path)
lrx.lrx_proc(arg, input_file.name, output_file.name)
Expand Down

0 comments on commit 817cbdd

Please sign in to comment.