#NEWLINE# def test_bm25_alt_corpus( self ) : #NEWLINE# #INDENT# for message in self . messages : #NEWLINE# #INDENT# FTSDoc . create ( message = message ) #NEWLINE# #UNINDENT# def assertResults( term , expected ) : #NEWLINE# #INDENT# query = FTSDoc . search_bm25 ( term , with_score = True ) #NEWLINE# cleaned = [ ( round ( doc . score , 2 ) , ' ' . join ( doc . message . split ( ) [ : 2 ] ) ) for doc in query ] #NEWLINE# self . assertEqual ( cleaned , expected ) #NEWLINE# #UNINDENT# assertResults ( 'things' , [ ( ( - 0.45 ) , 'Faith has' ) , ( ( - 0.36 ) , 'Be faithful' ) ] ) #NEWLINE# results = [ round ( x . score , 2 ) for x in FTSDoc . search_bm25 ( 'faith' , with_score = True ) ] #NEWLINE# self . assertEqual ( results , [ ( - 0.0 ) , ( - 0.0 ) , ( - 0.0 ) , ( - 0.0 ) , ( - 0.0 ) ] )