1. 程式人生 > >語音識別的大規模漢語樹形詞典 搜索速度快如閃電

語音識別的大規模漢語樹形詞典 搜索速度快如閃電

大神 tdi cti 找到 oot idt 滿足 pst 添加

  1. #include "stdafx.h"
  2. #include "YuyinTree.h"
  3. #include "YuyinTreeDlg.h"
  4. #ifdef _DEBUG
  5. #define new DEBUG_NEW
  6. #undef THIS_FILE
  7. static char THIS_FILE[] = __FILE__;
  8. #endif
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CAboutDlg dialog used for App About
  11. CStoredPinyin* m_storedPinyin[30000];
  12. CWordTree* curTree=
    new CWordTree; //指向詞語樹指針
  13. CString MaxLenghci=‘/‘‘; //存儲該單詞包括的最大子詞
  14. CString Tempci; //臨時詞
  15. int StoredNum=0; //已存入查詢數組中拼音個數
  16. class CAboutDlg : public CDialog
  17. {
  18. public:
  19. CAboutDlg();
  20. // Dialog Data
  21. //{{AFX_DATA(CAboutDlg)
  22. enum { IDD = IDD_ABOUTBOX };
  23. //}}AFX_DATA
  24. // ClassWizard generated virtual function overrides
  25. //{{AFX_VIRTUAL(CAboutDlg)
  26. protected:
  27. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  28. //}}AFX_VIRTUAL
  29. // Implementation
  30. protected:
  31. //{{AFX_MSG(CAboutDlg)
  32. //}}AFX_MSG
  33. DECLARE_MESSAGE_MAP()
  34. };
  35. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  36. {
  37. //{{AFX_DATA_INIT(CAboutDlg)
  38. //}}AFX_DATA_INIT
  39. }
  40. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  41. {
  42. CDialog::DoDataExchange(pDX);
  43. //{{AFX_DATA_MAP(CAboutDlg)
  44. //}}AFX_DATA_MAP
  45. }
  46. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  47. //{{AFX_MSG_MAP(CAboutDlg)
  48. // No message handlers
  49. //}}AFX_MSG_MAP
  50. END_MESSAGE_MAP()
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CYuyinTreeDlg dialog
  53. CYuyinTreeDlg::CYuyinTreeDlg(CWnd* pParent /*=NULL*/)
  54. : CDialog(CYuyinTreeDlg::IDD, pParent)
  55. {
  56. //{{AFX_DATA_INIT(CYuyinTreeDlg)
  57. m_inputTongyin = _T("");
  58. //}}AFX_DATA_INIT
  59. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  60. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  61. }
  62. void CYuyinTreeDlg::DoDataExchange(CDataExchange* pDX)
  63. {
  64. CDialog::DoDataExchange(pDX);
  65. //{{AFX_DATA_MAP(CYuyinTreeDlg)
  66. DDX_Text(pDX, IDC_PINYIN_EQUAL, m_inputTongyin);
  67. //}}AFX_DATA_MAP
  68. }
  69. BEGIN_MESSAGE_MAP(CYuyinTreeDlg, CDialog)
  70. //{{AFX_MSG_MAP(CYuyinTreeDlg)
  71. ON_WM_SYSCOMMAND()
  72. ON_WM_PAINT()
  73. ON_WM_QUERYDRAGICON()
  74. ON_BN_CLICKED(IDC_BTN_READFILE, OnBtnReadfile)
  75. ON_BN_CLICKED(IDC_BTN_TEST_PANDCHI, OnBtnTestPandchi)
  76. ON_BN_CLICKED(IDC_BTN_TEST_TONGYINCI, OnBtnTestTongyinci)
  77. ON_BN_CLICKED(IDC_YUYIN_QUERY, OnTongyinQuery)
  78. ON_NOTIFY(TVN_SELCHANGED, IDC_YUYIN_TREE, OnSelchangedYuyinTree)
  79. //}}AFX_MSG_MAP
  80. END_MESSAGE_MAP()
  81. /////////////////////////////////////////////////////////////////////////////
  82. // CYuyinTreeDlg message handlers
  83. BOOL CYuyinTreeDlg::OnInitDialog()
  84. {
  85. CDialog::OnInitDialog();
  86. // Add "About..." menu item to system menu.
  87. // IDM_ABOUTBOX must be in the system command range.
  88. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  89. ASSERT(IDM_ABOUTBOX < 0xF000);
  90. CMenu* pSysMenu = GetSystemMenu(FALSE);
  91. if (pSysMenu != NULL)
  92. {
  93. CString strAboutMenu;
  94. strAboutMenu.LoadString(IDS_ABOUTBOX);
  95. if (!strAboutMenu.IsEmpty())
  96. {
  97. pSysMenu->AppendMenu(MF_SEPARATOR);
  98. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  99. }
  100. }
  101. // Set the icon for this dialog. The framework does this automatically
  102. // when the application‘s main window is not a dialog
  103. SetIcon(m_hIcon, TRUE); // Set big icon
  104. SetIcon(m_hIcon, FALSE); // Set small icon
  105. // TODO: Add extra initialization here
  106. //程序添加的代碼:
  107. //初始化已讀單詞數組
  108. for(int i=0;i<30000;i++)
  109. {
  110. m_storedPinyin[i]=NULL;
  111. }
  112. FILE *InputFile=NULL; //讀取文件指針
  113. CTreeNode* CurNode=NULL; //當前節點
  114. CTreeNode* FatherNode=NULL; //當前節點的父節點
  115. TCHAR NodeItem[100]; //節點的全部數據
  116. TCHAR NodePinyin[51]; //節點的拼音
  117. TCHAR NodeHanzi[50]; //節點漢字
  118. int ZiMuNum,j,k;
  119. int WordNum=0; //統計詞的數目
  120. BOOL IsFirst=TRUE; //標誌是否是根節點的第一個孩子節點
  121. CTreeNode* TempfatherNode=NULL; //臨時父節點
  122. CTreeNode* TempfatherNode1=NULL; //臨時父節點
  123. InputFile=fopen("LexiconTree.txt","r");
  124. while(!feof(InputFile))
  125. {
  126. WordNum++;
  127. fscanf(InputFile,"%s",NodeItem);
  128. ZiMuNum=0; //ZiMuNum為讀取字母個數
  129. while(NodeItem[ZiMuNum]!=‘,‘)//讀取漢字
  130. {
  131. NodeHanzi[ZiMuNum]=NodeItem[ZiMuNum];
  132. ZiMuNum++;
  133. }
  134. NodeHanzi[ZiMuNum]=‘/0‘;// 此時NodeHanzi存儲了漢字
  135. ZiMuNum++;
  136. while(NodeItem[ZiMuNum]!=‘,‘)//讀取詞號
  137. {
  138. ZiMuNum++;
  139. }
  140. ZiMuNum++;
  141. j=ZiMuNum;
  142. k=0;
  143. while(NodeItem[j]!=‘/0‘) //讀拼音
  144. {
  145. NodePinyin[k]=NodeItem[j];
  146. k++;
  147. j++;
  148. }
  149. NodePinyin[k-1]=‘/0‘; //此時NodePinyin存儲了拼音
  150. CString TempString; //暫時存儲拼音
  151. TempString=NodePinyin;
  152. CurNode=new CTreeNode;
  153. CurNode->m_Pinyin=TempString;
  154. CurNode->m_Word=NodeHanzi;
  155. CurNode->m_pParent=NULL;
  156. CurNode->m_pchild=NULL;
  157. CurNode->m_pneighbour=NULL;
  158. CurNode->m_pchar=NULL;
  159. CurNode->m_CurNum=0;
  160. BOOL Fviewed=FALSE; //是否查到的標誌,默認為沒查到
  161. BOOL FParent=FALSE; //接點是否有父節點的標誌,如a,;a,ba,;a,ba,hao,
  162. BOOL FEqual=FALSE; //相同發音詞標誌,如a,啊,阿,呵
  163. for(int temp=0;temp<30000;temp++) //temp為叠代次數,先檢查看看是否已經插入了詞
  164. {
  165. if(m_storedPinyin[temp]!=NULL) //看當前查看的數據項是否有值,若有進入循環,否則跳過
  166. {
  167. int t=-1;
  168. t=TempString.Find(m_storedPinyin[temp]->m_StoredPinyin); //find 的意思是找到整個匹配串
  169. if(t>=0) //若有重疊項,進入語句,插數據項
  170. {
  171. if(TempString==m_storedPinyin[temp]->m_StoredPinyin) //若兩者拼音完全相同,把漢字插入樹節點項的相似字數組中
  172. {
  173. Fviewed=TRUE; //查到
  174. FEqual=TRUE; //相同詞標記TRUE
  175. int TempCurNum=(m_storedPinyin[temp]->m_pcurPosition)->m_CurNum;
  176. CTongyinci* temp1=new CTongyinci;
  177. temp1->next=NULL;
  178. temp1->m_data=new char[50];
  179. strcpy(temp1->m_data,NodeHanzi);
  180. CTongyinci* temp2=(m_storedPinyin[temp]->m_pcurPosition)->m_pchar;
  181. CTongyinci* pre;
  182. while(temp2!=NULL)
  183. {
  184. pre=temp2;
  185. temp2=temp2->next;
  186. }
  187. pre->next=temp1;
  188. (m_storedPinyin[temp]->m_pcurPosition)->m_CurNum=(m_storedPinyin[temp]->m_pcurPosition)->m_CurNum+1;
  189. break;
  190. }
  191. else if(t==0) //否則,插入樹節點項的子節點中,必需保證從第一個字對齊並且在待檢查接點中重疊部分後一位為",",檢查
  192. { //比如a和an不能是父子節點關系;la和a不能是父子節點關系
  193. Tempci=m_storedPinyin[temp]->m_StoredPinyin;
  194. int Strsize=Tempci.GetLength(); //問題
  195. if(TempString.GetAt(Strsize)==‘,‘) //若滿足重疊部分後一位為","
  196. {
  197. FParent=TRUE; //有父親節點
  198. if(Strsize>=MaxLenghci.GetLength())
  199. {
  200. MaxLenghci=Tempci; //註意
  201. TempfatherNode1=m_storedPinyin[temp]->m_pcurPosition; //註意
  202. }
  203. Fviewed=TRUE; //查到
  204. }
  205. }
  206. }
  207. }
  208. else
  209. continue;
  210. }
  211. if(FParent&&!FEqual)
  212. {
  213. CurNode->m_CurNum++; //當前同音字數加1
  214. /* char** pTempChar=new char*[50]; //開辟一個而維數組,臨時值向同音字的指針
  215. for(int l=0;l<50;l++)
  216. {
  217. pTempChar[l]=new char[50];
  218. pTempChar[l][0]=‘/0‘;
  219. }
  220. */
  221. CTongyinci* temp=new CTongyinci;
  222. temp->next=NULL;
  223. temp->m_data=new char[50];
  224. strcpy(temp->m_data,NodeHanzi);
  225. CurNode->m_pchar=temp;
  226. curTree->InsertNode(&CurNode,&TempfatherNode1); //在查到的節點處插入子節點
  227. CStoredPinyin* TempStorPinyin1=new CStoredPinyin; //創建臨時待查詢對象
  228. TempStorPinyin1->m_pcurPosition=CurNode;
  229. TempStorPinyin1->m_StoredPinyin=TempString;
  230. TempStorPinyin1->m_pchar=temp;
  231. m_storedPinyin[StoredNum++]=TempStorPinyin1; //將產生節點存放已訪問數組中
  232. }
  233. MaxLenghci=‘/0‘; //恢復用到的兩個變量到初值
  234. TempfatherNode1=NULL;
  235. if(!Fviewed) //如果在已存詞表中找不到該詞則在根節點插入新詞,並存放在已訪問數組中
  236. {
  237. if(IsFirst==TRUE)
  238. {
  239. TempfatherNode=curTree->m_Root;
  240. }
  241. CurNode->m_CurNum++; //當前同音字數加1
  242. /* char** pTempChar=new char*[50]; //開辟一個而維數組,臨時值向同音字的指針,存100個詞
  243. for(int l=0;l<50;l++)
  244. {
  245. pTempChar[l]=new char[10];
  246. pTempChar[l][0]=‘/0‘;
  247. }
  248. CurNode->m_pchar=pTempChar;
  249. strcpy(CurNode->m_pchar[0],NodeHanzi);*/
  250. CTongyinci* temp=new CTongyinci;
  251. temp->next=NULL;
  252. temp->m_data=new char[50];
  253. strcpy(temp->m_data,NodeHanzi);
  254. CurNode->m_pchar=temp;
  255. TempfatherNode=curTree->InsertFirstNode(&CurNode,&TempfatherNode); //在根節點插入新詞
  256. IsFirst=FALSE; //以後插入的點全不是第一個節點
  257. CStoredPinyin* TempStorPinyin; //創建臨時待查詢對象
  258. TempStorPinyin=new CStoredPinyin;
  259. TempStorPinyin->m_pcurPosition=CurNode;
  260. TempStorPinyin->m_StoredPinyin=NodePinyin;
  261. TempStorPinyin->m_pchar=temp;
  262. //排錯flag pass 10月21號
  263. m_storedPinyin[StoredNum]=TempStorPinyin; //將產生節點存放已訪問數組中
  264. StoredNum++;
  265. }
  266. }
  267. char buffer[50];
  268. sprintf(buffer,"已讀取單詞: %d",WordNum);
  269. AfxMessageBox(buffer);
  270. BrowseYuyin();
  271. return TRUE; // return TRUE unless you set the focus to a control
  272. }
  273. void CYuyinTreeDlg::OnSysCommand(UINT nID, LPARAM lParam)
  274. {
  275. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  276. {
  277. CAboutDlg dlgAbout;
  278. dlgAbout.DoModal();
  279. }
  280. else
  281. {
  282. CDialog::OnSysCommand(nID, lParam);
  283. }
  284. }
  285. // If you add a minimize button to your dialog, you will need the code below
  286. // to draw the icon. For MFC applications using the document/view model,
  287. // this is automatically done for you by the framework.
  288. void CYuyinTreeDlg::OnPaint()
  289. {
  290. if (IsIconic())
  291. {
  292. CPaintDC dc(this); // device context for painting
  293. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  294. // Center icon in client rectangle
  295. int cxIcon = GetSystemMetrics(SM_CXICON);
  296. int cyIcon = GetSystemMetrics(SM_CYICON);
  297. CRect rect;
  298. GetClientRect(&rect);
  299. int x = (rect.Width() - cxIcon + 1) / 2;
  300. int y = (rect.Height() - cyIcon + 1) / 2;
  301. // Draw the icon
  302. dc.DrawIcon(x, y, m_hIcon);
  303. }
  304. else
  305. {
  306. CDialog::OnPaint();
  307. }
  308. }
  309. // The system calls this to obtain the cursor to display while the user drags
  310. // the minimized window.
  311. HCURSOR CYuyinTreeDlg::OnQueryDragIcon()
  312. {
  313. return (HCURSOR) m_hIcon;
  314. }
  315. // 添加的主要代碼
  316. void CYuyinTreeDlg::OnBtnReadfile() //測試樹第一層節點
  317. {
  318. //檢驗第一層節點插入是否正確,結果正確
  319. CTreeNode* root=curTree->m_Root;
  320. CTreeNode* Temp=root->m_pchild;
  321. while(Temp!=NULL)
  322. {
  323. AfxMessageBox(Temp->m_Pinyin);
  324. Temp=Temp->m_pneighbour;
  325. }
  326. }
  327. CWordTree::CWordTree() //樹的初始化
  328. {
  329. m_Root=new CTreeNode;
  330. m_Root->m_Pinyin="";
  331. m_Root->m_pParent=NULL;
  332. m_Root->m_pchild=NULL;
  333. m_Root->m_pneighbour=NULL;
  334. m_Root->m_CurNum=0;
  335. m_Root->m_Word="";
  336. m_Root->m_pchar=NULL;
  337. }
  338. void CWordTree::CreateTree()
  339. {
  340. }
  341. CTreeNode* CWordTree::InsertFirstNode(CTreeNode** newNode,CTreeNode** parent) //插入第一層節點
  342. {
  343. CTreeNode* WilladNode=*newNode;
  344. CTreeNode* FatherNode=*parent;
  345. if(FatherNode==curTree->m_Root)
  346. {
  347. FatherNode->m_pchild=WilladNode;
  348. WilladNode->m_pParent=curTree->m_Root;
  349. }
  350. else
  351. {
  352. FatherNode->m_pneighbour=WilladNode;
  353. WilladNode->m_pParent=curTree->m_Root;
  354. }
  355. return WilladNode;
  356. }
  357. void CWordTree::InsertNode(CTreeNode** newNode,CTreeNode** parent) //插入某層節點的孩子節點
  358. {
  359. CTreeNode* WilladNode=*newNode;
  360. CTreeNode* FatherNode=*parent;
  361. CTreeNode* Temp=NULL;
  362. if(FatherNode->m_pchild==NULL)
  363. {
  364. FatherNode->m_pchild=WilladNode;
  365. WilladNode->m_pParent=FatherNode;
  366. }
  367. else
  368. {
  369. Temp=FatherNode->m_pchild;
  370. while(Temp->m_pneighbour!=NULL)
  371. {
  372. Temp=Temp->m_pneighbour;
  373. }
  374. Temp->m_pneighbour=WilladNode;
  375. WilladNode->m_pParent=FatherNode;
  376. }
  377. }
  378. void CYuyinTreeDlg::OnBtnTestPandchi() //測試樹的相鄰層接點
  379. {
  380. CTreeNode* root=curTree->m_Root;
  381. CTreeNode* Temp=root->m_pchild;
  382. AfxMessageBox(Temp->m_Pinyin);
  383. Temp=Temp->m_pchild;
  384. while(Temp!=NULL)
  385. {
  386. AfxMessageBox(Temp->m_Pinyin);
  387. Temp=Temp->m_pneighbour;
  388. }
  389. }
  390. void CYuyinTreeDlg::OnBtnTestTongyinci() //測試發音為‘a‘的同音詞
  391. {
  392. CTreeNode* NodeA=curTree->m_Root->m_pchild;
  393. CTongyinci* temp=NodeA->m_pchar;
  394. while(temp!=NULL)
  395. {
  396. AfxMessageBox(temp->m_data);
  397. temp=temp->next;
  398. }
  399. }
  400. void CYuyinTreeDlg::BrowseYuyin() //遍歷4層語音樹
  401. {
  402. CTreeCtrl* pCtrl = (CTreeCtrl*) GetDlgItem(IDC_YUYIN_TREE);
  403. ASSERT(pCtrl != NULL);
  404. TVINSERTSTRUCT tvInsert;
  405. tvInsert.hParent = NULL;
  406. tvInsert.hInsertAfter = NULL;
  407. tvInsert.item.mask = TVIF_TEXT;
  408. tvInsert.item.pszText = _T("詞拼音");
  409. HTREEITEM hRoot = pCtrl->InsertItem(&tvInsert);
  410. CTreeNode* root=curTree->m_Root;
  411. CTreeNode* Temp=root->m_pchild;
  412. HTREEITEM hPA=NULL;
  413. HTREEITEM hPB=NULL;
  414. HTREEITEM hPC=NULL;
  415. while(Temp!=NULL)
  416. {
  417. hPA=pCtrl->InsertItem(TVIF_TEXT,
  418. _T(Temp->m_Pinyin), 0, 0, 0, 0, 0, hRoot, NULL);
  419. CTreeNode* TempNode1=Temp->m_pchild;
  420. while(TempNode1!=NULL)
  421. {
  422. hPB=pCtrl->InsertItem(TVIF_TEXT,
  423. _T(TempNode1->m_Pinyin), 0, 0, 0, 0, 0, hPA, NULL);
  424. CTreeNode* TempNode2=TempNode1->m_pchild;
  425. while(TempNode2!=NULL)
  426. {
  427. hPC=pCtrl->InsertItem(TVIF_TEXT,
  428. _T(TempNode2->m_Pinyin), 0, 0, 0, 0, 0, hPB, NULL);
  429. CTreeNode* TempNode3=TempNode2->m_pchild;
  430. while(TempNode3!=NULL)
  431. {
  432. pCtrl->InsertItem(TVIF_TEXT,
  433. _T(TempNode3->m_Pinyin), 0, 0, 0, 0, 0, hPC, NULL);
  434. TempNode3=TempNode3->m_pneighbour;
  435. }
  436. TempNode2=TempNode2->m_pneighbour;
  437. }
  438. TempNode1=TempNode1->m_pneighbour;
  439. }
  440. Temp=Temp->m_pneighbour;
  441. }
  442. }
  443. void CYuyinTreeDlg::OnTongyinQuery() //查詢拼音的同音字,放入Combox中
  444. {
  445. // TODO: Add your control notification handler code here
  446. UpdateData(TRUE);
  447. CString StringWilqury=m_inputTongyin;
  448. CString Tempci;
  449. BOOL FExit=FALSE; //該拼音在樹中是否存在標誌
  450. int TempNum;
  451. CComboBox* tongyinc=(CComboBox*)GetDlgItem(IDC_PINYIN_RESULT);
  452. ASSERT(tongyinc != NULL);
  453. tongyinc->ResetContent();
  454. ASSERT(tongyinc->GetCount() == 0);
  455. for(int temp=0;temp<30000;temp++)
  456. {
  457. if(m_storedPinyin[temp]!=NULL&&m_storedPinyin[temp]->m_StoredPinyin==StringWilqury)
  458. {
  459. TempNum=m_storedPinyin[temp]->m_pcurPosition->m_CurNum;
  460. // for(int i=0;i<TEMPNUM;I++) Tempci="m_storedPinyin[temp]-" {>m_pcurPosition->m_pchar[i];
  461. // }
  462. CTongyinci* temp1=m_storedPinyin[temp]->m_pcurPosition->m_pchar;
  463. while(temp1!=NULL)
  464. {
  465. Tempci=temp1->m_data;
  466. temp1=temp1->next;
  467. tongyinc->AddString(Tempci);
  468. }
  469. tongyinc->SetWindowText(m_storedPinyin[temp]->m_pcurPosition->m_pchar->m_data);
  470. FExit=TRUE;
  471. }
  472. }
  473. if(!FExit)
  474. tongyinc->SetWindowText("該拼音在樹中不存在!");
  475. }
  476. void CYuyinTreeDlg::OnSelchangedYuyinTree(NMHDR* pNMHDR, LRESULT* pResult) //當單擊鼠標時響應函數
  477. {
  478. NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
  479. // TODO: Add your control notification handler code here
  480. TV_ITEM item=pNMTreeView->itemNew;
  481. HTREEITEM hItem=item.hItem;
  482. CTreeCtrl* pCtrl = (CTreeCtrl*) GetDlgItem(IDC_YUYIN_TREE);
  483. ASSERT(pCtrl != NULL);
  484. CString Tempci=pCtrl->GetItemText(hItem);
  485. if(Tempci=="詞拼音")
  486. return;
  487. BOOL FExit=FALSE; //該拼音在樹中是否存在標誌
  488. int TempNum;
  489. CComboBox* tongyinc=(CComboBox*)GetDlgItem(IDC_PINYIN_RESULT);
  490. ASSERT(tongyinc != NULL);
  491. tongyinc->ResetContent();
  492. ASSERT(tongyinc->GetCount() == 0);
  493. for(int temp=0;temp<30000;temp++)
  494. {
  495. if(m_storedPinyin[temp]!=NULL&&m_storedPinyin[temp]->m_StoredPinyin==Tempci)
  496. {
  497. TempNum=m_storedPinyin[temp]->m_pcurPosition->m_CurNum;
  498. /* for(int i=0;i<TEMPNUM;I++) Tempci="m_storedPinyin[temp]-" {>m_pcurPosition->m_pchar[i];
  499. tongyinc->AddString(Tempci);
  500. }
  501. */
  502. CTongyinci* temp1=m_storedPinyin[temp]->m_pcurPosition->m_pchar;
  503. while(temp1!=NULL)
  504. {
  505. Tempci=temp1->m_data;
  506. temp1=temp1->next;
  507. tongyinc->AddString(Tempci);
  508. }
  509. tongyinc->SetWindowText(m_storedPinyin[temp]->m_pcurPosition->m_pchar->m_data);
  510. FExit=TRUE;
  511. }
  512. }
  513. if(!FExit)
  514. tongyinc->SetWindowText("該拼音在樹中不存在!");
  515. *pResult = 0;
  516. }

再分享一下我老師大神的人工智能教程吧。零基礎!通俗易懂!風趣幽默!希望你也加入到我們人工智能的隊伍中來!http://www.captainbed.net

語音識別的大規模漢語樹形詞典 搜索速度快如閃電