Calculate the appropriate weight for each query term, Programming Languages

Assignment Help:

1-Create ir3.py based on ir2.py

2-Repeatedly prompt the user for a query (if they enter "q", then quit)

3-Find the terms in the query, and calculate the appropriate weight for each query term

• (hint:) : weight for query = log2 (total number of doc / number of times the word appear in all the Doc).

• weight for query =((log( float( len( documents) ) / docfreq [ term ] ))/log(2))

• the Output for the query ""quick brown vex zebras""should be :

Doc name

Term

Weights

Q

Quick

0.58

Q

Brown

1.58

Q

Vex

0.58

Q

Zebras

1.58

4-Calculate the similarity for each query/document pair

(hint:) : the similarity= Q * D1 / |Q||D1| for example :

2361_Calculate the appropriate weight for each query term.png

5-List the documents in order of decreasing similarity to the query, along with their similarity value

• Your results for "quick brown vex zebras" should be:

D1.txt 0.42, D3.txt 0.33, D2.txt 0.08

7-Make sure that querying "quick brown vex zebras" a 2nd time gives the same result

8-What is the result for the query "quick brown vex lion"?

Genral Hint :

• For user Input :
while True:
querystring = raw_input( '\nEnter query (q to quit): ' )
if querystring == 'q':
print '\nGoodbye!\n'
break
...do more stuff...

• To sort a dictionary in descending order by value from operator import itemgetter
items = results.items()
items.sort( key = itemgetter(1), reverse=True )
for (document, ranking) in items:
print document, "%.2f" % ranking


Related Discussions:- Calculate the appropriate weight for each query term

Define a procedure that takes a list as a single argument, (a) Define a pro...

(a) Define a procedure (subsets x) that takes a list as a single argument and returns all 2^n subsets of that list, i.e. the power set of the list; e.g. (subsets '(a b c)) ==> (

Program to reads a sequence of integer numbers , Task: This assignment...

Task: This assignment is about writing programmes and Web Services in C#: 1) Develop a console programme that reads a sequence of integer numbers from the console and sorts

Creates an object and prompt the user to enter the name, Design an object d...

Design an object definition named Pet, which should have the following fields: name: The name field holds the name of a Pet type: The type field holds the type of anima

Create a one to two page html document, Task 1 Think about a Web site...

Task 1 Think about a Web site you would like to work on for Assignment 2. For example, you can do a personal interest site, a site for your favourite nonprofit organization,

Asp.net and asp.net ajax, ASP.NET and ASP.NET AJAX ASP.NET AJAX, formerly k...

ASP.NET and ASP.NET AJAX ASP.NET AJAX, formerly known as "Atlas", is an Enthusiasm rendering of an AJAX centered structure, designed for ASP.NET (although it can be used on other s

Information hiding, Why is this correct/when is this the right ide

Why is this correct/when is this the right idea

Java virtual machine, Expertsmind.com is expert in java assignment help ...

Expertsmind.com is expert in java assignment help JAVA Virtual Machine A Java exclusive device or java virtual machine (JVM) is an exclusive device able of undertaking Jav

Algorithm for sorting lists, In this question we will de ne a function for ...

In this question we will de ne a function for sorting lists based upon the algorithm selection sort. First, de ne a function smallest which takes as input a list of integers and r

C# xna game project, I need to finish my game project within two weeks usin...

I need to finish my game project within two weeks using XNA. Would you guys can help me to finish it? Thank you

CGI mailer Script, i neeed an CGI Script that send mass emails i need this...

i neeed an CGI Script that send mass emails i need this input fields Sender Name: Sender Email: Subject: Message: choose (HTML Or text ) , by default HTML Emails and send bu

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd