File size: 1,132 Bytes
284253a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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);