0% found this document useful (0 votes)
4 views3 pages

IR Assignment11

The document is an assignment from Walchand Institute of Technology discussing the implementation of the Shift-OR algorithm for sequential searching in information retrieval systems. It includes a theoretical overview of conflation algorithms, comparative performance analysis, and a Python program code for the Shift-OR algorithm. The assignment is submitted by Ayush Pande, a final year Btech IT student, and includes screenshots of the output.

Uploaded by

vinayostwal707
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

IR Assignment11

The document is an assignment from Walchand Institute of Technology discussing the implementation of the Shift-OR algorithm for sequential searching in information retrieval systems. It includes a theoretical overview of conflation algorithms, comparative performance analysis, and a Python program code for the Shift-OR algorithm. The assignment is submitted by Ayush Pande, a final year Btech IT student, and includes screenshots of the output.

Uploaded by

vinayostwal707
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

WALCHAND INSTITUTE OF TECHNOLOGY, SOLAPUR

INFORMATION TECHNOLOGY
2021-22 SEMESTER - II
ASSIGNMENT - 11
Subject: Information Retrieval

Name: Ayush Pande Roll no: 74 Class: Final Year Btech IT

Title: Implementation of sequential searching using Shift-OR Algorithm

Theory:
The characteristics of conflation algorithms are discussed and examples given of
some algorithms which have been used for information retrieval systems.
Comparative experiments with a range of keyword dictionaries and with the
Cranfield document test collection suggest that there is relatively little difference
in the performance of the algorithms despite the widely disparate means by which
they have been developed and by which they operate.

Program Code:
#11
from tkinter import *
root = Tk()
[Link]("500x550")
[Link]('Shift-OR Sequential Search')

def to_bin(n, width=32):


"Pad a binary number to WIDTH bits wide"
s = bin(n).replace("0b", "")
return (("%0" + str(width) + "d") % int(s))
def neg(x):
#0b11111111111111111111111111111111 - x
return 0b11111111111111111111111111111111 - x
def shift_or():
trace = True
text=[Link]()
pattern= [Link]()
"""Same as shift_and, but invert masks and use OR to
avoid an | in the inner loop."""
m = len(pattern)
n = len(text)
neg0 = neg(0)
# build table
B = {} # char -> bitmask table
for i in range(m):
B[pattern[i]] = ([Link](pattern[i], 0) | (1 << i))

1
WALCHAND INSTITUTE OF TECHNOLOGY, SOLAPUR
INFORMATION TECHNOLOGY
2021-22 SEMESTER - II
ASSIGNMENT - 11
Subject: Information Retrieval
B = {k: neg(B[k]) for k in B}
# complement all bit masks in B, complement bit mask
a = neg0
hit = (1 << (m - 1))
listNodes = Listbox(root, width=80, height=35)
[Link](column=0, row=12)
notf=0
for i in range(n):
a = (((a << 1) & neg0) | [Link](text[i], neg0))
if trace:
[Link](END, " %s & B[%c] : %s" % (to_bin(a), text[i], to_bin([Link](text[i], neg0))))
#print("%s & B[%c] : %s" % (to_bin(a), text[i], to_bin([Link](text[i], neg0))))

if a & hit == 0:
[Link](END,"\nPattern Found at %d" % (i - m + 2))
notf=1

if notf == 0 :
[Link](END, "\n Pattern Not Found ")

var = IntVar()
variable1=StringVar()
variable2=StringVar()# Value saved here variable2=StringVar() # Value saved here
Label(root, text = "Shift-OR Sequential Search: ",background='skyblue'
,foreground='black').grid(row=4, column=3)
Label(root, text = "Enter Text:").grid(row=7, column=2)
Entry(root, width=30,textvariable = variable1).grid(row=7, column=3)
Label(root, text = "Enter Pattern: ").grid(row=9, column=2)
Entry(root, width=30,textvariable = variable2).grid(row=9, column=3)
Button(root, text = "Show Results", command= shift_or).grid(row=11, column=3)
[Link](bg="#D1E9C3")
[Link]()

#place(y=25, x=130)

Screenshots/Output:

2
WALCHAND INSTITUTE OF TECHNOLOGY, SOLAPUR
INFORMATION TECHNOLOGY
2021-22 SEMESTER - II
ASSIGNMENT - 11
Subject: Information Retrieval

You might also like