Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load chunk from sorted ark files #146

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions data_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def _input_is_feature_file(fea_scp):
return not _input_is_wav_file(fea_scp)

def _read_features_and_labels_with_kaldi(fea_scp, fea_opts, fea_only, lab_folder, lab_opts, output_folder):
def _sort_before_loading():
return True #For now this decision is hard coded

fea = dict()
lab = dict()
if _input_is_feature_file(fea_scp):
Expand All @@ -36,10 +39,13 @@ def _read_features_and_labels_with_kaldi(fea_scp, fea_opts, fea_only, lab_folder
elif _input_is_wav_file(fea_scp):
kaldi_bin = "wav-copy"
read_function = read_vec_flt_ark
fea = {
k: m
for k, m in read_function("ark:" + kaldi_bin + " scp:" + fea_scp + " ark:- |" + fea_opts, output_folder)
}

if _sort_before_loading():
fea_scp_string='"cat '+fea_scp+' | sort -k 1 |"'
else:
fea_scp_string=fea_scp
fea = { k:m for k,m in read_function('ark:'+kaldi_bin+' scp:'+fea_scp_string+' ark:- |'+fea_opts,output_folder) }

if not fea_only:
lab = {
k: v
Expand Down