summaryrefslogtreecommitdiff
path: root/tnet_io
diff options
context:
space:
mode:
Diffstat (limited to 'tnet_io')
-rw-r--r--tnet_io/cwrapper.cpp6
-rw-r--r--tnet_io/cwrapper.h1
-rw-r--r--tnet_io/init.c7
3 files changed, 13 insertions, 1 deletions
diff --git a/tnet_io/cwrapper.cpp b/tnet_io/cwrapper.cpp
index e82f3f8..4149557 100644
--- a/tnet_io/cwrapper.cpp
+++ b/tnet_io/cwrapper.cpp
@@ -2,13 +2,13 @@
#include "KaldiLib/Labels.h"
#include "KaldiLib/Common.h"
#include "KaldiLib/UserInterface.h"
-#include "../../common.h"
#include <string>
#define SNAME "TNET"
extern "C" {
#include "cwrapper.h"
#include "string.h"
+#include "../../common.h"
extern Matrix *nerv_matrix_host_float_new_(lua_State *L, long nrow, long ncol);
@@ -77,6 +77,10 @@ extern "C" {
repo->feature_repo.MoveNext();
}
+ int tnet_feature_repo_is_end(TNetFeatureRepo *repo) {
+ return repo->feature_repo.EndOfList();
+ }
+
size_t tnet_feature_repo_current_samplerate(TNetFeatureRepo *repo) {
return repo->feature_repo.CurrentHeader().mSamplePeriod;
}
diff --git a/tnet_io/cwrapper.h b/tnet_io/cwrapper.h
index a34f090..54fb69b 100644
--- a/tnet_io/cwrapper.h
+++ b/tnet_io/cwrapper.h
@@ -14,6 +14,7 @@ extern "C" {
size_t tnet_feature_repo_current_samplerate(TNetFeatureRepo *repo);
const char *tnet_feature_repo_current_tag(TNetFeatureRepo *repo);
void tnet_feature_repo_next(TNetFeatureRepo *repo);
+ int tnet_feature_repo_is_end(TNetFeatureRepo *repo);
void tnet_feature_repo_destroy(TNetFeatureRepo *repo);
typedef struct TNetLabelRepo TNetLabelRepo;
diff --git a/tnet_io/init.c b/tnet_io/init.c
index 3fa7cb8..16f6f37 100644
--- a/tnet_io/init.c
+++ b/tnet_io/init.c
@@ -40,10 +40,17 @@ static int feat_repo_next(lua_State *L) {
return 0;
}
+static int feat_repo_is_end(lua_State *L) {
+ TNetFeatureRepo *repo = luaT_checkudata(L, 1, nerv_tnet_feat_repo_tname);
+ lua_pushboolean(L, tnet_feature_repo_is_end(repo));
+ return 1;
+}
+
static const luaL_Reg feat_repo_methods[] = {
{"cur_utter", feat_repo_current_utterance},
{"cur_tag", feat_repo_current_tag},
{"next", feat_repo_next},
+ {"is_end", feat_repo_is_end},
{NULL, NULL}
};