update to dropout model with oversampling
Browse files
demo.py
CHANGED
@@ -28,7 +28,8 @@ st.set_page_config(page_title="ENGAGEMENT analyzer (beta ver 0.2)",
|
|
28 |
|
29 |
@st.cache(allow_output_mutation=True)
|
30 |
def load_model(spacy_model):
|
31 |
-
nlp = spacy.load("en_engagement_RoBERTa_context_flz")
|
|
|
32 |
return (nlp)
|
33 |
|
34 |
|
@@ -115,7 +116,7 @@ TEXT_LIST = [
|
|
115 |
]
|
116 |
|
117 |
|
118 |
-
@st.cache
|
119 |
def preprocess(text):
|
120 |
text = re.sub("\n\n", ' &&&&&&&&#&#&#&#&', text)
|
121 |
text = re.sub('\n', ' ', text)
|
@@ -237,8 +238,6 @@ cc = '<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><im
|
|
237 |
st.sidebar.markdown(cc, unsafe_allow_html=True)
|
238 |
|
239 |
st.header("Engagement Analyzer (beta ver 0.2)")
|
240 |
-
st.info('Updated on Nov. 18th, 2022')
|
241 |
-
|
242 |
st.write(
|
243 |
"Engagement Analyzer is a free tool that analyzes English texts for rhetorical strategies under the Engagement system framework (Martin & White, 2005). Martin and White (2005) propose two basic stance-taking strategies: expansion and contraction, which are in turn divided into finer-grained rhetorical strategies. The current tool allows you to analyze texts for a total of nine rhetorical strategies. The definitions of each category label can be found from the side bar"
|
244 |
)
|
@@ -253,6 +252,14 @@ with st.expander("See more explanation"):
|
|
253 |
|
254 |
""")
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
with st.form("my_form"):
|
257 |
|
258 |
st.subheader("Option 1: selecting example text from list")
|
@@ -310,14 +317,17 @@ visualize_spans(doc,
|
|
310 |
'start': TPL_SPAN_START,
|
311 |
},
|
312 |
"colors": {
|
313 |
-
"ENTERTAIN": "#
|
314 |
-
"DENY": '#
|
315 |
-
"COUNTER": "#
|
316 |
-
"PRONOUNCE": "#
|
317 |
-
"ENDORSE": "#
|
318 |
-
"
|
319 |
-
"
|
320 |
-
"
|
|
|
|
|
|
|
321 |
},
|
322 |
})
|
323 |
|
|
|
28 |
|
29 |
@st.cache(allow_output_mutation=True)
|
30 |
def load_model(spacy_model):
|
31 |
+
# nlp = spacy.load("en_engagement_RoBERTa_context_flz")
|
32 |
+
nlp = spacy.load("en_engagement_spl_RoBERTa_acad_max1_do02")
|
33 |
return (nlp)
|
34 |
|
35 |
|
|
|
116 |
]
|
117 |
|
118 |
|
119 |
+
@st.cache(suppress_st_warning=True)
|
120 |
def preprocess(text):
|
121 |
text = re.sub("\n\n", ' &&&&&&&&#&#&#&#&', text)
|
122 |
text = re.sub('\n', ' ', text)
|
|
|
238 |
st.sidebar.markdown(cc, unsafe_allow_html=True)
|
239 |
|
240 |
st.header("Engagement Analyzer (beta ver 0.2)")
|
|
|
|
|
241 |
st.write(
|
242 |
"Engagement Analyzer is a free tool that analyzes English texts for rhetorical strategies under the Engagement system framework (Martin & White, 2005). Martin and White (2005) propose two basic stance-taking strategies: expansion and contraction, which are in turn divided into finer-grained rhetorical strategies. The current tool allows you to analyze texts for a total of nine rhetorical strategies. The definitions of each category label can be found from the side bar"
|
243 |
)
|
|
|
252 |
|
253 |
""")
|
254 |
|
255 |
+
st.info('''Updated on Dec. 4th, 2022\n
|
256 |
+
The current version was trained on 1,333 sentences and tested on 323 sentences. It achieved the following benchmark:
|
257 |
+
- Micro F1 = 68.94
|
258 |
+
- Micro Precision = 71.17
|
259 |
+
- Micro Recall = 66.84
|
260 |
+
I expect that the model's performance improves as the annotated dataset gets larger.
|
261 |
+
''')
|
262 |
+
|
263 |
with st.form("my_form"):
|
264 |
|
265 |
st.subheader("Option 1: selecting example text from list")
|
|
|
317 |
'start': TPL_SPAN_START,
|
318 |
},
|
319 |
"colors": {
|
320 |
+
"ENTERTAIN": "#73C6B6",
|
321 |
+
"DENY": '#CD6155',
|
322 |
+
"COUNTER": "#D35400",
|
323 |
+
"PRONOUNCE": "#2ECC71",
|
324 |
+
"ENDORSE": "#A569BD",
|
325 |
+
"CONCUR": "#F39C12",
|
326 |
+
"CITATION": "#F8C471",
|
327 |
+
"SOURCES": "#F7DC6F",
|
328 |
+
"MONOGLOSS": "#85929E",
|
329 |
+
"ATTRIBUTE": "#85C1E9",
|
330 |
+
"JUSTIFYING": "#2ECC71",
|
331 |
},
|
332 |
})
|
333 |
|