#NEWLINE# def __init__( self , config , trainingDataset , holdOutDataset ) : #NEWLINE# #INDENT# self . config = config #NEWLINE# self . logger = config [ 'logger' ] #NEWLINE# self . esClient = Elasticsearch ( ( ( config [ 'elasticsearch' ] [ 'host' ] + ':' ) + str ( config [ 'elasticsearch' ] [ 'port' ] ) ) ) #NEWLINE# self . trainingDataset = trainingDataset #NEWLINE# self . holdOutDataset = holdOutDataset #NEWLINE# self . bagOfPhrases = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . corpusIndex = config [ 'corpus' ] [ 'index' ] #NEWLINE# self . corpusType = config [ 'corpus' ] [ 'type' ] #NEWLINE# self . corpusFields = config [ 'corpus' ] [ 'text_fields' ] #NEWLINE# self . corpusSize = 0 #NEWLINE# self . timeout = 6000000 #NEWLINE# self . processorIndex = config [ 'processor' ] [ 'index' ] #NEWLINE# self . processorType = config [ 'processor' ] [ 'type' ] #NEWLINE# self . processorPhraseType = ( config [ 'processor' ] [ 'type' ] + '__phrase' ) #NEWLINE# count = self . esClient . count ( index = self . corpusIndex , doc_type = self . corpusType , body = { #NEWLINE# #INDENT# 'query' : { #NEWLINE# #INDENT# 'match_all' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . corpusSize = count [ 'count' ] #NEWLINE# self . featureNames = map ( ( lambda x : x [ 'name' ] ) , config [ 'generator' ] [ 'features' ] ) #NEWLINE# for module in config [ 'processor' ] [ 'modules' ] : #NEWLINE# #INDENT# self . featureNames = ( self . featureNames + map ( ( lambda x : x [ 'name' ] ) , module [ 'features' ] ) ) #NEWLINE# #UNINDENT# self . workerName = 'bayzee.generation.worker' #NEWLINE# self . dispatchers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . worker = DurableChannel ( self . workerName , config )