January 23,2006

pc code convert to wince

一些code 在PC 上可以使用但是WINCE 不可以
所以我提供一些Sample 可以分享

int BigramCacheLM::Train(class WordBreaker *wb, char *cacheLMList, char *essayFileNameList, char *filteredEssayTempFileName, char *oldAdaptiveFile, int order)
{
class EssayFilter *ef;
class NGramCounter *ngc;
//char filteredEssayTempFileName2[256];
/*Roger*/
TCHAR filteredEssayTempFileName2[256]; // roger

// Filter the essays first;
ef = new EssayFilter();
ef->Filter(essayFileNameList, filteredEssayTempFileName);
if (ef)
delete ef;

// Break the words of essay;
TCHAR AB[8] = TEXT("%hs.tmp");
wvsprintf(filteredEssayTempFileName2, AB, filteredEssayTempFileName);
char *B;
B=(char *)(&filteredEssayTempFileName2[0]);
//C=(unsigned short *)(&filteredEssayTempFileName[0]);
wb->BreakFile(filteredEssayTempFileName, B);
// Get the count;
ngc = new NGramCounter(fLexicon);
// Read the old adaptive file;
ngc->ReadCount(oldAdaptiveFile, order, 0);
// Output the resulting count file to the cacheLM file;
ngc->CountFile(cacheLMList, B, order, kPhaseCacheSize);

unsigned short *C;
C=(unsigned short *)(&filteredEssayTempFileName[0]);
DeleteFile(filteredEssayTempFileName2);
DeleteFile(C);
//_unlink(filteredEssayTempFileName2);
//_unlink(filteredEssayTempFileName);



if (ngc)
delete ngc;

return kSuccess;
}

Posted by yam_javanull at 樂多Roodo! │14:36 │回應(0)引用(0)C++
樂多分類:網路/3C 共同主題:程式設計 工具:編輯本文
Ads by Roodo! 

引用URL

http://cgi.blog.roodo.com/trackback/1039289