]> zdv2.bktei.com Git - BK-2020-03.git/blob - unitproc/find_erotica.sh
chore(unitproc/find_erotica.sh):Update nouns
[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.3.0
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' 'vulva');
73 cmd+=('-e' 'womanhood');
74 cmd+=('-e' 'manhood');
75 cmd+=('-e' 'his member');
76 cmd+=('-e' 'slit');
77 cmd+=('-e' 'pussy');
78 cmd+=('-e' 'vagina');
79 cmd+=('-e' ' cock');
80 cmd+=('-e' 'dildo');
81 cmd+=('-e' 'shaft');
82 cmd+=('-e' 'blood');
83 cmd+=('-e' ' lust');
84 cmd+=('-e' 'tongue');
85 cmd+=('-e' 'neck');
86 cmd+=('-e' 'voyeur');
87 cmd+=('-e' 'ecstacy');
88 cmd+=('-e' 'pleasure');
89 cmd+=('-e' 'tingle');
90 cmd+=('-e' 'orgasm');
91 cmd+=('-e' 'lips');
92 cmd+=('-e' 'lovers');
93 cmd+=('-e' 'hard-on');
94 cmd+=('-e' 'sex');
95 cmd+=('-e' 'throat');
96 cmd+=('-e' 'cleavage');
97 cmd+=('-e' 'kiss');
98 cmd+=('--');
99 cmd+=("$fin");
100 local output; mapfile -t output < <( "${cmd[@]}"; );
101 printf "%s\n" "${output[@]}";
102 #printf "Found %d matching lines for nouns.\n" "${#output[@]}" 1>&2; # debug
103 # yell "STATUS:Finished find_nouns() on $fin" # debug;
104 }; # find nouns
105 find_adjectives() {
106 # Desc: Find adjectives
107 # Usage: cat *.txt | find_adjectives
108 # Input: stdin input lines
109 # CONTEXT_ADJ grep parameter
110 # Output: stdout lines matching grep patterns
111
112 local cmd+=('grep');
113 cmd+=('--ignore-case');
114 cmd+=('--extended-regexp');
115 cmd+=('--context' "$CONTEXT_ADJ");
116 cmd+=('-e' 'handsome');
117 cmd+=('-e' 'gorgeous');
118 cmd+=('-e' 'beautiful');
119 cmd+=('-e' 'bewitching');
120 cmd+=('-e' 'seductive');
121 cmd+=('-e' 'lusty');
122 cmd+=('-e' 'comely');
123 cmd+=('-e' 'stunning');
124 cmd+=('-e' 'elegant');
125 cmd+=('-e' 'exquisite');
126 cmd+=('-e' 'luxurious');
127 cmd+=('-e' 'ravishing');
128 cmd+=('-e' 'magnificent');
129 cmd+=('-e' 'glistening');
130 cmd+=('-e' 'lovely');
131 cmd+=('-e' 'loving');
132 cmd+=('-e' 'sexy|sexual|sexiest');
133 cmd+=('-e' 'sweet');
134 cmd+=('-e' 'sensual');
135 cmd+=('-e' 'arousing');
136 cmd+=('-e' 'warm');
137 cmd+=('-e' 'moist');
138 cmd+=('-e' 'soaked');
139 cmd+=('-e' 'hot');
140 cmd+=('-e' 'gentle');
141 cmd+=('-e' 'supple');
142 cmd+=('-e' 'tender');
143 cmd+=('-e' 'pleasurabl');
144 cmd+=('-e' 'buxom|busty|curvy');
145 cmd+=('-e' 'naked|nude');
146 cmd+=('--');
147 cmd+=('-');
148
149 local output; mapfile -t output < <( "${cmd[@]}"; );
150 printf "%s\n" "${output[@]}";
151 #printf "Found %d matching lines for adjectives.\n" "${#output[@]}" 1>&2; # debug
152 }; # find adjectives
153 find_verbs() {
154 # Desc: Find verbs
155 # Usage: cat *.txt | find_verbs
156 # Input: stdin input lines
157 # CONTEXT_VERB grep parameter
158 # Output: stdout lines matching grep patterns
159
160 local cmd+=('grep');
161 cmd+=('--ignore-case');
162 cmd+=('--extended-regexp');
163 cmd+=('--context' "$CONTEXT_VERB");
164 cmd+=('-e' 'love');
165 cmd+=('-e' 'nuzzle');
166 cmd+=('-e' 'pleasure');
167 cmd+=('-e' 'make love');
168 cmd+=('-e' 'fuck');
169 cmd+=('-e' 'arouse');
170 cmd+=('-e' 'quiver');
171 cmd+=('-e' 'tremble');
172 cmd+=('-e' 'caress');
173 cmd+=('-e' 'knead');
174 cmd+=('-e' 'kiss');
175 cmd+=('-e' 'moan');
176 cmd+=('-e' 'suck|suckle');
177 cmd+=('-e' 'fondle');
178 cmd+=('-e' 'grope');
179 cmd+=('-e' 'feel up|felt up|felt (me|her|him) up');
180 cmd+=('--');
181 cmd+=('-');
182 local output; mapfile -t output < <( "${cmd[@]}"; );
183 printf "%s\n" "${output[@]}";
184 #printf "Found %d matching lines for verbs.\n" "${#output[@]}" 1>&2; # debug
185 }; # find verbs
186 find_mix_1() {
187 # Desc: Filter mix 1
188 # Usage: cat *.txt | find_mix_1
189 # Input: stdin input lines
190 # CONTEXT_VERB grep parameter
191 # Output: stdout lines matching grep patterns
192 local cmd+=('grep');
193 cmd+=('--ignore-case');
194 cmd+=('--context' "$CONTEXT_MIX_1");
195 cmd+=('-e' 'kiss');
196 cmd+=('-e' 'breast');
197 cmd+=('-e' 'tits');
198 cmd+=('-e' 'manhood');
199 cmd+=('-e' 'vagina');
200 cmd+=('-e' 'sex');
201 cmd+=('--');
202 cmd+=('-');
203 local output; mapfile -t output < <( "${cmd[@]}"; );
204 printf "%s\n" "${output[@]}";
205 };
206 find_mix_2() {
207 # Desc: Filter mix 2
208 # Usage: cat *.txt | find_mix_2
209 # Input: stdin input lines
210 # CONTEXT_VERB grep parameter
211 # Output: stdout lines matching grep patterns
212
213 local cmd+=('grep');
214 cmd+=('--ignore-case');
215 cmd+=('--context' "$CONTEXT_MIX_2");
216 cmd+=('-e' 'nipple');
217 cmd+=('-e' 'womanhood');
218 cmd+=('-e' 'manhood');
219 cmd+=('-e' 'slit');
220 cmd+=('-e' 'pussy');
221 cmd+=('-e' 'vagina');
222 cmd+=('-e' 'cock');
223 cmd+=('-e' 'shaft');
224 cmd+=('-e' '\ lust');
225 cmd+=('-e' 'voyeur');
226 cmd+=('-e' 'ecstacy');
227 cmd+=('-e' 'tingle');
228 cmd+=('-e' 'orgasm');
229 cmd+=('-e' 'gorgeous');
230 cmd+=('-e' 'bewitching');
231 cmd+=('-e' 'seductive');
232 cmd+=('-e' 'lusty');
233 cmd+=('-e' 'stunning');
234 cmd+=('-e' 'ravishing');
235 cmd+=('-e' 'lovely');
236 cmd+=('-e' 'sexy');
237 cmd+=('-e' 'sweet');
238 cmd+=('-e' 'sexiest');
239 cmd+=('-e' 'sensual');
240 cmd+=('-e' 'arousing');
241 cmd+=('-e' 'moist');
242 cmd+=('-e' 'love');
243 cmd+=('-e' 'nuzzle');
244 cmd+=('-e' 'pleasure');
245 cmd+=('-e' 'make\ love');
246 cmd+=('-e' 'sex');
247 cmd+=('-e' 'fuck');
248 cmd+=('-e' 'arouse');
249 cmd+=('-e' 'kiss');
250 cmd+=('-e' 'breast');
251 cmd+=('-e' 'tits');
252 cmd+=('-e' 'manhood');
253 cmd+=('-e' 'vagina');
254 cmd+=('-e' 'lips');
255 cmd+=('-e' 'lovers');
256 cmd+=('--');
257 cmd+=('-');
258 local output; mapfile -t output < <( "${cmd[@]}"; );
259 printf "%s\n" "${output[@]}";
260 };
261 find_phrase () {
262 # Desc: Filter phrase
263 # Usage: cat *.txt | find_phrase
264 # Input: stdin input lines
265 # CONTEXT_VERB grep parameter
266 # Output: stdout lines matching grep patterns
267
268 local cmd+=('grep');
269 cmd+=('--ignore-case');
270 cmd+=('--context' "$CONTEXT_PHRASE");
271 cmd+=('--extended-regexp');
272 cmd+=('--color=always');
273 cmd+=('-e' '( his| her| my) [^\.|;]{,48}( his| her| my) (breast|pussy|tits|nipple|womanhood|cock( |\.|,)|manhood|dick|cunt)');
274 cmd+=('-e' '( his| her| my) [^\.|;]{,24}nipple.{,24}harden');
275 cmd+=('-e' '(suck|lick)[^\.|;]{,12} (nipple|cock( |\.|,)|dick)');
276 cmd+=('-e' '(slap)[^\.|;]{,12}( ass)');
277 cmd+=('-e' '( his| her| my) [^\.|;]{,12}(cunt|pussy( |\.|,)|cock( |\.|,)|dick|shaft( |\.|,|;))');
278 cmd+=('--');
279 cmd+=('-');
280 local output; mapfile -t output < <( "${cmd[@]}"; );
281 printf "%s\n" "${output[@]}";
282 #printf "Found %d matching lines for phrases in %s.\n" "${#output[@]}" "$fin" 1>&2; # debug
283 }; # find phrase
284 main () {
285 din="$1";
286 if [[ ! -d "$din" ]]; then die "FATAL:Not a dir:${din}"; fi;
287
288 find "$din" -type f -name "*.txt" | shuf | head -n "$FIN_MAX" | \
289 #parallel search_thread '{}' | less --RAW-CONTROL-CHARS -S;
290 parallel search_thread '{}';
291 };
292 export -f yell die must search_thread find_nouns find_adjectives find_verbs find_mix_1 find_mix_2 find_phrase;
293
294 main "$@";