summaryrefslogtreecommitdiff
path: root/kaldi_io/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2016-02-29 22:02:32 +0800
committerDeterminant <[email protected]>2016-02-29 22:02:32 +0800
commite7c9175e1059a15720025a99ccdb35d5bf6dc30f (patch)
tree27f10d1f95116c9faf7b62a6524c235dd811aeb5 /kaldi_io/src
parentd9e03b7d2c14549ab480d5e3b31518be4cdc8eed (diff)
parent24d56605428467e604afded423ba2ff49f2644e3 (diff)
Merge branch 'master' of https://github.com/sxkachilles/nerv-speech into sxkachilles-master
Conflicts: kaldi_decode/src/Makefile kaldi_io/src/cwrapper_kaldi.cpp
Diffstat (limited to 'kaldi_io/src')
-rw-r--r--kaldi_io/src/cwrapper_kaldi.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/kaldi_io/src/cwrapper_kaldi.cpp b/kaldi_io/src/cwrapper_kaldi.cpp
index e8b11a1..788128b 100644
--- a/kaldi_io/src/cwrapper_kaldi.cpp
+++ b/kaldi_io/src/cwrapper_kaldi.cpp
@@ -159,8 +159,13 @@ extern "C" {
Matrix *kaldi_label_repo_read_utterance(KaldiLabelRepo *repo, KaldiFeatureRepo *frepo, int nframes,
lua_State *L,
int debug, MContext *context) {
- Matrix *mat;
- kaldi::Posterior targets = repo->targets_reader->Value(frepo->utt);
+ Matrix *mat = NULL;
+ /* check if the alignment of the utterance exists, otherwise return NULL */
+ kaldi::Posterior targets;
+ if (repo->targets_reader->HasKey(frepo->utt))
+ targets = repo->targets_reader->Value(frepo->utt);
+ else
+ return mat;
int n = targets.size() < nframes ? targets.size() : nframes;
int m = (int)targets[0].size();