GithubHelp home page GithubHelp logo

imsridhar / wikipedia-search-engine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dhruvkhattar/wikipedia-search-engine

0.0 0.0 0.0 19 KB

A search engine over the Wikipedia dump.

Shell 0.11% Python 99.89%

wikipedia-search-engine's Introduction

Wikipedia-Search-Engine

This repository consists of a search engine over the 59GB Wikipedia dump. The code consists of indexer.py and search.py. Both simple and multi field queries have been implemented. The search returns a ranked list of articles in real time.

Indexing:

  • Parsing: SAX Parser is used to parse the XML corpus.
  • Casefolding: Converting Upper Case to Lower Case.
  • Tokenisation: It is done using regex.
  • Stop Word Removal: Stop words are removed by referring to the stop word list returned by nltk.
  • Stemming: A python library PyStemmer is used for this purpose.
  • Creating various index files with word to field postings.
  • Multi-way External sorting on the index files to create field based files along with their respective offsets.

Searching:

  • The query given is parsed, processed and given to the respective query handler(simple or field).
  • One by one word is searched in vocabulary and the file number is noted.
  • The respective field files are opened and the document ids along with the frequencies are noted.
  • The documents are ranked on the basis of TF-IDF scores.
  • The title of the documents are extracted using title.txt

Files Produced

  • index*.txt (intermediate files) : It consists of words with their posting list. Eg. d1b2t4c5 d5b3t6l1
  • title.txt : It consist of id-title mapping.
  • titleOffset.txt : Offset for title.txt
  • vocab.txt : It has all the words and the file number in which those words can be found along with the document frequency.
  • offset.txt : Offset for vocab.txt
  • [b|t|i|r|l|c]*.txt : It consists of words found in various sections of the article along with document id and frequency.
  • offset_[b|t|i|r|l|c]*.txt : Offset for various field files.

How to run:

python3 indexer.py

This function takes as input the corpus file and creates the entire index in a field separated manner. It also creates a vocabulary list and a file containg the title-id map. Along with these files, it also creates the offsets for all the files.

python3 search.py

This function opens a shell and asks for the query to be searched. It returns the top ten results from the Wikipedia corpus.

wikipedia-search-engine's People

Contributors

dhruvkhattar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.