prashant
commited on
Commit
·
b26b139
1
Parent(s):
550b85d
coherence country dropdown
Browse files- appStore/coherence.py +53 -1
- appStore/keyword_search.py +14 -13
appStore/coherence.py
CHANGED
@@ -3,6 +3,58 @@ import glob, os, sys;
|
|
3 |
sys.path.append('../utils')
|
4 |
|
5 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
def app():
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
sys.path.append('../utils')
|
4 |
|
5 |
import streamlit as st
|
6 |
+
import ast
|
7 |
+
|
8 |
+
# Reading data and Declaring necessary variables
|
9 |
+
with open('ndcs/countryList.txt') as dfile:
|
10 |
+
countryList = dfile.read()
|
11 |
+
countryList = ast.literal_eval(countryList)
|
12 |
+
countrynames = list(countryList.keys())
|
13 |
+
|
14 |
+
with open('ndcs/cca.txt', encoding='utf-8', errors='ignore') as dfile:
|
15 |
+
cca_sent = dfile.read()
|
16 |
+
cca_sent = ast.literal_eval(cca_sent)
|
17 |
+
|
18 |
+
with open('ndcs/ccm.txt', encoding='utf-8', errors='ignore') as dfile:
|
19 |
+
ccm_sent = dfile.read()
|
20 |
+
ccm_sent = ast.literal_eval(ccm_sent)
|
21 |
|
22 |
def app():
|
23 |
+
|
24 |
+
#### APP INFO #####
|
25 |
+
with st.container():
|
26 |
+
st.markdown("<h1 style='text-align: center; \
|
27 |
+
color: black;'> Check NDC Coherence</h1>",
|
28 |
+
unsafe_allow_html=True)
|
29 |
+
st.write(' ')
|
30 |
+
st.write(' ')
|
31 |
+
with st.expander("ℹ️ - About this app", expanded=False):
|
32 |
+
|
33 |
+
st.write(
|
34 |
+
"""
|
35 |
+
The *Check NDC Coherence* application provides easy evaluation of
|
36 |
+
coherence between a given policy document and a country’s (Intended)\
|
37 |
+
Nationally Determined Contribution (INDCs/NDCs) using open-source \
|
38 |
+
data from the German Institute of Development and Sustainability’s \
|
39 |
+
(IDOS) [NDC Explorer](https://klimalog.idos-research.de/ndc/#NDCExplorer/worldMap?NewAndUpdatedNDC??income???catIncome).\
|
40 |
+
""")
|
41 |
+
st.write("")
|
42 |
+
st.write(""" User can select a country context via the drop-down menu \
|
43 |
+
on the left-hand side of the application. Subsequently, the user is \
|
44 |
+
given the opportunity to manually upload another policy document \
|
45 |
+
from the same national context or to select a pre-loaded example \
|
46 |
+
document. Thereafter, the user can choose between two categories \
|
47 |
+
to compare coherence between the documents: climate change adaptation \
|
48 |
+
and climate change mitigation. Based on the selected information, \
|
49 |
+
the application identifies relevant paragraphs in the uploaded \
|
50 |
+
document and assigns them to the respective indicator from the NDC \
|
51 |
+
Explorer. Currently, the NDC Explorer has 20 indicators under \
|
52 |
+
climate change mitigation (e.g., fossil fuel production, REDD+) and \
|
53 |
+
22 indicators under climate change adaptation (e.g., sea level rise,\
|
54 |
+
investment needs). The assignment of the paragraph to a corresponding\
|
55 |
+
indicator is based on vector similarities in which only paragraphs \
|
56 |
+
with similarity above 0.55 to the indicators are considered. """)
|
57 |
+
|
58 |
+
option = st.sidebar.selectbox('Select Country', (countrynames))
|
59 |
+
countryCode = countryList[option]
|
60 |
+
|
appStore/keyword_search.py
CHANGED
@@ -47,20 +47,21 @@ def app():
|
|
47 |
policy document - developed by GIZ Data and the \
|
48 |
Sustainable Development Solution Network.
|
49 |
""")
|
|
|
50 |
st.write(""" The application allows its user to perform a keyword search\
|
51 |
-
based on two options: a lexical (TFIDF)
|
52 |
-
bi-encoder search. The difference between both
|
53 |
-
straightforward; while the lexical search only
|
54 |
-
in the document with exact matching results,
|
55 |
-
shows paragraphs with meaningful connections
|
56 |
-
on the context as well. The semantic search
|
57 |
-
experience in using the application. Both
|
58 |
-
probabilistic retrieval framework in its identification
|
59 |
-
paragraphs. By defualt the search is performed using
|
60 |
-
to find 'Exact/Lexical Matches' please tick the
|
61 |
-
by pass semantic search.. Furthermore
|
62 |
-
user to search for pre-defined keywords
|
63 |
-
present in sidebar.""")
|
64 |
|
65 |
|
66 |
with st.sidebar:
|
|
|
47 |
policy document - developed by GIZ Data and the \
|
48 |
Sustainable Development Solution Network.
|
49 |
""")
|
50 |
+
st.write("")
|
51 |
st.write(""" The application allows its user to perform a keyword search\
|
52 |
+
based on two options: a lexical ([TFIDF](https://en.wikipedia.org/wiki/Tf%E2%80%93idf))\
|
53 |
+
search and semantic bi-encoder search. The difference between both \
|
54 |
+
approaches is quite straightforward; while the lexical search only \
|
55 |
+
displays paragraphs in the document with exact matching results, \
|
56 |
+
the semantic search shows paragraphs with meaningful connections \
|
57 |
+
(e.g., synonyms) based on the context as well. The semantic search \
|
58 |
+
allows for a personalized experience in using the application. Both \
|
59 |
+
methods employ a probabilistic retrieval framework in its identification\
|
60 |
+
of relevant paragraphs. By defualt the search is performed using \
|
61 |
+
'Semantic Search' to find 'Exact/Lexical Matches' please tick the \
|
62 |
+
checkbox provided, which will by pass semantic search.. Furthermore,\
|
63 |
+
the application allows the user to search for pre-defined keywords \
|
64 |
+
from different thematic buckets present in sidebar.""")
|
65 |
|
66 |
|
67 |
with st.sidebar:
|