Application Example using the ATK Real-Time API
下面是一个关于HTK的例子
- #include "stdafx.h"
- #include "dllSudx.h"
- typedef vector
- struct ASampleSet
- {
- char name[256];
- TSoundTag tags[301];
- };
- typedef vector
- TStringArray sampleList;
- TSampleSetList sampleSetList;
- int vector_count = 0;
- int ListWavFiles(char* dir, TStringArray& fileList)
- {
- struct _finddata_t c_file;
- long hFile;
- char tmp[1024];
- int retVal = 0;
- sprintf(tmp, "%s//%s", dir, "*.wav");
- /* Find first .c file in current directory */
- if( (hFile = _findfirst( tmp, &c_file )) == -1L )
- return retVal;
- else
- {
- sprintf(tmp, "%s//%s", dir, c_file.name);
- fileList.push_back(tmp);
- retVal++;
- while( _findnext( hFile, &c_file ) == 0 )
- {
- sprintf(tmp, "%s//%s", dir, c_file.name);
- fileList.push_back(tmp);
- retVal++;
- }
- _findclose( hFile );
- }
- return retVal;
- }
- int ListVecFiles(char* dir, TStringArray& fileList)
- {
- struct _finddata_t c_file;
- long hFile;
- char tmp[1024];
- int retVal = 0;
- sprintf(tmp, "%s//%s", dir, "*.vec");
- /* Find first .c file in current directory */
- if( (hFile = _findfirst( tmp, &c_file )) == -1L )
- return retVal;
- else
- {
- sprintf(tmp, "%s//%s", dir, c_file.name);
- fileList.push_back(tmp);
- retVal++;
- while( _findnext( hFile, &c_file ) == 0 )
- {
- sprintf(tmp, "%s//%s", dir, c_file.name);
- fileList.push_back(tmp);
- retVal++;
- }
- _findclose( hFile );
- }
- return retVal;
- }
- int LoadVecFiles(TStringArray& fileList, TSampleSetList& sampleSetList)
- {
- int retVal = 0;
- for(int i=0; i<FILELIST.SIZE(); <声音文件名 printf(?使用方法:test printf(?参数错误/n?); { *if(argc!="4)" bVolumeFlag) bool , vecDirectory char* *VoiceName, VRecognize16BitWav(char int ; g_TestVectorFileName="test.vec" string } FALSE; : TRUE ? matchCount="0;" return matchCount++; i+="3;" pMatchResult[matchCount].dwMatchOffset="i;" pMatchResult[matchCount].ucScore="score;" &score)) bMode, pSampleVec, if(sudxCompareEx(pSrcVec+i, score; i++) matchCount<100; && i<nSrcLen-tailLen i="0;" for(int tailLen="64;" else 0; if(nSampleLen<300) if(nSampleLen<64) if(bMode="=TRUE)" tailLen; 输出匹配结果(得分、偏移量) pMatchResult) MATCHRESULT* 输出匹配结果个数 pnMaxMatch, int* 模式。="TRUE:快速模式;=FALSE:准确模式" BOOL 样本向量的个数 nSampleLen, 样本向量的首地址指针 TSoundTag* 信号源向量的长度(以TSoundTag为计量单位) nSrcLen, 待识别信号源向量的首地址指针 pSrcVec, sudxMatch(TSoundTag* 注意事项:pnMaxMatch的存储空间由应用程序分配,最大为100条记录。 函数返回:1:调用成功。0:调用失败 MATCHRESULT; dwMatchOffset; DWORD ucScore; char unsigned tagMATCHRESULT struct typedef retVal; ); fflush(stdout fileList[i].c_str()); [%s]/n?, file open not printf(?can fclose(fp); !/n?, OK set[%s] printf(?sample retVal++; sampleSetList.push_back(aset); strcpy(aset.name, short!/n?, too if(size!="80)" fp); 80, sizeof(TSoundTag), size="fread(aset.tags," aset; ASampleSet if(fp) ?rb?); fp="fopen(fileList[i].c_str()," FILE*>
- printf("/t声音文件名是要被识别的声音文件,样本目录中包含已经预先处理好的样本/n"
- "/t 音量标志: 表示识别时是否采用音量相关的方式,为0表示识别时不管音量大小,为1表示识别时需要考虑音量大小/n"
- "Press any key continue...");
- getch();
- return -1;
- }*/
- //int volFlag = atol(argv[3]);
- if(bVolumeFlag)
- {
- sudxSetCompVolumeFlag(TRUE);
- printf("采用与音量相关的方式比较/n");
- }
- else
- {
- sudxSetCompVolumeFlag(FALSE);
- printf("采用与音量无关的方式比较/n");
- }
- TStringArray sampleList;
- int i = ListVecFiles(vecDirectory, sampleList);
- if(i<=0)
- {
- printf("No sample files in dir [%s]/n", vecDirectory);
- return -2;
- }
- TSampleSetList sampleSetList;
- int vector_count = LoadVecFiles(sampleList, sampleSetList);
- if(vector_count<=0)
- {
- printf("没有找到样本集合文件/n");
- return -3;
- }
- printf("Now start.../n");
- const int bufSampleSize = 49306; ////充值成功,你的账户余额为的 8k采样,8位长度编码的语音文件大小
- unsigned char * p8bitBuf = new unsigned char[ bufSampleSize];
- short *pFileBuf = new short[bufSampleSize*2]; //每次处理2M个16bit pcm样本,也就是4M byte数据。
- // char outFile[1000];
- // sprintf(outFile, "%s//%s.vec", "c:", VoiceName);
- // FILE* fout = fopen(outFile, "w+b"); //打开或创建向量文件
- FILE *fp = fopen(VoiceName, "rb");
- fseek(fp, 0L, SEEK_END);
- long size = ftell(fp);
- fseek(fp, 44L, SEEK_SET); //跳过wav头
- int old_clock = clock();
- // long segSize = fread(p8bitBuf, sizeof(char), bufSampleSize, fp);
- //alaw2linear( p8bitBuf , bufSampleSize , pFileBuf );
- long segSize = fread(pFileBuf, sizeof(short), bufSampleSize, fp);
- TSoundTag* pOut;
- int outSize, tailSize;
- short* pTail=NULL;
- int last_result[17];
- int iMax = sudxGetMaxInputSampleSize();
- int error = sudxCalcBuffer( pFileBuf, segSize, &pOut, &outSize, &pTail, &tailSize, last_result);
- if ( error > 0 )
- {
- if ( outSize > (64 + 1 ))
- {
- old_clock = clock();
- int compare_turn = outSize - 64 - 1;
- for(i=0; i<COMPARE_TURN; { int i++) for(int [%s]/n?, file if(tailSize tailSize="compare_turn+64-300-i;" sampleSetList[j].name); (i+1)*128, %d, pos sample at Match printf(?Quick ) FALSE) &(sampleSetList[j].tags[1]), sudxCompare(pOut+1+i, if( j++) j<vector_count; j="0;">300)
- {
- if(sudxCompare(pOut+1+i, sampleSetList[j].tags+1, TRUE))
- printf("精确匹配位置 %d, file[%s]/n", (i+1)*128, sampleSetList[j].name);
- else
- printf("!!Slow Not Match at sample pos %d, file[%s]/n", (i+1)*128, sampleSetList[j].name);
- }
- }
- else
- {
- printf("Not Match at sample pos %d, file [%s]/n", (i+1)*128, sampleSetList[j].name);
- }
- }
- }
- int time_passed = clock()-old_clock;
- printf("计算结束, 耗时%d ms/n", time_passed);
- printf("比较速度为每秒钟可查找%f秒音乐/n", double(compare_turn)*128.0/8000.0/(double(time_passed)/1000.0));
- }
- else
- {
- printf("输入的声音过短,不能比较/n");
- return -2;
- }
- }
- else
- {
- return -1;
- }
- return 0;
- }
- int VRecoInit(char * vecDirectory )
- {
- int i = ListVecFiles(vecDirectory, sampleList);
- if(i<=0)
- {
- printf("No sample files in dir [%s]/n", vecDirectory);
- return -2;
- }
- vector_count = LoadVecFiles(sampleList, sampleSetList);
- if(vector_count<=0)
- {
- printf("没有找到样本集合文件/n");
- return -3;
- }
- return 0;
- }
- ///
- int VRecognize(char *VoiceName, char* vecDirectory , bool bVolumeFlag, int * iMatchCount)
- {
- /*if(argc!=4)
- {
- printf("参数错误/n");
- printf("使用方法:test
- printf("/t声音文件名是要被识别的声音文件,样本目录中包含已经预先处理好的样本/n"
- "/t 音量标志: 表示识别时是否采用音量相关的方式,为0表示识别时不管音量大小,为1表示识别时需要考虑音量大小/n"
- "Press any key continue...");
- getch();
- return -1;
- }*/
- //int volFlag = atol(argv[3]);
- if(bVolumeFlag)
- {
- sudxSetCompVolumeFlag(TRUE);
- printf("采用与音量相关的方式比较/n");
- }
- else
- {
- sudxSetCompVolumeFlag(FALSE);
- printf("采用与音量无关的方式比较/n");
- }
- char gcaMsg[1000];
- sprintf(gcaMsg , "Now start...%s/n", VoiceName);
- printf( gcaMsg );
- fflush(stdout);
- const int bufSampleSize = 2048*1024; ////充值成功,你的账户余额为的 8k采样,8位长度编码的语音文件大小
- unsigned char * p8bitBuf = new unsigned char[ bufSampleSize];
- short *pFileBuf = new short[bufSampleSize]; //每次处理2M个16bit pcm样本,也就是4M byte数据。
- // char outFile[1000];
- // sprintf(outFile, "%s//%s.vec", "c:", VoiceName);
- // FILE* fout = fopen(outFile, "w+b"); //打开或创建向量文件
- try
- {
- sprintf(gcaMsg , "bf fopen...%s/n", VoiceName);
- printf( gcaMsg );
- fflush(stdout);
- FILE *fp = fopen(VoiceName, "rb");
- fseek(fp, 0L, SEEK_END);
- long size = ftell(fp);
- fseek(fp, 44L, SEEK_SET); //跳过wav头
- sprintf(gcaMsg , "af fopen...%s/n", VoiceName);
- printf( gcaMsg );
- fflush(stdout);
- int old_clock = clock();
- long segSize = fread(p8bitBuf, sizeof(char), bufSampleSize, fp);
- alaw2linear( p8bitBuf , bufSampleSize , pFileBuf );
- sprintf(gcaMsg , "Af alaw2linear...%s/n", VoiceName);
- printf( gcaMsg );
- fflush(stdout);
- // long segSize = fread(pFileBuf, sizeof(short), bufSampleSize, fp);
- TSoundTag* pOut;
- int outSize, tailSize;
- short* pTail=NULL;
- int last_result[17];
- //int iMax = sudxGetMaxInputSampleSize();
- int error = sudxCalcBuffer( pFileBuf, segSize, &pOut, &outSize, &pTail, &tailSize, last_result);
- if ( error > 0 )
- {
- sprintf(gcaMsg , "Af sudxCalcBuffer...%s/n", VoiceName);
- printf( gcaMsg );
- fflush(stdout);
- if ( outSize > (64 + 1 ))
- {
- old_clock = clock();
- int compare_turn = outSize - 64 - 1;
- for(int i=0; i<COMPARE_TURN; { int i++) for(int [%s]/n?, file if(tailSize tailSize="compare_turn+64-300-i;" sampleSetList[j].name); (i+1)*128, %d, pos sample at Match printf(?Quick ) FALSE) &(sampleSetList[j].tags[1]), sudxCompare(pOut+1+i, if( j++) j<vector_count; j="0;" iMatchCount)++; (*>300)
- {
- if(sudxCompare(pOut+1+i, sampleSetList[j].tags+1, TRUE))
- {
- (* iMatchCount) ++;
- printf("精确匹配位置 %d, file[%s]/n", (i+1)*128, sampleSetList[j].name);
- }
- else
- {
- // printf("!!Slow Not Match at sample pos %d, file[%s]/n", (i+1)*128, sampleSetList[j].name);
- }
- }
- }
- }
- }
- int time_passed = clock()-old_clock;
- printf("计算结束, 耗时%d ms Match Count =%d/n", time_passed,(* iMatchCount) );
- printf("比较速度为每秒钟可查找%f秒音乐/n", double(compare_turn)*128.0/8000.0/(double(time_passed)/1000.0));
- fflush( stdout );
- }
- else
- {
- printf("输入的声音过短,不能比较/n");
- return -2;
- }
- }
- else
- {
- sprintf(gcaMsg , "Now Fail ...%s/n return -1", "CalcBuffer");
- printf( gcaMsg );
- fflush(stdout);
- return -1;
- }
- }
- catch ( ... )
- {
- sprintf(gcaMsg , "Now Fail ...%s/n return -3", "Catch");
- printf( gcaMsg );
- fflush(stdout);
- return -3;
- }
- return 0;
- }
- char * asds_version="!HVER!ASDS: 1.6.0 [SJY 01/06/07]";
- #include "AMonitor.h"
- #include "AIO.h"
- // ---------------- Globals To Define the Recognition System -----------------
- class QA;
- // Information Channel - connects to AIO output
- static ABuffer *inChan; // input channel from AIO
- // Active components (threads)
- // NB: AIO will start-up its own ASource,ASyn,ACode & ARec
- static AIO *aio; // the AIO subsystem
- static AMonitor *amon; // system monitor
- // Global resources - these will be passed to AIO on creation
- ARMan *rman; // resource manager for dict, grammars and HMMSet
- AHmms *hset; // HMM set is global since it never changes
- ADict *dict; // ditto dictionary (though it can be edited if desired)
- AGram *ggrm; // global grammar, always active
- QA *qty, *top; // question/answer instances
- // ------------------ Simple Question/Answer Class ----------------------
- // the status of each slot determines the dialogue flow. each slot
- // starts as unknown. When an answer is provided with high confidence
- // (>minconf), the slot is immediately grounded. Otherwise the slot
- // status moves to unconfirmed ready for explicit checking.
- typedef enum { unknown, unconfirmed, grounded, cancelled } SlotStatus;
- // the system listens to the user in QA.listen, this implements a simple
- // state machine where the states are:
- typedef enum { aActive,aInProcess,aTimeout,aDone,aTerminated} ASRStatus;
- typedef enum { sActive, sDone, sInt } SynStatus;
- static Boolean terminated = FALSE;
- static const float minconf = 0.5;
- class QA {
- public:
- QA(const string& aname, // name of qa object
- const string& aprompt, // query prompt
- const string& gramfile, // name of grammar file
- const string& ahelp); // help message
- ASRStatus Listen(string prompt, string rgroup, SynStatus& ss);
- // output prompt and listen using given res group and update slot value
- void Ask(); // ask question, record answer and set status
- void Check(); // check answer and set status
- void GetSlot(); // get a value for the slot by asking and checking
- string GetValue(); // strip tag and return actual value
- void Show(); // show current slot status
- void Reset();
- SlotStatus status; // slot status
- string value; // slot value
- float curconf; // current input
- string curtag;
- string curwords;
- private:
- string name; // name of slot (also name of semantic tag)
- string prompt; // question
- string help; // help string
- ResourceGroup *ask;
- ResourceGroup *chk;
- };
- // construct a QA object with given prompt and grammar
- QA::QA(const string& aname, const string& aprompt,
- const string& gramfile, const string& ahelp)
- {
- // save the prompts
- prompt = aprompt; help = ahelp; name = aname;
- // create grammar specific to this question
- AGram *g1 = new AGram(name,gramfile);
- rman->StoreGram(g1);
- ask = rman->NewGroup(name+"-ask");
- ask->AddHMMs(hset); // Add the global resources
- ask->AddDict(dict);
- ask->AddGram(ggrm); // include global grammar in parallel with
- ask->AddGram(g1); // qa specific grammar
- // create copy of ask but prepend "No" to front of qa grammar
- // and add confirm in parallel
- chk = rman->NewGroup(name+"-chk");
- chk->AddHMMs(hset); // Add the global resources
- chk->AddDict(dict);
- chk->AddGram(ggrm); // include global grammar
- AGram *g2 = new AGram(*g1); // copy g1
- rman->StoreGram(g2);
- g2->OpenEdit(); // Modify copy of g1 by prepending
- GramSubN *s = g2->main; // "NO" to front with skip to end
- GramNode *ent = s->NewNullNode(99);
- GramNode *no = s->NewWordNode("NO","no");
- GramNode *yes = s->NewCallNode("confirm","yes"); // Add confirm in //
- s->AddLink(ent,no); s->AddLink(ent,yes); s->AddLink(yes,s->exit);
- s->AddLink(no,s->entry); s->AddLink(no,s->exit);
- s->entry = ent;
- g2->CloseEdit();
- chk->AddGram(g2); // Add the new "correction" grammar
- // initial status is unknown
- status = unknown; value = "";
- }
- // Reset slot values for a new dialogue
- void QA::Reset()
- {
- status = unknown; value = "";
- }
- // For debugging only
- void QA::Show()
- {
- string s = "???";
- switch (status){
- case unknown: s = "unknown"; break;
- case unconfirmed: s = "unconfirmed"; break;
- case grounded: s = "grounded"; break;
- case cancelled: s = "cancelled"; break;
- }
- printf("Slot: %s: status=%s value=%s [cur=%s(%s) %.1f]/n",
- name.c_str(),s.c_str(),value.c_str(),curtag.c_str(),curwords.c_str(),curconf);
- }
- // listen to rec packets and construct slot value
- // return system status when finished listening
- ASRStatus QA::Listen(string prompt, string rgroup, SynStatus& ss)
- {
- APacket p;
- string s="";
- float conf=0.0;
- int numwords=0;
- ASRStatus as;
- curtag=""; curwords="";
- // set the resource group to use and start recognising
- string grp = "setgroup("+rgroup+")";
- string prmpt = "ask(/""+prompt+"/")";
- printf("%s --> %s/n",prmpt.c_str(),grp.c_str());
- aio->SendMessage(grp);
- aio->SendMessage(prmpt);
- // listen to response of form "tag(w1 w2 ...)"
- // Following implements a simple state machine ss= syn state as=asr state
- ss = sActive; as = aActive;
- do {
- AStringData *sd;
- ACommandData *cd;
- APhraseData *pd;
- string cmd;
- p = inChan->GetPacket();
- switch(p.GetKind()) {
- case StringPacket:
- sd = (AStringData *)p.GetData();
- if (sd->data.find("TERMINATED") != string::npos) {
- as = aTerminated;
- }
- break;
- case CommandPacket:
- cd = (ACommandData *)p.GetData();
- cmd = cd->GetCommand();
- if (cmd=="synFinished")
- ss = sDone;
- else if (cmd=="synInterrupted")
- ss = sInt;
- else if (cmd=="asrTimeOut")
- as = aTimeout;
- break;
- case PhrasePacket:
- pd = (APhraseData *)p.GetData();
- if (as == aActive && pd->ptype == OpenTag_PT){
- assert(s == "" && numwords == 0);
- as = aInProcess;
- }else if (as == aInProcess && pd->ptype == Word_PT) {
- if (s=="") s = pd->word; else s = s + " " + pd->word;
- // printf("{%s[%.2f]}",pd->word.c_str(),pd->confidence);
- conf += pd->confidence; ++numwords;
- }else if (as == aInProcess &&
- (pd->ptype == CloseTag_PT || pd->ptype == End_PT)){
- curtag = pd->tag;
- curwords = s;
- as = aDone;
- }
- break;
- }
- } while (as <= aInProcess);
- curconf = numwords==0?0.0:conf/numwords;
- printf("/n Response: %s(%s)[%.1f]/n",curtag.c_str(),curwords.c_str(),curconf);
- return as;
- }
- // ask for information
- void QA::Ask()
- {
- Boolean ok = FALSE;
- ASRStatus as; SynStatus ss;
- do {
- as=Listen(prompt,ask->gname,ss);
- if (as==aDone){
- if (curtag == "command") {
- if (curwords == "HELP") {
- aio->SendMessage("tell(/""+help+"/")");
- }else if (curwords == "CANCEL"){
- aio->SendMessage("tell(/"Cancelled/")");
- ok = TRUE; status = cancelled;
- }
- }
- if (curtag == name){
- if (curconf > minconf){
- status = grounded;
- }else{
- status = unconfirmed;
- }
- value = curtag+"("+curwords+")";
- ok = TRUE;
- }
- }else if (as==aTimeout) {
- printf("Timeout/n");
- aio->SendMessage("tell(/"Sorry, I didnt hear that!/")");
- }else if (as==aTerminated) {
- terminated = TRUE;
- }
- } while (!ok && !terminated);
- }
- // confirm current slot value
- void QA::Check()
- {
- Boolean ok = FALSE;
- ASRStatus as; SynStatus ss;
- string prompt;
- do {
- prompt = "Are sure you want "+GetValue()+" ?";
- as = Listen(prompt,chk->gname,ss);
- if (as==aDone){
- if (curtag == "command") {
- if (curwords == "HELP") {
- aio->SendMessage("tell(/"I am trying to confirm your last input./")");
- aio->SendMessage("tell(/"Please say Yes or No. If No, you can also give the correct value./")");
- }else if (curwords == "CANCEL"){
- ok = TRUE; status = cancelled;
- }
- }
- if (curtag == "yes"){
- ok = TRUE; status = grounded;
- }else if (curtag == name){
- if (curconf > minconf){
- status = grounded;
- }else{
- status = unconfirmed;
- }
- value = curtag+"("+curwords+")";
- ok = TRUE;
- }else {
- ok = TRUE; status = unknown; // user must have said No without correction
- }
- }else if (as==aTimeout) {
- aio->SendMessage("Sorry, I didnt hear that!");
- }else if (as==aTerminated) {
- terminated = TRUE;
- }
- } while (!ok && !terminated);
- }
- void QA::GetSlot()
- {
- do {
- Ask();
- while (status == unconfirmed) Check();
- }while (status != grounded && status != cancelled && !terminated);
- }
- string QA::GetValue()
- {
- int n = value.find("(");
- if (n==string::npos) return "";
- ++n;
- int m = value.length() - n -1;
- string val = value.substr(n,m);
- for (int i = 0; i<M; rman- AGram(?GGram?,?global.net?); ggrm="new" ADict(?ADict?); dict="new" AHmms(?HmmSet?); hset="new" resources fixed global create ARMan; rman="new" manager resource a ABuffer(?inChan?); inChan="new" AIO from channel return the { BuildRecogniser() void } getchar(); Continue/n/n?); to Return Press printf(?='==========================================/n/n");' microphone./n/n?); by up picked not printf(?is output/n?); speech that ensure headphones printf(?Use microphone./n?); open an uses demo this - printf(?/nWARNING System/n?); Dialog Spoken Asynchronous ATK printf(?/nASDS: HTK_Error(9999); throw HTK/n?); initialise cannot HRError(9999,?ASDS: (InitHTK(argc,argv,asds_version)<SUCCESS){ if *argv[]) char argc, Initialise(int --------------------------- Code Initialisation ---------------------- val; val[i]="tolower(ch);" ch="val[i];" int i++){>StoreHMMs(hset);
- rman->StoreDict(dict);
- rman->StoreGram(ggrm);
- ResourceGroup *main = rman->NewGroup("main");
- main->AddHMMs(hset); main->AddDict(dict); main->AddGram(ggrm);
- // create the qa objects, these will create the resource groups
- top = new QA("topping",
- "What topping would you like?",
- "topping.net",
- "I have a variety of toppings/n - try your favourite combination");
- qty = new QA("quantity",
- "How many pizzas would you like?",
- "howmany.net",
- "I need to know how many pizzas to deliver");
- // now we have resources, create aio
- aio = new AIO("aio",inChan,rman);
- aio->DefineFiller("ER");
- aio->DefineFiller("SIL");
- aio->DefineFiller("OH");
- // finally create Monitor and attach it to AIO
- amon = new AMonitor;
- aio->AttachMonitor(amon);
- }
- void StartRecogniser()
- {
- // Start up each component thread
- amon->Start();
- aio->Start();
- }
- void ShutDown()
- {
- printf("Shutting down/n");
- // wait till components shutdown
- aio->SendMessage("closedown()");
- // then kill monitor
- amon->Terminate();
- HJoinMonitor();
- }
- // ------------------------- Application Code ---------------------------
- void RunApplication()
- {
- // Start recogniser running
- StartRecogniser();
- do{
- top->GetSlot();
- if (!terminated && top->status == grounded) qty->GetSlot();
- if (top->status == grounded && qty->status == grounded) {
- string order = "Your order is "+qty->GetValue()+" "+top->GetValue();
- if (qty->GetValue() == "one")
- order += " pizza.";
- else
- order += " pizzas.";
- printf("Order: %s/n",order.c_str());
- aio->SendMessage("tell(/""+order+"/")");
- }
- top->Reset(); qty->Reset();
- printf("/n/n=====================================/n/n");
- }while(!terminated);
- ShutDown();
- }
- // --------------------------- Main Program ----------------------------
- int main(int argc, char *argv[])
- {
- try {
- Initialise(argc,argv);
- BuildRecogniser();
- RunApplication();
- }
- catch (ATK_Error e){
- int n = HRErrorCount();
- printf("ATK Error %d/n",e.i);
- for (int i=1; i<=n; i++)
- printf(" %d. %s/n",i,HRErrorGetMess(i));
- }
- catch (HTK_Error e){
- int n = HRErrorCount();
- printf("HTK Error %d/n",e.i);
- for (int i=1; i<=n; i++)
- printf(" %d. %s/n",i,HRErrorGetMess(i));
- }
- return 0;
- }