资源简介
包内包含中文分词作业描述、C语言源程序、可执行文件和说明文档
代码片段和文件信息
#include
#include
#include
#define BOOL char
#define bool BOOL
#define TRUE 1
#define FALSE 0
#define MAX_CWORD_LEN 18 //最长的词
#define MAX_SWORD_LEN 256 //最长的句子
#define MAX_CDIM 90
#define MAX_WORD 8000
//不进行索引的单词
char *arrayEnglishStop[] = {
“a“ “b“ “c“ “d“ “e“ “f“ “g“ “h“ “i“ “j“ “k“ “l“ “m“ “n“ “o“ “p“ “q“ “r“ “s“ “t“ “u“ “v“ “w“ “x“ “y“ “z“
“1“ “2“ “3“ “4“ “5“ “6“ “7“ “8“ “9“ “0“
“about“ “above“ “after“ “again“ “all“ “also“ “am“ “an“ “and“ “any“ “are“ “as“ “at“
“back“ “be“ “been“ “before“ “behind“ “being“ “below“ “but“ “by“
“can“ “click“ “do“ “does“ “done“ “each“ “else“ “etc“ “ever“ “every“
“few“ “for“ “from“ “generally“ “get“ “go“ “gone“ “has“ “have“ “hello“ “here“ “how“
“if“ “in“ “into“ “is“ “just“ “keep“ “later“ “let“ “like“ “lot“ “lots“ “made“
“make“ “makes“ “many“ “may“ “me“ “more“ “most“ “much“ “must“ “my“ “need“ “no“ “not“
“now“ “of“ “often“ “on“ “only“ “or“ “other“ “others“ “our“ “out“ “over“ “please“ “put“
“so“ “some“ “such“ “than“ “that“ “the“ “their“ “them“ “then“ “there“ “these“ “they“
“this“ “try“ “to“ “up“ “us“ “very“ “want“ “was“ “we“ “well“ “what“ “when“ “where“
“which“ “why“ “will“ “with“ “within“ “you“ “your“ “yourself“
};
//词典索引时字或词不需要索引
char *arrayChineseStop[] = {
“的““吗““么““啊““说““对““在““和““是“
“被““最““所““那““这““有““将““会““与“
“於““于““他““她““它““您““为““欢迎“
};
//标点符号及汉字的标点符号注意 + - “ 这三个符号,因为在搜索的时候需要通过他们进行异或等条件判断
char arrayAsciiSymbol[] ={
‘!‘‘\\‘‘*‘‘(‘‘)‘‘-‘‘_‘‘+‘‘=‘‘{‘‘}‘‘[‘‘]‘‘:‘‘;‘‘\‘‘‘\“‘‘‘‘<‘‘>‘‘.‘‘?‘‘/‘‘|‘‘@‘‘#‘‘$‘‘%‘‘^‘‘&‘
};
//汉字词典
typedef struct _WORD_NODE
{
char strWord[MAX_CWORD_LEN+1];
// todo 可以增加 两个字,三个字,四个字,五个字的数组,这样查起来更快
struct _WORD_NODE *nextWord;
}WORD_NODE; //定义结构体类型
struct _CH_DICT {
WORD_NODE *lstWord;
}CH_DICT[MAX_CDIM][MAX_CDIM]; //定义结构体二维数组变量:词典
char SEG_LIST[MAX_WORD]; //定义数组存放分词后的句串
int WNUM_IN = 0;
int WNUM_OUT = 0;
char *strTrim(char str[])
{
int firstchar=0;
int endpos=0;
int i;
int firstpos=0;
for(i=0;str[i]!=‘\0‘;i++){
if(str[i]==‘ ‘ || str[i] == ‘\r‘ || str [i] == ‘\n‘ || str [i]==‘\t‘){
if(firstchar==0) firstpos++;
}
else{
endpos=i;
firstchar=1;
}
}
for(i=firstpos;i<=endpos;i++)
str[i-firstpos]=str[i]; //去除待处理字符串中的空格、换行等
str[i-firstpos]=‘\0‘;
return str;
}
int addDictWord(char *strWord int len)
{
unsigned char firstCharlastChar;
WORD_NODE* curLst;
WORD_NODE* newWord *curTmp ;
firstChar = strWord[0] ;
lastChar = strWord[len-1];
if (firstChar < 161 || lastChar < 161 ) //建立汉字词典,不允许出现非汉字或是汉字的全角符号
return -1;
newWord = (WORD_NODE*)malloc(sizeof(WORD_NODE));
if ( newWord == NULL)
return -1;
strcpy(newWord->strWord
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4599128 2005-01-13 22:30 中文分词\分词作业\ziguang.txt
文件 144 2007-04-10 23:21 中文分词\分词作业\作业布置.txt
文件 875008 2008-10-18 15:03 中文分词\分词作业\最大匹配分词法.doc
文件 4580 2007-04-10 23:17 中文分词\分词作业\测试文档-2.txt
文件 2542 2005-04-11 09:25 中文分词\分词作业\测试文档.txt
文件 7376 2005-04-11 09:26 中文分词\分词作业\测试文档(已分词)-2.txt
文件 4176 2005-04-11 09:27 中文分词\分词作业\测试文档(已分词).txt
文件 11670 2008-11-01 21:36 中文分词\中文分词作业源代码和文档\fenci.cpp
文件 192602 2008-11-01 21:09 中文分词\中文分词作业源代码和文档\fenci.exe
文件 4580 2008-11-01 18:26 中文分词\中文分词作业源代码和文档\output\input.txt
文件 5936 2008-11-01 21:12 中文分词\中文分词作业源代码和文档\output\output.txt
文件 4599128 2005-01-13 22:30 中文分词\中文分词作业源代码和文档\output\ziguang.txt
文件 25600 2008-11-01 21:47 中文分词\中文分词作业源代码和文档\程序说明文档.doc
目录 0 2008-11-01 21:12 中文分词\中文分词作业源代码和文档\output
目录 0 2008-10-23 22:22 中文分词\分词作业
目录 0 2008-11-01 21:12 中文分词\中文分词作业源代码和文档
目录 0 2008-11-15 10:40 中文分词
----------- --------- ---------- ----- ----
10332470 17
- 上一篇:C++实现GMM源码
- 下一篇:VC++MFC模拟四部电梯程序
相关资源
- VC++MFC模拟四部电梯程序
- C++实现GMM源码
- 基于Visual C++/Access实现的学生宿舍管理
- Visual C++.NET图像处理编程源代码 陆宗
- c++ MFC 通讯录 源代码
- Visual Studio 2010 Express 学习版
- MFC图形编程教程,有各种绘图
- Linux多线程服务端编程:使用muduo C+
- 简易防火墙使用C++与Qt4.5带源代码
- 数据库课程设计 - 汽车租借信息系统
- VC++课程设计 计算器
-
C++调用Windows MediaPla
yer实现的多媒体 - c++坦克大战源码_写的不错
- 粒子群优化算法PSOC++
- C++语言程序设计(郑丽)含课本知识
- NTFS文件系统下用C++定位文件簇号和目
- 基于C++的SNMP++开发包
- c++程序设计语言英文第三版.pdf
- Parasoft C++ test 9.2官方用户手册_中文版
- Spline曲线(穿过控制点CC++版本)
- 八皇后程序源码(MFC)
- 非常帅的军棋源代码附说明文档 VC
- VC MFC操作Excel 20个 源代码合集
- C++调用C#库例程
- C++统计英文词频
- C++花店销售管理系统源码及文档
- OpenSSL RSA 非对称加密(VS2013,C++实现
- C++ 五子棋游戏 图形界面
- soble 算子的 边缘检测 VisualC++
- 曾棕根.ACM程序设计.pdf
评论
共有 条评论