Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[egs] Add missing file local/join_suffix.py in TEDLIUM s5_r3; thx:ana…
…nd@sayint.ai (#2741)
- Loading branch information
1 parent
1d079fa
commit f1f9a48
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright 2014 Nickolay V. Shmyrev | ||
# 2016 Johns Hopkins University (author: Daniel Povey) | ||
# Apache 2.0 | ||
|
||
|
||
import sys | ||
from codecs import open | ||
|
||
# This script joins together pairs of split-up words like "you 're" -> "you're". | ||
# The TEDLIUM transcripts are normalized in a way that's not traditional for | ||
# speech recognition. | ||
|
||
for line in sys.stdin: | ||
items = line.split() | ||
new_items = [] | ||
i = 1 | ||
while i < len(items): | ||
if i < len(items) - 1 and items[i+1][0] == '\'': | ||
new_items.append(items[i] + items[i+1]) | ||
i = i + 1 | ||
else: | ||
new_items.append(items[i]) | ||
i = i + 1 | ||
print(items[0] + ' ' + ' '.join(new_items)) |