WALCHAND INSTITUTE OF TECHNOLOGY, SOLAPUR
INFORMATION TECHNOLOGY
2021-22 SEMESTER - II
ASSIGNMENT – 3
Subject: Information Retrieval
Name: Ayush pande Roll no: 74 Class: Final Year Btech IT
Title: Implementation of IR system using Boolean model
Theory: Model is an idealization or abstraction of an actual process
• Mathematical models are used to study the properties of the process, draw conclusions,
make predictions
• Conclusions derived from a model depend on whether the model is a good
approximation of the actual situation
• Statistical models represent repetitive processes, make predictions about frequencies
of interesting events
• Retrieval models can describe the computational process– e.g. how documents are
ranked– Note that how documents or indexes are stored is implementation
• Retrieval models can attempt to describe the human process– e.g. the information
need, interaction– Few do so meaningfully
• Retrieval models have an explicit or implicit definition of relevance
Program Code:
dic_bool = {i:[] for i in range(1,11)}
for i in keywords :
for k in range(10):
dic_bool[k+1].append(1) if i in allNouns_separate[k] else dic_bool[k+1].append(0)
print(dic_bool)
#boolean model
def boolean_model():
try:
query = input('Enter Query, keywords are: {}\nQuery: '.format(keywords))
list_query=[]
for i in query.split():
if i in keywords:
list_query.append(keywords.index(i))
else:
list_query.append(i)
for i in dic_bool:
temp_query = ''
for j in list_query:
if type(j) == int:
temp_query += str(dic_bool[i][j])+' '
else:
temp_query += j+' '
#print(temp_query.strip())
if bool(eval(temp_query.strip())):
print('Document {} is relevant'.format(i))
except:
print('Some Error Occured')
for i in range(4):
boolean_model()
Screenshots/Output:
2
3