Update app.py
Browse files
app.py
CHANGED
@@ -97,6 +97,14 @@ import allennlp_models.tagging
|
|
97 |
predictor = Predictor.from_path("structured-prediction-srl-bert.tar.gz")
|
98 |
|
99 |
#---------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
#---------------------------------------------------------------
|
101 |
# @st.cache
|
102 |
def claim(text):
|
@@ -174,7 +182,7 @@ def claim(text):
|
|
174 |
else:
|
175 |
substr = substr + val_string[i]
|
176 |
substr = substr.strip() # remove leading/trailing white space
|
177 |
-
pronouns =
|
178 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
179 |
who.add(substr)
|
180 |
else:
|
@@ -205,7 +213,7 @@ def claim(text):
|
|
205 |
else:
|
206 |
substr = substr + val_string[i]
|
207 |
substr = substr.strip() # remove leading/trailing white space
|
208 |
-
pronouns =
|
209 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
210 |
what.add(substr)
|
211 |
else:
|
@@ -234,7 +242,7 @@ def claim(text):
|
|
234 |
else:
|
235 |
substr = substr + val_string[i]
|
236 |
substr = substr.strip() # remove leading/trailing white space
|
237 |
-
pronouns =
|
238 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
239 |
why.add(substr)
|
240 |
else:
|
@@ -263,7 +271,7 @@ def claim(text):
|
|
263 |
else:
|
264 |
substr = substr + val_string[i]
|
265 |
substr = substr.strip() # remove leading/trailing white space
|
266 |
-
pronouns =
|
267 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
268 |
when.add(substr)
|
269 |
else:
|
@@ -293,7 +301,7 @@ def claim(text):
|
|
293 |
else:
|
294 |
substr = substr + val_string[i]
|
295 |
substr = substr.strip() # remove leading/trailing white space
|
296 |
-
pronouns =
|
297 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
298 |
where.add(substr)
|
299 |
else:
|
|
|
97 |
predictor = Predictor.from_path("structured-prediction-srl-bert.tar.gz")
|
98 |
|
99 |
#---------------------------------------------------------------
|
100 |
+
list_of_pronouns = ["I", "you", "he", "she", "it", "we", "they", "me", "him", "her", "us", "them",
|
101 |
+
"mine", "yours", "his", "hers", "its", "ours", "theirs",
|
102 |
+
"this", "that", "these", "those",
|
103 |
+
"myself", "yourself", "himself", "herself", "itself", "ourselves", "yourselves", "themselves",
|
104 |
+
"who", "whom", "what", "which", "whose",
|
105 |
+
"all", "another", "any", "anybody", "anyone", "anything", "both", "each", "either",
|
106 |
+
"everybody", "everyone", "everything", "few", "many", "neither", "nobody", "none", "nothing",
|
107 |
+
"one", "other", "several", "some", "somebody", "someone", "something"]
|
108 |
#---------------------------------------------------------------
|
109 |
# @st.cache
|
110 |
def claim(text):
|
|
|
182 |
else:
|
183 |
substr = substr + val_string[i]
|
184 |
substr = substr.strip() # remove leading/trailing white space
|
185 |
+
pronouns = list_of_pronouns
|
186 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
187 |
who.add(substr)
|
188 |
else:
|
|
|
213 |
else:
|
214 |
substr = substr + val_string[i]
|
215 |
substr = substr.strip() # remove leading/trailing white space
|
216 |
+
pronouns = list_of_pronouns
|
217 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
218 |
what.add(substr)
|
219 |
else:
|
|
|
242 |
else:
|
243 |
substr = substr + val_string[i]
|
244 |
substr = substr.strip() # remove leading/trailing white space
|
245 |
+
pronouns = list_of_pronouns
|
246 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
247 |
why.add(substr)
|
248 |
else:
|
|
|
271 |
else:
|
272 |
substr = substr + val_string[i]
|
273 |
substr = substr.strip() # remove leading/trailing white space
|
274 |
+
pronouns = list_of_pronouns
|
275 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
276 |
when.add(substr)
|
277 |
else:
|
|
|
301 |
else:
|
302 |
substr = substr + val_string[i]
|
303 |
substr = substr.strip() # remove leading/trailing white space
|
304 |
+
pronouns = list_of_pronouns
|
305 |
if substr.lower() not in pronouns and not substr.lower().endswith("'s"): # remove pronouns and possessive pronouns
|
306 |
where.add(substr)
|
307 |
else:
|