Skip to content

AzamatMedetbekov/Search-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Search

The input is the text, the search query and the resultsCount number. In this project, resultsCount lines from the text are returned in descending order of relevance. If two lines have the same relevance, they are returned in the same order in which they occur in the text. If there are less than resultsCount relevant (with relevance > 0) rows, then as many relevant rows as could be found are returned.

Algorithm

The measure of relevance will be the sum of TF-IDF for unique words included in the query. A document is a string, a collection of documents is a set of lines of text.

The algorithm is not case-sensitive. A word is considered to be the maximum continuous sequence of characters that satisfies the criterion std::isalpha(). Lines in the text that do not contain words are ignored.

Realisation

Class SearchEngine is realized in this project.

Class has such methods:

  • BuildIndex - processes the text and builds an index on it
  • search - searches for relevant strings

A typical application pattern is sparse indexing and frequent search queries.

How to run

Prerequisites

  • C++ Compiler: C++17 compatible (e.g., GCC, Clang, MSVC).
  • CMake (Optional): Version 3.10+ for Option 1.

Option 1: Using CMake

Navigate to your project's root directory, then execute the following commands in your terminal:

mkdir build
cd build
cmake ..
cmake --build .
cd Debug 
./searchEngineTests

Option 2: Direct compilation

g++ -std=c++17 searchEngine.cpp tests.cpp -o searchEngineTests
./searchEngineTests

About

TF-IDF

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages