|
name: Bluemoon |
|
description: "Bluemoon 1-1 Fandom RP+ERP cleaned and formatted for Fastchat" |
|
|
|
readers: |
|
- reader: &bluemoon |
|
type: csv |
|
config: |
|
fields: |
|
conversation: 'thread_href' |
|
from: 'message_username' |
|
message: 'message' |
|
|
|
writers: |
|
- writer: &fastchat_pretty |
|
type: fastchat |
|
config: |
|
indent: 2 |
|
|
|
debug_steps: |
|
- step: &extract_ooc |
|
type: RegexExtract |
|
description: "Extract OOC matches for examination" |
|
config: |
|
path: 'out/ooc.txt' |
|
dotAll: true |
|
multiLine: true |
|
escape: true |
|
overwrite: true |
|
patterns: [ |
|
'\{.*\}', '\[.*?\]', '\(\(.*?(\)|\W)\)+', '^\(.*?\){1}', '\n\n\(.*?\){1}$', |
|
'(OOC|ooc|OoC)(:| |-)\n?.*?(\n|$)', |
|
'(\n\nSee more|See more\n\n)', '^(RE|Re):.*?\n', '^NSFW:.*?\n$', |
|
'^Note to everyone.*\)\)\n', '_*Author.*\n*_', |
|
'x{3,}.*TEST?x*', '^- Let me.*-\B\s+' |
|
] |
|
|
|
- step: &extract_links |
|
type: RegexExtract |
|
description: "Extract links for examination." |
|
config: |
|
path: 'out/links.txt' |
|
escape: true |
|
overwrite: true |
|
patterns: [ |
|
'\[img|video.*\[\/img|video\]+', |
|
'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+' |
|
] |
|
|
|
- step: &extract_trim_nonwords |
|
type: RegexExtract |
|
description: "Extract leading non-word data for examination." |
|
config: |
|
path: 'out/trim-nonwords.txt' |
|
dotAll: true |
|
multiLine: true |
|
escape: true |
|
overwrite: true |
|
patterns: [ |
|
'^(-|,|\||\.|=|_|])\W*(s|\W)+\W(\b|\n)', |
|
'^([w_=x]{5,}|~\+\+~)(\b|\n)', |
|
'^(_|])+(\b|\n)', '^(\s|\.|,|\|)+' |
|
] |
|
|
|
steps: |
|
- step: &html_linebreaks |
|
type: ExactReplace |
|
description: "Convert html <br/> line breaks to \n" |
|
config: |
|
replacements: [ [ '<br/>', "\n" ] ] |
|
|
|
- step: &html_strip |
|
type: HtmlStrip |
|
description: "Strip HTML" |
|
|
|
- step: &ooc_strip |
|
type: RegexReplace |
|
description: "Strip OOC content and some HTML errors." |
|
config: |
|
dotAll: true |
|
multiLine: true |
|
replacements: [ |
|
|
|
[ '\{.*\}', "" ], [ '\[.*?\]', "" ], [ '\(\(.*?(\)|\W)\)+', "" ], |
|
|
|
[ '^\(.*?\){1}', "" ], [ '\n\n\(.*?\){1}$', "" ], |
|
[ '(OOC|ooc|OoC)(:| |-)\n?.*?(\n|$)', "" ], |
|
[ '(\n\nSee more|See more\n\n)', "" ], [ '^(RE|Re):.*?\n', "" ], [ '^NSFW:.*?\n$', "" ], |
|
|
|
[ '^Note to everyone.*\)\)\n', "" ], [ '_*Author.*\n*_', "" ], |
|
[ 'x{3,}.*TEST?x*', "" ], [ '^- Let me.*-', "" ] |
|
] |
|
|
|
- step: &links |
|
type: RegexReplace |
|
description: "Remove all links" |
|
config: |
|
replacements: [ |
|
[ '\[(img|video).*].*\[(\/img|video)\]', "" ], |
|
[ '[hH]ttp[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', "" ] |
|
] |
|
|
|
- step: &reduce_whitespace |
|
type: ExactReplace |
|
description: "Reduce standalone tabs that do not affect formatting, and newlines to maximum of two consecutive." |
|
config: |
|
recursive: true |
|
replacements: [ |
|
[ "\t\n", "\n" ], [ "\n\n\n", "\n\n" ], [ ' ', ' ' ], [ " \n", "\n" ] |
|
] |
|
|
|
- step: &trim |
|
type: Trim |
|
description: "Trim leading and trailing whitespace." |
|
|
|
- step: &ooc_prune |
|
type: FullMatch |
|
description: "Prune fully OOC messages with known content." |
|
config: |
|
action: drop |
|
caseSensitive: false |
|
patterns: [ |
|
"BUMP", "-BUMP-", "~BUMP~", "Closed...", "Closed", "This thread is closed", "bump.", "*DELETED*", |
|
"...", "Okay... so you didn't make a starting post??", "-----", "~~~~~" ] |
|
|
|
- step: &strip_unicode |
|
type: Encoding |
|
description: "Strip unicode sequences not present in ascii. This doesn't affect output encoding." |
|
config: |
|
invalid: "" |
|
codec: us-ascii |
|
|
|
- step: &trim_nonwords |
|
type: RegexReplace |
|
description: "Consecutive non-word characters at start and end of messages." |
|
config: |
|
dotAll: true |
|
multiLine: true |
|
replacements: [ |
|
[ '^(-|,|\||\.|=|_|])\W*(s|\W)+\W(\b|\n)', "" ], |
|
[ '^([w_=x]{5,}|~\+\+~)(\b|\n)', "" ], |
|
[ '^(_|])+(\b|\n)', "" ], [ '^(\s|\.|,|\|)+', "" ] |
|
] |
|
|
|
- step: &empty |
|
type: FullMatch |
|
description: "Drop empty messages." |
|
config: |
|
action: drop |
|
patterns: [ "" ] |
|
|
|
- step: &two_alternating_participants |
|
type: Participants |
|
description: "Require exactly 2 alternating participants" |
|
config: |
|
min: 2 |
|
max: 2 |
|
alternating: true |
|
|
|
- step: &rename_participants |
|
type: RenameParticipants |
|
description: "Rename participants to their conversation roles." |
|
config: |
|
names: [ "human", "gpt" ] |
|
|
|
- step: &edge_cases |
|
type: ExactReplace |
|
description: "Remove a few edge cases." |
|
config: |
|
replacements: [ |
|
[ "TEXT TEXT TEXT TEXT TEXT\nTEXT TEXTTEXTTEXT", "" ], |
|
[ "hvlr\n/\n", "" ], |
|
[ "' s ,\ns s.\ns s, ,\ns.\n", "" ], |
|
[ "I'll post first\n_ _ _ _ _ _ _ _ _ _ _\n", "" ], [ "Moved from PMs to threads", "" ], |
|
[ "NSFW\n\n", "" ], |
|
] |
|
|
|
input: |
|
- path: "data/rentry/bluemoon/bluemoon-fanbased-roleplays-1x1.csv" |
|
description: "Bluemoon 1-1 Fandom RP+ERP" |
|
reader: *bluemoon |
|
steps: [ *html_linebreaks, *links, *html_strip, *trim, *reduce_whitespace, |
|
*ooc_strip, *ooc_prune ] |
|
|
|
output: |
|
- name: 'Bluemoon' |
|
path: 'out/bluemoon.json' |
|
description: 'Bluemoon 1-1 Fandom RP+ERP cleaned and formatted for Fastchat' |
|
writer: fastchat |
|
steps: [ *strip_unicode, *reduce_whitespace, *trim_nonwords, *edge_cases, *trim, *empty, |
|
*two_alternating_participants, *rename_participants ] |