Skip to content

Commit

Permalink
Python wrapper for get_h_transducer (Addresses pykaldi#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
vrmpx committed Apr 30, 2019
1 parent 89b5a76 commit 148281e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 8 additions & 0 deletions kaldi/hmm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,20 @@

from ._hmm_topology import *
from ._hmm_utils import *
from ._hmm_utils import _get_h_transducer
from ._hmm_utils_ext import *
from ._posterior import *
from ._posterior_ext import *
from ._transition_model import *
from ._tree_accu import *
from kaldi.fstext import StdVectorFst

def get_h_transducer(self, ilabel_info, ctx_dep, trans_model, config):
"""Python wrapper for _hmm_utils.get_h_transducer. Post-process output into StdVectorFst."""
h_transducer, disambig_syms_left = _get_h_transducer(ilabel_info, ctx_dep, trans_model, config)
return StdVectorFst(h_transducer), disambig_syms_left

__all__ = [name for name in dir()
if name[0] != '_'
and not name.endswith('Base')]

5 changes: 2 additions & 3 deletions kaldi/hmm/hmm-utils.clif
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ from "hmm/hmm-utils.h":
# NOTE(Dogan): No need for the following functions in Python.
# GetHmmAsFsa, GetHmmAsFsaSimple

def `GetHTransducer` as get_h_transducer(
def `GetHTransducer` as _get_h_transducer(
ilabel_info: list<list<int>>, ctx_dep: ContextDependencyInterface,
trans_model: TransitionModel, config: HTransducerConfig)
-> (h_transducer: StdVectorFst, disambig_syms_left: list<int>):
"""Creates the H transducer."""
return StdVectorFst(...)


def `GetIlabelMapping` as get_ilabel_mapping(
ilabel_info_old: list<list<int>>, ctx_dep: ContextDependencyInterface,
trans_model: TransitionModel) -> list<int>:
Expand Down

0 comments on commit 148281e

Please sign in to comment.