Skip to content

514InParadox/Mini-SearchEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zju ads homework:mini search engine

image-20240930084300631

文件结构

.
├── README.md
├── img
│   └── image-20240930084300631.png # 要求图片
├── includes
│   ├── stmr.h
│   └── utils.h
├── src
│   ├── getfile.cpp                 # 内容抓取(直接使用 ./data/shakespeare)
│   ├── parser.cpp                  # 
│   ├── stmr.cpp
│   └── utils.cpp
├── data
│   ├── shakespeare                 # 内容数据原根目录
│   └── stopwords.txt               # 停用词(TXT)
├── .gitignore
├── CMakeLists.txt
├── run.bat
└── main.cpp

任务

内容抓取(Crawling)

这里直接使用 github 上开源的文件目录 shakespeare。

HTML 解析(Parsing)、内容清理(Content Cleaning)

done.

词汇标准化(Normalization)

这里使用提供的 stemmer。注意其无法进行 ran -> run 等变化。

建立倒排索引(Creating the Inverted Index)

先认为内存大小足够。

先直接处理完 file-word 向量之后直接插入倒排索引

添加元数据和权重(Metadata and Weighting)

done.

处理文件和单词以计算 TF-IDF。

存储和优化(Storage and Optimization)

文件处理完之后,可以将其存储到磁盘上。

TODO:需要定义存储/读取方式。

查询时的检索(Retrieval during Queries)

先直接查询倒排索引,找到对应文档之后直接按权重排序

使用方法

如果 data 目录下没有 shakespeare 文件夹,先运行 updata.bat 模拟数据抓取;

然后运行 run.bat,会自动编译并启动程序。

运行环境

Cpp standard: c++17

使用 cmake 构建。

使用 windows11 系统,如果 .bat 脚本无法运行可以直接修改。

引用

  1. Word stemming

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages