亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hlat.c

?? 隱馬爾科夫模型工具箱
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* ----------------------------------------------------------- *//*                                                             *//*                          ___                                *//*                       |_| | |_/   SPEECH                    *//*                       | | | | \   RECOGNITION               *//*                       =========   SOFTWARE                  */ /*                                                             *//*                                                             *//* ----------------------------------------------------------- *//* developed at:                                               *//*                                                             *//*      Speech Vision and Robotics group                       *//*      Cambridge University Engineering Department            *//*      http://svr-www.eng.cam.ac.uk/                          *//*                                                             *//* author: Gunnar Evermann <ge204@eng.cam.ac.uk>               *//* ----------------------------------------------------------- *//*         Copyright:                                          *//*         2001-2002  Cambridge University                     *//*                    Engineering Department                   *//*                                                             *//*   Use of this software is governed by a License Agreement   *//*    ** See the file License for the Conditions of Use  **    *//*    **     This banner notice must not be removed      **    *//*                                                             *//* ----------------------------------------------------------- *//*       File: HLat.c:  Lattice Manipulation                   *//* ----------------------------------------------------------- *//*#### todo:     - implement lattice oracle WER calculation     - allow batch processing?*/char *hlat_version = "!HVER!HLat:   3.2 [CUED 09/12/02]";char *hlat_vc_id = "$Id: HLat.c,v 1.3 2002/12/19 16:37:11 ge204 Exp $";#include "HShell.h"#include "HMem.h"#include "HMath.h"#include "HWave.h"#include "HAudio.h"#include "HParm.h"#include "HLabel.h"#include "HModel.h"#include "HUtil.h"#include "HDict.h"#include "HNet.h"#include "HLM.h"#include "HLat.h"/* ----------------------------- Trace Flags ------------------------- */#define T_TOP  00001#define T_PRUN 00002#define T_FB   00004#define T_EXP  00010#define T_MEM  00020#define T_TRAN 00040static int trace=0;static ConfParam *cParm[MAXGLOBS];      /* config parameters */static int nParm = 0;/* --------------------------- Global Flags -------------------------- */static LabId startWord;         /* word at start of Lattice (!SENT_START) */static LabId endWord;           /* word at end of Lattice (!SENT_END) */static LabId startLMWord;       /* word at start in LM (<s>) */static LabId endLMWord;         /* word at end in LM (</s>) */static LabId nullWord;          /* null word in Lattices (!NULL) */static MemHeap slaHeap, slnHeap;/* MHEAPs for use in LatExpand() *//* --------------------------- Prototypes ---------------------------- */#ifndef NO_LAT_LMtypedef struct _SubLNode SubLNode;typedef struct _SubLArc SubLArc;struct _SubLNode {   union {      LMState lmstate;      LNode *newln;   } data;   SubLArc *foll;   SubLNode *next;};struct _SubLArc {   LogFloat lmprob;   SubLNode *end;   LArc *la;   SubLArc *next;};#endif/* --------------------------- Initialisation ---------------------- *//* EXPORT->InitLat: register module & set configuration parameters */void InitLat(void){   int i;   Register(hlat_version,hlat_vc_id);   nParm = GetConfig("HLAT", TRUE, cParm, MAXGLOBS);   if (nParm>0){      if (GetConfInt(cParm,nParm,"TRACE",&i)) trace = i;   }#ifndef NO_LAT_LM   CreateHeap (&slaHeap, "LatExpand arc heap", MHEAP, sizeof (SubLArc), 1.0, 1000, 128000);   CreateHeap (&slnHeap, "LatExpand node heap", MHEAP,sizeof (SubLNode), 1.0, 1000, 32000);#endif}/* --------------------------- Lattice processing ------------------- *//* LatCheck     check lattice for consistency: single start & end nodes; no cycles.*/void LatCheck (Lattice *lat){   int i, nStart, nEnd;   LNode *ln;   LNode **topOrder;   /* check for unique start and end nodes */   nStart = nEnd = 0;   for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln) {      if (!ln->pred)         ++nStart;      if (!ln->foll)         ++nEnd;   }   if (nStart != 1)      HError (8622, "HLat: lattice has %d start nodes (should be 1)", nStart);   if (nEnd != 1)      HError (8622, "HLat: lattice has %d end nodes (should be 1)", nEnd);   /* check wheter lat is a DAG ( <=> top order exists). */   topOrder = (LNode **) New (&gcheap, lat->nn * sizeof(LNode *));   if (!LatTopSort (lat, topOrder))      HError (8622, "HLat: lattice contains cylces");   Dispose (&gcheap, topOrder);}/* FixPronProbs     replace pronunciation probabilities in lattices with values taken from     the dictionary*/void FixPronProbs (Lattice *lat, Vocab *voc){   int i, v;   LNode *ln;   Pron pron;   LArc *la;   for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln) {      if (ln->word != voc->nullWord) {         if (ln->v > ln->word->nprons)            HError (8621, "FixPronprbs: lattice refers to non-existing pron");         pron = ln->word->pron;         for (v = 2; v <= ln->v; ++v)            pron = pron->next;         if (pron->pnum != ln->v)            HError (8621, "FixPronprbs: dict pron numbering invalid");                  for (la = ln->pred; la; la = la->parc)            la->prlike = pron->prob;      }      else {         for (la = ln->pred; la; la = la->parc)            la->prlike = 0.0;      }   }}/* LatStartNode     return lattice start node     ###GE: maybe store this in Lattice structure to save time?*/LNode *LatStartNode (Lattice *lat){   int i;   LNode *ln;   for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln)      if (!ln->pred)         return ln;   HError (8622, "HLat: lattice has no start node");   return NULL;         /* make compiler happy */}/* LatEndNode     return lattice end node     ###GE: maybe store this in Lattice structure to save time?*/LNode *LatEndNode (Lattice *lat){   int i;   LNode *ln;   for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln)      if (!ln->foll)         return ln;   HError (8622, "HLat: lattice has no end node");   return NULL;         /* make compiler happy */}/* helper function for LatTopSort()   number preceeding nodes depth first */void LatTopSortVisit (LNode *ln, int *time){   LArc *la;   ln->n = -2;          /* mark node as seen, but not numbered, yet (GRAY in CLR) */   for (la = ln->pred; la; la = la->parc)      if (la->start->n == -1)         LatTopSortVisit (la->start, time);      ++(*time);   ln->n = *time;}/* LatTopSort     sort lattice nodes in topological order     returns array of LNode pointers.     uses depth first traversal (in reverse (pred) direction)      based on [CLR:1990], p. 485 */Boolean LatTopSort (Lattice *lat, LNode **topOrder){   int time = -1;       /* new numbering will start at 0 */   int i;   LNode *ln;   LArc *la;   Boolean isDAG = TRUE;   for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln)      ln->n = -1;        /* mark node as unseen (WHITE in CLR) */   LatTopSortVisit (LatEndNode (lat), &time);      /* we should have seen all nodes */   assert (time+1 == lat->nn);    /* check topological order */   for (i = 0, la = lat->larcs; i < lat->na; ++i, ++la)      if (!(la->start->n < la->end->n)) {         isDAG = FALSE;         HError (-8622, "LatTopSort: Lattice contains cycles");          break;      }   for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln)      topOrder[ln->n] = ln;      /*#### GE: reset ln->n values? */   for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln)      ln->n = i;   return isDAG;}/* LatAttachInfo     allocate & attach an Info structre for each node*/void LatAttachInfo (MemHeap *heap, size_t size, Lattice *lat){   int i;   LNode *ln;      for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln)      ln->hook = (Ptr) New (heap, size);}/* LatDetachInfo     free Info structre for each node*/void LatDetachInfo (MemHeap *heap, Lattice *lat){   int i;   LNode *ln;      for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln)      Dispose (heap, ln->hook);}/* LatForwBackw     perform forward-backward algorithm on lattice and store scores in     FBInfo structre     choice of using sum (LATFB_SUM) or max (LATFB_MAX) of scores*/LogDouble LatForwBackw (Lattice *lat, LatFBType type){   int i;   LNode *ln;   LArc *la;   LNode **topOrder;   LogDouble score;   /* We assume that the FBinfo structures are already allocated. */   /* init */   for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln) {      LNodeFw (ln) = LNodeBw (ln) = LZERO;   }   LNodeFw (LatStartNode (lat)) = 0.0;   LNodeBw (LatEndNode (lat)) = 0.0;   /* find topological order of nodes */   topOrder = (LNode **) New (&gcheap, lat->nn * sizeof(LNode *));   if (!LatTopSort (lat, topOrder))      HError (8622, "LatForwBackw: cannot calculate forw/backw score on Lattice with cycles");          /* the processing in the forward and backward directions are really      almost the same. if the data structures had been done _slightly_      nicer this could be done in one loop. The only readable way now       would be defining a couple of macros... */   /* forward direction */   for (i = 0; i < lat->nn; ++i) {      ln = topOrder[i];      for (la = ln->foll; la; la = la->farc) {         assert (la->start == ln);                  score = LNodeFw (ln) + LArcTotLike (lat, la);         switch (type) {         case LATFB_SUM:            LNodeFw (la->end) = LAdd (LNodeFw (la->end), score);            break;         case LATFB_MAX:            if (score > LNodeFw (la->end))               LNodeFw (la->end) = score;            break;         default:            abort ();         }      }   }   /* backward direction */   for (i = lat->nn - 1; i >= 0; --i) {      ln = topOrder[i];      for (la = ln->pred; la; la = la->parc) {         assert (la->end == ln);                  score = LNodeBw (ln) + LArcTotLike (lat, la);         switch (type) {         case LATFB_SUM:            LNodeBw (la->start) = LAdd (LNodeBw (la->start), score);            break;         case LATFB_MAX:            if (score > LNodeBw (la->start))               LNodeBw (la->start) = score;            break;         default:            abort ();         }      }   }   if (trace & T_FB) {      printf ("forward prob:  %f\n", LNodeFw (topOrder[lat->nn - 1]));      printf ("backward prob: %f\n", LNodeBw (topOrder[0]));   }   score = LNodeBw (topOrder[0]);   Dispose (&gcheap, topOrder);   return score;}/* EXPORT->LatFindBest     find the N-best paths (i.e. lowest sum of LArcTotLike()s) and generate     Transcription.     ####GE: currently only N=1 is supported*/Transcription *LatFindBest (MemHeap *heap, Lattice *lat, int N){   int i;   LNode *ln;   LNode **topOrder;   LArc *la;   LogDouble score, ac, lm, pr, tot;   Word nullWord;   Pron pron;   Transcription *trans;   LabList *ll;   LLink lab;      if (N != 1)      HError (8690, "FindBest: only 1-best supported, yet.");   /* during the search ln->score will hold the score of the best      path to ln (i.e. lowest score). ln->hook will point to      the arc leading to the preceeding node in this path */   /* init fields */   for (i = 0, ln = lat->lnodes; i < lat->nn; ++i, ++ln) {      ln->score = LZERO;      ln->hook = NULL;   }   LatStartNode (lat)->score = 0.0;   /* find topological order of nodes */   topOrder = (LNode **) New (&gcheap, lat->nn * sizeof(LNode *));   if (!LatTopSort (lat, topOrder))      HError (8690, "LatFindBest: cannot find best path in Lattice with cycles");   assert (topOrder[0] == LatStartNode (lat));   /* traverse nodes in top order */   for (i = 0; i < lat->nn; ++i) {      ln = topOrder[i];            /* for all outgoing arcs: propagate scores forward */      for (la = ln->foll; la; la = la->farc) {         assert (la->start == ln);         score = la->start->score + LArcTotLike (lat, la);         if (score > la->end->score) {            la->end->score = score;            la->end->hook = (Ptr) la;         }      }   }   /* create traqnscription */   trans = CreateTranscription (heap);   ll = CreateLabelList (heap, 0);      nullWord = lat->voc->nullWord;   ac = lm = pr = tot = 0;   if (trace & T_TRAN)      printf ("1best trans (wordPron t ac lm pr tot): ");   /* backtrack from end node along best path and generate transcription */   ln = LatEndNode (lat);   la = (LArc *) ln->hook;   while (la) {      LabId outlab;      if (ln->word != nullWord) {         for (pron = ln->word->pron; pron; pron = pron->next)            if (pron->pnum == ln->v)                break;         if (pron)            outlab = pron->outSym;         else   /* if we can't find pronvar (e.g. wlist), fall back to word */            outlab = ln->word->wordName;         if (outlab) {            lab = CreateLabel (heap, ll->maxAuxLab);            lab->labid = outlab;            lab->start = la->start->time * 1.0e7;            lab->end = ln->time * 1.0e7;            lab->score = LArcTotLike (lat, la);                        lab->succ = ll->head->succ;            lab->pred = ll->head;            lab->succ->pred = lab->pred->succ = lab;         }      }      ac += la->aclike;      lm += la->lmlike;      pr += la->prlike;      tot += LArcTotLike (lat, la);      if (trace & T_TRAN)         printf ("(%s%d %.2f %.3f %.3f %.3f %.3f) ", ln->word->wordName->name, ln->v,                 ln->time, la->aclike, la->lmlike, la->prlike, LArcTotLike (lat, la));

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
777a∨成人精品桃花网| 欧美日韩午夜影院| 久久99精品国产麻豆婷婷| 91精品国产品国语在线不卡| 午夜精品久久久久久久99水蜜桃 | 久久福利视频一区二区| 精品国产sm最大网站免费看| 韩国毛片一区二区三区| 欧美国产日产图区| 色婷婷av一区二区三区大白胸 | 91视频www| 亚洲精品免费在线播放| 在线播放一区二区三区| 激情偷乱视频一区二区三区| 国产精品卡一卡二| 欧美群妇大交群的观看方式| 精品在线播放免费| 亚洲天堂网中文字| 欧美一区二区美女| 成人综合婷婷国产精品久久蜜臀| 日韩美女视频一区二区 | 亚洲成av人片| 久久夜色精品国产噜噜av| 91香蕉视频污| 麻豆成人久久精品二区三区小说| 亚洲国产成人午夜在线一区| 欧美丰满少妇xxxxx高潮对白| 一本色道久久加勒比精品| 美女免费视频一区二区| 国产精品久久久久久久岛一牛影视 | 大白屁股一区二区视频| 午夜精品视频在线观看| 国产精品久久一卡二卡| 4438亚洲最大| 91麻豆精品秘密| 激情丁香综合五月| 亚洲第一搞黄网站| 日韩理论片网站| 精品捆绑美女sm三区| 日本精品一区二区三区高清| 国产一区二区电影| 日韩成人免费看| 日韩理论在线观看| 久久九九全国免费| 宅男噜噜噜66一区二区66| av福利精品导航| 国产尤物一区二区| 免费视频一区二区| 亚洲午夜视频在线| 亚洲男女一区二区三区| 久久亚洲精品小早川怜子| 欧美欧美欧美欧美首页| 欧美在线综合视频| 99久久精品国产麻豆演员表| 国产福利精品一区二区| 国内精品久久久久影院色| 首页国产欧美日韩丝袜| 亚洲一区二区av电影| ...xxx性欧美| 国产精品毛片久久久久久久| 欧美精品一区二区在线播放| 欧美精品v国产精品v日韩精品 | 日本欧美大码aⅴ在线播放| 亚洲一区二区三区中文字幕 | 欧美高清性hdvideosex| 在线精品视频免费播放| 色狠狠一区二区| 色av一区二区| 欧美在线观看禁18| 在线观看精品一区| 欧美午夜精品久久久久久超碰| 在线播放国产精品二区一二区四区| 欧美精品一区二区三区蜜桃视频| 国产乱子轮精品视频| 蜜臀久久久久久久| 美女尤物国产一区| 久久精品国产一区二区| 国产精品一区二区男女羞羞无遮挡| 精品亚洲成a人| 国产91在线看| 成人18视频日本| 91色porny蝌蚪| 91激情五月电影| 欧美日韩情趣电影| 日韩欧美一区二区视频| 精品国产一区二区三区久久影院| 欧美精品一区二区三区蜜桃视频| 久久婷婷色综合| 国产精品欧美一区二区三区| 亚洲靠逼com| 亚洲资源中文字幕| 日本v片在线高清不卡在线观看| 日韩电影一区二区三区四区| 韩国av一区二区三区| 成人av资源网站| 欧美日韩国产免费一区二区| 日韩一区二区免费在线电影| 久久夜色精品国产欧美乱极品| 日韩一区二区不卡| 成人午夜在线免费| 亚洲男女一区二区三区| 国产精品乱子久久久久| 亚洲欧洲av一区二区三区久久| 亚洲免费资源在线播放| 日韩精品乱码免费| 国产精品综合视频| 91久久免费观看| 日韩欧美激情一区| 国产精品免费久久| 无码av免费一区二区三区试看| 国内精品免费在线观看| 一本一本大道香蕉久在线精品 | 欧美日本韩国一区| 亚洲精品一区二区三区精华液 | 免费高清在线视频一区·| 成人免费视频app| 欧美精品tushy高清| 国产精品久久久久天堂| 免费的成人av| 色婷婷国产精品久久包臀| 精品免费国产二区三区 | 亚洲尤物在线视频观看| 欧美丰满少妇xxxbbb| 99精品国产99久久久久久白柏| 欧美性做爰猛烈叫床潮| 国产亚洲综合性久久久影院| 亚洲国产美国国产综合一区二区| 国产精品自拍网站| 欧美精品v国产精品v日韩精品| 国产精品理伦片| 国产在线视频一区二区| 欧美色涩在线第一页| 国产清纯美女被跳蛋高潮一区二区久久w| 亚洲卡通动漫在线| 国产成人在线免费| 欧美一区三区四区| 亚洲图片欧美视频| 91亚洲精品久久久蜜桃网站| 久久老女人爱爱| 免费看日韩精品| 欧美日韩国产免费一区二区 | 亚洲一区视频在线观看视频| 国产乱码精品一品二品| 欧美疯狂性受xxxxx喷水图片| 日本精品一区二区三区四区的功能| 中文字幕av一区 二区| 91网站最新网址| 亚洲欧美激情在线| 日韩欧美一卡二卡| 91福利在线免费观看| 经典三级视频一区| 亚洲欧美另类图片小说| 精品粉嫩超白一线天av| 欧美三级欧美一级| 成人av免费在线播放| 精品一区二区在线视频| 石原莉奈一区二区三区在线观看| 波多野结衣中文字幕一区二区三区| 久久午夜老司机| 久久综合久久99| 精品一区二区三区免费视频| 777xxx欧美| 日韩黄色一级片| 欧美日韩1234| 男女男精品视频网| 制服丝袜成人动漫| 国产精品一区二区在线观看网站| 国产一区在线精品| 久久免费美女视频| 国产成人精品免费视频网站| 国产色爱av资源综合区| 国产成人免费在线| 国产精品免费久久| 一本大道av一区二区在线播放| 亚洲欧美国产三级| 欧美日韩视频第一区| 六月丁香综合在线视频| 久久亚洲一区二区三区明星换脸| 久久99精品视频| 国产女主播一区| 91视频一区二区| 亚洲123区在线观看| 日韩精品专区在线| 国产精品一区一区三区| 国产精品嫩草影院av蜜臀| 在线欧美一区二区| 免费观看成人av| 国产人成一区二区三区影院| 99精品一区二区三区| 亚洲成av人片| 久久久久国色av免费看影院| 99精品国产99久久久久久白柏| 亚洲一区二区三区精品在线| 日韩一区二区三区高清免费看看| 精品写真视频在线观看| 成人免费在线视频观看| 538在线一区二区精品国产| 精品写真视频在线观看| 亚洲免费毛片网站| 精品国产一区二区三区忘忧草|