#NEWLINE# def eg1( ) : #NEWLINE# #INDENT# m1 = MinHash ( ) #NEWLINE# m2 = MinHash ( ) #NEWLINE# for d in data1 : #NEWLINE# #INDENT# m1 . update ( d . encode ( 'utf8' ) ) #NEWLINE# #UNINDENT# for d in data2 : #NEWLINE# #INDENT# m2 . update ( d . encode ( 'utf8' ) ) #NEWLINE# #UNINDENT# print ( 'Estimated Jaccard for data1 and data2 is' , m1 . jaccard ( m2 ) ) #NEWLINE# s1 = set ( data1 ) #NEWLINE# s2 = set ( data2 ) #NEWLINE# actual_jaccard = ( float ( len ( s1 . intersection ( s2 ) ) ) / float ( len ( s1 . union ( s2 ) ) ) ) #NEWLINE# print ( 'Actual Jaccard for data1 and data2 is' , actual_jaccard )