1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-11 03:02:03 +02:00

(v2.1.1.9102) fix sir

This commit is contained in:
2024-10-18 10:58:57 +02:00
parent 11b1dc2b02
commit da6321c504
6 changed files with 23 additions and 20 deletions

View File

@ -7,10 +7,11 @@ if [ "$(basename "$PWD")" != "AMR" ]; then
fi
# Define the output file, located in ./data-raw
output_file="data-raw/gpt_training_text.txt"
version="$1"
output_file="data-raw/gpt_training_text_v${version}.txt"
# Clear the output file if it exists
echo "This files contains all context you must know about the AMR package for R."> "$output_file"
echo "This files contains all context you must know about the AMR package for R." > "$output_file"
echo -e "\n\n\n\n" >> "$output_file"
# Function to remove header block (delimited by # ======)
@ -20,7 +21,7 @@ remove_header() {
# Process all .R files in the 'R' folder
for file in R/*.R; do
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
remove_header "$file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
@ -28,7 +29,7 @@ done
# Process all .Rmd files in the 'vignettes' folder
for file in vignettes/*.Rmd; do
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
remove_header "$file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
@ -37,7 +38,7 @@ done
# Process important metadata files (DESCRIPTION, NAMESPACE, index.md)
for file in DESCRIPTION NAMESPACE index.md; do
if [[ -f $file ]]; then
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
cat "$file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
@ -46,7 +47,7 @@ done
# Process test files (if available) in the 'tests' folder
for file in tests/*.R; do
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
remove_header "$file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
@ -54,7 +55,7 @@ done
# Process all .Rd files from the 'man' folder
for file in man/*.Rd; do
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo "THE PART HEREAFTER CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file"
remove_header "$file" >> "$output_file"
echo -e "\n\n" >> "$output_file"