Spaces:
Runtime error
Runtime error
anonymousauthors
commited on
Commit
β’
5a5f4eb
1
Parent(s):
265c345
Upload 2 files
Browse files
pages/0_π_Dictionary_(Search).py
CHANGED
@@ -4,6 +4,7 @@ import pandas as pd
|
|
4 |
import os
|
5 |
import pickle
|
6 |
from collections import defaultdict, Counter
|
|
|
7 |
|
8 |
from PyDictionary import PyDictionary
|
9 |
|
@@ -46,8 +47,12 @@ datas = pickle.load(open(f'all_secret_langauge_by_fist/{file_name}', 'rb'))
|
|
46 |
if title in datas:
|
47 |
st.title(title)
|
48 |
# st.markdown(f":red[[]]")
|
49 |
-
st.markdown(f"## {title}'s meaning in English[ΒΉ](#jump)")
|
50 |
-
|
|
|
|
|
|
|
|
|
51 |
# write the meaning of input word
|
52 |
try:
|
53 |
title_mean = dictionary.meaning(title)
|
@@ -59,15 +64,20 @@ if title in datas:
|
|
59 |
st.error(f'We cannot find the meaning of {title} in English (PyDictionary), which might be due to the bug.',
|
60 |
icon="π¨")
|
61 |
|
62 |
-
st.markdown(f"---")
|
63 |
-
st.markdown(f"## {title}'s secret languages")
|
64 |
data_title = datas[title]
|
65 |
# st.markdown(data_title.keys())
|
66 |
title_secret_languages = list(sorted(list(set(data_title["secret languages"]))))
|
67 |
# dataframe = pd.DataFrame(datas[title])
|
68 |
# st.markdown(f'### We found {len(set(dataframe.loc[:, "secret languages"]))} secret languages of {title}.', unsafe_allow_html=True)
|
69 |
-
st.markdown(f'Overall, we found :red[{len(title_secret_languages)}] secret languages of :blue[{title}].',
|
70 |
-
unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
71 |
special = '"'
|
72 |
# _title_secret_languages = [f'[{i}](#{i.strip().replace("(", ",,").replace(")", "..").replace("[", ",,,").replace("]", "...").replace(special, "././")})'
|
73 |
# for i in title_secret_languages]
|
@@ -112,10 +122,14 @@ if title in datas:
|
|
112 |
st.markdown(f"\**Hyperlinks only function when the corresponding tab is open. "
|
113 |
f"For example, the hyperlinks in the paraphrase section will only work when the paraphrase tab is open. However, due to the container property of Hugging Face Space, the hyperlinks might be not able to function.*")
|
114 |
st.markdown('\**Due to the grammatical properties of HTML, the layout of this page may vary.*')
|
115 |
-
st.markdown(f"---")
|
116 |
-
st.markdown(f"## Examples of replaced sentences")
|
117 |
-
st.markdown(f"The number following the tasks represents the number of examples found for a particular task, which may be different from the number of secret languages.")
|
118 |
-
|
|
|
|
|
|
|
|
|
119 |
# st.text(','.join(title_secret_languages).replace('<s>', '\<s\>'))
|
120 |
# st.dataframe(dataframe)
|
121 |
_num = Counter(data_title['tasks'])
|
|
|
4 |
import os
|
5 |
import pickle
|
6 |
from collections import defaultdict, Counter
|
7 |
+
from streamlit_extras.colored_header import colored_header
|
8 |
|
9 |
from PyDictionary import PyDictionary
|
10 |
|
|
|
47 |
if title in datas:
|
48 |
st.title(title)
|
49 |
# st.markdown(f":red[[]]")
|
50 |
+
# st.markdown(f"## {title}'s meaning in English[ΒΉ](#jump)")
|
51 |
+
colored_header(
|
52 |
+
label=f"{title}'s meaning in English[ΒΉ](#jump)",
|
53 |
+
description="",
|
54 |
+
color_name="violet-70",
|
55 |
+
)
|
56 |
# write the meaning of input word
|
57 |
try:
|
58 |
title_mean = dictionary.meaning(title)
|
|
|
64 |
st.error(f'We cannot find the meaning of {title} in English (PyDictionary), which might be due to the bug.',
|
65 |
icon="π¨")
|
66 |
|
67 |
+
# st.markdown(f"---")
|
68 |
+
# st.markdown(f"## {title}'s secret languages")
|
69 |
data_title = datas[title]
|
70 |
# st.markdown(data_title.keys())
|
71 |
title_secret_languages = list(sorted(list(set(data_title["secret languages"]))))
|
72 |
# dataframe = pd.DataFrame(datas[title])
|
73 |
# st.markdown(f'### We found {len(set(dataframe.loc[:, "secret languages"]))} secret languages of {title}.', unsafe_allow_html=True)
|
74 |
+
# st.markdown(f'Overall, we found :red[{len(title_secret_languages)}] secret languages of :blue[{title}].',
|
75 |
+
# unsafe_allow_html=True)
|
76 |
+
colored_header(
|
77 |
+
label=f"{title}'s secret languages",
|
78 |
+
description=f'Overall, we found :red[{len(title_secret_languages)}] secret languages of :blue[{title}].',
|
79 |
+
color_name="red-70",
|
80 |
+
)
|
81 |
special = '"'
|
82 |
# _title_secret_languages = [f'[{i}](#{i.strip().replace("(", ",,").replace(")", "..").replace("[", ",,,").replace("]", "...").replace(special, "././")})'
|
83 |
# for i in title_secret_languages]
|
|
|
122 |
st.markdown(f"\**Hyperlinks only function when the corresponding tab is open. "
|
123 |
f"For example, the hyperlinks in the paraphrase section will only work when the paraphrase tab is open. However, due to the container property of Hugging Face Space, the hyperlinks might be not able to function.*")
|
124 |
st.markdown('\**Due to the grammatical properties of HTML, the layout of this page may vary.*')
|
125 |
+
# st.markdown(f"---")
|
126 |
+
# st.markdown(f"## Examples of replaced sentences")
|
127 |
+
# st.markdown(f"The number following the tasks represents the number of examples found for a particular task, which may be different from the number of secret languages.")
|
128 |
+
colored_header(
|
129 |
+
label=f"Examples of replaced sentences",
|
130 |
+
description=f'The number following the tasks represents the number of examples found for a particular task, which may be different from the number of secret languages.',
|
131 |
+
color_name="orange-70",
|
132 |
+
)
|
133 |
# st.text(','.join(title_secret_languages).replace('<s>', '\<s\>'))
|
134 |
# st.dataframe(dataframe)
|
135 |
_num = Counter(data_title['tasks'])
|
pages/1_π_Dictionary_(Browse).py
CHANGED
@@ -6,6 +6,7 @@ import pickle
|
|
6 |
from streamlit import session_state as _state
|
7 |
|
8 |
from PyDictionary import PyDictionary
|
|
|
9 |
|
10 |
dictionary = PyDictionary()
|
11 |
|
@@ -119,13 +120,28 @@ for k in buttons:
|
|
119 |
|
120 |
word_buttons = []
|
121 |
if k == '0-9':
|
122 |
-
st.title(k)
|
|
|
|
|
|
|
|
|
|
|
123 |
file_names = ['num_dict.pkl']
|
124 |
elif k == 'Others':
|
125 |
-
st.title(k)
|
|
|
|
|
|
|
|
|
|
|
126 |
file_names = ['other_dict.pkl']
|
127 |
elif ord(k[0]) in list(range(97, 123)) + list(range(65, 91)):
|
128 |
-
st.title(chr(ord(k)))
|
|
|
|
|
|
|
|
|
|
|
129 |
file_names = [f'{ord(k[0]) + 32}_dict.pkl', f'{ord(k[0])}_dict.pkl']
|
130 |
all_data = {}
|
131 |
all_key = []
|
|
|
6 |
from streamlit import session_state as _state
|
7 |
|
8 |
from PyDictionary import PyDictionary
|
9 |
+
from streamlit_extras.colored_header import colored_header
|
10 |
|
11 |
dictionary = PyDictionary()
|
12 |
|
|
|
120 |
|
121 |
word_buttons = []
|
122 |
if k == '0-9':
|
123 |
+
# st.title(k)
|
124 |
+
colored_header(
|
125 |
+
label=k,
|
126 |
+
description="",
|
127 |
+
color_name="violet-70",
|
128 |
+
)
|
129 |
file_names = ['num_dict.pkl']
|
130 |
elif k == 'Others':
|
131 |
+
# st.title(k)
|
132 |
+
colored_header(
|
133 |
+
label=k,
|
134 |
+
description="",
|
135 |
+
color_name="violet-70",
|
136 |
+
)
|
137 |
file_names = ['other_dict.pkl']
|
138 |
elif ord(k[0]) in list(range(97, 123)) + list(range(65, 91)):
|
139 |
+
# st.title(chr(ord(k)))
|
140 |
+
colored_header(
|
141 |
+
label=chr(ord(k)),
|
142 |
+
description="",
|
143 |
+
color_name="violet-70",
|
144 |
+
)
|
145 |
file_names = [f'{ord(k[0]) + 32}_dict.pkl', f'{ord(k[0])}_dict.pkl']
|
146 |
all_data = {}
|
147 |
all_key = []
|