Giter Club home page Giter Club logo

boolean-retrieval-engine's Introduction

Boolean Retrieval Engine

This is a Python implementation of indexing and searching techniques for Boolean retrieval. A Boolean query contains the operators AND, OR, NOT, (, and ). This is a good source for more information on Boolean retrieval and its techniques.

Requirements

  • NLTK installed
  • Corpus for indexing and searching with constituent documents named numerically (e.g. Reuters corpus in NLTK data)

Indexing

$ python index.py -i <directory-of-documents> -d <dictionary-file> -p <postings-file>

  • <directory-of-documents> is the directory for the collection of documents to be indexed
  • <dictionary-file> is the filename of dictionary to be created by indexer
    • Human readeable
    • First line contains metadata of metainformation and indicates all docIDs indexed in ascending order: e.g. "Indexed from docIDs:1,5,6,9,10,11,12,13,14,18,19,22,23,24,27,29,30,36,37,..."
    • Subsequent lines are of the format: "<term> <df> <byte offset in postings file>"
  • <postings-file> is the filename of the postings file created by indexer
  • Non-human readable
  • raw bytes where every 4 bytes represents a docID int

Searching

$ python search.py -d <dictionary-file> -p <postings-file> -q <file-of-queries> -o <output-file-of-results>

  • <dictionary-file> and <postings-file> are created by the indexer as aforementioned
  • <file-of-queries> is a text file containing the list of Boolean queries, one for each line
  • A Boolean query is a space-delimited boolean expression of search terms. E.g. term1 OR term2 AND (term3 OR term4) AND NOT term5
  • Boolean operators must be given in UPPERCASE
  • <output-file-of-results> is the name of the output file for the search results for the given queries
  • For the same line number, each line in <output-file-of-results> is a space-delimited list of docIDs (sorted ascending) corresponding to the search result for the corresponding query in <file-of-queries>

boolean-retrieval-engine's People

Stargazers

 avatar Hossein Taghi-Zadeh avatar Rossil avatar Zhouhan Chen avatar vermont avatar MasterMonster avatar Frida Liu avatar Han Cui avatar  avatar  avatar aaabcandyyy avatar  avatar Bidon Saha avatar Cyan Hou avatar  avatar Yilin 'Alex' Wang avatar tangrui avatar  avatar Ayush Rai avatar Illia Litvin avatar Prabhsimran Singh avatar TzeSing avatar Denis Skripov avatar  avatar Abhijeet Kumar avatar

Watchers

James Cloos avatar Jin Zhe avatar

boolean-retrieval-engine's Issues

ValueError: invalid literal for int() with base 10: 'Doc1.txt'

Getting error while running the Indexer.py

Traceback (most recent call last):
File "index.py", line 144, in
index(document_directory, dictionary_file, postings_file) # call the indexer
File "index.py", line 27, in index
docID_list = [int(docID_string) for docID_string in os.listdir(document_directory)]
File "index.py", line 27, in
docID_list = [int(docID_string) for docID_string in os.listdir(document_directory)]
ValueError: invalid literal for int() with base 10: 'Doc1.txt'

I have provided folder path which has doc1.txt and doc2.txt

Does it expect the files in some other format
I am new to pythons so excuse if its not a good ques

dictionry file

hi jin i need dictionary ,posting ,query files can you help me

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.