摘要: 对从网络上抓取到的网页进行处理:建立网络库,分词,去重,if-tdf计算权重,归一化,然后根据查询词将文本相似度从高到低的依次返回给客户第一阶段:python网络爬虫抓取网页,并存盘第二阶段:对磁盘上的网页文件建立网页库,将全部网页写入网页库,并建立相应网页的偏移量索引文件(1 23 100)-->... 阅读全文
posted @ 2014-08-28 14:32 rail 阅读(429) 评论(0) 推荐(0) 编辑
摘要: 编辑距离: 一个单词变换成另一个单词所需的步数,基本步骤:增加一个字符,减少一个字符,修改一个字符。应用:搜索的时候使用ipone-->iphone,编辑距离为1,在类似文本纠错的项目中,找出编辑距离最小的值(可以用priority_queue),实现模糊匹配!1.英文int Edit_Disten... 阅读全文
posted @ 2014-08-18 15:10 rail 阅读(736) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std;templatestruct LRUCacheEntry{ K key; T data; LRUCacheEntry* prev; LRUCacheEntry* n... 阅读全文
posted @ 2014-08-14 17:14 rail 阅读(538) 评论(0) 推荐(0) 编辑
摘要: [syswj@host 0813]$ cat dic_tree.cpp #include #include #define MAX 26using namespace std;typedef struct TrieNode{ int ncount; struct TrieNode *ne... 阅读全文
posted @ 2014-08-13 15:27 rail 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 客户端使用select模型: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 1... 阅读全文
posted @ 2014-07-31 00:18 rail 阅读(4211) 评论(0) 推荐(1) 编辑
摘要: 一个tcp的客户端服务器程序服务器端不变,客户端通过I/O复用轮询键盘输入与socket输入(接收客户端的信息)服务器端: 1 /*服务器: 2 1.客户端关闭后,服务器再向客户端发送信息,第一次会收到一个RST复位报文,第二次会收到SIGPIPE信号,导致服务器关闭,必须对这个信号进行处理: 3 ... 阅读全文
posted @ 2014-07-29 23:50 rail 阅读(250) 评论(0) 推荐(0) 编辑
摘要: unix的RIO提供的readn,writen,readline两类不同的函数:1.无缓冲区的输入输出函数rio_readn 1 ssize_t rio_readn(int fp, void *usrbuf, size_t n) 2 { 3 size_t nleft = n; 4 ... 阅读全文
posted @ 2014-07-29 21:07 rail 阅读(449) 评论(0) 推荐(0) 编辑