hey i am a beginner as far as python is concerned..i am having diff in understanding this code..i am supp to do it in python..if anyone can tell me wht it does it wud be really helpful

for qid,query in "as2.qrys": 
       for word in query: 
         docs = set(index[word]) 
         for doc in docs: 
           number_of_matched_words [doc] ++ 
       for doc in matches: 
         if number_of_matched_words[doc] == length(query): 
           print qid, 0, doc, 0, 1, 0

Edited 7 Years Ago by vegaseat: added code tags

i am having diff in understanding this code..i am supp to do it in python

for qid,query in "as2.qrys": 
       for word in query: 
         docs = set(index[word]) 
         for doc in docs: 
           number_of_matched_words [doc] ++ 
       for doc in matches: 
         if number_of_matched_words[doc] == length(query): 
           print qid, 0, doc, 0, 1, 0

Is this psuedo-code that you're supposed to translate into Python?

yes....its v similar to python. i am not sure however what matches exactly contains.....index is a dictionary which has words as keys and document numbers that contain words as the values...ie index = {tracl:["num1","num2","num3"...],field:[.....],...} ... i have been given a test list from which i have to take all words and compare with the index and find out documents which contain the words

This question has already been answered. Start a new discussion instead.