import streamlit as st import streamlit.components.v1 as components import monpa st.title("Multi-Objective NER POS Annotator @ TMU") st.markdown(f'MONPA 是一個提供正體中文斷詞、詞性標註以及命名實體辨識的多任務模型。本網站僅為示範,歡迎 `pip install monpa` 安裝 python package (最新版本 v0.3.1)。') text = st.text_input('請在下方輸入欲斷詞的句子,限 200 字以內...', placeholder='今天天氣很好。') try: chunk = monpa.pseg(text) except: st.markdown(f':red[發生錯誤,請重新輸入]') st.write(f'斷詞結果:\n') result = "$~~~$".join(f"{item[0]}`{item[1]}`" for item in chunk if item[0] not in {" ", ""}) st.markdown(f'**{result}**') st.divider() st.markdown('MONPA Github [https://github.com/monpa-team/monpa](https://github.com/monpa-team/monpa)') st.markdown('[NLP Lab,](https://nlp.tmu.edu.tw/)') st.markdown('Graduate Institute of Data Science @ TMU')