#NEWLINE# def gete2wlandw2el( filename ) : #NEWLINE# #INDENT# example_to_worker_label = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# worker_to_example_label = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# label_set = [ ] #NEWLINE# f = open ( filename ) #NEWLINE# for line in f . xreadlines ( ) : #NEWLINE# #INDENT# line = line . strip ( ) #NEWLINE# if ( not line ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# items = line . split ( '\t' ) #NEWLINE# example_to_worker_label . setdefault ( items [ 1 ] , [ ] ) . append ( ( items [ 0 ] , items [ 2 ] ) ) #NEWLINE# worker_to_example_label . setdefault ( items [ 0 ] , [ ] ) . append ( ( items [ 1 ] , items [ 2 ] ) ) #NEWLINE# if ( items [ 2 ] not in label_set ) : #NEWLINE# #INDENT# label_set . append ( items [ 2 ] ) #NEWLINE# #UNINDENT# #UNINDENT# return ( example_to_worker_label , worker_to_example_label , label_set )