hmm-test-utils.h
Go to the documentation of this file.
1 // hmm/hmm-test-utils.h
2 
3 // Copyright 2009-2011 Microsoft Corporation
4 // 2015 Johns Hopkins University (author: Daniel Povey)
5 
6 // See ../../COPYING for clarification regarding multiple authors
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 // MERCHANTABLITY OR NON-INFRINGEMENT.
18 // See the Apache 2 License for the specific language governing permissions and
19 // limitations under the License.
20 
21 #ifndef KALDI_HMM_HMM_TEST_UTILS_H_
22 #define KALDI_HMM_HMM_TEST_UTILS_H_
23 
24 #include "hmm/hmm-topology.h"
25 #include "hmm/transition-model.h"
26 #include "lat/kaldi-lattice.h"
27 #include "tree/context-dep.h"
28 
29 namespace kaldi {
30 
31 // Here we put a convenience function for generating a TransitionModel object --
32 // useful in test code. We may put other testing-related things here in time.
33 
34 // This function returns a randomly generated TransitionModel object.
35 // If 'ctx_dep' is not NULL, it outputs to *ctx_dep a pointer to the
36 // tree that was used to generate the transition model.
37 TransitionModel *GenRandTransitionModel(ContextDependency **ctx_dep);
38 
42 HmmTopology GetDefaultTopology(const std::vector<int32> &phones);
43 
44 
50 HmmTopology GenRandTopology(const std::vector<int32> &phones,
51  const std::vector<int32> &num_pdf_classes);
52 
55 HmmTopology GenRandTopology();
56 
63 void GeneratePathThroughHmm(const HmmTopology &topology,
64  bool reorder,
65  int32 phone,
66  std::vector<std::pair<int32, int32> > *path);
67 
68 
71 void GenerateRandomAlignment(const ContextDependencyInterface &ctx_dep,
72  const TransitionModel &trans_model,
73  bool reorder,
74  const std::vector<int32> &phone_sequence,
75  std::vector<int32> *alignment);
76 
77 
78 
79 
80 } // namespace kaldi
81 
82 #endif
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
HmmTopology GetDefaultTopology(const std::vector< int32 > &phones_in)
This function returns a HmmTopology object giving a normal 3-state topology, covering all phones in t...
kaldi::int32 int32
void GeneratePathThroughHmm(const HmmTopology &topology, bool reorder, int32 phone, std::vector< std::pair< int32, int32 > > *path)
This function generates a random path through the HMM for the given phone.
HmmTopology GenRandTopology(const std::vector< int32 > &phones_in, const std::vector< int32 > &num_pdf_classes)
This method of generating an arbitrary HmmTopology object allows you to specify the number of pdf-cla...
void GenerateRandomAlignment(const ContextDependencyInterface &ctx_dep, const TransitionModel &trans_model, bool reorder, const std::vector< int32 > &phone_sequence, std::vector< int32 > *alignment)
For use in test code, this function generates an alignment (a sequence of transition-ids) correspondi...
TransitionModel * GenRandTransitionModel(ContextDependency **ctx_dep_out)