File size: 4,211 Bytes
a9c9fcf
 
 
 
 
9e890c9
a9c9fcf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8267d8a
a9c9fcf
 
8267d8a
a9c9fcf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8267d8a
a9c9fcf
 
 
 
 
8267d8a
a9c9fcf
 
 
 
 
8267d8a
a9c9fcf
 
 
 
 
 
 
8267d8a
a9c9fcf
 
8267d8a
a9c9fcf
 
 
 
 
 
 
8267d8a
a9c9fcf
 
 
 
8267d8a
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
_input_steps:
  - step: &bluemoon
      type: CsvInput
      sync: main
      config:
        path: "original/rentry/bluemoon/bluemoon-fanbased-roleplays-1x1.csv"
        fields:
          conversation: 'thread_href'
          from: 'message_username'
          message: 'message'

_debug_steps:
  - step: &extract_ooc
      type: RegexExtract
      description: "Extract OOC matches for examination"
      config:
        path: 'out/ooc_%worker%.txt'
        dotAll: true
        multiLine: true
        escape: true
        patterns: [
          '\{.*\}', '\[.*?\]', '\(\(.*?(\)|\W)\)+', '^\(.*?\){1}', '\([^\(]+\)$',
          '(OOC|ooc|OoC|OCC|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.*-', '^.*\^\^;.*\){1}',
          '^As the title suggests.*Littleton.', '^.*\)\)\n'
        ]

  - 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|\.|,|\|)+'
        ]

  - step: &strip_usernames
      type: ExactReplace
      pack: [ 'resources/gen/usernames.csv' ]
      config:
        caseSensitive: true
        packedReplacements: [ 'resources/gen/usernames.csv' ]


passes:
  # Collect all usernames from source data
  - pass: &usernames
      required:
        - path: "data/rentry/bluemoon/bluemoon-fanbased-roleplays-1x1.csv"
          sha512: f31d6bd278bc4211736d6aace3917cd0c1d0143bec9bf9d07054f5f9b32060e17399b6ea0935774b2271ac45a88309a60ef8eec8c4ac5283d1b353a255529cc5
      steps:
        - *bluemoon
        - type: CsvOutput
          description: "Extract usernames"
          config:
            path: 'out/usernames_%worker%.csv'
            ignoreDuplicates: true
            fields: [ 'from' ]
        - type: FileConcatenate
          sync: main
          config:
            path: 'resources/gen/usernames_all.csv'
            files: [ 'out/usernames_*.csv' ]
            ignoreDuplicateLines: true
            eol: "\r\n"
            delete: true
      artifacts:
        - file: 'resources/gen/usernames_all.csv'
          sha512: ffcc8aa980f4d8b0cace9092280d07215337cc316cb3fa45742a5f5a735d21a31f581d27884a414df21ac99616d14c7ebec1ab68a5766c10faa4b1564ceb7c20

  # Count the occurrences of usernames in messages in the source data
  - pass: &count_usernames
      required:
        - path: "resources/gen/usernames_all.csv"
          sha512: ffcc8aa980f4d8b0cace9092280d07215337cc316cb3fa45742a5f5a735d21a31f581d27884a414df21ac99616d14c7ebec1ab68a5766c10faa4b1564ceb7c20
        - path: "data/rentry/bluemoon/bluemoon-fanbased-roleplays-1x1.csv"
          sha512: f31d6bd278bc4211736d6aace3917cd0c1d0143bec9bf9d07054f5f9b32060e17399b6ea0935774b2271ac45a88309a60ef8eec8c4ac5283d1b353a255529cc5
      steps:
        - *bluemoon
        - type: StatsCountOccurrences
          description: "Count occurrences of usernames."
          pack: [ 'resources/gen/usernames_all.csv' ]
          config:
            path: 'out/usernames_counted_%worker%.csv'
            packedPatterns: [ 'resources/gen/usernames_all.csv' ]
            countCol: 2
            regex: false
            min: 1
        - type: StatsAddColMerge
          description: "Merge username count csv files"
          sync: main
          config:
            path: 'resources/gen/usernames.csv'
            files: [ 'out/usernames_counted_*.csv' ]
            cols: [ 2 ]
            min: 1
      artifacts:
        - file: 'resources/gen/usernames.csv'