Spaces:
Running
Running
aliasgerovs
commited on
Commit
•
dd505ce
1
Parent(s):
89d0a2c
Update app.py
Browse files
app.py
CHANGED
@@ -202,6 +202,11 @@ def remove_special_characters(text):
|
|
202 |
text = re.sub(pattern, '', text)
|
203 |
return text
|
204 |
|
|
|
|
|
|
|
|
|
|
|
205 |
def update_character_count(text):
|
206 |
return f"{len(text)} characters"
|
207 |
|
@@ -281,9 +286,10 @@ def ai_generated_test(ai_option, input):
|
|
281 |
segments = split_text_allow_complete_sentences_nltk(input)
|
282 |
|
283 |
for i in range(samples_len):
|
284 |
-
|
|
|
285 |
bc_score = predict_bc(text_bc_model, text_bc_tokenizer,cleaned_text )
|
286 |
-
mc_score = predict_mc(text_mc_model, text_mc_tokenizer,
|
287 |
bc_scores.append(bc_score)
|
288 |
mc_scores.append(mc_score)
|
289 |
|
|
|
202 |
text = re.sub(pattern, '', text)
|
203 |
return text
|
204 |
|
205 |
+
def remove_special_characters_2(text):
|
206 |
+
pattern = r'[^a-zA-Z0-9 ]+'
|
207 |
+
text = re.sub(pattern, '', text)
|
208 |
+
return text
|
209 |
+
|
210 |
def update_character_count(text):
|
211 |
return f"{len(text)} characters"
|
212 |
|
|
|
286 |
segments = split_text_allow_complete_sentences_nltk(input)
|
287 |
|
288 |
for i in range(samples_len):
|
289 |
+
cleaned_text_bc = remove_special_characters(segments[i])
|
290 |
+
cleaned_text_mc = remove_special_characters_2(segments[i])
|
291 |
bc_score = predict_bc(text_bc_model, text_bc_tokenizer,cleaned_text )
|
292 |
+
mc_score = predict_mc(text_mc_model, text_mc_tokenizer, cleaned_text_mc)
|
293 |
bc_scores.append(bc_score)
|
294 |
mc_scores.append(mc_score)
|
295 |
|