#NEWLINE# def get_golden_hits_cos( self ) : #NEWLINE# #INDENT# 'Manually computes cosine scores for test set to create golden results' #NEWLINE# d1_len = math . sqrt ( ( 2 ^ ( ( 2 + 1 ) + 1 ) ) ) #NEWLINE# d2_len = math . sqrt ( ( 1 + 1 ) ) #NEWLINE# d3_len = math . sqrt ( ( ( 1 + 1 ) + 1 ) ) #NEWLINE# N = 3 #NEWLINE# hello_idf = math . log ( ( N / 3 ) ) #NEWLINE# there_idf = math . log ( ( N / 2 ) ) #NEWLINE# world_idf = math . log ( ( N / 2 ) ) #NEWLINE# bob_idf = math . log ( ( N / 1 ) ) #NEWLINE# r = { #NEWLINE# #INDENT# 'hello there' : { #NEWLINE# #INDENT# 'doc1' : ( ( ( hello_idf * 2 ) / d1_len ) + ( there_idf / d1_len ) ) , #NEWLINE# 'doc2' : ( hello_idf / d2_len ) , #NEWLINE# 'doc3' : ( ( hello_idf / d3_len ) + ( there_idf / d3_len ) ) , #NEWLINE# #UNINDENT# } , #NEWLINE# 'there world' : { #NEWLINE# #INDENT# 'doc1' : ( ( there_idf / d1_len ) + ( world_idf / d1_len ) ) , #NEWLINE# 'doc2' : ( world_idf / d2_len ) , #NEWLINE# 'doc3' : ( there_idf / d3_len ) , #NEWLINE# #UNINDENT# } , #NEWLINE# 'hello world' : { #NEWLINE# #INDENT# 'doc1' : ( ( ( hello_idf * 2 ) / d1_len ) + ( world_idf / d1_len ) ) , #NEWLINE# 'doc2' : ( ( hello_idf / d2_len ) + ( world_idf / d2_len ) ) , #NEWLINE# 'doc3' : ( hello_idf / d3_len ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# pprint ( r ) #NEWLINE# return r