#NEWLINE# def __init__( self , corpusPath , modelPath , numModels = 50 , tokenRegex = '\\w{3,}' , numTopics = 20 , numIters = 1000 , MALLET_PATH = 'tools/mallet' ) : #NEWLINE# #INDENT# with ImportMalletCorpus ( corpusPath , tokenRegex ) as importer : #NEWLINE# #INDENT# importer . ImportFileOrFolder ( tokenRegex ) #NEWLINE# #UNINDENT# for index in range ( numModels ) : #NEWLINE# #INDENT# modelSubPath = '{}/model_{:03d}' . format ( modelPath , index ) #NEWLINE# with TrainMalletLDA ( modelPath , modelSubPath ) as builder : #NEWLINE# #INDENT# builder . TrainTopics ( numTopics , numIters )