Projects STRLCPY Maryam Commits 7e0c987b
🤬
  • To answer Mr. Saeed's comments = - imports are heavy and decrease the speed of the framework. So, try to import them in the class. - also, add them all to the requirements file.

  • Loading...
  • Hatma Suryotrisongko committed 2 years ago
    7e0c987b
    1 parent 2f4539d5
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    maryam/core/util/iris/topic.py
    skipped 2 lines
    3 3   
    4 4  import pandas as pd
    5 5  import numpy as np
    6  -import json
    7  -import csv
    8  -from dask import dataframe as dd
    9  - 
    10  -from sklearn.cluster import KMeans
    11  -import scipy
    12 6  import matplotlib.pyplot as plt
    13  -import umap
    14  - 
    15  -from bertopic import BERTopic
    16 7  from sentence_transformers import SentenceTransformer
    17  - 
    18  -from gensim.parsing.preprocessing import remove_stopwords, STOPWORDS
    19  - 
    20  -from top2vec import Top2Vec
    21 8   
    22 9  class main:
    23 10   
    24 11   def __init__(self, inputfile, filetype, keyword, showcharts, verbose):
    25 12   
     13 + from dask import dataframe as dd
     14 + import json
     15 + from gensim.parsing.preprocessing import remove_stopwords
     16 + 
    26 17   if verbose == True:
    27 18   print("\n\n DATASET = reading file : " + inputfile)
    28 19   print("\n\n Search keyword = " + keyword)
    skipped 42 lines
    71 62   
    72 63   def run_sklearn_cluster_kmeans(self, selected_pretrained_model, showcharts, verbose):
    73 64   
     65 + from sklearn.cluster import KMeans
     66 + import scipy
     67 + import umap
     68 + 
    74 69   pretrained_model = selected_pretrained_model
    75 70   if verbose == True:
    76 71   print("\n\n Model selection")
    skipped 54 lines
    131 126   
    132 127   def run_topic_modeling_bertopic(self, selected_pretrained_model, verbose):
    133 128   
     129 + from bertopic import BERTopic
     130 + 
    134 131   pretrained_model = selected_pretrained_model
    135 132   if verbose == True:
    136 133   print("\n\n Model selection")
    skipped 41 lines
    178 175   
    179 176   
    180 177   def run_search_topics_top2vec(self, keyword, showcharts, verbose):
     178 + 
     179 + from top2vec import Top2Vec
    181 180   
    182 181   print("\n\n Search Topics Using Top2Vec (caution: might not work well for a small dataset)")
    183 182   print("\n the Search Keyword = " + keyword)
    skipped 43 lines
  • ■ ■ ■ ■ ■
    setup.py
    skipped 43 lines
    44 44   'nltk',
    45 45   'matplotlib',
    46 46   'pandas',
    47  - 'wordcloud'
     47 + 'wordcloud',
     48 + 'numpy',
     49 + 'dask',
     50 + 'scikit-learn',
     51 + 'scipy',
     52 + 'umap',
     53 + 'bertopic',
     54 + 'sentence_transformers',
     55 + 'gensim',
     56 + 'top2vec'
    48 57   ],
    49 58   classifiers=[
    50 59   'Programming Language :: Python :: 3.10',
    skipped 8 lines
Please wait...
Page is in error, reload to recover