📄 eigenvectorselect.h
字号:
/***************************************************************
* 工程: 自然语言处理综合系统
* 作者: 李赟(liyun@nlu.caai.cn)
* 修改者
* 描述: 特征抽取的部分实现
* 主要函数:IDFEigentVector 、FindClassNames 、CHIEigentVector
G_UpdateKeyWords、G_UpdateIDVector、G_UpdateDocs
G_LoadKeyWords 等
* 版本: 1.0
* 修改:
* 参考文献:
**************************************************************/
#pragma warning(disable:4786)
#ifndef _EIGENTVECTORSELECT_H_051205_
#define _EIGENTVECTORSELECT_H_051205_
#include <fstream>
#include <list>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <cmath>
#include <sstream>
#include <string>
#include "io.h"
using namespace std;
typedef enum{DF_EVS,CHI_EVS} EvsMethod;
//用于CHI分类的数据结构单元
struct EVenty{
public:
string classname;
vector<pair<unsigned int,string> > wordspair; //初始化的一个词列表
unsigned int totalword; //总词数
unsigned int chivalue[4]; //chi的ABCD4个变量
unsigned int curindex; //当前词的cursor
bool isstop; //标示cursor是否到达
map<double,vector<string>,greater<double> > wordmap; //一个按权重排序的map,用于抽取特征
EVenty(){
classname = "";
totalword = curindex =0;
chivalue[0] =chivalue[1] =chivalue[2] =chivalue[3] =0;
isstop = false;
};
};
int changesuffix(char *filename,char *suffix);
int isHanzi(unsigned char ch1,unsigned char ch2);
__int16 ishtml(char *filename);
//全局函数,说明参见CPP中各函数声明
unsigned int G_LoadKeyWords(const string &dicextname,map<string,unsigned int> &allwords,unsigned int kwdnum,const string& vecfiledir);
unsigned int G_UpdateKeyWords(const string &dicextname,map<string,unsigned int> &allwords,unsigned int kwdnum,const string& vecfiledir);
unsigned int G_UpdateDocs(const string &dicextname,const map<string,unsigned int> &allwords,const string& vecfiledir);
unsigned int G_UpdateIDVector(const string &dicextname,map<string,unsigned int> &allwords,const string& vecfiledir);
unsigned short FindClassNames(set<string>& namevec,const string& vecfiledir,const string& extstr);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -