egumasa commited on
Commit
fe18b15
·
1 Parent(s): 2b04c98

make it rich table

Browse files
Files changed (1) hide show
  1. demo.py +65 -63
demo.py CHANGED
@@ -16,18 +16,20 @@ from utils.visualize import visualize_spans
16
  # "packages/en_engagement_RoBERTa-0.0.2/en_engagement_RoBERTa/en_engagement_RoBERTa-0.0.2"
17
  # )
18
 
19
- #Load from local storage
20
- #MODEL_LIST = ['en_engagement_RoBERTa-ME-AtoE.tar.gz']
21
 
22
- #model = st.selectbox('Select model', MODEL_LIST, index=0)
23
- #nlp = spacy.load("packages/" + model)
24
 
25
  # Load from huggingface
26
  # sm = spacy.load('en_core_web_sm', disable=['ner'])
27
 
28
- st.set_page_config(page_title="ENGAGEMENT analyzer (beta ver 0.3)",
29
- layout="wide",
30
- initial_sidebar_state="expanded")
 
 
31
 
32
 
33
  @st.cache(allow_output_mutation=True)
@@ -35,13 +37,13 @@ def load_model():
35
  # nlp = spacy.load("en_engagement_RoBERTa_context_flz")
36
  nlp = spacy.load("en_engagement_LSTM")
37
  # nlp = spacy.load("en_engagement_spl_RoBERTa_base_attention")
38
- return (nlp)
39
 
40
 
41
  nlp = load_model()
42
 
43
  doc = nlp(
44
- 'Welcome! Probably this is one of the few attempts to teach a machine how to read the discourse...! Although it is not perfect, you should be able to get a good place to start for your stance-taking analyses. The result will be presented here.'
45
  )
46
 
47
  # TPL_ENT = """
@@ -93,40 +95,40 @@ TPL_SPAN_START = """
93
  DEFAULT_TEXT = """Tickner said regardless of the result, the royal commission was a waste of money and he would proceed with a separate inquiry into the issue headed by Justice Jane Matthews. His attack came as the Aboriginal women involved in the case demanded a female minister examine the religious beliefs they claim are inherent in their fight against a bridge to the island near Goolwa in South Australia."""
94
 
95
  TEXT_LIST = [
96
- '''To a significant extent, individuals can be considered responsible for the rise of Hitler to power on the 31st of January, 1933. Hitler himself, the charismatic leader of the Nazi Party, as well as creator of Nazi policy, played a key role in his own rise to power. However, other individuals in government, such as Hindenburg and von Papen were influential in Hitler’s rise. To a small extent, other factors also enabled Hitler to rise to power such as the Depression and the weakness of the political system. Nevertheless to a significant extent, individuals can be held responsible for the rise of Adolf Hitler to power.''',
97
- '''Tickner said regardless of the result, the royal commission was a waste of money and he would proceed with a separate inquiry into the issue headed by Justice Jane Matthews. His attack came as the Aboriginal women involved in the case demanded a female minister examine the religious beliefs they claim are inherent in their fight against a bridge to the island near Goolwa in South Australia.''',
98
- '''Certainly, the argumentation is not without some faults. For example, the statement that “linking homosexuality to witches fulfills the same purpose” is not supported by references to the readings. It is not clear who was linking homosexuality to witches and in what context. Nevertheless, overall and in line with the general tendencies reported in the previous section, the author employs various contracting and expanding engagement resources successfully. However, a large part of the successful use of engagement resources seems to be related to how the author structures these strategies throughout the text, namely in a wave-like fashion: from acknowledging the opinions of others, to countering them by offering one’s own interpretation, to supporting it by acknowledging other sources.''',
99
- '''As the centuries passed, accounts of witchcraft became more and more specific; details of witches’ ceremonies and oaths became more concrete and whatever the condemned humans confessed to was treated as fact. As discussants correctly pointed out, Bernardino of Siena, Martin Le Franc, and the anonymous author of the Errores Gazariorum all have an even more aggressive campaign against witches than did the authors of our previous readings. By depicting their rituals and customs, they look to paint the most grotesque picture of witches possible. Their frenzied accusations, were some of the main catalysts of the subsequent witch hunts.''',
100
- '''The post labeled “Witchcraft as a Problem in Society” clearly explains the contribution that each text makes to the witch hunts. While two of the authors focused on describing, in full detail, the shocking and disturbing practices that witches partook of, the others tried to prove that the witch threat was real. These last texts sought to explain witchcraft so as to convince readers that witches actually existed. As all posts reiterate, the devil is definitely at the source of witchcraft.''',
101
- '''The third part temporarily puts aside mediation analysis and shifts the discussion to moderation analysis. In Chapter 7, I show how a multiple regression model can be made more flexible by allowing one variable’s effect to depend linearly on another variable in the model. The resulting moderated multiple regression model allows an investigator to ascertain the extent to which X’s influence on outcome variable Y is contingent on or interacts with a moderator variable W.''',
102
- '''For instance, research has shown that people have a tendency to justify close others’ unethical actions to protect them (Gino and Galinsky 2012). Research has also shown that parents who feel close to their children often adopt strict curfew practices (Elder et al., 1995). (EC-33)''',
103
- '''Fitzpatrick and Pagani (2013) found that engagement skills in classroom behaviour at kindergarten were related with better math scores and academic success. (LC-0525-EN)''',
104
- '''The COAG Reform Council (2013) indicated that when compared to other students, Australian Year 4 students who attended one year of ECEC services or programs gained 11 points higher in reading (LC-0471-MA). Preliminary evidence suggests that teaching children from low-income families using humanoid robots increases motivation, sense of community, and self-expression... (EC-64). These findings suggest that visual perception takes up only a small fraction of fixation durations. Specifically, Verdelhan (2010) proposes a two-country, one-good model in which each country has an exogenously specified i.i.d. consumption growth process. Waters & Baur (2003) suggest that children or adolescents who are overweight or obese suffer from social and psychological issues. (LC-0460-EN)''',
105
- '''According to the Australian Bureau of Statistics (2008), the percentage of obese or overweight adults is a staggering 60%.
106
  According to George et al. (2011), in the UK immigration has improved the academic performance of the native children.
107
- According to UNICEF (2011) a child that is breastfed within the first hour of life is fourteen times less likely to die from diarrhoea or pneumonia.''',
108
- '''As far as I am concerned, I do think globalization is good chance for China’s developing. From my point of view, I prefer to think that advantages of globalization outweighs disadvantages. ''',
109
- '''As we know, China has made great progress for these years. I think it is the result of globalization. We all know China is a fast-developing country. We can seethe great progress that China has made. ''',
110
- '''His idea was that an important ninth century bishop called John Anglicus may indeed have given birth to a child in full view of everyone on the streets of Rome, but that this bishop was not and never had been the pope. Of course, there is no evidence whatever for this, as Leibnitz himself well knew.''',
111
- '''On the whole, however, when evaluating meanings metaphorically, the Chinese EFL learners hedge and qualify their statements subjectively, tempering the certainty and authority of their assertions rather than using the resources of interpersonal metaphor to reinforce and substantiate their arguments. These tendencies reveal a key area for pedagogical intervention. Namely, instruction could focus on the value of construing metaphors objectively to obscure the author as the source of the evaluation. Similarly, raising students’ awareness of the space of negotiation and the value of offering assertions on a cline of certainty (e.g., IT IS EVIDENT) rather than through exclusive declarations of shared knowledge (e.g., AS WE ALL KNOW) is critical for academic writing refinement. Instructional interventions such as these are key areas for further investigation.''',
112
- '''Of the defendants involved in Utah Pie Company’s case only one seems to have emerged as exceptionally successful. However this success was not a factor of overwhelming market power, as can be seen by the dominant position of Mrs. Smith’s during this time, which had maintained a 39-45 percent market share over the corresponding period.''',
113
- '''Because of the evidence presented by Tremblay and Tremblay, it would appear that mergers in the brewing industry would have been procompetitive because of economies of scale. However, allowing a firm to acquire more than 20% of the market in Wisconsin would give it too much power to charge higher prices, even if the merger would help lower total average costs.''',
114
- '''Taken in whole, the economic evidence for grocery retailers in the decades after the Von’s decision suggests that increased concentration is pro-competitive and good for consumers, running contrary to the fears proposed by the Court.''',
115
- '''The remedies that Justice Lewis Powell prescribed did not gain the desired effect, and I feel that they were not very effective in promoting competition. (Elan, S86)''',
116
- '''There is the possibility for abuse if the producer sets different maximum prices for different retailers, allowing some to reap higher profits.''',
117
- '''Such a program, with appropriate limits, would provide a balanced structure that would ensure quality patient care.''',
118
- '''A recent survey of physician satisfaction by Harvard Medical School found that physician autonomy and the ability to provide high-quality care, not income, are most strongly associated with changes in job satisfaction . Thus, it seems reasonable to assume that health care providers would take advantage of the greater bargaining power to improve the quality of care. (Ken, S78-79)''',
119
- '''It appears, then, that maximum price fixing does the greatest harm when set below a competitive level [evidentialize]. In Case 4 it could potentially do harm to small retailers trying to enter the market [suggest], but does so for the benefit of consumers and the producer. Based purely on the models, it appears that, at the very least, maximum prices deserve a Rule of Reason approach to evaluate their cost and benefits.''',
120
- '''It could be seen that for this 68% of the respondents, Tampines was characteristically a location that provided for them all their basic needs. It can be seen from chart [11] that many people quoted accessibility and proximity to home, and even shopping as one of the ideal factors that drew them there. Accessibility is quite a key factor because it is evident that the regional centre was built on the basis of good infrastructure. In comparison, 32% of the respondents felt that the conventional downtown was still a major attraction, even though the regional centre had gained quite a vast amount of popularity and did to large extent have an air of modernity.'''
121
  ]
122
 
123
 
124
  @st.cache(suppress_st_warning=True)
125
  def preprocess(text):
126
- text = re.sub("\n\n", ' &&&&&&&&#&#&#&#&', text)
127
- text = re.sub('\n', ' ', text)
128
- text = re.sub('\s+', " ", text)
129
- text = re.sub('&&&&&&&&#&#&#&#&', '\n\n', text)
130
  return text
131
 
132
 
@@ -171,7 +173,7 @@ with st.sidebar:
171
  | `Monogloss` | An utterance which does not employ any value of engagement. Such an utterance ignores the dialogic potential in an utterance. |
172
 
173
  """)
174
- #For a more complete description of the category, visit [the annotation guideline](https://egumasa.github.io/engagement-annotation-project/3_Categories/)!!
175
 
176
  st.sidebar.markdown("""
177
  Engagement Analyzer is developed by [Masaki Eguchi](https://masakieguchi.weebly.com).
@@ -211,45 +213,45 @@ with st.expander("See more explanation"):
211
 
212
  """)
213
 
214
- st.info('''Updated on Jan.11th, 2023\n
215
  The current version was trained on 2,519 sentences and tested on 443 sentences. It achieved the following benchmark:
216
  - Macro F1 = .75
217
  - Macro Precision = .78
218
  - Macro Recall = .74
219
  I expect that the model's performance improves as the annotated dataset gets larger.
220
- ''')
221
 
222
  with st.form("my_form"):
223
-
224
  st.subheader("Option 1: selecting example text from list")
225
- text = st.selectbox('', TEXT_LIST)
226
 
227
  st.subheader("Option 2: analyze your own text")
228
  input_text = st.text_area(
229
  label="",
230
- value=
231
- "I would strongly encourage you to put your texts here to analyze it for stance-taking expressions.",
232
- height=120)
233
  st.text(
234
- 'The text from the pull-down list and in the textbox cannot be analyzed at the same time. Please select the mode.'
235
  )
236
 
237
  textmode = st.radio(
238
- label='Choose the mode.',
239
- options=['Option 1: Pull-down choice', 'Option 2: My own text'],
240
- index=1)
 
241
 
242
  submitted = st.form_submit_button("Submit")
243
  if submitted:
244
- if textmode == 'Option 2: My own text':
245
  text = input_text
246
- with st.spinner('Analysis in progress...'):
247
  doc = nlp(preprocess(text))
248
- #st.markdown("> " + input_text)
249
  else:
250
- with st.spinner('Analysis in progress...'):
251
  doc = nlp(preprocess(text))
252
- #st.markdown("> " + text)
253
 
254
  ## Dependency parsing
255
 
@@ -265,21 +267,21 @@ with st.form("my_form"):
265
  # st.write(text)
266
  # delete_span(doc.spans['sc'])
267
 
268
- cleanup_justify(doc, doc.spans['sc'])
269
- delete_overlapping_span(doc.spans['sc'])
270
 
271
  visualize_spans(
272
  doc,
273
  spans_key="sc",
274
  displacy_options={
275
- 'template': {
276
  "span": TPL_SPAN,
277
- 'slice': TPL_SPAN_SLICE,
278
- 'start': TPL_SPAN_START,
279
  },
280
  "colors": {
281
  "ENTERTAIN": "#82b74b",
282
- "DENY": '#c94c4c',
283
  "COUNTER": "#eea29a",
284
  "PRONOUNCE": "#92a8d1",
285
  "ENDORSE": "#034f84",
@@ -291,10 +293,10 @@ visualize_spans(
291
  "CITATION": "#F8C471",
292
  "SOURCES": "#F7DC6F",
293
  "JUSTIFYING": "#2ECC71",
294
- "ENDOPHORIC": "#FAD7A0"
295
  },
296
  },
297
- simple = True
298
  )
299
 
300
  st.subheader("Bibliography")
@@ -304,4 +306,4 @@ st.markdown("""
304
  * Ryshina-Pankova, M. (2014). Exploring academic argumentation in course-related blogs through ENGAGEMENT. In G. Thompson & L. Alba-Juez (Eds.), _Pragmatics & Beyond New Series (Vol. 242, pp. 281–302)_. John Benjamins Publishing Company. https://doi.org/10.1075/pbns.242.14rys
305
  * Wu, S. M. (2007). The use of engagement resources in high- and low-rated undergraduate geography essays. _Journal of English for Academic Purposes, 6_ (3), 254–271. https://doi.org/10.1016/j.jeap.2007.09.006
306
 
307
- """)
 
16
  # "packages/en_engagement_RoBERTa-0.0.2/en_engagement_RoBERTa/en_engagement_RoBERTa-0.0.2"
17
  # )
18
 
19
+ # Load from local storage
20
+ # MODEL_LIST = ['en_engagement_RoBERTa-ME-AtoE.tar.gz']
21
 
22
+ # model = st.selectbox('Select model', MODEL_LIST, index=0)
23
+ # nlp = spacy.load("packages/" + model)
24
 
25
  # Load from huggingface
26
  # sm = spacy.load('en_core_web_sm', disable=['ner'])
27
 
28
+ st.set_page_config(
29
+ page_title="ENGAGEMENT analyzer (beta ver 0.3)",
30
+ layout="wide",
31
+ initial_sidebar_state="expanded",
32
+ )
33
 
34
 
35
  @st.cache(allow_output_mutation=True)
 
37
  # nlp = spacy.load("en_engagement_RoBERTa_context_flz")
38
  nlp = spacy.load("en_engagement_LSTM")
39
  # nlp = spacy.load("en_engagement_spl_RoBERTa_base_attention")
40
+ return nlp
41
 
42
 
43
  nlp = load_model()
44
 
45
  doc = nlp(
46
+ "Welcome! Probably this is one of the few attempts to teach a machine how to read the discourse...! Although it is not perfect, you should be able to get a good place to start for your stance-taking analyses. The result will be presented here."
47
  )
48
 
49
  # TPL_ENT = """
 
95
  DEFAULT_TEXT = """Tickner said regardless of the result, the royal commission was a waste of money and he would proceed with a separate inquiry into the issue headed by Justice Jane Matthews. His attack came as the Aboriginal women involved in the case demanded a female minister examine the religious beliefs they claim are inherent in their fight against a bridge to the island near Goolwa in South Australia."""
96
 
97
  TEXT_LIST = [
98
+ """To a significant extent, individuals can be considered responsible for the rise of Hitler to power on the 31st of January, 1933. Hitler himself, the charismatic leader of the Nazi Party, as well as creator of Nazi policy, played a key role in his own rise to power. However, other individuals in government, such as Hindenburg and von Papen were influential in Hitler’s rise. To a small extent, other factors also enabled Hitler to rise to power such as the Depression and the weakness of the political system. Nevertheless to a significant extent, individuals can be held responsible for the rise of Adolf Hitler to power.""",
99
+ """Tickner said regardless of the result, the royal commission was a waste of money and he would proceed with a separate inquiry into the issue headed by Justice Jane Matthews. His attack came as the Aboriginal women involved in the case demanded a female minister examine the religious beliefs they claim are inherent in their fight against a bridge to the island near Goolwa in South Australia.""",
100
+ """Certainly, the argumentation is not without some faults. For example, the statement that “linking homosexuality to witches fulfills the same purpose” is not supported by references to the readings. It is not clear who was linking homosexuality to witches and in what context. Nevertheless, overall and in line with the general tendencies reported in the previous section, the author employs various contracting and expanding engagement resources successfully. However, a large part of the successful use of engagement resources seems to be related to how the author structures these strategies throughout the text, namely in a wave-like fashion: from acknowledging the opinions of others, to countering them by offering one’s own interpretation, to supporting it by acknowledging other sources.""",
101
+ """As the centuries passed, accounts of witchcraft became more and more specific; details of witches’ ceremonies and oaths became more concrete and whatever the condemned humans confessed to was treated as fact. As discussants correctly pointed out, Bernardino of Siena, Martin Le Franc, and the anonymous author of the Errores Gazariorum all have an even more aggressive campaign against witches than did the authors of our previous readings. By depicting their rituals and customs, they look to paint the most grotesque picture of witches possible. Their frenzied accusations, were some of the main catalysts of the subsequent witch hunts.""",
102
+ """The post labeled “Witchcraft as a Problem in Society” clearly explains the contribution that each text makes to the witch hunts. While two of the authors focused on describing, in full detail, the shocking and disturbing practices that witches partook of, the others tried to prove that the witch threat was real. These last texts sought to explain witchcraft so as to convince readers that witches actually existed. As all posts reiterate, the devil is definitely at the source of witchcraft.""",
103
+ """The third part temporarily puts aside mediation analysis and shifts the discussion to moderation analysis. In Chapter 7, I show how a multiple regression model can be made more flexible by allowing one variable’s effect to depend linearly on another variable in the model. The resulting moderated multiple regression model allows an investigator to ascertain the extent to which X’s influence on outcome variable Y is contingent on or interacts with a moderator variable W.""",
104
+ """For instance, research has shown that people have a tendency to justify close others’ unethical actions to protect them (Gino and Galinsky 2012). Research has also shown that parents who feel close to their children often adopt strict curfew practices (Elder et al., 1995). (EC-33)""",
105
+ """Fitzpatrick and Pagani (2013) found that engagement skills in classroom behaviour at kindergarten were related with better math scores and academic success. (LC-0525-EN)""",
106
+ """The COAG Reform Council (2013) indicated that when compared to other students, Australian Year 4 students who attended one year of ECEC services or programs gained 11 points higher in reading (LC-0471-MA). Preliminary evidence suggests that teaching children from low-income families using humanoid robots increases motivation, sense of community, and self-expression... (EC-64). These findings suggest that visual perception takes up only a small fraction of fixation durations. Specifically, Verdelhan (2010) proposes a two-country, one-good model in which each country has an exogenously specified i.i.d. consumption growth process. Waters & Baur (2003) suggest that children or adolescents who are overweight or obese suffer from social and psychological issues. (LC-0460-EN)""",
107
+ """According to the Australian Bureau of Statistics (2008), the percentage of obese or overweight adults is a staggering 60%.
108
  According to George et al. (2011), in the UK immigration has improved the academic performance of the native children.
109
+ According to UNICEF (2011) a child that is breastfed within the first hour of life is fourteen times less likely to die from diarrhoea or pneumonia.""",
110
+ """As far as I am concerned, I do think globalization is good chance for China’s developing. From my point of view, I prefer to think that advantages of globalization outweighs disadvantages. """,
111
+ """As we know, China has made great progress for these years. I think it is the result of globalization. We all know China is a fast-developing country. We can seethe great progress that China has made. """,
112
+ """His idea was that an important ninth century bishop called John Anglicus may indeed have given birth to a child in full view of everyone on the streets of Rome, but that this bishop was not and never had been the pope. Of course, there is no evidence whatever for this, as Leibnitz himself well knew.""",
113
+ """On the whole, however, when evaluating meanings metaphorically, the Chinese EFL learners hedge and qualify their statements subjectively, tempering the certainty and authority of their assertions rather than using the resources of interpersonal metaphor to reinforce and substantiate their arguments. These tendencies reveal a key area for pedagogical intervention. Namely, instruction could focus on the value of construing metaphors objectively to obscure the author as the source of the evaluation. Similarly, raising students’ awareness of the space of negotiation and the value of offering assertions on a cline of certainty (e.g., IT IS EVIDENT) rather than through exclusive declarations of shared knowledge (e.g., AS WE ALL KNOW) is critical for academic writing refinement. Instructional interventions such as these are key areas for further investigation.""",
114
+ """Of the defendants involved in Utah Pie Company’s case only one seems to have emerged as exceptionally successful. However this success was not a factor of overwhelming market power, as can be seen by the dominant position of Mrs. Smith’s during this time, which had maintained a 39-45 percent market share over the corresponding period.""",
115
+ """Because of the evidence presented by Tremblay and Tremblay, it would appear that mergers in the brewing industry would have been procompetitive because of economies of scale. However, allowing a firm to acquire more than 20% of the market in Wisconsin would give it too much power to charge higher prices, even if the merger would help lower total average costs.""",
116
+ """Taken in whole, the economic evidence for grocery retailers in the decades after the Von’s decision suggests that increased concentration is pro-competitive and good for consumers, running contrary to the fears proposed by the Court.""",
117
+ """The remedies that Justice Lewis Powell prescribed did not gain the desired effect, and I feel that they were not very effective in promoting competition. (Elan, S86)""",
118
+ """There is the possibility for abuse if the producer sets different maximum prices for different retailers, allowing some to reap higher profits.""",
119
+ """Such a program, with appropriate limits, would provide a balanced structure that would ensure quality patient care.""",
120
+ """A recent survey of physician satisfaction by Harvard Medical School found that physician autonomy and the ability to provide high-quality care, not income, are most strongly associated with changes in job satisfaction . Thus, it seems reasonable to assume that health care providers would take advantage of the greater bargaining power to improve the quality of care. (Ken, S78-79)""",
121
+ """It appears, then, that maximum price fixing does the greatest harm when set below a competitive level [evidentialize]. In Case 4 it could potentially do harm to small retailers trying to enter the market [suggest], but does so for the benefit of consumers and the producer. Based purely on the models, it appears that, at the very least, maximum prices deserve a Rule of Reason approach to evaluate their cost and benefits.""",
122
+ """It could be seen that for this 68% of the respondents, Tampines was characteristically a location that provided for them all their basic needs. It can be seen from chart [11] that many people quoted accessibility and proximity to home, and even shopping as one of the ideal factors that drew them there. Accessibility is quite a key factor because it is evident that the regional centre was built on the basis of good infrastructure. In comparison, 32% of the respondents felt that the conventional downtown was still a major attraction, even though the regional centre had gained quite a vast amount of popularity and did to large extent have an air of modernity.""",
123
  ]
124
 
125
 
126
  @st.cache(suppress_st_warning=True)
127
  def preprocess(text):
128
+ text = re.sub("\n\n", " &&&&&&&&#&#&#&#&", text)
129
+ text = re.sub("\n", " ", text)
130
+ text = re.sub("\s+", " ", text)
131
+ text = re.sub("&&&&&&&&#&#&#&#&", "\n\n", text)
132
  return text
133
 
134
 
 
173
  | `Monogloss` | An utterance which does not employ any value of engagement. Such an utterance ignores the dialogic potential in an utterance. |
174
 
175
  """)
176
+ # For a more complete description of the category, visit [the annotation guideline](https://egumasa.github.io/engagement-annotation-project/3_Categories/)!!
177
 
178
  st.sidebar.markdown("""
179
  Engagement Analyzer is developed by [Masaki Eguchi](https://masakieguchi.weebly.com).
 
213
 
214
  """)
215
 
216
+ st.info("""Updated on Jan.11th, 2023\n
217
  The current version was trained on 2,519 sentences and tested on 443 sentences. It achieved the following benchmark:
218
  - Macro F1 = .75
219
  - Macro Precision = .78
220
  - Macro Recall = .74
221
  I expect that the model's performance improves as the annotated dataset gets larger.
222
+ """)
223
 
224
  with st.form("my_form"):
 
225
  st.subheader("Option 1: selecting example text from list")
226
+ text = st.selectbox("", TEXT_LIST)
227
 
228
  st.subheader("Option 2: analyze your own text")
229
  input_text = st.text_area(
230
  label="",
231
+ value="I would strongly encourage you to put your texts here to analyze it for stance-taking expressions.",
232
+ height=120,
233
+ )
234
  st.text(
235
+ "The text from the pull-down list and in the textbox cannot be analyzed at the same time. Please select the mode."
236
  )
237
 
238
  textmode = st.radio(
239
+ label="Choose the mode.",
240
+ options=["Option 1: Pull-down choice", "Option 2: My own text"],
241
+ index=1,
242
+ )
243
 
244
  submitted = st.form_submit_button("Submit")
245
  if submitted:
246
+ if textmode == "Option 2: My own text":
247
  text = input_text
248
+ with st.spinner("Analysis in progress..."):
249
  doc = nlp(preprocess(text))
250
+ # st.markdown("> " + input_text)
251
  else:
252
+ with st.spinner("Analysis in progress..."):
253
  doc = nlp(preprocess(text))
254
+ # st.markdown("> " + text)
255
 
256
  ## Dependency parsing
257
 
 
267
  # st.write(text)
268
  # delete_span(doc.spans['sc'])
269
 
270
+ cleanup_justify(doc, doc.spans["sc"])
271
+ delete_overlapping_span(doc.spans["sc"])
272
 
273
  visualize_spans(
274
  doc,
275
  spans_key="sc",
276
  displacy_options={
277
+ "template": {
278
  "span": TPL_SPAN,
279
+ "slice": TPL_SPAN_SLICE,
280
+ "start": TPL_SPAN_START,
281
  },
282
  "colors": {
283
  "ENTERTAIN": "#82b74b",
284
+ "DENY": "#c94c4c",
285
  "COUNTER": "#eea29a",
286
  "PRONOUNCE": "#92a8d1",
287
  "ENDORSE": "#034f84",
 
293
  "CITATION": "#F8C471",
294
  "SOURCES": "#F7DC6F",
295
  "JUSTIFYING": "#2ECC71",
296
+ "ENDOPHORIC": "#FAD7A0",
297
  },
298
  },
299
+ simple=False,
300
  )
301
 
302
  st.subheader("Bibliography")
 
306
  * Ryshina-Pankova, M. (2014). Exploring academic argumentation in course-related blogs through ENGAGEMENT. In G. Thompson & L. Alba-Juez (Eds.), _Pragmatics & Beyond New Series (Vol. 242, pp. 281–302)_. John Benjamins Publishing Company. https://doi.org/10.1075/pbns.242.14rys
307
  * Wu, S. M. (2007). The use of engagement resources in high- and low-rated undergraduate geography essays. _Journal of English for Academic Purposes, 6_ (3), 254–271. https://doi.org/10.1016/j.jeap.2007.09.006
308
 
309
+ """)