From 52fcde1cdffbefee730bb90e535c54c9d426f6d3 Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Wed, 4 Dec 2013 14:28:48 -0500 Subject: Remove dependency on pycdec for force alignment --- word-aligner/force_align.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'word-aligner') diff --git a/word-aligner/force_align.py b/word-aligner/force_align.py index b03d446e..d5d59d11 100755 --- a/word-aligner/force_align.py +++ b/word-aligner/force_align.py @@ -3,6 +3,10 @@ import os import sys +# Hook into realtime +sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'realtime', 'rt')) +from aligner import ForceAligner + def main(): if len(sys.argv[1:]) < 4: @@ -16,10 +20,6 @@ def main(): sys.stderr.write('where heuristic is one of: (intersect union grow-diag grow-diag-final grow-diag-final-and) default=grow-diag-final-and\n') sys.exit(2) - # Hook into realtime - sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'realtime')) - from rt.aligner import ForceAligner - aligner = ForceAligner(*sys.argv[1:]) for line in sys.stdin: -- cgit v1.2.3 From 45d094ed4520b87372ad6a4afb06e23d752129d7 Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Wed, 4 Dec 2013 14:43:50 -0500 Subject: Flush each line --- word-aligner/force_align.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'word-aligner') diff --git a/word-aligner/force_align.py b/word-aligner/force_align.py index d5d59d11..8386e6a5 100755 --- a/word-aligner/force_align.py +++ b/word-aligner/force_align.py @@ -21,9 +21,13 @@ def main(): sys.exit(2) aligner = ForceAligner(*sys.argv[1:]) - - for line in sys.stdin: + + while True: + line = sys.stdin.readline() + if not line: + break sys.stdout.write('{}\n'.format(aligner.align_formatted(line.strip()))) + sys.stdout.flush() aligner.close() -- cgit v1.2.3