Skip to content

Fa-Abdullah/Information-Retrieval-Search-Engine

Repository files navigation

Tolerant Information Retrieval System

A comprehensive Information Retrieval (IR) system that combines web scraping, indexing techniques, fuzzy matching, and spelling correction to provide accurate and tolerant search over a real-world book dataset.


Overview

This project implements a complete search engine pipeline, starting from collecting data through web scraping to building efficient search indexes and supporting tolerant query processing.

The dataset contains 1,000 books collected from Books to Scrape, and the system supports exact search, phrase search, multi-term queries, and spelling correction.


Features

  • Web scraping of 1,000 books
  • Text preprocessing and normalization
  • Inverted Index construction
  • Positional Index for phrase search
  • K-Gram Index for tolerant retrieval
  • Single-term search
  • Multi-term (AND) search
  • Exact phrase search
  • Spelling correction using:
    • K-Gram candidate generation
    • Jaccard Similarity
    • Edit Distance (Levenshtein)
    • Soundex phonetic matching
  • Ranked search results

Technologies Used

Category Technologies
Programming Language Python
Web Scraping BeautifulSoup, Requests
Data Processing Pandas, Regex
NLP NLTK
Machine Learning Utilities Scikit-learn
Indexing Inverted Index, Positional Index, K-Gram
Similarity Jaccard Similarity, Edit Distance
Phonetic Matching Soundex

Dataset

  • Source: Books to Scrape
  • Number of documents: 10,000 books

Each record includes:

  • Book title
  • Category
  • Product description

Search Pipeline

  1. Collect book data using web scraping.
  2. Clean and preprocess the text.
  3. Build the Inverted Index.
  4. Build the Positional Index.
  5. Build the K-Gram Index.
  6. Process user queries.
  7. Apply spelling correction when needed.
  8. Retrieve and rank matching documents.

Usage

Open the notebook and execute all cells sequentially.

The notebook will:

  • Scrape the dataset
  • Preprocess the documents
  • Build all indexes
  • Execute search queries
  • Demonstrate spelling correction
  • Display ranked search results

Search Capabilities

Single-Term Search

Retrieve documents containing a specific keyword.

Multi-Term Search

Search multiple terms using AND logic with TF-based ranking.

Phrase Search

Locate documents containing an exact phrase using positional indexing.

Tolerant Search

Automatically suggests corrections for misspelled queries using:

  • K-Gram Index
  • Jaccard Similarity
  • Edit Distance
  • Soundex

Example

Input:

retrival

Output:

retrieval

The correction is selected based on similarity scores and edit distance before executing the search.


Future Improvements

  • TF-IDF ranking
  • BM25 ranking
  • Boolean query parser
  • Wildcard search
  • Query auto-completion
  • Web interface using Streamlit or Flask

About

Search engine implementing information retrieval techniques for document indexing, ranking, and retrieval.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors