bionic787
12/24/2013 - 6:14 AM

python-variable-args

Ref: http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/

class Main(object):
 
     @staticmethod
     def main(**kwargs):
 
         """ Process all files """
         objOpnionFiles = OpnionFiles()
         #process_all_files(fname_data_files)
 
         """ Process a test file """
         l.info('Processing a test file ...')
         #fpath_a_data_file = '../../data/test_1.txt'
         fpath_a_data_file = '../../data/test_2.txt'
 
         objOpnionFiles.process_a_file(fpath_a_data_file,**kwargs)
 
         l.info('Leaving main...')
 

if __name__ == "__main__":
     kwargs = {}
     kwargs['fname_useless_words'] = 'useless.txt'
     kwargs['fname_data_files'] = '../../data/datafiles_2012.txt'
     kwargs['fpath_data_files'] = '../../data/2012/'
     kwargs['fpath_judge_file'] = '../../data/judges.txt'
     kwargs['do_stemming'] = False
     kwargs['do_lemmatization'] = False
 
     l.info('Calling main function ....')
     Main.main(**kwargs)