freemt
commited on
Commit
·
8517064
1
Parent(s):
8b3cbde
Update skeleton ready with ezbee dzbee
Browse files- app.py +104 -51
- config.toml +6 -0
- data/en - Copy.txt +8 -0
- data/zh - Copy.txt +7 -0
- litbee/__main__.py +5 -4
- litbee/dzbee_page.py +4 -1
- litbee/ezbee_page.py +85 -19
- litbee/fetch_paste.py +9 -0
- litbee/fetch_upload.py +198 -0
- litbee/fetch_urls.py +9 -0
- litbee/files2df.py +3 -1
- litbee/options.py +82 -0
- litbee/process_upload.py +3 -29
- litbee/utils.py +14 -9
- litbee/xbee_page.py +3 -2
- main_example.py +124 -0
- poetry.lock +171 -1
- pyproject.toml +1 -0
- tests/test_litbee.py +1 -2
app.py
CHANGED
@@ -1,34 +1,106 @@
|
|
1 |
-
"""Prep __main__.py.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
# pylint: disable=invalid-name
|
3 |
import os
|
|
|
|
|
4 |
from pathlib import Path
|
|
|
5 |
from typing import Optional
|
6 |
|
|
|
|
|
7 |
import pandas as pd
|
8 |
-
|
9 |
import streamlit as st
|
10 |
-
from
|
11 |
-
from types import SimpleNamespace
|
12 |
-
|
13 |
-
import logzero
|
14 |
from logzero import logger
|
15 |
from set_loglevel import set_loglevel
|
|
|
16 |
|
17 |
from litbee import __version__, litbee
|
18 |
-
from litbee.
|
19 |
-
|
20 |
-
from litbee.
|
21 |
-
from litbee.
|
22 |
-
from litbee.
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
os.environ["TZ"] = "Asia/Shanghai"
|
25 |
-
|
|
|
26 |
logzero.loglevel(set_loglevel())
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
st.set_page_config(
|
29 |
page_title=f"litbee v{__version__}",
|
30 |
-
page_icon="🧊",
|
31 |
-
|
|
|
32 |
initial_sidebar_state="auto", # "auto" or "expanded" or "collapsed",
|
33 |
menu_items=menu_items,
|
34 |
)
|
@@ -37,47 +109,28 @@ st.set_page_config(
|
|
37 |
pd.set_option("display.precision", 2)
|
38 |
pd.options.display.float_format = "{:,.2f}".format
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
if "ns" not in state:
|
42 |
-
state.ns = SimpleNamespace()
|
|
|
43 |
|
44 |
|
45 |
def main():
|
46 |
-
|
47 |
-
|
48 |
-
sb_front_cover()
|
49 |
-
|
50 |
-
try:
|
51 |
-
_ = state.ns.df
|
52 |
-
state.ns.count += 1
|
53 |
-
logger.debug(" run: %s", state.ns.count)
|
54 |
-
except AttributeError:
|
55 |
-
logger.debug("first run")
|
56 |
-
# df = files2df("data/en.txt", "data/zh.txt")
|
57 |
-
df = files2df("data/test_en.txt", "data/test_zh.txt")
|
58 |
-
state.ns.count = 1
|
59 |
-
state.ns.df = df
|
60 |
-
|
61 |
-
# multi-page setup
|
62 |
-
menu = {
|
63 |
-
"ezbee": ezbee_page,
|
64 |
-
"dzbee": dzbee_page,
|
65 |
-
"xbee": xbee_page,
|
66 |
-
}
|
67 |
-
selection = st.sidebar.radio("", menu)
|
68 |
-
page = menu[selection]
|
69 |
-
|
70 |
-
# page.app()
|
71 |
-
page()
|
72 |
-
|
73 |
-
# 'items', 'keys', values, 'to_dict', 'update', 'values'
|
74 |
-
# logger.debug("state.ns: %s", state.ns)
|
75 |
-
|
76 |
-
st.write(f"run: {state.ns.count}")
|
77 |
-
# st.dataframe(state.ns.df)
|
78 |
-
|
79 |
-
# st.markdown(html_string, unsafe_allow_html=True)
|
80 |
-
# st.markdown(state.ns.df.to_html(), unsafe_allow_html=True)
|
81 |
|
82 |
|
83 |
main()
|
|
|
1 |
+
"""Prep __main__.py.
|
2 |
+
|
3 |
+
https://share.streamlit.io/deploy
|
4 |
+
Advanced settings...
|
5 |
+
Python version
|
6 |
+
3.7
|
7 |
+
3.8
|
8 |
+
3.9*
|
9 |
+
3.10
|
10 |
+
|
11 |
+
https://docs.streamlit.io/knowledge-base/using-streamlit/hide-row-indices-displaying-dataframe
|
12 |
+
Hide row indices when displaying a dataframe
|
13 |
+
# CSS to inject contained in a string
|
14 |
+
hide_table_row_index = '''
|
15 |
+
<style>
|
16 |
+
tbody th {display:none}
|
17 |
+
.blank {display:none}
|
18 |
+
</style>
|
19 |
+
'''
|
20 |
+
# Inject CSS with Markdown
|
21 |
+
st.markdown(hide_table_row_index, unsafe_allow_html=True)
|
22 |
+
|
23 |
+
# Display a static table
|
24 |
+
st.table(df)
|
25 |
+
|
26 |
+
# Hide row indices with st.dataframe
|
27 |
+
# CSS to inject contained in a string
|
28 |
+
hide_dataframe_row_index = '''
|
29 |
+
<style>
|
30 |
+
.row_heading.level0 {display:none}
|
31 |
+
.blank {display:none}
|
32 |
+
</style>
|
33 |
+
'''
|
34 |
+
# Inject CSS with Markdown
|
35 |
+
st.markdown(hide_dataframe_row_index, unsafe_allow_html=True)
|
36 |
+
|
37 |
+
# Display an interactive table
|
38 |
+
st.dataframe(df)
|
39 |
+
|
40 |
+
https://medium.com/@avra42/streamlit-python-cool-tricks-to-make-your-web-application-look-better-8abfc3763a5b
|
41 |
+
hide_menu_style = '''
|
42 |
+
<style>
|
43 |
+
#MainMenu {visibility: hidden; }
|
44 |
+
footer {visibility: hidden;}
|
45 |
+
</style>
|
46 |
+
'''
|
47 |
+
st.markdown(hide_menu_style, unsafe_allow_html=True)
|
48 |
+
|
49 |
+
"""
|
50 |
# pylint: disable=invalid-name
|
51 |
import os
|
52 |
+
import sys
|
53 |
+
import time
|
54 |
from pathlib import Path
|
55 |
+
from types import SimpleNamespace
|
56 |
from typing import Optional
|
57 |
|
58 |
+
import loguru
|
59 |
+
import logzero
|
60 |
import pandas as pd
|
|
|
61 |
import streamlit as st
|
62 |
+
from loguru import logger as loggu
|
|
|
|
|
|
|
63 |
from logzero import logger
|
64 |
from set_loglevel import set_loglevel
|
65 |
+
from streamlit import session_state as state
|
66 |
|
67 |
from litbee import __version__, litbee
|
68 |
+
from litbee.options import options
|
69 |
+
|
70 |
+
# from litbee.files2df import files2df
|
71 |
+
# from litbee.utils import sb_front_cover, instructions, menu_items
|
72 |
+
# from litbee.ezbee_page import ezbee_page
|
73 |
+
# from litbee.dzbee_page import dzbee_page
|
74 |
+
# from litbee.xbee_page import xbee_page
|
75 |
+
from litbee.utils import menu_items
|
76 |
+
|
77 |
+
# from ezbee import ezbee
|
78 |
|
79 |
os.environ["TZ"] = "Asia/Shanghai"
|
80 |
+
time.tzset()
|
81 |
+
os.environ["LOGLEVEL"] = "10" # uncomment this in dev
|
82 |
logzero.loglevel(set_loglevel())
|
83 |
|
84 |
+
loggu.remove()
|
85 |
+
_ = (
|
86 |
+
"<green>{time:YY-MM-DD HH:mm:ss}</green> | "
|
87 |
+
"<level>{level: <5}</level> | <level>{message}</level> "
|
88 |
+
"<cyan>{name}</cyan>:<cyan>{line}</cyan>"
|
89 |
+
)
|
90 |
+
loggu.add(
|
91 |
+
sys.stderr,
|
92 |
+
format=_,
|
93 |
+
level=set_loglevel(),
|
94 |
+
colorize=True,
|
95 |
+
)
|
96 |
+
|
97 |
+
# from PIL import Image
|
98 |
+
# page_icon=Image.open("icon.ico"),
|
99 |
st.set_page_config(
|
100 |
page_title=f"litbee v{__version__}",
|
101 |
+
# page_icon="🧊",
|
102 |
+
page_icon="🐝",
|
103 |
+
# layout="wide",
|
104 |
initial_sidebar_state="auto", # "auto" or "expanded" or "collapsed",
|
105 |
menu_items=menu_items,
|
106 |
)
|
|
|
109 |
pd.set_option("display.precision", 2)
|
110 |
pd.options.display.float_format = "{:,.2f}".format
|
111 |
|
112 |
+
_ = dict(
|
113 |
+
beetype="ezbee",
|
114 |
+
src_filename="",
|
115 |
+
tgt_filename="",
|
116 |
+
src_fileio=b"",
|
117 |
+
tgt_fileio=b"",
|
118 |
+
src_file="",
|
119 |
+
tgt_file="",
|
120 |
+
list1=[""],
|
121 |
+
list2=[""],
|
122 |
+
df=None,
|
123 |
+
df_a=None,
|
124 |
+
df_s_a=None,
|
125 |
+
)
|
126 |
if "ns" not in state:
|
127 |
+
state.ns = SimpleNamespace(**_)
|
128 |
+
state.ns.list = [*_]
|
129 |
|
130 |
|
131 |
def main():
|
132 |
+
"""Bootstrap."""
|
133 |
+
options()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
|
136 |
main()
|
config.toml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[theme]
|
2 |
+
primaryColor="#2214c7"
|
3 |
+
backgroundColor="#ffffff"
|
4 |
+
secondaryBackgroundColor="#e8eef9"
|
5 |
+
textColor="#000000"
|
6 |
+
font="sans serif"
|
data/en - Copy.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[Young Warrior] Kingold(...) 2021-12-30 22:27:37
|
2 |
+
It seems that the standalone version can
|
3 |
+
omit the GUI and specify the two files to be aligned directly on the command line.
|
4 |
+
|
5 |
+
|
6 |
+
But if it's not the GUI module that's taking up space, then
|
7 |
+
removing it won't help compress the size of the whole package.
|
8 |
+
|
data/zh - Copy.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
【少侠】Kingold(...) 2021-12-30 22:27:37
|
2 |
+
单机版貌似可以省略掉图形界面,直接
|
3 |
+
命令行指定两个待对齐文件。
|
4 |
+
|
5 |
+
不过如果占地方的
|
6 |
+
|
7 |
+
不是图形界面的模块,那去掉了也对压缩整个包的大小没帮助。
|
litbee/__main__.py
CHANGED
@@ -2,15 +2,14 @@
|
|
2 |
# pylint: disable=invalid-name
|
3 |
import os
|
4 |
from pathlib import Path
|
5 |
-
from typing import Optional
|
6 |
-
|
7 |
-
import streamlit as st
|
8 |
-
from streamlit import session_state as state
|
9 |
from types import SimpleNamespace
|
|
|
10 |
|
11 |
import logzero
|
|
|
12 |
from logzero import logger
|
13 |
from set_loglevel import set_loglevel
|
|
|
14 |
|
15 |
from litbee import __version__, litbee
|
16 |
from litbee.files2df import files2df
|
@@ -22,6 +21,7 @@ logzero.loglevel(set_loglevel())
|
|
22 |
if "ns" not in state:
|
23 |
state.ns = SimpleNamespace()
|
24 |
|
|
|
25 |
def main():
|
26 |
logger.debug("state: %s", state)
|
27 |
|
@@ -29,4 +29,5 @@ def main():
|
|
29 |
state.ns.df = df
|
30 |
logger.debug("state: %s", state)
|
31 |
|
|
|
32 |
main()
|
|
|
2 |
# pylint: disable=invalid-name
|
3 |
import os
|
4 |
from pathlib import Path
|
|
|
|
|
|
|
|
|
5 |
from types import SimpleNamespace
|
6 |
+
from typing import Optional
|
7 |
|
8 |
import logzero
|
9 |
+
import streamlit as st
|
10 |
from logzero import logger
|
11 |
from set_loglevel import set_loglevel
|
12 |
+
from streamlit import session_state as state
|
13 |
|
14 |
from litbee import __version__, litbee
|
15 |
from litbee.files2df import files2df
|
|
|
21 |
if "ns" not in state:
|
22 |
state.ns = SimpleNamespace()
|
23 |
|
24 |
+
|
25 |
def main():
|
26 |
logger.debug("state: %s", state)
|
27 |
|
|
|
29 |
state.ns.df = df
|
30 |
logger.debug("state: %s", state)
|
31 |
|
32 |
+
|
33 |
main()
|
litbee/dzbee_page.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
"""Display dzbee page."""
|
2 |
-
import streamlit as st
|
3 |
import pandas as pd
|
|
|
|
|
|
|
4 |
|
5 |
|
6 |
def dzbee_page():
|
@@ -14,4 +16,5 @@ def dzbee_page():
|
|
14 |
logger.error(exc)
|
15 |
df = pd.DataFrame([[""]])
|
16 |
|
|
|
17 |
st.table(df)
|
|
|
1 |
"""Display dzbee page."""
|
|
|
2 |
import pandas as pd
|
3 |
+
import streamlit as st
|
4 |
+
from loguru import logger as loggu
|
5 |
+
from logzero import logger
|
6 |
|
7 |
|
8 |
def dzbee_page():
|
|
|
16 |
logger.error(exc)
|
17 |
df = pd.DataFrame([[""]])
|
18 |
|
19 |
+
loggu.debug(" df ")
|
20 |
st.table(df)
|
litbee/ezbee_page.py
CHANGED
@@ -1,9 +1,32 @@
|
|
1 |
"""Display ezbee page."""
|
2 |
-
|
3 |
-
import pandas as pd
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
from st_aggrid import AgGrid
|
6 |
from st_aggrid.grid_options_builder import GridOptionsBuilder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
def ezbee_page():
|
@@ -12,11 +35,13 @@ def ezbee_page():
|
|
12 |
# st.write('### ezbee')
|
13 |
# st.write('Welcome to app1')
|
14 |
|
|
|
15 |
try:
|
16 |
df = st.session_state.ns.df
|
17 |
except Exception as exc:
|
18 |
logger.error(exc)
|
19 |
df = pd.DataFrame([[""]])
|
|
|
20 |
|
21 |
# st.table(df) # looks alright
|
22 |
|
@@ -24,19 +49,14 @@ def ezbee_page():
|
|
24 |
# bigger, no pagination
|
25 |
# st.markdown(df.to_html(), unsafe_allow_html=True)
|
26 |
|
27 |
-
gb = GridOptionsBuilder.from_dataframe(df)
|
28 |
-
gb.configure_pagination()
|
29 |
-
options = {
|
30 |
-
"resizable": True,
|
31 |
-
"autoHeight": True,
|
32 |
-
"wrapText": True,
|
33 |
-
"editable": True,
|
34 |
-
}
|
35 |
-
gb.configure_default_column(**options)
|
36 |
-
gridOptions = gb.build()
|
37 |
-
|
38 |
# ag_grid smallish, editable, probably slower
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
df_exp = st.expander("to be aligned", expanded=False)
|
41 |
with df_exp:
|
42 |
st.write(df) # too small
|
@@ -53,11 +73,57 @@ def ezbee_page():
|
|
53 |
)
|
54 |
# """
|
55 |
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
agdf = AgGrid(
|
58 |
-
df,
|
59 |
-
|
60 |
-
editable=True,
|
61 |
gridOptions=gridOptions,
|
62 |
-
key="outside"
|
63 |
-
|
|
|
|
|
|
|
|
|
|
1 |
"""Display ezbee page."""
|
2 |
+
from functools import partial
|
|
|
3 |
|
4 |
+
import logzero
|
5 |
+
import pandas as pd
|
6 |
+
import streamlit as st
|
7 |
+
from ezbee import ezbee
|
8 |
+
from ezbee.gen_pairs import gen_pairs
|
9 |
+
from loguru import logger as loggu
|
10 |
+
from logzero import logger
|
11 |
+
from set_loglevel import set_loglevel
|
12 |
from st_aggrid import AgGrid
|
13 |
from st_aggrid.grid_options_builder import GridOptionsBuilder
|
14 |
+
from streamlit import session_state as state
|
15 |
+
|
16 |
+
logzero.loglevel(set_loglevel())
|
17 |
+
|
18 |
+
|
19 |
+
def st_radio_horizontal(*args, **kwargs):
|
20 |
+
"""Trick to have horizontal st radio to simulate tabs."""
|
21 |
+
col, _ = st.columns(2)
|
22 |
+
with col:
|
23 |
+
# st.write('<style> div[data-testid=column] > div > div > div > div.stRadio > div{flex-direction: row;}</style>', unsafe_allow_html=True)
|
24 |
+
# return st.radio(*args, **kwargs)
|
25 |
+
st.write(
|
26 |
+
"<style> div[data-testid=stSidebar] > div > div > div > div > div > div > div.stRadio > div{flex-direction: row;}</style>",
|
27 |
+
unsafe_allow_html=True,
|
28 |
+
)
|
29 |
+
return st.sidebar.radio(*args, **kwargs)
|
30 |
|
31 |
|
32 |
def ezbee_page():
|
|
|
35 |
# st.write('### ezbee')
|
36 |
# st.write('Welcome to app1')
|
37 |
|
38 |
+
_ = """
|
39 |
try:
|
40 |
df = st.session_state.ns.df
|
41 |
except Exception as exc:
|
42 |
logger.error(exc)
|
43 |
df = pd.DataFrame([[""]])
|
44 |
+
# """
|
45 |
|
46 |
# st.table(df) # looks alright
|
47 |
|
|
|
49 |
# bigger, no pagination
|
50 |
# st.markdown(df.to_html(), unsafe_allow_html=True)
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
# ag_grid smallish, editable, probably slower
|
53 |
|
54 |
+
if "df" not in globals():
|
55 |
+
logger.debug(" df not defined, return")
|
56 |
+
return None
|
57 |
+
|
58 |
+
df = pd.DataFrame([["", "", ""]], columns=["text1", "text2", "llh"])
|
59 |
+
|
60 |
df_exp = st.expander("to be aligned", expanded=False)
|
61 |
with df_exp:
|
62 |
st.write(df) # too small
|
|
|
73 |
)
|
74 |
# """
|
75 |
|
76 |
+
list1 = [elm.strip() for elm in df.text1 if elm.strip()]
|
77 |
+
list2 = [elm.strip() for elm in df.text2 if elm.strip()]
|
78 |
+
logger.info("Processing data...")
|
79 |
+
try:
|
80 |
+
aset = ezbee(
|
81 |
+
list1,
|
82 |
+
list2,
|
83 |
+
# eps=eps,
|
84 |
+
# min_samples=min_samples,
|
85 |
+
)
|
86 |
+
except Exception as e:
|
87 |
+
logger.error("aset = ezbee(...) exc: %s", e)
|
88 |
+
aset = ""
|
89 |
+
return None
|
90 |
+
|
91 |
+
# fastlid changed logger.level is changed to 20
|
92 |
+
# turn back to loglevel
|
93 |
+
logzero.loglevel(set_loglevel())
|
94 |
+
if aset:
|
95 |
+
logger.debug("aset: %s...%s", aset[:3], aset[-3:])
|
96 |
+
|
97 |
+
# st.write(aset)
|
98 |
+
|
99 |
+
aligned_pairs = gen_pairs(list1, list2, aset)
|
100 |
+
if aligned_pairs:
|
101 |
+
logger.debug("%s...%s", aligned_pairs[:3], aligned_pairs[-3:])
|
102 |
+
|
103 |
+
df_a = pd.DataFrame(aligned_pairs, columns=["text1", "text2", "llh"])
|
104 |
+
|
105 |
+
# insert seq no
|
106 |
+
df_a.insert(0, "sn", range(len(df_a)))
|
107 |
+
|
108 |
+
gb = GridOptionsBuilder.from_dataframe(df_a)
|
109 |
+
gb.configure_pagination(paginationAutoPageSize=True)
|
110 |
+
options = {
|
111 |
+
"resizable": True,
|
112 |
+
"autoHeight": True,
|
113 |
+
"wrapText": True,
|
114 |
+
"editable": True,
|
115 |
+
}
|
116 |
+
gb.configure_default_column(**options)
|
117 |
+
gridOptions = gb.build()
|
118 |
+
|
119 |
+
st.write("aligned (double-click a cell to edit)")
|
120 |
agdf = AgGrid(
|
121 |
+
# df,
|
122 |
+
df_a,
|
|
|
123 |
gridOptions=gridOptions,
|
124 |
+
key="outside",
|
125 |
+
editable=True,
|
126 |
+
width="100%",
|
127 |
+
height=500,
|
128 |
+
# fit_columns_on_grid_load=True,
|
129 |
+
)
|
litbee/fetch_paste.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Display from paste."""
|
2 |
+
import pandas as pd
|
3 |
+
import streamlit as st
|
4 |
+
from logzero import logger
|
5 |
+
|
6 |
+
|
7 |
+
def fetch_paste():
|
8 |
+
"""Display from paste."""
|
9 |
+
st.write("Coming soon")
|
litbee/fetch_upload.py
ADDED
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Fetch content from upload.
|
2 |
+
|
3 |
+
org ezbee_page.py.
|
4 |
+
"""
|
5 |
+
from functools import partial
|
6 |
+
from itertools import zip_longest
|
7 |
+
|
8 |
+
import logzero
|
9 |
+
import pandas as pd
|
10 |
+
import streamlit as st
|
11 |
+
from ezbee import ezbee
|
12 |
+
from dzbee import dzbee
|
13 |
+
from ezbee.gen_pairs import gen_pairs # aset2pairs?
|
14 |
+
from loguru import logger as loggu
|
15 |
+
from logzero import logger
|
16 |
+
from set_loglevel import set_loglevel
|
17 |
+
from st_aggrid import AgGrid
|
18 |
+
from st_aggrid.grid_options_builder import GridOptionsBuilder
|
19 |
+
from streamlit import session_state as state
|
20 |
+
|
21 |
+
logzero.loglevel(set_loglevel())
|
22 |
+
|
23 |
+
|
24 |
+
def fetch_upload():
|
25 |
+
"""Fetch content from upload."""
|
26 |
+
|
27 |
+
# src_fileio tgt_fileio
|
28 |
+
sb_pick_files = st.sidebar.expander("Pick two files", expanded=True)
|
29 |
+
with sb_pick_files:
|
30 |
+
src_fileio = st.file_uploader(
|
31 |
+
"Choose source file (utf8 txt)",
|
32 |
+
type=[
|
33 |
+
"txt",
|
34 |
+
],
|
35 |
+
key="src_text",
|
36 |
+
# accept_multiple_files=True,
|
37 |
+
# accept_multiple_files=False,
|
38 |
+
)
|
39 |
+
|
40 |
+
tgt_fileio = st.file_uploader(
|
41 |
+
"Choose target file (utf8 txt)",
|
42 |
+
type=[
|
43 |
+
"txt",
|
44 |
+
],
|
45 |
+
key="tgt_text",
|
46 |
+
# accept_multiple_files=True,
|
47 |
+
)
|
48 |
+
|
49 |
+
# logger.debug(" len(src_fileio): %s", len(src_fileio))
|
50 |
+
# logger.debug(" len(tgt_fileio): %s", len(tgt_fileio))
|
51 |
+
|
52 |
+
if src_fileio:
|
53 |
+
logger.debug(" type(src_fileio): %s", type(src_fileio))
|
54 |
+
if isinstance(src_fileio, list):
|
55 |
+
logger.debug(" len(src_fileio): %s", len(src_fileio))
|
56 |
+
logger.debug("src_fileio[-1].name: [%s]", src_fileio[-1].name)
|
57 |
+
filenames = [elm.name for elm in src_fileio]
|
58 |
+
logger.debug("src_fileio names: %s", filenames)
|
59 |
+
|
60 |
+
# state.ns.src_fileio = src_fileio
|
61 |
+
state.ns.src_file = src_fileio[-1].getvalue().decode()
|
62 |
+
state.ns.src_filename = src_fileio[-1].name
|
63 |
+
else:
|
64 |
+
logger.debug("src_fileio.name: [%s]", src_fileio.name)
|
65 |
+
filenames = [src_fileio.name]
|
66 |
+
logger.debug("src_fileio names: %s", filenames)
|
67 |
+
|
68 |
+
# state.ns.src_fileio = src_fileio
|
69 |
+
state.ns.src_file = src_fileio.getvalue().decode()
|
70 |
+
state.ns.src_filename = src_fileio.name
|
71 |
+
|
72 |
+
if tgt_fileio:
|
73 |
+
if isinstance(tgt_fileio, list):
|
74 |
+
logger.warning("not set to handle multiple files")
|
75 |
+
logger.warning("set accept_multiple_files=False in the meantime")
|
76 |
+
else:
|
77 |
+
state.ns.tgt_file = tgt_fileio.getvalue().decode()
|
78 |
+
state.ns.tgt_filename = tgt_fileio.name
|
79 |
+
|
80 |
+
try:
|
81 |
+
_ = state.ns.src_file.splitlines()
|
82 |
+
list1 = [elm.strip() for elm in _ if elm.strip()]
|
83 |
+
_ = state.ns.tgt_file.splitlines()
|
84 |
+
list2 = [elm.strip() for elm in _ if elm.strip()]
|
85 |
+
except Exception as exc:
|
86 |
+
logger.error(exc)
|
87 |
+
list1 = [""]
|
88 |
+
list2 = [""]
|
89 |
+
state.ns.list1 = list1[:]
|
90 |
+
state.ns.list2 = list2[:]
|
91 |
+
|
92 |
+
df = pd.DataFrame(zip_longest(list1, list2, fillvalue=""))
|
93 |
+
try:
|
94 |
+
df.columns = ["text1", "text2"]
|
95 |
+
except Exception as exc:
|
96 |
+
logger.debug("df: \n%s", df)
|
97 |
+
logger.error("%s", exc)
|
98 |
+
|
99 |
+
state.ns.df = df
|
100 |
+
logger.debug("df: %s", df)
|
101 |
+
|
102 |
+
# st.table(df) # looks alright
|
103 |
+
|
104 |
+
# stlyed pd dataframe?
|
105 |
+
# bigger, no pagination
|
106 |
+
# st.markdown(df.to_html(), unsafe_allow_html=True)
|
107 |
+
|
108 |
+
# ag_grid smallish, editable, probably slower
|
109 |
+
|
110 |
+
# if "df" not in globals() or "df" not in locals():
|
111 |
+
if "df" not in locals():
|
112 |
+
logger.debug(" df not defined, return")
|
113 |
+
|
114 |
+
if df.empty:
|
115 |
+
logger.debug(" df.empty, return")
|
116 |
+
return None
|
117 |
+
|
118 |
+
# df = pd.DataFrame([["", "", ""]], columns=["text1", "text2", "llh"])
|
119 |
+
|
120 |
+
df_exp = st.expander("to be aligned", expanded=False)
|
121 |
+
with df_exp:
|
122 |
+
st.write(df) # too small
|
123 |
+
|
124 |
+
_ = """
|
125 |
+
ag_exp = st.expander("done aligned") # , expanded=False
|
126 |
+
with ag_exp:
|
127 |
+
agdf = AgGrid(
|
128 |
+
df,
|
129 |
+
# fit_columns_on_grid_load=True,
|
130 |
+
editable=True,
|
131 |
+
gridOptions=gridOptions,
|
132 |
+
key="ag_exp",
|
133 |
+
)
|
134 |
+
# """
|
135 |
+
|
136 |
+
list1 = [elm.strip() for elm in df.text1 if elm.strip()]
|
137 |
+
list2 = [elm.strip() for elm in df.text2 if elm.strip()]
|
138 |
+
logger.info("Processing data...")
|
139 |
+
if state.ns.beetype in ["ezbee", "dzbee"]:
|
140 |
+
try:
|
141 |
+
# aset = ezbee(
|
142 |
+
aset = globals()[state.ns.beetype](
|
143 |
+
list1,
|
144 |
+
list2,
|
145 |
+
# eps=eps,
|
146 |
+
# min_samples=min_samples,
|
147 |
+
)
|
148 |
+
except Exception as e:
|
149 |
+
logger.error("aset = ezbee(...) exc: %s", e)
|
150 |
+
aset = ""
|
151 |
+
# st.write(e)
|
152 |
+
st.write("Collecting inputs...")
|
153 |
+
return None
|
154 |
+
else:
|
155 |
+
st.write(f"{state.ns.beetype} coming soon...")
|
156 |
+
return None
|
157 |
+
|
158 |
+
# fastlid changed logger.level is changed to 20
|
159 |
+
# turn back to loglevel
|
160 |
+
logzero.loglevel(set_loglevel())
|
161 |
+
if aset:
|
162 |
+
logger.debug("aset: %s...%s", aset[:3], aset[-3:])
|
163 |
+
# logger.debug("aset[:10]: %s", aset[:10])
|
164 |
+
|
165 |
+
# st.write(aset)
|
166 |
+
|
167 |
+
aligned_pairs = gen_pairs(list1, list2, aset)
|
168 |
+
if aligned_pairs:
|
169 |
+
logger.debug("%s...%s", aligned_pairs[:3], aligned_pairs[-3:])
|
170 |
+
# logger.debug("aligned_pairs[:20]: \n%s", aligned_pairs[:20])
|
171 |
+
|
172 |
+
df_a = pd.DataFrame(aligned_pairs, columns=["text1", "text2", "llh"])
|
173 |
+
|
174 |
+
# insert seq no
|
175 |
+
df_a.insert(0, "sn", range(len(df_a)))
|
176 |
+
|
177 |
+
gb = GridOptionsBuilder.from_dataframe(df_a)
|
178 |
+
gb.configure_pagination(paginationAutoPageSize=True)
|
179 |
+
options = {
|
180 |
+
"resizable": True,
|
181 |
+
"autoHeight": True,
|
182 |
+
"wrapText": True,
|
183 |
+
"editable": True,
|
184 |
+
}
|
185 |
+
gb.configure_default_column(**options)
|
186 |
+
gridOptions = gb.build()
|
187 |
+
|
188 |
+
st.write("aligned (double-click a cell to edit, drag column header to adjust widths)")
|
189 |
+
agdf = AgGrid(
|
190 |
+
# df,
|
191 |
+
df_a,
|
192 |
+
gridOptions=gridOptions,
|
193 |
+
key="outside",
|
194 |
+
editable=True,
|
195 |
+
# width="100%", # width parameter is deprecated
|
196 |
+
height=500,
|
197 |
+
# fit_columns_on_grid_load=True,
|
198 |
+
)
|
litbee/fetch_urls.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Fetch from urls."""
|
2 |
+
import pandas as pd
|
3 |
+
import streamlit as st
|
4 |
+
from logzero import logger
|
5 |
+
|
6 |
+
|
7 |
+
def fetch_urls():
|
8 |
+
"""Display from urls."""
|
9 |
+
st.write("Coming soon")
|
litbee/files2df.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
"""Convert two iesl to pandas.DataFrame."""
|
2 |
# pylint: disable=invalid-name
|
3 |
|
4 |
-
from itertools import zip_longest
|
5 |
import tempfile
|
|
|
|
|
6 |
import pandas as pd
|
|
|
7 |
from litbee.process_upload import process_upload
|
8 |
|
9 |
|
|
|
1 |
"""Convert two iesl to pandas.DataFrame."""
|
2 |
# pylint: disable=invalid-name
|
3 |
|
|
|
4 |
import tempfile
|
5 |
+
from itertools import zip_longest
|
6 |
+
|
7 |
import pandas as pd
|
8 |
+
|
9 |
from litbee.process_upload import process_upload
|
10 |
|
11 |
|
litbee/options.py
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Load content."""
|
2 |
+
# pylint: disable=invalid-name
|
3 |
+
from functools import partial
|
4 |
+
|
5 |
+
import streamlit as st
|
6 |
+
from loguru import logger as loggu
|
7 |
+
from logzero import logger
|
8 |
+
from streamlit import session_state as state
|
9 |
+
|
10 |
+
from litbee.fetch_paste import fetch_paste
|
11 |
+
|
12 |
+
# from litbee.ezbee_page import ezbee_page
|
13 |
+
# from litbee.dzbee_page import dzbee_page
|
14 |
+
# from litbee.xbee_page import xbee_page
|
15 |
+
from litbee.fetch_upload import fetch_upload
|
16 |
+
from litbee.fetch_urls import fetch_urls
|
17 |
+
from litbee.files2df import files2df
|
18 |
+
from litbee.utils import instructions, sb_front_cover
|
19 |
+
|
20 |
+
|
21 |
+
def options():
|
22 |
+
"""Load content."""
|
23 |
+
sb_front_cover()
|
24 |
+
|
25 |
+
try:
|
26 |
+
_ = state.ns.df
|
27 |
+
state.ns.count += 1
|
28 |
+
logger.debug(" run: %s", state.ns.count)
|
29 |
+
except AttributeError:
|
30 |
+
logger.debug("first run")
|
31 |
+
# df = files2df("data/en.txt", "data/zh.txt")
|
32 |
+
df = files2df("data/test_en.txt", "data/test_zh.txt")
|
33 |
+
state.ns.count = 1
|
34 |
+
state.ns.df = df
|
35 |
+
|
36 |
+
# horizonral radio
|
37 |
+
st.sidebar.write(
|
38 |
+
"<style>div.row-widget.stRadio > div{flex-direction:row;}</style>",
|
39 |
+
unsafe_allow_html=True,
|
40 |
+
)
|
41 |
+
|
42 |
+
beetype_list = ["ezbee", "dzbee", "xbee"]
|
43 |
+
|
44 |
+
col1, col2 = st.columns(2)
|
45 |
+
|
46 |
+
with col1:
|
47 |
+
beetype = st.sidebar.radio("Pick a bee", beetype_list)
|
48 |
+
state.ns.beetype = beetype
|
49 |
+
|
50 |
+
if beetype not in ["ezbee", "dzbee"]:
|
51 |
+
st.write("Coming soon")
|
52 |
+
return None
|
53 |
+
|
54 |
+
# multi-page setup
|
55 |
+
menu = {
|
56 |
+
"upload": fetch_upload,
|
57 |
+
"paste": fetch_paste,
|
58 |
+
"urls": fetch_urls,
|
59 |
+
}
|
60 |
+
|
61 |
+
with col2:
|
62 |
+
source = st.sidebar.radio("Source", [*menu])
|
63 |
+
|
64 |
+
# item = menu[source]
|
65 |
+
# item()
|
66 |
+
|
67 |
+
menu[source]()
|
68 |
+
|
69 |
+
# if hasattr(state.ns, "df"): delattr(state.ns, "df")
|
70 |
+
|
71 |
+
# logger.debug(" state.ns: %s", state.ns)
|
72 |
+
|
73 |
+
# show state.ns[:6]
|
74 |
+
loggu.debug(f" state.ns.list: {state.ns.list}")
|
75 |
+
|
76 |
+
_ = map(partial(getattr, state.ns), state.ns.list[:3])
|
77 |
+
logger.debug(" state.ns.list[:3]: %s", str([*_]))
|
78 |
+
|
79 |
+
st.write(f"run: {state.ns.count}")
|
80 |
+
loggu.debug(f"run: {state.ns.count}")
|
81 |
+
|
82 |
+
fileio_slot = st.empty()
|
litbee/process_upload.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
"""Process uploads."""
|
2 |
# pylint: disable=invalid-name, unused-import
|
|
|
|
|
3 |
from typing import Union
|
4 |
|
5 |
-
from pathlib import Path
|
6 |
-
import tempfile
|
7 |
import cchardet
|
8 |
from logzero import logger
|
9 |
|
@@ -37,7 +37,7 @@ def process_upload(upload: Union[str, tempfile._TemporaryFileWrapper, bytes]) ->
|
|
37 |
]
|
38 |
# check .txt .md ''(no suffix)
|
39 |
if fpath.suffix.lower() not in suffixes:
|
40 |
-
logger.warning(
|
41 |
# return "File type not supported, yet."
|
42 |
|
43 |
try:
|
@@ -76,29 +76,3 @@ def process_upload(upload: Union[str, tempfile._TemporaryFileWrapper, bytes]) ->
|
|
76 |
logger.warning("%s", msg)
|
77 |
|
78 |
return msg
|
79 |
-
|
80 |
-
|
81 |
-
_ = ''' # colab gradio-file-inputs-upload.ipynb
|
82 |
-
# file_to_text/process_file
|
83 |
-
def zip_to_text(file_obj):
|
84 |
-
"""
|
85 |
-
# zf = zipfile.ZipFile('german-recipes-dataset.zip')
|
86 |
-
zf = file_obj
|
87 |
-
namelist = zipfile.ZipFile.namelist(zf);
|
88 |
-
# filename = zf.open(namelist[0]);
|
89 |
-
file_contents = []
|
90 |
-
for filename in namelist:
|
91 |
-
with zf.open(filename) as fhandle:
|
92 |
-
file_contents.append(fhandle.read().decode())
|
93 |
-
"""
|
94 |
-
# fileobj is <class 'tempfile._TemporaryFileWrapper'>
|
95 |
-
|
96 |
-
# gr.inputs.File("bytes")
|
97 |
-
if isinstance(file_obj, bytes):
|
98 |
-
data = file_obj.decode()
|
99 |
-
return f"{type(file_obj)}\n{dir(file_obj)}\n{data}"
|
100 |
-
|
101 |
-
# "file"/gr.inputs.File("file") file_obj.name: /tmp/READMEzm8hc5ze.md
|
102 |
-
data = Path(file_obj.name).read_bytes()
|
103 |
-
return f"{file_obj.name} {type(file_obj)}\n{dir(file_obj)} \n{data}"
|
104 |
-
# '''
|
|
|
1 |
"""Process uploads."""
|
2 |
# pylint: disable=invalid-name, unused-import
|
3 |
+
import tempfile
|
4 |
+
from pathlib import Path
|
5 |
from typing import Union
|
6 |
|
|
|
|
|
7 |
import cchardet
|
8 |
from logzero import logger
|
9 |
|
|
|
37 |
]
|
38 |
# check .txt .md ''(no suffix)
|
39 |
if fpath.suffix.lower() not in suffixes:
|
40 |
+
logger.warning("suffix: [%s] not in %s", fpath.suffix, suffixes)
|
41 |
# return "File type not supported, yet."
|
42 |
|
43 |
try:
|
|
|
76 |
logger.warning("%s", msg)
|
77 |
|
78 |
return msg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
litbee/utils.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
"""Prep front cover for sidebar (based on st-bumblebee-st_app.py)."""
|
2 |
-
import streamlit as st
|
3 |
from textwrap import dedent
|
|
|
4 |
import logzero
|
|
|
5 |
from logzero import logger
|
6 |
from set_loglevel import set_loglevel
|
7 |
|
@@ -9,7 +10,8 @@ from litbee import __version__
|
|
9 |
|
10 |
logzero.loglevel(set_loglevel())
|
11 |
|
12 |
-
msg = dedent(
|
|
|
13 |
What would you like to do?
|
14 |
The following alignment engines are available.
|
15 |
|
@@ -22,7 +24,8 @@ msg = dedent("""
|
|
22 |
**DL-Engin**: based on machine learning, multilingual, one para/sent takes about 1s.
|
23 |
"""
|
24 |
).strip()
|
25 |
-
msg = dedent(
|
|
|
26 |
* ezbee: english-chinese, fast para-align
|
27 |
|
28 |
* dzbee: german-chinese, fast para-align
|
@@ -46,7 +49,8 @@ def sb_front_cover():
|
|
46 |
st.markdown(msg)
|
47 |
|
48 |
|
49 |
-
intructins = dedent(
|
|
|
50 |
* Set up options in the left sidebar
|
51 |
|
52 |
* Click expanders / +: to reveal more details; -: to hide them
|
@@ -67,7 +71,8 @@ def instructions():
|
|
67 |
logger.debug("instructions exit")
|
68 |
|
69 |
|
70 |
-
about = dedent(
|
|
|
71 |
# litbee {__version__}
|
72 |
|
73 |
https://bumblebee.freeforums.net/thread/5/litbee or head to 桃花元 (qq group 316287378)
|
@@ -75,7 +80,7 @@ about = dedent(f"""
|
|
75 |
).strip()
|
76 |
|
77 |
menu_items = {
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
}
|
|
|
1 |
"""Prep front cover for sidebar (based on st-bumblebee-st_app.py)."""
|
|
|
2 |
from textwrap import dedent
|
3 |
+
|
4 |
import logzero
|
5 |
+
import streamlit as st
|
6 |
from logzero import logger
|
7 |
from set_loglevel import set_loglevel
|
8 |
|
|
|
10 |
|
11 |
logzero.loglevel(set_loglevel())
|
12 |
|
13 |
+
msg = dedent(
|
14 |
+
"""
|
15 |
What would you like to do?
|
16 |
The following alignment engines are available.
|
17 |
|
|
|
24 |
**DL-Engin**: based on machine learning, multilingual, one para/sent takes about 1s.
|
25 |
"""
|
26 |
).strip()
|
27 |
+
msg = dedent(
|
28 |
+
"""
|
29 |
* ezbee: english-chinese, fast para-align
|
30 |
|
31 |
* dzbee: german-chinese, fast para-align
|
|
|
49 |
st.markdown(msg)
|
50 |
|
51 |
|
52 |
+
intructins = dedent(
|
53 |
+
f"""
|
54 |
* Set up options in the left sidebar
|
55 |
|
56 |
* Click expanders / +: to reveal more details; -: to hide them
|
|
|
71 |
logger.debug("instructions exit")
|
72 |
|
73 |
|
74 |
+
about = dedent(
|
75 |
+
f"""
|
76 |
# litbee {__version__}
|
77 |
|
78 |
https://bumblebee.freeforums.net/thread/5/litbee or head to 桃花元 (qq group 316287378)
|
|
|
80 |
).strip()
|
81 |
|
82 |
menu_items = {
|
83 |
+
"Get Help": "https://bumblebee.freeforums.net/thread/5/litbee",
|
84 |
+
"Report a bug": "https://github.com/ffreemt/litbee/issues",
|
85 |
+
"About": about,
|
86 |
+
}
|
litbee/xbee_page.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
"""Display xbee page."""
|
2 |
-
import streamlit as st
|
3 |
import pandas as pd
|
|
|
|
|
4 |
|
5 |
|
6 |
def xbee_page():
|
7 |
"""Display xbee page."""
|
8 |
# st.title('dzbee')
|
9 |
-
st.write(
|
10 |
|
11 |
try:
|
12 |
df = st.session_state.ns.df
|
|
|
1 |
"""Display xbee page."""
|
|
|
2 |
import pandas as pd
|
3 |
+
import streamlit as st
|
4 |
+
from logzero import logger
|
5 |
|
6 |
|
7 |
def xbee_page():
|
8 |
"""Display xbee page."""
|
9 |
# st.title('dzbee')
|
10 |
+
st.write("Coming soon")
|
11 |
|
12 |
try:
|
13 |
df = st.session_state.ns.df
|
main_example.py
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Prep __main__.py.
|
2 |
+
|
3 |
+
https://share.streamlit.io/deploy
|
4 |
+
Advanced settings...
|
5 |
+
Python version
|
6 |
+
3.7
|
7 |
+
3.8
|
8 |
+
3.9*
|
9 |
+
3.10
|
10 |
+
|
11 |
+
https://docs.streamlit.io/knowledge-base/using-streamlit/hide-row-indices-displaying-dataframe
|
12 |
+
Hide row indices when displaying a dataframe
|
13 |
+
# CSS to inject contained in a string
|
14 |
+
hide_table_row_index = '''
|
15 |
+
<style>
|
16 |
+
tbody th {display:none}
|
17 |
+
.blank {display:none}
|
18 |
+
</style>
|
19 |
+
'''
|
20 |
+
# Inject CSS with Markdown
|
21 |
+
st.markdown(hide_table_row_index, unsafe_allow_html=True)
|
22 |
+
|
23 |
+
# Display a static table
|
24 |
+
st.table(df)
|
25 |
+
|
26 |
+
# Hide row indices with st.dataframe
|
27 |
+
# CSS to inject contained in a string
|
28 |
+
hide_dataframe_row_index = '''
|
29 |
+
<style>
|
30 |
+
.row_heading.level0 {display:none}
|
31 |
+
.blank {display:none}
|
32 |
+
</style>
|
33 |
+
'''
|
34 |
+
# Inject CSS with Markdown
|
35 |
+
st.markdown(hide_dataframe_row_index, unsafe_allow_html=True)
|
36 |
+
|
37 |
+
# Display an interactive table
|
38 |
+
st.dataframe(df)
|
39 |
+
|
40 |
+
https://medium.com/@avra42/streamlit-python-cool-tricks-to-make-your-web-application-look-better-8abfc3763a5b
|
41 |
+
hide_menu_style = '''
|
42 |
+
<style>
|
43 |
+
#MainMenu {visibility: hidden; }
|
44 |
+
footer {visibility: hidden;}
|
45 |
+
</style>
|
46 |
+
'''
|
47 |
+
st.markdown(hide_menu_style, unsafe_allow_html=True)
|
48 |
+
|
49 |
+
"""
|
50 |
+
# pylint: disable=invalid-name
|
51 |
+
import os
|
52 |
+
import sys
|
53 |
+
from pathlib import Path
|
54 |
+
from types import SimpleNamespace
|
55 |
+
from typing import Optional
|
56 |
+
|
57 |
+
import loguru
|
58 |
+
import logzero
|
59 |
+
import pandas as pd
|
60 |
+
import streamlit as st
|
61 |
+
from loguru import logger as loggu
|
62 |
+
from logzero import logger
|
63 |
+
from set_loglevel import set_loglevel
|
64 |
+
from streamlit import session_state as state
|
65 |
+
|
66 |
+
from litbee import __version__, litbee
|
67 |
+
from litbee.options import options
|
68 |
+
|
69 |
+
# from litbee.files2df import files2df
|
70 |
+
# from litbee.utils import sb_front_cover, instructions, menu_items
|
71 |
+
# from litbee.ezbee_page import ezbee_page
|
72 |
+
# from litbee.dzbee_page import dzbee_page
|
73 |
+
# from litbee.xbee_page import xbee_page
|
74 |
+
from litbee.utils import menu_items
|
75 |
+
|
76 |
+
# from ezbee import ezbee
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
os.environ["TZ"] = "Asia/Shanghai"
|
81 |
+
os.environ["LOGLEVEL"] = "10" # uncomment this in dev
|
82 |
+
logzero.loglevel(set_loglevel())
|
83 |
+
|
84 |
+
loggu.remove()
|
85 |
+
_ = (
|
86 |
+
"<green>{time:YY-MM-DD HH:mm:ss}</green> | "
|
87 |
+
"<level>{level: <5}</level> | <level>{message}</level> "
|
88 |
+
"<cyan>{name}</cyan>:<cyan>{line}</cyan>"
|
89 |
+
)
|
90 |
+
loggu.add(
|
91 |
+
sys.stderr,
|
92 |
+
format=_,
|
93 |
+
level=set_loglevel(),
|
94 |
+
colorize=True,
|
95 |
+
)
|
96 |
+
|
97 |
+
# from PIL import Image
|
98 |
+
# page_icon=Image.open("icon.ico"),
|
99 |
+
st.set_page_config(
|
100 |
+
page_title=f"litbee v{__version__}",
|
101 |
+
# page_icon="🧊",
|
102 |
+
page_icon="🐝",
|
103 |
+
# layout="wide",
|
104 |
+
initial_sidebar_state="auto", # "auto" or "expanded" or "collapsed",
|
105 |
+
menu_items=menu_items,
|
106 |
+
)
|
107 |
+
|
108 |
+
# pd.set_option("precision", 2)
|
109 |
+
pd.set_option("display.precision", 2)
|
110 |
+
pd.options.display.float_format = "{:,.2f}".format
|
111 |
+
|
112 |
+
|
113 |
+
_ = dict(beetype="ezbee", src_filename="", tgt_filename="", src_fileio=b"", tgt_fileio=b"", src_file="", tgt_file="", list1=[], list2=[], df=None, df_a=None, df_s_a=None,)
|
114 |
+
if "ns" not in state:
|
115 |
+
state.ns = SimpleNamespace(**_)
|
116 |
+
state.ns.list = [*_]
|
117 |
+
|
118 |
+
|
119 |
+
def main():
|
120 |
+
"""Bootstrap."""
|
121 |
+
options()
|
122 |
+
|
123 |
+
|
124 |
+
main()
|
poetry.lock
CHANGED
@@ -1,3 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
[[package]]
|
2 |
name = "altair"
|
3 |
version = "4.2.0"
|
@@ -56,6 +76,17 @@ cffi = ">=1.0.1"
|
|
56 |
dev = ["pytest", "cogapp", "pre-commit", "wheel"]
|
57 |
tests = ["pytest"]
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
[[package]]
|
60 |
name = "asttokens"
|
61 |
version = "2.0.5"
|
@@ -231,6 +262,17 @@ category = "main"
|
|
231 |
optional = false
|
232 |
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
[[package]]
|
235 |
name = "debugpy"
|
236 |
version = "1.6.0"
|
@@ -255,6 +297,27 @@ category = "main"
|
|
255 |
optional = false
|
256 |
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
[[package]]
|
259 |
name = "entrypoints"
|
260 |
version = "0.4"
|
@@ -404,6 +467,17 @@ python-versions = ">=3.7"
|
|
404 |
[package.dependencies]
|
405 |
gitdb = ">=4.0.1,<5"
|
406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
[[package]]
|
408 |
name = "icecream"
|
409 |
version = "2.1.2"
|
@@ -596,6 +670,31 @@ category = "main"
|
|
596 |
optional = false
|
597 |
python-versions = ">=3.6"
|
598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
[[package]]
|
600 |
name = "jsonschema"
|
601 |
version = "4.5.1"
|
@@ -1304,6 +1403,22 @@ urllib3 = ">=1.21.1,<1.27"
|
|
1304 |
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
|
1305 |
use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"]
|
1306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1307 |
[[package]]
|
1308 |
name = "scikit-learn"
|
1309 |
version = "1.1.1"
|
@@ -1427,6 +1542,14 @@ category = "main"
|
|
1427 |
optional = false
|
1428 |
python-versions = ">=3.6"
|
1429 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1430 |
[[package]]
|
1431 |
name = "stack-data"
|
1432 |
version = "0.2.0"
|
@@ -1622,6 +1745,14 @@ dev = ["autoflake (>=1.3.1,<2.0.0)", "flake8 (>=3.8.3,<4.0.0)"]
|
|
1622 |
doc = ["mkdocs (>=1.1.2,<2.0.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "mdx-include (>=1.4.1,<2.0.0)"]
|
1623 |
test = ["shellingham (>=1.3.0,<2.0.0)", "pytest (>=4.4.0,<5.4.0)", "pytest-cov (>=2.10.0,<3.0.0)", "coverage (>=5.2,<6.0)", "pytest-xdist (>=1.32.0,<2.0.0)", "pytest-sugar (>=0.9.4,<0.10.0)", "mypy (==0.910)", "black (>=22.3.0,<23.0.0)", "isort (>=5.0.6,<6.0.0)"]
|
1624 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1625 |
[[package]]
|
1626 |
name = "tzdata"
|
1627 |
version = "2022.1"
|
@@ -1735,9 +1866,17 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
|
|
1735 |
[metadata]
|
1736 |
lock-version = "1.1"
|
1737 |
python-versions = "^3.8.3"
|
1738 |
-
content-hash = "
|
1739 |
|
1740 |
[metadata.files]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1741 |
altair = [
|
1742 |
{file = "altair-4.2.0-py3-none-any.whl", hash = "sha256:0c724848ae53410c13fa28be2b3b9a9dcb7b5caa1a70f7f217bd663bb419935a"},
|
1743 |
{file = "altair-4.2.0.tar.gz", hash = "sha256:d87d9372e63b48cd96b2a6415f0cf9457f50162ab79dc7a31cd7e024dd840026"},
|
@@ -1773,6 +1912,10 @@ argon2-cffi-bindings = [
|
|
1773 |
{file = "argon2_cffi_bindings-21.2.0-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ed2937d286e2ad0cc79a7087d3c272832865f779430e0cc2b4f3718d3159b0cb"},
|
1774 |
{file = "argon2_cffi_bindings-21.2.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:5e00316dabdaea0b2dd82d141cc66889ced0cdcbfa599e8b471cf22c620c329a"},
|
1775 |
]
|
|
|
|
|
|
|
|
|
1776 |
asttokens = [
|
1777 |
{file = "asttokens-2.0.5-py2.py3-none-any.whl", hash = "sha256:0844691e88552595a6f4a4281a9f7f79b8dd45ca4ccea82e5e05b4bbdb76705c"},
|
1778 |
{file = "asttokens-2.0.5.tar.gz", hash = "sha256:9a54c114f02c7a9480d56550932546a3f1fe71d8a02f1bc7ccd0ee3ee35cf4d5"},
|
@@ -1925,6 +2068,10 @@ colorama = [
|
|
1925 |
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
|
1926 |
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
|
1927 |
]
|
|
|
|
|
|
|
|
|
1928 |
debugpy = [
|
1929 |
{file = "debugpy-1.6.0-cp310-cp310-macosx_10_15_x86_64.whl", hash = "sha256:eb1946efac0c0c3d411cea0b5ac772fbde744109fd9520fb0c5a51979faf05ad"},
|
1930 |
{file = "debugpy-1.6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:e3513399177dd37af4c1332df52da5da1d0c387e5927dc4c0709e26ee7302e8f"},
|
@@ -1953,6 +2100,10 @@ defusedxml = [
|
|
1953 |
{file = "defusedxml-0.7.1-py2.py3-none-any.whl", hash = "sha256:a352e7e428770286cc899e2542b6cdaedb2b4953ff269a210103ec58f6198a61"},
|
1954 |
{file = "defusedxml-0.7.1.tar.gz", hash = "sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"},
|
1955 |
]
|
|
|
|
|
|
|
|
|
1956 |
entrypoints = [
|
1957 |
{file = "entrypoints-0.4-py3-none-any.whl", hash = "sha256:f174b5ff827504fd3cd97cc3f8649f3693f51538c7e4bdf3ef002c8429d42f9f"},
|
1958 |
{file = "entrypoints-0.4.tar.gz", hash = "sha256:b706eddaa9218a19ebcd67b56818f05bb27589b1ca9e8d797b74affad4ccacd4"},
|
@@ -1996,6 +2147,9 @@ gitpython = [
|
|
1996 |
{file = "GitPython-3.1.27-py3-none-any.whl", hash = "sha256:5b68b000463593e05ff2b261acff0ff0972df8ab1b70d3cdbd41b546c8b8fc3d"},
|
1997 |
{file = "GitPython-3.1.27.tar.gz", hash = "sha256:1c885ce809e8ba2d88a29befeb385fcea06338d3640712b59ca623c220bb5704"},
|
1998 |
]
|
|
|
|
|
|
|
1999 |
icecream = [
|
2000 |
{file = "icecream-2.1.2-py2.py3-none-any.whl", hash = "sha256:04b9cea4d9931cf6960db0430ebf11fa34464ce7152e384ddf50f96d25b201b4"},
|
2001 |
{file = "icecream-2.1.2.tar.gz", hash = "sha256:09300b2d1c678712410cbd47c95198eb1b580f66f311a554ccd6b9e758ece0ee"},
|
@@ -2048,6 +2202,10 @@ joblib = [
|
|
2048 |
{file = "joblib-1.1.0-py2.py3-none-any.whl", hash = "sha256:f21f109b3c7ff9d95f8387f752d0d9c34a02aa2f7060c2135f465da0e5160ff6"},
|
2049 |
{file = "joblib-1.1.0.tar.gz", hash = "sha256:4158fcecd13733f8be669be0683b96ebdbbd38d23559f54dca7205aea1bf1e35"},
|
2050 |
]
|
|
|
|
|
|
|
|
|
2051 |
jsonschema = [
|
2052 |
{file = "jsonschema-4.5.1-py3-none-any.whl", hash = "sha256:71b5e39324422543546572954ce71c67728922c104902cb7ce252e522235b33f"},
|
2053 |
{file = "jsonschema-4.5.1.tar.gz", hash = "sha256:7c6d882619340c3347a1bf7315e147e6d3dae439033ae6383d6acb908c101dfc"},
|
@@ -2657,6 +2815,10 @@ requests = [
|
|
2657 |
{file = "requests-2.27.1-py2.py3-none-any.whl", hash = "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"},
|
2658 |
{file = "requests-2.27.1.tar.gz", hash = "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"},
|
2659 |
]
|
|
|
|
|
|
|
|
|
2660 |
scikit-learn = [
|
2661 |
{file = "scikit-learn-1.1.1.tar.gz", hash = "sha256:3e77b71e8e644f86c8b5be7f1c285ef597de4c384961389ee3e9ca36c445b256"},
|
2662 |
{file = "scikit_learn-1.1.1-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:102f51797cd8944bf44a038d106848ddf2804f2c1edf7aea45fba81a4fdc4d80"},
|
@@ -2796,6 +2958,10 @@ soupsieve = [
|
|
2796 |
{file = "soupsieve-2.3.2.post1-py3-none-any.whl", hash = "sha256:3b2503d3c7084a42b1ebd08116e5f81aadfaea95863628c80a3b774a11b7c759"},
|
2797 |
{file = "soupsieve-2.3.2.post1.tar.gz", hash = "sha256:fc53893b3da2c33de295667a0e19f078c14bf86544af307354de5fcf12a3f30d"},
|
2798 |
]
|
|
|
|
|
|
|
|
|
2799 |
stack-data = [
|
2800 |
{file = "stack_data-0.2.0-py3-none-any.whl", hash = "sha256:999762f9c3132308789affa03e9271bbbe947bf78311851f4d485d8402ed858e"},
|
2801 |
{file = "stack_data-0.2.0.tar.gz", hash = "sha256:45692d41bd633a9503a5195552df22b583caf16f0b27c4e58c98d88c8b648e12"},
|
@@ -2895,6 +3061,10 @@ typer = [
|
|
2895 |
{file = "typer-0.4.1-py3-none-any.whl", hash = "sha256:e8467f0ebac0c81366c2168d6ad9f888efdfb6d4e1d3d5b4a004f46fa444b5c3"},
|
2896 |
{file = "typer-0.4.1.tar.gz", hash = "sha256:5646aef0d936b2c761a10393f0384ee6b5c7fe0bb3e5cd710b17134ca1d99cff"},
|
2897 |
]
|
|
|
|
|
|
|
|
|
2898 |
tzdata = [
|
2899 |
{file = "tzdata-2022.1-py2.py3-none-any.whl", hash = "sha256:238e70234214138ed7b4e8a0fab0e5e13872edab3be586ab8198c407620e2ab9"},
|
2900 |
{file = "tzdata-2022.1.tar.gz", hash = "sha256:8b536a8ec63dc0751342b3984193a3118f8fca2afe25752bb9b7fffd398552d3"},
|
|
|
1 |
+
[[package]]
|
2 |
+
name = "about-time"
|
3 |
+
version = "3.1.1"
|
4 |
+
description = "Easily measure timing and throughput of code blocks, with beautiful human friendly representations."
|
5 |
+
category = "main"
|
6 |
+
optional = false
|
7 |
+
python-versions = "*"
|
8 |
+
|
9 |
+
[[package]]
|
10 |
+
name = "alive-progress"
|
11 |
+
version = "2.4.1"
|
12 |
+
description = "A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!"
|
13 |
+
category = "main"
|
14 |
+
optional = false
|
15 |
+
python-versions = ">=3.7, <4"
|
16 |
+
|
17 |
+
[package.dependencies]
|
18 |
+
about-time = "3.1.1"
|
19 |
+
grapheme = "0.6.0"
|
20 |
+
|
21 |
[[package]]
|
22 |
name = "altair"
|
23 |
version = "4.2.0"
|
|
|
76 |
dev = ["pytest", "cogapp", "pre-commit", "wheel"]
|
77 |
tests = ["pytest"]
|
78 |
|
79 |
+
[[package]]
|
80 |
+
name = "aset2pairs"
|
81 |
+
version = "0.1.0"
|
82 |
+
description = "Convert aset to block pairs"
|
83 |
+
category = "main"
|
84 |
+
optional = false
|
85 |
+
python-versions = ">=3.8.3,<4.0.0"
|
86 |
+
|
87 |
+
[package.dependencies]
|
88 |
+
logzero = ">=1.7.0,<2.0.0"
|
89 |
+
|
90 |
[[package]]
|
91 |
name = "asttokens"
|
92 |
version = "2.0.5"
|
|
|
262 |
optional = false
|
263 |
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
264 |
|
265 |
+
[[package]]
|
266 |
+
name = "commonmark"
|
267 |
+
version = "0.9.1"
|
268 |
+
description = "Python parser for the CommonMark Markdown spec"
|
269 |
+
category = "main"
|
270 |
+
optional = false
|
271 |
+
python-versions = "*"
|
272 |
+
|
273 |
+
[package.extras]
|
274 |
+
test = ["flake8 (==3.7.8)", "hypothesis (==3.55.3)"]
|
275 |
+
|
276 |
[[package]]
|
277 |
name = "debugpy"
|
278 |
version = "1.6.0"
|
|
|
297 |
optional = false
|
298 |
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
299 |
|
300 |
+
[[package]]
|
301 |
+
name = "dzbee"
|
302 |
+
version = "0.1.1a2"
|
303 |
+
description = "pack_name descr"
|
304 |
+
category = "main"
|
305 |
+
optional = false
|
306 |
+
python-versions = ">=3.8.3,<4.0.0"
|
307 |
+
|
308 |
+
[package.dependencies]
|
309 |
+
aset2pairs = ">=0.1.0,<0.2.0"
|
310 |
+
cchardet = ">=2.1.7,<3.0.0"
|
311 |
+
icecream = ">=2.1.1,<3.0.0"
|
312 |
+
install = ">=1.3.5,<2.0.0"
|
313 |
+
Jinja2 = ">=3.1.2,<4.0.0"
|
314 |
+
json-de2zh = "0.1.1-alpha.0"
|
315 |
+
logzero = ">=1.7.0,<2.0.0"
|
316 |
+
Morfessor = ">=2.0.6,<3.0.0"
|
317 |
+
polyglot = ">=16.7.4,<17.0.0"
|
318 |
+
typer = ">=0.4.1,<0.5.0"
|
319 |
+
XlsxWriter = ">=3.0.3,<4.0.0"
|
320 |
+
|
321 |
[[package]]
|
322 |
name = "entrypoints"
|
323 |
version = "0.4"
|
|
|
467 |
[package.dependencies]
|
468 |
gitdb = ">=4.0.1,<5"
|
469 |
|
470 |
+
[[package]]
|
471 |
+
name = "grapheme"
|
472 |
+
version = "0.6.0"
|
473 |
+
description = "Unicode grapheme helpers"
|
474 |
+
category = "main"
|
475 |
+
optional = false
|
476 |
+
python-versions = "*"
|
477 |
+
|
478 |
+
[package.extras]
|
479 |
+
test = ["pytest", "sphinx", "sphinx-autobuild", "wheel", "twine"]
|
480 |
+
|
481 |
[[package]]
|
482 |
name = "icecream"
|
483 |
version = "2.1.2"
|
|
|
670 |
optional = false
|
671 |
python-versions = ">=3.6"
|
672 |
|
673 |
+
[[package]]
|
674 |
+
name = "json-de2zh"
|
675 |
+
version = "0.1.1a0"
|
676 |
+
description = "pack_name descr"
|
677 |
+
category = "main"
|
678 |
+
optional = false
|
679 |
+
python-versions = ">=3.8.3,<4.0.0"
|
680 |
+
|
681 |
+
[package.dependencies]
|
682 |
+
alive-progress = ">=2.4.1,<3.0.0"
|
683 |
+
cmat2aset = ">=0.1.0-alpha.7,<0.2.0"
|
684 |
+
fast-scores = ">=0.1.2,<0.2.0"
|
685 |
+
fastlid = ">=0.1.7,<0.2.0"
|
686 |
+
icecream = ">=2.1.1,<3.0.0"
|
687 |
+
install = ">=1.3.5,<2.0.0"
|
688 |
+
joblib = ">=1.1.0,<2.0.0"
|
689 |
+
nltk = ">=3.7,<4.0"
|
690 |
+
numpy = ">=1.22.3,<2.0.0"
|
691 |
+
rich = ">=12.4.1,<13.0.0"
|
692 |
+
set-loglevel = ">=0.1.2,<0.2.0"
|
693 |
+
simplemma = "0.3.0"
|
694 |
+
sklearn = ">=0.0,<0.1"
|
695 |
+
split-words = ">=0.1.2,<0.2.0"
|
696 |
+
typer = ">=0.4.1,<0.5.0"
|
697 |
+
|
698 |
[[package]]
|
699 |
name = "jsonschema"
|
700 |
version = "4.5.1"
|
|
|
1403 |
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
|
1404 |
use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"]
|
1405 |
|
1406 |
+
[[package]]
|
1407 |
+
name = "rich"
|
1408 |
+
version = "12.4.3"
|
1409 |
+
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
|
1410 |
+
category = "main"
|
1411 |
+
optional = false
|
1412 |
+
python-versions = ">=3.6.3,<4.0.0"
|
1413 |
+
|
1414 |
+
[package.dependencies]
|
1415 |
+
commonmark = ">=0.9.0,<0.10.0"
|
1416 |
+
pygments = ">=2.6.0,<3.0.0"
|
1417 |
+
typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.9\""}
|
1418 |
+
|
1419 |
+
[package.extras]
|
1420 |
+
jupyter = ["ipywidgets (>=7.5.1,<8.0.0)"]
|
1421 |
+
|
1422 |
[[package]]
|
1423 |
name = "scikit-learn"
|
1424 |
version = "1.1.1"
|
|
|
1542 |
optional = false
|
1543 |
python-versions = ">=3.6"
|
1544 |
|
1545 |
+
[[package]]
|
1546 |
+
name = "split-words"
|
1547 |
+
version = "0.1.2"
|
1548 |
+
description = "Split German words"
|
1549 |
+
category = "main"
|
1550 |
+
optional = false
|
1551 |
+
python-versions = ">=3.8.3,<4.0.0"
|
1552 |
+
|
1553 |
[[package]]
|
1554 |
name = "stack-data"
|
1555 |
version = "0.2.0"
|
|
|
1745 |
doc = ["mkdocs (>=1.1.2,<2.0.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "mdx-include (>=1.4.1,<2.0.0)"]
|
1746 |
test = ["shellingham (>=1.3.0,<2.0.0)", "pytest (>=4.4.0,<5.4.0)", "pytest-cov (>=2.10.0,<3.0.0)", "coverage (>=5.2,<6.0)", "pytest-xdist (>=1.32.0,<2.0.0)", "pytest-sugar (>=0.9.4,<0.10.0)", "mypy (==0.910)", "black (>=22.3.0,<23.0.0)", "isort (>=5.0.6,<6.0.0)"]
|
1747 |
|
1748 |
+
[[package]]
|
1749 |
+
name = "typing-extensions"
|
1750 |
+
version = "4.2.0"
|
1751 |
+
description = "Backported and Experimental Type Hints for Python 3.7+"
|
1752 |
+
category = "main"
|
1753 |
+
optional = false
|
1754 |
+
python-versions = ">=3.7"
|
1755 |
+
|
1756 |
[[package]]
|
1757 |
name = "tzdata"
|
1758 |
version = "2022.1"
|
|
|
1866 |
[metadata]
|
1867 |
lock-version = "1.1"
|
1868 |
python-versions = "^3.8.3"
|
1869 |
+
content-hash = "7fbe1cd54bf6ad1eb68f992dac0b0cd5a9095bfece8c31edb11e224e4e41d4f3"
|
1870 |
|
1871 |
[metadata.files]
|
1872 |
+
about-time = [
|
1873 |
+
{file = "about-time-3.1.1.tar.gz", hash = "sha256:586b329450c9387d1ae8c42d2db4f5b4c57a54508d0f1b7bb00322ffd5ce9f9b"},
|
1874 |
+
{file = "about_time-3.1.1-py3-none-any.whl", hash = "sha256:96841beb3f9b5de1cbb323d2bdb0fa9abdecbc46f2d546b9b3c2483d23daa17a"},
|
1875 |
+
]
|
1876 |
+
alive-progress = [
|
1877 |
+
{file = "alive-progress-2.4.1.tar.gz", hash = "sha256:089757c8197f27ad972ba27e1060f6db92368d83c736884e159034fd74865323"},
|
1878 |
+
{file = "alive_progress-2.4.1-py3-none-any.whl", hash = "sha256:5503ffca0a0607d5f0d24d3b10a718fe50e375470fa07602b246333eb7ec88ee"},
|
1879 |
+
]
|
1880 |
altair = [
|
1881 |
{file = "altair-4.2.0-py3-none-any.whl", hash = "sha256:0c724848ae53410c13fa28be2b3b9a9dcb7b5caa1a70f7f217bd663bb419935a"},
|
1882 |
{file = "altair-4.2.0.tar.gz", hash = "sha256:d87d9372e63b48cd96b2a6415f0cf9457f50162ab79dc7a31cd7e024dd840026"},
|
|
|
1912 |
{file = "argon2_cffi_bindings-21.2.0-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ed2937d286e2ad0cc79a7087d3c272832865f779430e0cc2b4f3718d3159b0cb"},
|
1913 |
{file = "argon2_cffi_bindings-21.2.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:5e00316dabdaea0b2dd82d141cc66889ced0cdcbfa599e8b471cf22c620c329a"},
|
1914 |
]
|
1915 |
+
aset2pairs = [
|
1916 |
+
{file = "aset2pairs-0.1.0-py3-none-any.whl", hash = "sha256:a7137c7492566933198eebcef8df8c77ffda2f239f0865ae28c2afaf2a252550"},
|
1917 |
+
{file = "aset2pairs-0.1.0.tar.gz", hash = "sha256:ee8d69f5ddce401f4999182678b108d9580edcc19374e44ed698c2171a17b483"},
|
1918 |
+
]
|
1919 |
asttokens = [
|
1920 |
{file = "asttokens-2.0.5-py2.py3-none-any.whl", hash = "sha256:0844691e88552595a6f4a4281a9f7f79b8dd45ca4ccea82e5e05b4bbdb76705c"},
|
1921 |
{file = "asttokens-2.0.5.tar.gz", hash = "sha256:9a54c114f02c7a9480d56550932546a3f1fe71d8a02f1bc7ccd0ee3ee35cf4d5"},
|
|
|
2068 |
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
|
2069 |
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
|
2070 |
]
|
2071 |
+
commonmark = [
|
2072 |
+
{file = "commonmark-0.9.1-py2.py3-none-any.whl", hash = "sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9"},
|
2073 |
+
{file = "commonmark-0.9.1.tar.gz", hash = "sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60"},
|
2074 |
+
]
|
2075 |
debugpy = [
|
2076 |
{file = "debugpy-1.6.0-cp310-cp310-macosx_10_15_x86_64.whl", hash = "sha256:eb1946efac0c0c3d411cea0b5ac772fbde744109fd9520fb0c5a51979faf05ad"},
|
2077 |
{file = "debugpy-1.6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:e3513399177dd37af4c1332df52da5da1d0c387e5927dc4c0709e26ee7302e8f"},
|
|
|
2100 |
{file = "defusedxml-0.7.1-py2.py3-none-any.whl", hash = "sha256:a352e7e428770286cc899e2542b6cdaedb2b4953ff269a210103ec58f6198a61"},
|
2101 |
{file = "defusedxml-0.7.1.tar.gz", hash = "sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"},
|
2102 |
]
|
2103 |
+
dzbee = [
|
2104 |
+
{file = "dzbee-0.1.1a2-py3-none-any.whl", hash = "sha256:fe1c4e80be236a66639dba2ed7f1c71497def05e9a6eea838264ea9d92543426"},
|
2105 |
+
{file = "dzbee-0.1.1a2.tar.gz", hash = "sha256:24dadb5fa6606d4fd54d28eb34db2126ce078a4a8b5032090dba2856ed906091"},
|
2106 |
+
]
|
2107 |
entrypoints = [
|
2108 |
{file = "entrypoints-0.4-py3-none-any.whl", hash = "sha256:f174b5ff827504fd3cd97cc3f8649f3693f51538c7e4bdf3ef002c8429d42f9f"},
|
2109 |
{file = "entrypoints-0.4.tar.gz", hash = "sha256:b706eddaa9218a19ebcd67b56818f05bb27589b1ca9e8d797b74affad4ccacd4"},
|
|
|
2147 |
{file = "GitPython-3.1.27-py3-none-any.whl", hash = "sha256:5b68b000463593e05ff2b261acff0ff0972df8ab1b70d3cdbd41b546c8b8fc3d"},
|
2148 |
{file = "GitPython-3.1.27.tar.gz", hash = "sha256:1c885ce809e8ba2d88a29befeb385fcea06338d3640712b59ca623c220bb5704"},
|
2149 |
]
|
2150 |
+
grapheme = [
|
2151 |
+
{file = "grapheme-0.6.0.tar.gz", hash = "sha256:44c2b9f21bbe77cfb05835fec230bd435954275267fea1858013b102f8603cca"},
|
2152 |
+
]
|
2153 |
icecream = [
|
2154 |
{file = "icecream-2.1.2-py2.py3-none-any.whl", hash = "sha256:04b9cea4d9931cf6960db0430ebf11fa34464ce7152e384ddf50f96d25b201b4"},
|
2155 |
{file = "icecream-2.1.2.tar.gz", hash = "sha256:09300b2d1c678712410cbd47c95198eb1b580f66f311a554ccd6b9e758ece0ee"},
|
|
|
2202 |
{file = "joblib-1.1.0-py2.py3-none-any.whl", hash = "sha256:f21f109b3c7ff9d95f8387f752d0d9c34a02aa2f7060c2135f465da0e5160ff6"},
|
2203 |
{file = "joblib-1.1.0.tar.gz", hash = "sha256:4158fcecd13733f8be669be0683b96ebdbbd38d23559f54dca7205aea1bf1e35"},
|
2204 |
]
|
2205 |
+
json-de2zh = [
|
2206 |
+
{file = "json_de2zh-0.1.1a0-py3-none-any.whl", hash = "sha256:ae20c3296912e8c9a013ed53ff361cc18e0f1524f2641fb86e2c4e65994dc199"},
|
2207 |
+
{file = "json_de2zh-0.1.1a0.tar.gz", hash = "sha256:ff15c6418d52340d401dc69854c6d90b088aa5d535930c4d73ea4d0aca8161ca"},
|
2208 |
+
]
|
2209 |
jsonschema = [
|
2210 |
{file = "jsonschema-4.5.1-py3-none-any.whl", hash = "sha256:71b5e39324422543546572954ce71c67728922c104902cb7ce252e522235b33f"},
|
2211 |
{file = "jsonschema-4.5.1.tar.gz", hash = "sha256:7c6d882619340c3347a1bf7315e147e6d3dae439033ae6383d6acb908c101dfc"},
|
|
|
2815 |
{file = "requests-2.27.1-py2.py3-none-any.whl", hash = "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"},
|
2816 |
{file = "requests-2.27.1.tar.gz", hash = "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"},
|
2817 |
]
|
2818 |
+
rich = [
|
2819 |
+
{file = "rich-12.4.3-py3-none-any.whl", hash = "sha256:26ef784599a9ab905ade34ff28904e4fbe9bce16e02c33c78b0229551104c146"},
|
2820 |
+
{file = "rich-12.4.3.tar.gz", hash = "sha256:e7550ca19aec51b216ae4c34bfce82e94a0c79bdbf95cafbf42f343d0fb3f45a"},
|
2821 |
+
]
|
2822 |
scikit-learn = [
|
2823 |
{file = "scikit-learn-1.1.1.tar.gz", hash = "sha256:3e77b71e8e644f86c8b5be7f1c285ef597de4c384961389ee3e9ca36c445b256"},
|
2824 |
{file = "scikit_learn-1.1.1-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:102f51797cd8944bf44a038d106848ddf2804f2c1edf7aea45fba81a4fdc4d80"},
|
|
|
2958 |
{file = "soupsieve-2.3.2.post1-py3-none-any.whl", hash = "sha256:3b2503d3c7084a42b1ebd08116e5f81aadfaea95863628c80a3b774a11b7c759"},
|
2959 |
{file = "soupsieve-2.3.2.post1.tar.gz", hash = "sha256:fc53893b3da2c33de295667a0e19f078c14bf86544af307354de5fcf12a3f30d"},
|
2960 |
]
|
2961 |
+
split-words = [
|
2962 |
+
{file = "split-words-0.1.2.tar.gz", hash = "sha256:4b8ed2bd86e266570e61c5e9ae210e7cf5e01b530e7dace2a047cd86af5276c9"},
|
2963 |
+
{file = "split_words-0.1.2-py3-none-any.whl", hash = "sha256:5c7657f03fbdbe8ec731afff715e0779f754a01dbeac8ddc762ee2f2af6d4eb8"},
|
2964 |
+
]
|
2965 |
stack-data = [
|
2966 |
{file = "stack_data-0.2.0-py3-none-any.whl", hash = "sha256:999762f9c3132308789affa03e9271bbbe947bf78311851f4d485d8402ed858e"},
|
2967 |
{file = "stack_data-0.2.0.tar.gz", hash = "sha256:45692d41bd633a9503a5195552df22b583caf16f0b27c4e58c98d88c8b648e12"},
|
|
|
3061 |
{file = "typer-0.4.1-py3-none-any.whl", hash = "sha256:e8467f0ebac0c81366c2168d6ad9f888efdfb6d4e1d3d5b4a004f46fa444b5c3"},
|
3062 |
{file = "typer-0.4.1.tar.gz", hash = "sha256:5646aef0d936b2c761a10393f0384ee6b5c7fe0bb3e5cd710b17134ca1d99cff"},
|
3063 |
]
|
3064 |
+
typing-extensions = [
|
3065 |
+
{file = "typing_extensions-4.2.0-py3-none-any.whl", hash = "sha256:6657594ee297170d19f67d55c05852a874e7eb634f4f753dbd667855e07c1708"},
|
3066 |
+
{file = "typing_extensions-4.2.0.tar.gz", hash = "sha256:f1c24655a0da0d1b67f07e17a5e6b2a105894e6824b92096378bb3668ef02376"},
|
3067 |
+
]
|
3068 |
tzdata = [
|
3069 |
{file = "tzdata-2022.1-py2.py3-none-any.whl", hash = "sha256:238e70234214138ed7b4e8a0fab0e5e13872edab3be586ab8198c407620e2ab9"},
|
3070 |
{file = "tzdata-2022.1.tar.gz", hash = "sha256:8b536a8ec63dc0751342b3984193a3118f8fca2afe25752bb9b7fffd398552d3"},
|
pyproject.toml
CHANGED
@@ -17,6 +17,7 @@ streamlit-multipage = "^0.0.18"
|
|
17 |
cchardet = "^2.1.7"
|
18 |
streamlit-aggrid = "^0.2.3"
|
19 |
ezbee = "0.1.0a3"
|
|
|
20 |
|
21 |
[tool.poe.executor]
|
22 |
type = "poetry"
|
|
|
17 |
cchardet = "^2.1.7"
|
18 |
streamlit-aggrid = "^0.2.3"
|
19 |
ezbee = "0.1.0a3"
|
20 |
+
dzbee = "^0.1.1-alpha.2"
|
21 |
|
22 |
[tool.poe.executor]
|
23 |
type = "poetry"
|
tests/test_litbee.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
"""Test litbee."""
|
2 |
# pylint: disable=broad-except
|
3 |
-
from litbee import __version__
|
4 |
-
from litbee import litbee
|
5 |
|
6 |
|
7 |
def test_version():
|
|
|
1 |
"""Test litbee."""
|
2 |
# pylint: disable=broad-except
|
3 |
+
from litbee import __version__, litbee
|
|
|
4 |
|
5 |
|
6 |
def test_version():
|