1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 08:06:12 +01:00

(v2.1.1.9099) fix generating GPT training test

This commit is contained in:
dr. M.S. (Matthijs) Berends 2024-10-17 11:55:23 +02:00
parent a9e753b1dc
commit cfd31f0f0c
4 changed files with 189 additions and 190 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 2.1.1.9098 Version: 2.1.1.9099
Date: 2024-10-17 Date: 2024-10-17
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)

View File

@ -1,4 +1,4 @@
# AMR 2.1.1.9098 # AMR 2.1.1.9099
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)* *(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*

View File

@ -1,7 +1,13 @@
#!/bin/bash #!/bin/bash
# Check if the current directory is named 'AMR'
if [ "$(basename "$PWD")" != "AMR" ]; then
echo "Error: The script must be run from the 'AMR' directory."
exit 1
fi
# Define the output file, located in ./data-raw # Define the output file, located in ./data-raw
output_file="gpt_training_text.txt" output_file="data-raw/gpt_training_text.txt"
# Clear the output file if it exists # 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"
@ -12,16 +18,16 @@ remove_header() {
sed '/# =\{6,\}/,/# =\{6,\}/d' "$1" sed '/# =\{6,\}/,/# =\{6,\}/d' "$1"
} }
# Process all .R files in the '../R' folder # Process all .R files in the 'R' folder
for file in ../R/*.R; do for file in R/*.R; do
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file" echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file" echo -e "\n\n" >> "$output_file"
remove_header "$file" >> "$output_file" remove_header "$file" >> "$output_file"
echo -e "\n\n" >> "$output_file" echo -e "\n\n" >> "$output_file"
done done
# Process all .Rmd files in the '../vignettes' folder # Process all .Rmd files in the 'vignettes' folder
for file in ../vignettes/*.Rmd; do for file in vignettes/*.Rmd; do
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file" echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file" echo -e "\n\n" >> "$output_file"
remove_header "$file" >> "$output_file" remove_header "$file" >> "$output_file"
@ -29,7 +35,7 @@ for file in ../vignettes/*.Rmd; do
done done
# Process important metadata files (DESCRIPTION, NAMESPACE, index.md) # Process important metadata files (DESCRIPTION, NAMESPACE, index.md)
for file in ../DESCRIPTION ../NAMESPACE ../index.md; do for file in DESCRIPTION NAMESPACE index.md; do
if [[ -f $file ]]; then if [[ -f $file ]]; then
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file" echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file" echo -e "\n\n" >> "$output_file"
@ -38,16 +44,16 @@ for file in ../DESCRIPTION ../NAMESPACE ../index.md; do
fi fi
done done
# Process test files (if available) in the '../tests' folder # Process test files (if available) in the 'tests' folder
for file in ../tests/*.R; do for file in tests/*.R; do
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file" echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file" echo -e "\n\n" >> "$output_file"
remove_header "$file" >> "$output_file" remove_header "$file" >> "$output_file"
echo -e "\n\n" >> "$output_file" echo -e "\n\n" >> "$output_file"
done done
# Process all .Rd files from the '../man' folder # Process all .Rd files from the 'man' folder
for file in ../man/*.Rd; do for file in man/*.Rd; do
echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file" echo "THE NEXT PART CONTAINS CONTENTS FROM FILE $file" >> "$output_file"
echo -e "\n\n" >> "$output_file" echo -e "\n\n" >> "$output_file"
remove_header "$file" >> "$output_file" remove_header "$file" >> "$output_file"

File diff suppressed because it is too large Load Diff