-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgetMixedWords
More file actions
executable file
·58 lines (45 loc) · 1.76 KB
/
Copy pathgetMixedWords
File metadata and controls
executable file
·58 lines (45 loc) · 1.76 KB
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
#!/bin/bash
# Script to find mixed words in killer_cronicas.txt
INPUT=input.txt
WORDS=words.txt
COUNT=count.txt
MIXED=mixed_words.txt
if [[ $# -ne 1 ]]; then
echo "Usage: $0 Filename ";
exit 1;
else
cp "$1" "$INPUT"; # Preserve original copy
fi
aspell -C list < $INPUT > $WORDS
aspell -C -des list < $WORDS > temp && mv temp $WORDS
aspell -C -dit list < $WORDS > temp && mv temp $WORDS
aspell -C -dfr list < $WORDS > temp && mv temp $WORDS
aspell -C -dpt_BR list < $WORDS > temp && mv temp $WORDS
aspell -C -dpt_PT list < $WORDS > temp && mv temp $WORDS
aspell -C -daf list < $WORDS > temp && mv temp $WORDS
# Filter out valid words in English, Spanish, Italian, French,
# Portuguese, and Afrikaans
tr '[:upper:]' '[:lower:]' < $WORDS | sort > temp && mv temp $WORDS
grep -v -E "killer|crónic[a|as]|xx|arg" $WORDS > temp && mv temp $WORDS
grep -v -E "maría|pizarnik" $WORDS > temp && mv temp $WORDS
grep -v -E "sh[o|a]|voh|dra|th|pomo|ion|ex|line" $WORDS > temp && mv temp $WORDS
grep -v -E "of|hasn|isn|hadn|didn|couldn|wouldn|doesn|weren|wasn|ness|nne|liz" $WORDS > temp && mv temp $WORDS
grep -v -E "^..$" $WORDS > temp && mv temp $WORDS
grep -v -E "^...$" $WORDS > temp && mv temp $WORDS
grep -v -E "h$" $WORDS > temp && mv temp $WORDS
uniq -i -c $WORDS | sort -rn > $COUNT
uniq -i $WORDS > temp && mv temp $WORDS
wc $WORDS
uniq -i -c $WORDS | sort -rn > $COUNT
grep -v -E "ao|ía|ht|zh|sh|ñ|hc|ó|hp" $WORDS > temp && mv temp $WORDS
wc $WORDS
uniq -i -c $WORDS | sort -rn > $COUNT
awk '{ print $2 }' $COUNT > temp && mv temp $COUNT
for i in `cat $COUNT`; do
read -p "Is \"$i\" a word or name (y/n)? " choice
case "$choice" in
y|Y ) grep -i -v "$i" $WORDS > temp && mv temp $WORDS;;
n|N ) ;;
* ) echo "invalid";;
esac
done