diff options
author | Determinant <[email protected]> | 2016-02-25 23:20:01 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2016-02-25 23:20:01 +0800 |
commit | c8b16da63e360cfd3172ee67218df19d44f2f5bf (patch) | |
tree | 0a97db12f5be62528f52ea3f80dc9d667a1e3159 /kaldi_io/src | |
parent | 7d774e72c4ca239765ce3e8b78da66f234592118 (diff) |
fix compilation error
Diffstat (limited to 'kaldi_io/src')
-rw-r--r-- | kaldi_io/src/cwrapper_kaldi.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/kaldi_io/src/cwrapper_kaldi.cpp b/kaldi_io/src/cwrapper_kaldi.cpp index 83331ce..e8b11a1 100644 --- a/kaldi_io/src/cwrapper_kaldi.cpp +++ b/kaldi_io/src/cwrapper_kaldi.cpp @@ -82,22 +82,26 @@ extern "C" { KaldiLookupFeatureRepo *kaldi_lookup_feature_repo_new(const char *feature_rspecifier, const char *map_rspecifier) { KaldiLookupFeatureRepo *repo = new KaldiLookupFeatureRepo(); - kaldi::SequentialBaseFloatMatrixReader feature_reader = kaldi::SequentialBaseFloatMatrixReader(string(feature_rspecifier)); - for (; !feature_reader.Done(); feature_reader.Next()) + kaldi::SequentialBaseFloatMatrixReader *feature_reader = \ + new kaldi::SequentialBaseFloatMatrixReader(string(feature_rspecifier)); + for (; !feature_reader->Done(); feature_reader->Next()) { - const std::string &key = feature_reader.Key(); - const kaldi::Matrix<BaseFloat> &feat = feature_reader.Value(); + const std::string &key = feature_reader->Key(); + const kaldi::Matrix<BaseFloat> &feat = feature_reader->Value(); if (repo->key2mat.find(key) != repo->key2mat.end()) fprintf(stderr, "[kaldi] warning: lookup feature for key %s already exists", key.c_str()); repo->key2mat[key] = feat; } - kaldi::SequentialTokenVectorReader map_reader = kaldi::SequentialTokenVectorReader(string(map_rspecifier)); - for (; !map_reader.Done(); map_reader.Next()) + delete feature_reader; + kaldi::SequentialTokenVectorReader *map_reader = \ + new kaldi::SequentialTokenVectorReader(string(map_rspecifier)); + for (; !map_reader->Done(); map_reader->Next()) { - const std::vector<std::string> target = map_reader.Value(); + const std::vector<std::string> target = map_reader->Value(); assert(target.size() >= 1); - repo->map[map_reader.Key()] = *target.begin(); + repo->map[map_reader->Key()] = *target.begin(); } + delete map_reader; return repo; } |