summaryrefslogtreecommitdiff
path: root/kaldi_io/src
diff options
context:
space:
mode:
Diffstat (limited to 'kaldi_io/src')
-rw-r--r--kaldi_io/src/cwrapper_kaldi.cpp20
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;
}