summaryrefslogtreecommitdiff
path: root/htk_io/src/test.c
blob: 1ced108f7605fff4d4c3d6fc1f3498279df91f65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "cwrapper.h"
#include "nerv/lib/matrix/mmatrix.h"
#include <stdio.h>

MContext context;

void print_nerv_matrix(Matrix *mat) {
    int n = mat->nrow;
    int m = mat->ncol;
    int i, j;
    size_t stride = mat->stride;
    for (i = 0; i < n; i++)
    {

        float *nerv_row = (float *)((char *)mat->data.f + i * stride);
        for (j = 0; j < m; j++)
            fprintf(stderr, "%.8f ", nerv_row[j]);
        fprintf(stderr, "\n");
    }
}

int main() {
    fprintf(stderr, "init repo\n");
    TNetFeatureRepo *feat_repo = tnet_feature_repo_new(
            "/slfs1/users/mfy43/swb_ivec/train_bp.scp",
            "/slfs1/users/mfy43/swb_ivec/plp_0_d_a.conf", 5);
    Matrix *feat_utter;
    feat_utter = tnet_feature_repo_read_utterance(feat_repo, NULL, 1, &context);

    TNetLabelRepo *lab_repo = tnet_label_repo_new(
            "/slfs1/users/mfy43/swb_ivec/ref.mlf",
            "map",
            "/slfs1/users/mfy43/swb_ivec/dict",
            "*/",
            "lab");
    Matrix *lab_utter = tnet_label_repo_read_utterance(lab_repo,
            feat_utter->nrow - 5 * 2,
            tnet_feature_repo_current_samplerate(feat_repo),
            tnet_feature_repo_current_tag(feat_repo), NULL,
            1, &context);
    print_nerv_matrix(lab_utter);
    return 0;
}