diff options
| author | Patrick Simianer <p@simianer.de> | 2014-01-13 12:37:45 +0100 | 
|---|---|---|
| committer | Patrick Simianer <p@simianer.de> | 2014-01-13 12:37:45 +0100 | 
| commit | a2f803d5b629f31cf41313d77e382150dd007d39 (patch) | |
| tree | c56130c1112e803058b33b98853cff08a8f8450d /word-aligner | |
| parent | 926fb52bfc85dcd58156916ca2536ee32c719954 (diff) | |
| parent | c148f8429c66103a401ba4c3a029e349cd11aa8a (diff) | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'word-aligner')
| -rwxr-xr-x | word-aligner/force_align.py | 16 | 
1 files changed, 10 insertions, 6 deletions
diff --git a/word-aligner/force_align.py b/word-aligner/force_align.py index b03d446e..8386e6a5 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,14 +20,14 @@ 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: + +    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()  | 
