Update app.py
Browse files
app.py
CHANGED
@@ -36,22 +36,28 @@ if (st.button('بحث', disabled=False)):
|
|
36 |
st.dataframe(df)
|
37 |
|
38 |
if (st.button('استعمال الرسم البياني', disabled=False)):
|
|
|
39 |
tmt = {}
|
40 |
VocMap = './voc.csv'
|
41 |
ScoreMap = './BM25.csv'
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
50 |
def Query2id(voc, query):
|
51 |
return [voc.index[voc['word'] == word].values[0] for word in query.split()]
|
52 |
|
53 |
id_list = Query2id(df3, sent)
|
54 |
-
|
55 |
def setQueriesVoc(df, id_list):
|
56 |
res = []
|
57 |
for e in id_list:
|
|
|
36 |
st.dataframe(df)
|
37 |
|
38 |
if (st.button('استعمال الرسم البياني', disabled=False)):
|
39 |
+
|
40 |
tmt = {}
|
41 |
VocMap = './voc.csv'
|
42 |
ScoreMap = './BM25.csv'
|
43 |
|
44 |
+
@st.cache
|
45 |
+
def reading_df(path1, path2):
|
46 |
+
df_voc = pd.read_csv(path1, delimiter='\t')
|
47 |
+
df_graph = pd.read_csv(path2, delimiter='\t')
|
48 |
+
df_graph.set_index(['ID1','ID2'], inplace=True)
|
49 |
+
df_gr = pd.read_csv(ScoreMap, delimiter='\t')
|
50 |
+
df_gr.set_index(['ID1'], inplace=True)
|
51 |
+
return df_voc, df_graph, df_gr
|
52 |
+
|
53 |
+
df3, df_g, df_in = reading_df(path1, path2)
|
54 |
+
|
55 |
+
@st.cache
|
56 |
def Query2id(voc, query):
|
57 |
return [voc.index[voc['word'] == word].values[0] for word in query.split()]
|
58 |
|
59 |
id_list = Query2id(df3, sent)
|
60 |
+
@st.cache
|
61 |
def setQueriesVoc(df, id_list):
|
62 |
res = []
|
63 |
for e in id_list:
|