#NEWLINE# def parse( self , line ) : #NEWLINE# #INDENT# parts = line . strip ( ) . split ( self . delimiter ) #NEWLINE# ( user , item , count ) = parts [ : 3 ] #NEWLINE# val = float ( count ) #NEWLINE# if ( val >= self . thresh ) : #NEWLINE# #INDENT# if self . binarize : #NEWLINE# #INDENT# val = 1 #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# val = 0 #NEWLINE# #UNINDENT# return ( int ( user ) , ( int ( item ) , val ) )