prashant
commited on
Commit
·
11e64f9
1
Parent(s):
acaefb4
text rank display improvments
Browse files- appStore/sdg_analysis.py +7 -6
- utils/keyword_extraction.py +6 -3
appStore/sdg_analysis.py
CHANGED
@@ -117,7 +117,7 @@ def app():
|
|
117 |
textranklist_ = textrank(sdgdata)
|
118 |
if len(textranklist_) > 0:
|
119 |
# tfidfkeywordList.append({'SDG':label, 'TFIDF Keywords':tfidflist_})
|
120 |
-
textrankkeywordlist.append({'SDG':label, 'TextRank Keywords':textranklist_})
|
121 |
# tfidfkeywordsDf = pd.DataFrame(tfidfkeywordList)
|
122 |
tRkeywordsDf = pd.DataFrame(textrankkeywordlist)
|
123 |
|
@@ -139,13 +139,14 @@ def app():
|
|
139 |
with c5:
|
140 |
st.pyplot(fig)
|
141 |
|
142 |
-
st.markdown("
|
143 |
|
144 |
-
c1, c2, c3 = st.columns([1, 10, 1])
|
145 |
-
with c2:
|
146 |
-
|
|
|
147 |
|
148 |
-
st.markdown("
|
149 |
# c7, c8, c9 = st.columns([1, 10, 1])
|
150 |
# with c8:
|
151 |
AgGrid(df, reload_data = False, update_mode="value_changed")
|
|
|
117 |
textranklist_ = textrank(sdgdata)
|
118 |
if len(textranklist_) > 0:
|
119 |
# tfidfkeywordList.append({'SDG':label, 'TFIDF Keywords':tfidflist_})
|
120 |
+
textrankkeywordlist.append({'SDG':label, 'TextRank Keywords':",".join(textranklist_)})
|
121 |
# tfidfkeywordsDf = pd.DataFrame(tfidfkeywordList)
|
122 |
tRkeywordsDf = pd.DataFrame(textrankkeywordlist)
|
123 |
|
|
|
139 |
with c5:
|
140 |
st.pyplot(fig)
|
141 |
|
142 |
+
st.markdown("###### What keywords are present under SDG classified text? ######")
|
143 |
|
144 |
+
# c1, c2, c3 = st.columns([1, 10, 1])
|
145 |
+
# with c2:
|
146 |
+
# st.table(tRkeywordsDf)
|
147 |
+
AgGrid(tRkeywordsDf, reload_data = False, update_mode="value_changed")
|
148 |
|
149 |
+
st.markdown("###### Top few SDG Classified paragraph/text results ######")
|
150 |
# c7, c8, c9 = st.columns([1, 10, 1])
|
151 |
# with c8:
|
152 |
AgGrid(df, reload_data = False, update_mode="value_changed")
|
utils/keyword_extraction.py
CHANGED
@@ -69,11 +69,14 @@ def textrank(textdata, ratio = 0.1, words = 0):
|
|
69 |
try:
|
70 |
words = int(config.get('sdg','TOP_KEY'))
|
71 |
results = keywords.keywords(textdata, words = words).split("\n")
|
72 |
-
except:
|
73 |
-
logging.warning(
|
74 |
results = keywords.keywords(textdata, ratio= ratio).split("\n")
|
75 |
else:
|
76 |
-
|
|
|
|
|
|
|
77 |
|
78 |
return results
|
79 |
|
|
|
69 |
try:
|
70 |
words = int(config.get('sdg','TOP_KEY'))
|
71 |
results = keywords.keywords(textdata, words = words).split("\n")
|
72 |
+
except Exception as e:
|
73 |
+
logging.warning(e)
|
74 |
results = keywords.keywords(textdata, ratio= ratio).split("\n")
|
75 |
else:
|
76 |
+
try:
|
77 |
+
results = keywords.keywords(textdata, words= words).split("\n")
|
78 |
+
except:
|
79 |
+
results = keywords.keywords(textdata, ratio = ratio).split("\n")
|
80 |
|
81 |
return results
|
82 |
|