Spaces:
GIZ
/
Running on CPU Upgrade

prashant commited on
Commit
5e6f5c6
1 Parent(s): d9aacf7

textrank results display

Browse files
Files changed (1) hide show
  1. appStore/sdg_analysis.py +13 -9
appStore/sdg_analysis.py CHANGED
@@ -56,19 +56,19 @@ def app():
56
 
57
  df, x = sdg_classification(allDocuments['documents'])
58
  sdg_labels = df.SDG.unique()
59
- keywordList = []
 
60
  for label in sdg_labels:
61
  sdgdata = " ".join(df[df.SDG == label].text.to_list())
62
  tfidflist_ = keywordExtraction(label,[sdgdata])
63
  textranklist_ = textrank(sdgdata, words = 20)
64
- keywordList.append({'SDG':label, 'TFIDF Keywords':tfidflist_, 'TEXT RANK':textranklist_})
65
- keywordsDf = pd.DataFrame(keywordList)
 
 
66
 
67
 
68
 
69
-
70
-
71
-
72
 
73
  plt.rcParams['font.size'] = 25
74
  colors = plt.get_cmap('Blues')(np.linspace(0.2, 0.7, len(x)))
@@ -92,9 +92,13 @@ def app():
92
 
93
  c1, c2, c3 = st.columns([1, 10, 1])
94
  with c2:
95
- st.table(keywordsDf)
96
-
97
-
 
 
 
 
98
  c7, c8, c9 = st.columns([1, 10, 1])
99
  with c8:
100
  st.table(df)
 
56
 
57
  df, x = sdg_classification(allDocuments['documents'])
58
  sdg_labels = df.SDG.unique()
59
+ tfidfkeywordList = []
60
+ textrankkeywordlist = []
61
  for label in sdg_labels:
62
  sdgdata = " ".join(df[df.SDG == label].text.to_list())
63
  tfidflist_ = keywordExtraction(label,[sdgdata])
64
  textranklist_ = textrank(sdgdata, words = 20)
65
+ tfidfkeywordList.append({'SDG':label, 'TFIDF Keywords':tfidflist_})
66
+ textrankkeywordlist.append({'SDG':label, 'TextRank Keywords':textranklist_})
67
+ tfidfkeywordsDf = pd.DataFrame(tfidfkeywordList)
68
+ tRkeywordsDf = pd.DataFrame(textrankkeywordlist)
69
 
70
 
71
 
 
 
 
72
 
73
  plt.rcParams['font.size'] = 25
74
  colors = plt.get_cmap('Blues')(np.linspace(0.2, 0.7, len(x)))
 
92
 
93
  c1, c2, c3 = st.columns([1, 10, 1])
94
  with c2:
95
+ st.table(tfidfkeywordsDf)
96
+
97
+ st.write("TextRank BASED")
98
+
99
+ c11, c12, c13 = st.columns([1, 10, 1])
100
+ with c12:
101
+ st.table(tRkeywordsDf)
102
  c7, c8, c9 = st.columns([1, 10, 1])
103
  with c8:
104
  st.table(df)