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
9 export SHOW_FILENAME
=false
;
10 export CONTEXT_NOUN
=256;
11 export CONTEXT_ADJ
=128;
12 export CONTEXT_VERB
=64;
13 export CONTEXT_MIX_1
=32;
14 export CONTEXT_MIX_2
=16;
15 export CONTEXT_PHRASE
=12;
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
22 # Desc: Apply filters to a file
23 # Depends: find_nouns();
24 # Input: arg1 file path
25 # Output: stdout search results
27 if [[ ! -f "$1" ]]; then die
"FATAL:Not a file:$1"; fi;
29 # yell "STATUS:Starting search_thread() on ${fin}" # debug;
30 # yell "Processing: ${fin}..."; # debug
32 mapfile
-t output
< <(
39 grep -v -- '-$'; # ADJUST ME
42 if [[ "${#output[@]}" -gt 0 ]]; then
43 printf "%s\n" "$(basename "${fin}" )";
44 printf "Result: %d lines.\n" "${#output[@]}"
45 printf "%s\n" "${output[@]}";
49 # yell "STATUS:Finished search_thread() on ${fin}" # debug;
53 # Usage: find_nouns [path]
54 # Input: arg1 text file path
55 # CONTEXT_NOUN grep parameter
56 # Output: stdout lines matching grep patterns
58 if [[ ! -f "$1" ]]; then die
"FATAL:Not a file:$1"; fi;
61 #yell "STATUS:Starting find_nouns() on $fin" # debug;
64 cmd
+=('--ignore-case');
65 if [[ "$SHOW_FILENAME" == "true" ]]; then cmd
+=('--with-filename'); fi;
66 cmd
+=('--line-number');
67 cmd
+=('--context' "$CONTEXT_NOUN");
69 #declare -p cmd CONTEXT_NOUN 1>&2; # debug
92 # yell "STATUS:Finished find_nouns() on $fin" # debug;
95 # Desc: Find adjectives
96 # Usage: cat *.txt | find_adjectives
97 # Input: stdin input lines
98 # CONTEXT_ADJ grep parameter
99 # Output: stdout lines matching grep patterns
102 cmd
+=('--ignore-case');
103 cmd
+=('--context' "$CONTEXT_ADJ");
131 # Usage: cat *.txt | find_verbs
132 # Input: stdin input lines
133 # CONTEXT_VERB grep parameter
134 # Output: stdout lines matching grep patterns
137 --context="$CONTEXT_VERB" \
152 # Usage: cat *.txt | find_mix_1
153 # Input: stdin input lines
154 # CONTEXT_VERB grep parameter
155 # Output: stdout lines matching grep patterns
158 --context="$CONTEXT_MIX_1" \
169 # Usage: cat *.txt | find_mix_2
170 # Input: stdin input lines
171 # CONTEXT_VERB grep parameter
172 # Output: stdout lines matching grep patterns
175 --context="$CONTEXT_MIX_2" \
219 # Desc: Filter phrase
220 # Usage: cat *.txt | find_phrase
221 # Input: stdin input lines
222 # CONTEXT_VERB grep parameter
223 # Output: stdout lines matching grep patterns
226 --context="$CONTEXT_PHRASE" \
229 -e '( his| her) .{,48}my (throat|breasts|pussy|tits|nipple|womanhood|cock|manhood|dick|cunt)' \
235 if [[ ! -d "$din" ]]; then die
"FATAL:Not a dir:${din}"; fi;
237 find "$din" -type f
-name "*.txt" | shuf |
head -n "$FIN_MAX" | \
238 parallel search_thread
'{}' |
less --RAW-CONTROL-CHARS -S;
240 export -f yell die must search_thread find_nouns find_adjectives find_verbs find_mix_1 find_mix_2 find_phrase
;
245 # find "$1" -type f -name "*.txt" | \
246 # shuf | head -n400 | \
247 # parallel grep -HEin -C256 -- 'nipple\|womanhood\|manhood\|his\ member\|slit\|pussy\|vagina\|cock\|shaft\|blood\|\ lust\|tongue\|neck\|voyeur\|ecstacy\|tingle\|orgasm\|lips' | \
248 # grep -i -C128 -- 'handsome\|gorgeous\|beautiful\|bewitching\|seductive\|lusty\|comely\|stunning\|elegant\|exquisite\|luxurious\|ravishing\|magnificent\|lovely\|sexy\|sweet\|sexiest\|sensual\|arousing\|warm\|moist' | \
249 # grep -i -C64 -- 'love\|nuzzle\|pleasure\|hot\|make\ love\|sex\|fuck\|arouse\|quiver' | \
250 # grep -i -C32 -- 'kiss\|breast\|tits\|manhood\|vagina' | \
251 # grep -i -C16 -- 'nipple\|womanhood\|manhood\|slit\|pussy\|vagina\|cock\|shaft\|\ lust\|voyeur\|ecstacy\|tingle\|orgasm\|gorgeous\|bewitching\|seductive\|lusty\|stunning\|ravishing\|lovely\|sexy\|sweet\|sexiest\|sensual\|arousing\|moist\|love\|nuzzle\|pleasure\|make\ love\|sex\|fuck\|arouse\|kiss\|breast\|tits\|manhood\|vagina\|lips' | \
252 # grep -Ei -C12 --color=always -- '( his| her) .{,48}my (throat|breasts|pussy|tits|nipple|womanhood|cock|manhood|dick|cunt)' | \
253 # grep -v -- '-$' | less --RAW-CONTROL-CHARS -S;