Calculate the appropriate weight for each query term, Programming Languages

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

Posted Date: 2/15/2013 12:12:47 AM | Location : United States







Related Discussions:- Calculate the appropriate weight for each query term, Assignment Help, Ask Question on Calculate the appropriate weight for each query term, Get Answer, Expert's Help, Calculate the appropriate weight for each query term Discussions

Write discussion on Calculate the appropriate weight for each query term
Your posts are moderated
Related Questions
,how to write matlab program for fast decoupled method

Problem Solving 1. Write Pascal code that accepts as input the names of the students, course work score and exam score for a unspecified number of students who have taken a subjec

1. Develop a Web page, indicating an ordered list of the names of your five friends. 2. Develop an HTML document with a nested list indicating the content page of any book 3.

How Can I Retrive Unicode CSV File the ADO.net VB.net

We are need of a PrestaShop Expert We are getting a fresh design created for our Jewellery website. This job is in 2 parts 1. The website engine is PrestaShop as well as w

All programs have to be done in console application. Program 1, 2 and 3 are due on 2/11/12 Program 4, 5, and 6 are due on 2/18/12 Program 7, 8, and 9 are due on 2/25/12 Program 10

Write a Prolog predicate remove_nth(N,L1,L2) that is true if list L2 is just list L1 with its Nth element removed. If L1 does not have an Nth element then the predicate should fail

Write a pseudocode for a program that reads a temperature as a whole number from a user and outputs a “probable” season (winter, sprint, summer, or fall) depending on the temperatu

Components of .NET Framework 3.5 .NET Framework Conceptual Overview Presents the .NET Structure and its elements. Installing the .NET Framework Provides information about .NET Stru

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4