Skip to content

Commit 73d4fb7

Browse files
committed
add script to find new vocabulary terms
1 parent 192084e commit 73d4fb7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Script to discover potential vocabulary terms from Vale output
3+
# Usage: ./discover-vocabulary.sh [file-pattern]
4+
5+
set -e
6+
7+
PATTERN=${1:-"**/*.mdx"}
8+
OUTPUT_FILE=".vale/vocabulary-candidates.txt"
9+
10+
echo "🔍 Discovering vocabulary candidates from Vale spelling errors..."
11+
echo "Pattern: $PATTERN"
12+
echo ""
13+
14+
# Run Vale and extract spelling error words
15+
vale --no-exit $PATTERN 2>&1 | \
16+
grep "Vale.Spelling" | \
17+
sed -n "s/.*Did you really mean '\([^']*\)'.*/\1/p" | \
18+
sort | uniq -c | sort -nr > "$OUTPUT_FILE"
19+
20+
if [ -s "$OUTPUT_FILE" ]; then
21+
echo "Found vocabulary candidates in $OUTPUT_FILE:"
22+
echo ""
23+
head -20 "$OUTPUT_FILE"
24+
echo ""
25+
echo "Review these terms and add appropriate ones to:"
26+
echo " - .vale/styles/config/vocabularies/Mintlify/accept.txt (if valid)"
27+
echo " - .vale/styles/config/vocabularies/Mintlify/reject.txt (if misspellings)"
28+
echo ""
29+
echo "To clean up this file: rm $OUTPUT_FILE"
30+
else
31+
echo "✅ No vocabulary issues found!"
32+
rm -f "$OUTPUT_FILE"
33+
fi

0 commit comments

Comments
 (0)