]> zdv2.bktei.com Git - BK-2020-03.git/blob - unitproc/find_erotica.sh
chore(unitproc/find_erotica.sh):Adjust vocab
[BK-2020-03.git] / unitproc / find_erotica.sh
1 #!/bin/bash
2 # Desc: Searches for erotic phrases in text files in specified working directory
3 # Usage: find_erotica.sh [dir]
4 # Depends: GNU Find utils, GNU Parallel 20210822, GNU Grep, GNU Coreutils 8.32, bc
5 # Version: 0.2.2
6
7
8 FIN_MAX=400;
9 export SHOW_FILENAME=false;
10 export CONTEXT_NOUN=128;
11 export CONTEXT_ADJ=64;
12 export CONTEXT_VERB=32;
13 export CONTEXT_MIX_1=32
14 export CONTEXT_MIX_2=32
15 export CONTEXT_PHRASE=16;
16
17
18 yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
19 die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status
20 must() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails
21 search_thread() {
22 # Desc: Apply filters to a file
23 # Depends: find_nouns();
24 # Input: arg1 file path
25 # Output: stdout search results
26
27 if [[ ! -f "$1" ]]; then die "FATAL:Not a file:$1"; fi;
28 local fin="$1";
29 # yell "STATUS:Starting search_thread() on ${fin}" # debug;
30 # yell "Processing: ${fin}..."; # debug
31
32 mapfile -t output < <(
33 find_nouns "$1" | \
34 find_adjectives | \
35 find_verbs | \
36 # find_mix_1 | \
37 # find_mix_2 | \
38 find_phrase | \
39 grep -v -- '-$'; # ADJUST ME
40 );
41
42 if [[ "${#output[@]}" -gt 1 ]]; then
43 printf "%s\n" "$(basename "${fin}" )";
44 printf "Result: %d lines.\n" "${#output[@]}";
45 printf "%s\n" "${output[@]}";
46 printf "\n";
47 fi;
48
49 # yell "STATUS:Finished search_thread() on ${fin}" # debug;
50 };
51 find_nouns() {
52 # Desc: Find nouns
53 # Usage: find_nouns [path]
54 # Input: arg1 text file path
55 # CONTEXT_NOUN grep parameter
56 # Output: stdout lines matching grep patterns
57
58 if [[ ! -f "$1" ]]; then die "FATAL:Not a file:$1"; fi;
59 fin="$1";
60
61 #yell "STATUS:Starting find_nouns() on $fin" # debug;
62
63 local cmd+=('grep');
64 cmd+=('--ignore-case');
65 cmd+=('--extended-regexp');
66 if [[ "$SHOW_FILENAME" == "true" ]]; then cmd+=('--with-filename'); fi;
67 cmd+=('--line-number');
68 cmd+=('--context' "$CONTEXT_NOUN");
69 cmd+=('-e' 'nipple');
70 cmd+=('-e' 'areola');
71 cmd+=('-e' 'breast');
72 cmd+=('-e' 'womanhood');
73 cmd+=('-e' 'manhood');
74 cmd+=('-e' 'his member');
75 cmd+=('-e' 'slit');
76 cmd+=('-e' 'pussy');
77 cmd+=('-e' 'vagina');
78 cmd+=('-e' ' cock');
79 cmd+=('-e' 'dildo');
80 cmd+=('-e' 'shaft');
81 cmd+=('-e' 'blood');
82 cmd+=('-e' ' lust');
83 cmd+=('-e' 'tongue');
84 cmd+=('-e' 'neck');
85 cmd+=('-e' 'voyeur');
86 cmd+=('-e' 'ecstacy');
87 cmd+=('-e' 'pleasure');
88 cmd+=('-e' 'tingle');
89 cmd+=('-e' 'orgasm');
90 cmd+=('-e' 'lips');
91 cmd+=('-e' 'lovers');
92 cmd+=('-e' 'hard-on');
93 cmd+=('-e' 'sex');
94 cmd+=('-e' 'throat');
95 cmd+=('-e' 'cleavage');
96 cmd+=('-e' 'kiss');
97 cmd+=('--');
98 cmd+=("$fin");
99 local output; mapfile -t output < <( "${cmd[@]}"; );
100 printf "%s\n" "${output[@]}";
101 #printf "Found %d matching lines for nouns.\n" "${#output[@]}" 1>&2; # debug
102 # yell "STATUS:Finished find_nouns() on $fin" # debug;
103 }; # find nouns
104 find_adjectives() {
105 # Desc: Find adjectives
106 # Usage: cat *.txt | find_adjectives
107 # Input: stdin input lines
108 # CONTEXT_ADJ grep parameter
109 # Output: stdout lines matching grep patterns
110
111 local cmd+=('grep');
112 cmd+=('--ignore-case');
113 cmd+=('--extended-regexp');
114 cmd+=('--context' "$CONTEXT_ADJ");
115 cmd+=('-e' 'handsome');
116 cmd+=('-e' 'gorgeous');
117 cmd+=('-e' 'beautiful');
118 cmd+=('-e' 'bewitching');
119 cmd+=('-e' 'seductive');
120 cmd+=('-e' 'lusty');
121 cmd+=('-e' 'comely');
122 cmd+=('-e' 'stunning');
123 cmd+=('-e' 'elegant');
124 cmd+=('-e' 'exquisite');
125 cmd+=('-e' 'luxurious');
126 cmd+=('-e' 'ravishing');
127 cmd+=('-e' 'magnificent');
128 cmd+=('-e' 'glistening');
129 cmd+=('-e' 'lovely');
130 cmd+=('-e' 'loving');
131 cmd+=('-e' 'sexy|sexual|sexiest');
132 cmd+=('-e' 'sweet');
133 cmd+=('-e' 'sensual');
134 cmd+=('-e' 'arousing');
135 cmd+=('-e' 'warm');
136 cmd+=('-e' 'moist');
137 cmd+=('-e' 'soaked');
138 cmd+=('-e' 'hot');
139 cmd+=('-e' 'gentle');
140 cmd+=('-e' 'supple');
141 cmd+=('-e' 'tender');
142 cmd+=('-e' 'pleasurabl');
143 cmd+=('-e' 'buxom|busty|curvy');
144 cmd+=('-e' 'naked|nude');
145 cmd+=('--');
146 cmd+=('-');
147
148 local output; mapfile -t output < <( "${cmd[@]}"; );
149 printf "%s\n" "${output[@]}";
150 #printf "Found %d matching lines for adjectives.\n" "${#output[@]}" 1>&2; # debug
151 }; # find adjectives
152 find_verbs() {
153 # Desc: Find verbs
154 # Usage: cat *.txt | find_verbs
155 # Input: stdin input lines
156 # CONTEXT_VERB grep parameter
157 # Output: stdout lines matching grep patterns
158
159 local cmd+=('grep');
160 cmd+=('--ignore-case');
161 cmd+=('--extended-regexp');
162 cmd+=('--context' "$CONTEXT_VERB");
163 cmd+=('-e' 'love');
164 cmd+=('-e' 'nuzzle');
165 cmd+=('-e' 'pleasure');
166 cmd+=('-e' 'make love');
167 cmd+=('-e' 'fuck');
168 cmd+=('-e' 'arouse');
169 cmd+=('-e' 'quiver');
170 cmd+=('-e' 'tremble');
171 cmd+=('-e' 'caress');
172 cmd+=('-e' 'knead');
173 cmd+=('-e' 'kiss');
174 cmd+=('-e' 'moan');
175 cmd+=('-e' 'suck|suckle');
176 cmd+=('-e' 'fondle');
177 cmd+=('-e' 'grope');
178 cmd+=('-e' 'feel up|felt up|felt (me|her|him) up');
179 cmd+=('--');
180 cmd+=('-');
181 local output; mapfile -t output < <( "${cmd[@]}"; );
182 printf "%s\n" "${output[@]}";
183 #printf "Found %d matching lines for verbs.\n" "${#output[@]}" 1>&2; # debug
184 }; # find verbs
185 find_mix_1() {
186 # Desc: Filter mix 1
187 # Usage: cat *.txt | find_mix_1
188 # Input: stdin input lines
189 # CONTEXT_VERB grep parameter
190 # Output: stdout lines matching grep patterns
191 local cmd+=('grep');
192 cmd+=('--ignore-case');
193 cmd+=('--context' "$CONTEXT_MIX_1");
194 cmd+=('-e' 'kiss');
195 cmd+=('-e' 'breast');
196 cmd+=('-e' 'tits');
197 cmd+=('-e' 'manhood');
198 cmd+=('-e' 'vagina');
199 cmd+=('-e' 'sex');
200 cmd+=('--');
201 cmd+=('-');
202 local output; mapfile -t output < <( "${cmd[@]}"; );
203 printf "%s\n" "${output[@]}";
204 };
205 find_mix_2() {
206 # Desc: Filter mix 2
207 # Usage: cat *.txt | find_mix_2
208 # Input: stdin input lines
209 # CONTEXT_VERB grep parameter
210 # Output: stdout lines matching grep patterns
211
212 local cmd+=('grep');
213 cmd+=('--ignore-case');
214 cmd+=('--context' "$CONTEXT_MIX_2");
215 cmd+=('-e' 'nipple');
216 cmd+=('-e' 'womanhood');
217 cmd+=('-e' 'manhood');
218 cmd+=('-e' 'slit');
219 cmd+=('-e' 'pussy');
220 cmd+=('-e' 'vagina');
221 cmd+=('-e' 'cock');
222 cmd+=('-e' 'shaft');
223 cmd+=('-e' '\ lust');
224 cmd+=('-e' 'voyeur');
225 cmd+=('-e' 'ecstacy');
226 cmd+=('-e' 'tingle');
227 cmd+=('-e' 'orgasm');
228 cmd+=('-e' 'gorgeous');
229 cmd+=('-e' 'bewitching');
230 cmd+=('-e' 'seductive');
231 cmd+=('-e' 'lusty');
232 cmd+=('-e' 'stunning');
233 cmd+=('-e' 'ravishing');
234 cmd+=('-e' 'lovely');
235 cmd+=('-e' 'sexy');
236 cmd+=('-e' 'sweet');
237 cmd+=('-e' 'sexiest');
238 cmd+=('-e' 'sensual');
239 cmd+=('-e' 'arousing');
240 cmd+=('-e' 'moist');
241 cmd+=('-e' 'love');
242 cmd+=('-e' 'nuzzle');
243 cmd+=('-e' 'pleasure');
244 cmd+=('-e' 'make\ love');
245 cmd+=('-e' 'sex');
246 cmd+=('-e' 'fuck');
247 cmd+=('-e' 'arouse');
248 cmd+=('-e' 'kiss');
249 cmd+=('-e' 'breast');
250 cmd+=('-e' 'tits');
251 cmd+=('-e' 'manhood');
252 cmd+=('-e' 'vagina');
253 cmd+=('-e' 'lips');
254 cmd+=('-e' 'lovers');
255 cmd+=('--');
256 cmd+=('-');
257 local output; mapfile -t output < <( "${cmd[@]}"; );
258 printf "%s\n" "${output[@]}";
259 };
260 find_phrase () {
261 # Desc: Filter phrase
262 # Usage: cat *.txt | find_phrase
263 # Input: stdin input lines
264 # CONTEXT_VERB grep parameter
265 # Output: stdout lines matching grep patterns
266
267 local cmd+=('grep');
268 cmd+=('--ignore-case');
269 cmd+=('--context' "$CONTEXT_PHRASE");
270 cmd+=('--extended-regexp');
271 cmd+=('--color=always');
272 cmd+=('-e' '( his| her| my) [^\.|;]{,48}( his| her| my) (breast|pussy|tits|nipple|womanhood|cock( |\.|,)|manhood|dick|cunt)');
273 cmd+=('-e' '( his| her| my) [^\.|;]{,24}nipple.{,24}harden');
274 cmd+=('-e' '(suck|lick)[^\.|;]{,12} (nipple|cock( |\.|,)|dick)');
275 cmd+=('-e' '(slap)[^\.|;]{,12}( ass)');
276 cmd+=('-e' '( his| her| my) [^\.|;]{,12}(cunt|pussy( |\.|,)|cock( |\.|,)|dick|shaft( |\.|,|;))');
277 cmd+=('--');
278 cmd+=('-');
279 local output; mapfile -t output < <( "${cmd[@]}"; );
280 printf "%s\n" "${output[@]}";
281 #printf "Found %d matching lines for phrases in %s.\n" "${#output[@]}" "$fin" 1>&2; # debug
282 }; # find phrase
283 main () {
284 din="$1";
285 if [[ ! -d "$din" ]]; then die "FATAL:Not a dir:${din}"; fi;
286
287 find "$din" -type f -name "*.txt" | shuf | head -n "$FIN_MAX" | \
288 #parallel search_thread '{}' | less --RAW-CONTROL-CHARS -S;
289 parallel search_thread '{}';
290 };
291 export -f yell die must search_thread find_nouns find_adjectives find_verbs find_mix_1 find_mix_2 find_phrase;
292
293 main "$@";