■ ■ ■ ■ ■ ■ ■
maryam/modules/iris/topicmodeling.py
| skipped 14 lines |
15 | 15 | | 'author': 'Hatma Suryotrisongko', |
16 | 16 | | 'version': '0.1.0', |
17 | 17 | | 'description': 'Topic Modeling Algorithms.', |
| 18 | + | 'required': ('dask', 'scikit-learn', 'umap', 'bertopic', 'gensim'), |
18 | 19 | | 'options': ( |
19 | 20 | | ('inputfile', None, True, 'Input file that contains the data', '-i', 'store', str), |
20 | 21 | | ('filetype', None, True, 'File type: csv/json', '-t', 'store', str), |
| skipped 9 lines |
30 | 31 | | |
31 | 32 | | run = self.topic(self.options['inputfile'], self.options['filetype'], self.options['showcharts'], self.options['verbose']) |
32 | 33 | | run.run_sklearn_cluster_kmeans(self.options['pretrained_model'], self.options['showcharts'], self.options['verbose']) |
33 | | - | run.run_topic_modeling_bertopic(self.options['pretrained_model'], self.options['verbose']) |
| 34 | + | |
| 35 | + | results = run.run_topic_modeling_bertopic(self.options['pretrained_model'], self.options['verbose']) |
| 36 | + | print("\n\nResults = \n") |
| 37 | + | print( results ) |
| 38 | + | |
| 39 | + | output = {'results': results.to_json(orient="records") } |
| 40 | + | print("\n\nOutput = \n") |
| 41 | + | print( output ) |
| 42 | + | |
| 43 | + | inputfile = self.options['inputfile'] |
| 44 | + | self.save_gather(output, 'iris/topicmodeling', inputfile, output=self.options['output']) |
| 45 | + | |
| 46 | + | return output |
34 | 47 | | |
35 | 48 | | |
36 | 49 | | def module_run(self): |
| skipped 1 lines |