HTK中的那些哈希表

第一个介绍的是LabId的hashtable

#define HASHSIZE 250007                /* size of hash table */
static NameCell *hashtab[HASHSIZE];  /* the actual table */

一般HTK中的hash槽位存的都是指针,她们指向另一个结构体。这个hashtable的元素为Lable,它的解引用(*Lable),即为NameCell,其内容:

typedef struct _NameCell{  /* Hash Table Linked List Item */
   char * name;             /* Label Name */
   Ptr aux;                 /* User pointer */
   struct _NameCell *next;  /* Chain */
}NameCell;

就是字符串,可以是HMM的名称,也可以是词(DictEntry)的名称。

一般通过GetLabId函数来返回这个结构指针,如果为NULL说明在hash表没有存对应的对象。

 

另一个哈希表,就是指向Macro的mtab:

MLink * mtab;           /* Array[0..MACHASHSIZE-1]OF MLink */
typedef struct _MacroDef *MLink;

typedef struct _MacroDef{
   MLink next;             /* next cell in hash table */
   char type;              /* type of macro [hluvixdtmps*] */
   short fidx;             /* idx of MMF file (0 = SMF) */
   LabId id;               /* name of macro */
   Ptr structure;          /* -> shared structure or HMM Def */
} MacroDef;

它是作为HMMSet对象中一个数据项。通过hset->mtab的hash值来访问HMM/Marco对象,也是这里的Ptr指针指向的对象。

再一个就是词典每个入口的hash表:

Word *wtab;          /* hash table for DictEntry's */
typedef struct _DictEntry *Word;
typedef struct _DictEntry{
   LabId wordName;  /* word identifier */
   Pron pron;       /* first pronunciation */
   int nprons;      /* number of prons for this word */
   Word next;       /* next word in hash table chain */
   void *aux;       /* hook used by HTK library modules for temp info */
} DictEntry;

它是词典vocab中一个数据项。也是通过LabId来计算hash值的。它的Pron是指针,指向发音对象WordPron,表明这个Word有几个读音,每个读音有哪几个音子。

在构建Lattice时,LNode就有关于发音的PronHolder对象,就是根据发音字典的Pron指针指向的WordPron来展开。

最后一个哈希表就是word end 表,它是在构建Network图时,最后一个发音音子指向一个word end节点。

/* Word end nodes are accessed through a hash table for fast access */
#define WNHASHSIZE 5701
static NetNode *wnHashTab[WNHASHSIZE];


/* The network nodes themselves just store connectivity info */
struct _NetNode {
   NetNodeType type;    /* Type of this node (includes context) */
   union {
      HLink  hmm;       /* HMM (physical) definition */
      Pron   pron;      /* Word represented (may == null) */
   }
   info;                /* Extra information specific to type of node */
   char    *tag;        /* Semantic tagging information */
   int nlinks;          /* Number of nodes connected to this one */
   NetLink *links;      /* Array[0..nlinks-1] of links to connected nodes */
   NetInst *inst;       /* Model Instance (if one exists, else NULL) */   
   NetNode *chain;
   int aux;
};

这个WordNode是由LArc的start节点的发音信息构建,也是它的inst指向start节点的pInst(PronHolder对象),且它的links指向LArc的ends节点。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值