noznarb's picture
Upload 6 files
284253a
raw
history blame
1.13 kB
import json
import re
fname = "bluemoon_roleplay_300k_vicuna.json";
with open(fname,"r") as f:
d = json.load(f);
mr = re.compile(r'(((OOC|OCC|ooc|occ|Occ|Ooc|OoC))|(OFF)):.*?((([ \.!?](IC|DE|BIC|ic|bic)[:\. ])|((BiC[:]?)|[\.!?](on:|ON:|On:)))|$)');
#remaining implicit OOC'ing
manual = [
"OOC: Sorry for the redonculous wait. Work takes priority ",
"OOC: I hope you don't mind that I put a time skip in here",
"OOC: Give her broken english.",
"OoC: aww, and here I'd been hoping that something would be done with the soul edge fragments",
"OOC:Oh sure. It's ok ",
"OOC: Sorry for being gone so long...I hope you will continue rping with me",
];
for conv in d:
for m in conv["conversations"]:
l = mr.search(m["value"]);
if l != None:
print(m["value"]);
s = mr.sub("",m["value"]);
if len(s) > 0:
print("--->",s,end="\n\n");
m["value"] = s;
else:
print("---> MANUAL INTERVENTION REQUIRED. CHECK KEYWORDS.");
s = m["value"];
for e in manual:
s = re.sub(e,"",s);
m["value"] = s;
fname = "bluemoon_roleplay_300k_vicuna_filtered.json";
with open(fname,"w") as f:
json.dump(d,f,indent=2);