Python Programming (Just need the Code) Index.py #Python 3.0 import re import os import collections import time #import other modules as needed class index:    def __init__(self, path):    def build...




Python Programming (Just need the Code)


Index.py


#Python 3.0

import re

import os

import collections

import 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 weights

def 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 score

def 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





May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here