词索引表
来源:互联网 发布:不停弹出windows media 编辑:程序博客网 时间:2024/04/28 03:13
STL实现,好久没看STL了,做个当温习一下,也是自己怕书上的算法麻烦偷懒下哈
BookInfo.txt文件
005 Computer Data Structures
010 Introduction to Data Structures
023 Fundamentals of Data Structures
034 The Design and Analysis of Computer Algorithms
050 Introduction to Numerical Analysis
067 Numerical Analysis
输出为BookInfo.txt文件 (关键词按字典顺序)
algorithms 034
analysis 034,050,067
computer 005,034
data 005,010,023
design 034
fundamentals 023
introduction 010,050
numerical 050,067
structures 005,010,023
- #include<iostream>
- #include<map>
- #include<vector>
- #include<stdlib.h>
- #include<fstream>
- #include<sstream>
- #include<set>
- using namespace std;
- typedef map<string,vector<string> > mp;
- typedef vector<string> vs;
- string ignorstr[]={"an","a","of","the","and","to"};
- int main()
- {
- mp IdxList;
- ifstream in("d://BookInfo.txt",ios::in);
- ofstream out("d://BookIdx.txt",ios::out);
- string s,ss,bno;
- set<string> strset(ignorstr,ignorstr+6);
- int i;
- while(getline(in,s))
- {
- transform(s.begin(), s.end(), s.begin(), ::tolower);
- stringstream strs(s);
- i=0;
- while(strs>>ss)
- {
- if(!i) bno=ss;
- else if(!strset.count(ss)) IdxList[ss].push_back(bno);
- i++; }
- }
- for(mp::iterator frm=IdxList.begin();frm!=IdxList.end();frm++)
- {
- out<<(*frm).first<<"/t/t";
- for(vs::iterator vfrm=(*frm).second.begin();vfrm!=(*frm).second.end();vfrm++)
- {out<<*vfrm;
- vfrm+1==(*frm).second.end()?out<<endl:out<<",";}
- }
- in.close();
- out.close();
- return 0;
- }
- 词索引表
- 建立词索引表
- 索引表 索引查找
- 索引表
- 索引表
- 【索引分类】索引组织表
- 数据结构------建立一个词索引表
- 查询数据库表索引名称、索引字段、创建索引语句
- 索引组织表+创建索引组织表
- 页目录索引,页表索引,字节索引
- oracle 索引组织表,索引聚簇表等
- 表空间、域索引、位图索引杂烩
- 6、索引与索引组织表
- 全文索引----创建多表solr索引
- 全文索引----创建多表solr索引
- 全文索引----创建多表solr索引
- 数据结构--建立词索引
- 关于搜索引擎索引表
- AdjustTokenPrivileges(进程权限)
- 百度的面试题《卷一》
- js控制select 中option项的上下移动
- 最简单的基于Tomcat的Web应用程序-没有Servlet,只访问静态资源(jsp,html,gif等)
- 今天开始做项目了
- 词索引表
- Java中常用的加密算法MD5,SHA,RSA
- linux学习内容
- linux下软件管理
- Protothreads简介
- 我们为什么会无聊
- C#开发和使用中的23个技巧
- 收集java的常用方法代码-MD5和一个可逆加密算法相接合的加密和解密程序
- 利用OleDb的GetOLEDBSchemaTable方法得到数据库架构信息-.NET教程,数据库应用