?? mydictionary.h
字號:
#if !defined(AFX_WORDTAGSET_H__8B656CD7_8E67_403B_A5F7_0D06D8944ECD__INCLUDED_)
#define AFX_WORDTAGSET_H__8B656CD7_8E67_403B_A5F7_0D06D8944ECD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afxdao.h>
/////////////////////////////////////////////////////////////////////////////
// CWordTagSet DAO recordset
class CWordTagSet : public CDaoRecordset
{
public:
CWordTagSet(CDaoDatabase* pDatabase = NULL);
int GetFreq(CString w, CString t);
int GetFreqs(CString w, CObArray & a);
DECLARE_DYNAMIC(CWordTagSet)
// Field/Param Data
//{{AFX_FIELD(CWordTagSet, CDaoRecordset)
long m_wid;
CString m_pos;
long m_pfreq;
long m_pid;
CString m_word;
long m_wfreq;
long m_wid2;
//}}AFX_FIELD
CString m_WordParam; // 詞語參數
CString m_TagParam; // 詞性標記參數
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWordTagSet)
public:
// virtual CString GetDefaultDBName(); // Default database name
// virtual CString GetDefaultSQL(); // Default SQL for Recordset
virtual void DoFieldExchange(CDaoFieldExchange* pFX); // RFX support
//}}AFX_VIRTUAL
// Implementation
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};
class CTagFreq: public CObject
{
public:
CString Tag;
int Freq;
CTagFreq(LPCSTR t, long f) {
Tag=t;
Freq=f;
} // 構造函數
};
class CMyDictionary
{
CDaoDatabase * pDatabase; // 數據庫類指針
CDaoRecordset * pWords, * pTags; // 詞表和詞性表記錄集指針
CDaoTableDef * pWordsDef, * pTagsDef; // 詞表和詞性表結構指針
public:
CMyDictionary(){}; // 構造函數
~CMyDictionary()
{// 構析函數
if(pWords) {
pWords->Close();
delete pWords;
}
if(pTags) {
pTags->Close();
delete pTags;
}
if(pWordsDef) {
pWordsDef->Close();
delete pWordsDef;
}
if(pTagsDef) {
pTagsDef->Close();
delete pTagsDef;
}
if(pDatabase) {
pDatabase->Close();
delete pDatabase;
AfxDaoTerm(); // can now safely terminate DAO
}
myDatabaseName = "";
};
CString myDatabaseName; // 數據庫文件名
BOOL OpenMDB(); //打開數據庫,表結構和記錄集
BOOL CloseMDB(); //關閉數據庫,表結構和記錄集,釋放個指針申請的內存
long GetWordID(CString w); // 成員函數:獲取詞語的代號
long GetFreq(CString w); // 成員函數:獲取詞語的頻度值
long GetFreq(CString w, CString t); // 成員函數:獲取詞語在一定詞性下的頻度值
long GetFreq(CString w, CObArray& a); // 成員函數:獲取詞語在任意詞性下的頻度值
long Insert(CString w, long freq=1); // 成員函數:插入詞頻信息,包括新詞的頻度值信息
long Insert(CString w, CString t, long freq=1); // 成員函數:插入詞語,詞性標記,詞頻信息
// 處理詞性標記的函數
CString GetTagOfWord(CString w); // 新增成員函數:獲取詞語的詞性標記
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WORDTAGSET_H__8B656CD7_8E67_403B_A5F7_0D06D8944ECD__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -