Index.py
#Python 3.0import reimport osimport collectionsimport time#import other modules as needed
class index:def __init__(self, path):
def build Index(self):#function to read documents from collection, tokenize and build the index with tokens# implement additional functionality to support relevance feedback#use unique document integer IDs
def rocchio(self, query _terms, pos_ feedback, neg_ feedback, alpha, beta, gamma):#function to implement rocchio algorithm#pos _feedback - documents deemed to be relevant by the user#neg_ feedback - documents deemed to be non-relevant by the user#Return the new query terms and their weightsdef query(self, query_ terms, k):#function for exact top K retrieval using cosine similarity#Returns at the minimum the document names of the top K documents ordered in decreasing order of similarity scoredef print_ direct (self):#function to print the terms and posting list in the index
def print_ doc _list(self):# function to print the documents and their document id
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here