All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ContextDependencyInterface Class Referenceabstract

context-dep-itf.h provides a link between the tree-building code in ../tree/, and the FST code in ../fstext/ (particularly, ../fstext/context-dep.h). More...

#include <context-dep-itf.h>

Inheritance diagram for ContextDependencyInterface:

Public Member Functions

virtual int ContextWidth () const =0
 ContextWidth() returns the value N (e.g. More...
 
virtual int CentralPosition () const =0
 Central position P of the phone context, in 0-based numbering, e.g. More...
 
virtual bool Compute (const std::vector< int32 > &phoneseq, int32 pdf_class, int32 *pdf_id) const =0
 The "new" Compute interface. More...
 
virtual void GetPdfInfo (const std::vector< int32 > &phones, const std::vector< int32 > &num_pdf_classes, std::vector< std::vector< std::pair< int32, int32 > > > *pdf_info) const =0
 GetPdfInfo returns a vector indexed by pdf-id, saying for each pdf which pairs of (phone, pdf-class) it can correspond to. More...
 
virtual void GetPdfInfo (const std::vector< int32 > &phones, const std::vector< std::vector< std::pair< int32, int32 > > > &pdf_class_pairs, std::vector< std::vector< std::vector< std::pair< int32, int32 > > > > *pdf_info) const =0
 This function outputs information about what possible pdf-ids can be generated for HMM-states; it covers the general case where the self-loop pdf-class may be different from the forward-transition pdf-class, so we are asking not about the set of possible pdf-ids for a given (phone, pdf-class), but the set of possible ordered pairs (forward-transition-pdf, self-loop-pdf) for a given (phone, forward-transition-pdf-class, self-loop-pdf-class). More...
 
virtual int32 NumPdfs () const =0
 NumPdfs() returns the number of acoustic pdfs (they are numbered 0.. NumPdfs()-1). More...
 
virtual ~ContextDependencyInterface ()
 
 ContextDependencyInterface ()
 
virtual
ContextDependencyInterface
Copy () const =0
 Returns pointer to new object which is copy of current one. More...
 

Private Member Functions

 KALDI_DISALLOW_COPY_AND_ASSIGN (ContextDependencyInterface)
 

Detailed Description

context-dep-itf.h provides a link between the tree-building code in ../tree/, and the FST code in ../fstext/ (particularly, ../fstext/context-dep.h).

It is an abstract interface that describes an object that can map from a phone-in-context to a sequence of integer leaf-ids.

Definition at line 34 of file context-dep-itf.h.

Constructor & Destructor Documentation

virtual ~ContextDependencyInterface ( )
inlinevirtual

Definition at line 102 of file context-dep-itf.h.

102 {};

Definition at line 103 of file context-dep-itf.h.

103 {}

Member Function Documentation

virtual int CentralPosition ( ) const
pure virtual

Central position P of the phone context, in 0-based numbering, e.g.

P = 1 for typical triphone system. We have to see if we can do without this function.

Implemented in ContextDependency.

Referenced by kaldi::ConvertAlignmentForPhone(), kaldi::ConvertAlignmentInternal(), kaldi::GenerateRandomAlignment(), kaldi::GetHmmAsFst(), kaldi::GetHmmAsFstSimple(), kaldi::GetIlabelMapping(), and kaldi::GetRandomAlignmentForPhone().

virtual bool Compute ( const std::vector< int32 > &  phoneseq,
int32  pdf_class,
int32 *  pdf_id 
) const
pure virtual

The "new" Compute interface.

For typical topologies, pdf_class would be 0, 1, 2. Returns success or failure; outputs the pdf-id.

"Compute" is the main function of this interface, that takes a sequence of N phones (and it must be N phones), possibly including epsilons (symbol id zero) but only at positions other than P [these represent unknown phone context due to end or begin of sequence]. We do not insist that Compute must always output (into stateseq) a nonempty sequence of states, but we anticipate that stateseq will alyway be nonempty at output in typical use cases. "Compute" returns false if expansion somehow failed. Normally the calling code should raise an exception if this happens. We can define a different interface later in order to handle other kinds of information– the underlying data-structures from event-map.h are very flexible.

Implemented in ContextDependency.

Referenced by kaldi::ConvertAlignmentForPhone(), kaldi::GenerateRandomAlignment(), kaldi::GetHmmAsFst(), kaldi::GetHmmAsFstSimple(), and kaldi::GetIlabelMapping().

virtual int ContextWidth ( ) const
pure virtual

ContextWidth() returns the value N (e.g.

3 for triphone models) that says how many phones are considered for computing context.

Implemented in ContextDependency.

Referenced by kaldi::ConvertAlignmentInternal(), kaldi::GenerateRandomAlignment(), kaldi::GetHmmAsFst(), kaldi::GetHmmAsFstSimple(), and kaldi::GetIlabelMapping().

virtual ContextDependencyInterface* Copy ( ) const
pure virtual

Returns pointer to new object which is copy of current one.

Implemented in ContextDependency.

Referenced by kaldi::TestConvertAlignment().

virtual void GetPdfInfo ( const std::vector< int32 > &  phones,
const std::vector< int32 > &  num_pdf_classes,
std::vector< std::vector< std::pair< int32, int32 > > > *  pdf_info 
) const
pure virtual

GetPdfInfo returns a vector indexed by pdf-id, saying for each pdf which pairs of (phone, pdf-class) it can correspond to.

(Usually just one). c.f. hmm/hmm-topology.h for meaning of pdf-class. This is the old, simpler interface of GetPdfInfo(), and that this one can only be called if the HmmTopology object's IsHmm() function call returns true.

Implemented in ContextDependency.

Referenced by TransitionModel::ComputeTuplesIsHmm(), and TransitionModel::ComputeTuplesNotHmm().

virtual void GetPdfInfo ( const std::vector< int32 > &  phones,
const std::vector< std::vector< std::pair< int32, int32 > > > &  pdf_class_pairs,
std::vector< std::vector< std::vector< std::pair< int32, int32 > > > > *  pdf_info 
) const
pure virtual

This function outputs information about what possible pdf-ids can be generated for HMM-states; it covers the general case where the self-loop pdf-class may be different from the forward-transition pdf-class, so we are asking not about the set of possible pdf-ids for a given (phone, pdf-class), but the set of possible ordered pairs (forward-transition-pdf, self-loop-pdf) for a given (phone, forward-transition-pdf-class, self-loop-pdf-class).

Note: 'phones' is a list of integer ids of phones, and 'pdf-class-pairs', indexed by phone, is a list of pairs (forward-transition-pdf-class, self-loop-pdf-class) that we can have for that phone. The output 'pdf_info' is indexed first by phone and then by the same index that indexes each element of 'pdf_class_pairs', and tells us for each pair in 'pdf_class_pairs', what is the list of possible (forward-transition-pdf-id, self-loop-pdf-id) that we can have. This is less efficient than the other version of GetPdfInfo().

Implemented in ContextDependency.

KALDI_DISALLOW_COPY_AND_ASSIGN ( ContextDependencyInterface  )
private
virtual int32 NumPdfs ( ) const
pure virtual

NumPdfs() returns the number of acoustic pdfs (they are numbered 0.. NumPdfs()-1).

Implemented in ContextDependency.


The documentation for this class was generated from the following file: