-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from troykelly/67-fix-bad-lexicon
Making sure there are word boundaries
- Loading branch information
Showing
4 changed files
with
80 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
#!/usr/bin/env zsh | ||
|
||
# Directory containing Python files | ||
SRC_DIR="src" | ||
# Base directories and specific files to include | ||
INCLUDE_DIRS=("src" ".devcontainer" ".github") | ||
INCLUDE_FILES=("Dockerfile" "lexicon.json" "prompt.md" "demo.xml") | ||
|
||
# Output markdown file | ||
OUTPUT_FILE="llm.md" | ||
|
||
# Create or clear the output file | ||
echo "# Files" > $OUTPUT_FILE | ||
|
||
# Function to process each Python file | ||
# Function to process each file | ||
process_file() { | ||
local file_path=$1 | ||
local file_extension="${file_path##*.}" | ||
echo "\n## ${file_path}\n" >> $OUTPUT_FILE | ||
echo "\`\`\`python" >> $OUTPUT_FILE | ||
echo "\`\`\`${file_extension}" >> $OUTPUT_FILE | ||
# Add the content of the file and ensure there is a trailing newline | ||
awk '{print} END {if (NR > 0 && substr($0, length($0), 1) != "\n") print ""}' $file_path >> $OUTPUT_FILE | ||
echo "\`\`\`\n" >> $OUTPUT_FILE | ||
} | ||
|
||
# Find all .py files in the SRC_DIR excluding __pycache__ and other unwanted directories | ||
find $SRC_DIR -type f -name "*.py" ! -path "*/__pycache__/*" | while read -r file; do | ||
process_file "$file" | ||
# Process each directory | ||
for dir in "${INCLUDE_DIRS[@]}"; do | ||
find $dir -type f ! -path "*/__pycache__/*" | while read -r file; do | ||
process_file "$file" | ||
done | ||
done | ||
|
||
# Process each specific file | ||
for file in "${INCLUDE_FILES[@]}"; do | ||
if [[ -f $file ]]; then | ||
process_file "$file" | ||
fi | ||
done | ||
|
||
echo "LLM prompt file has been generated at ${OUTPUT_FILE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters