카테고리 없음

스파르타 AI-8기 TIL(1/18)-TeamProject

kimjunki-8 2025. 1. 18. 21:29

오늘 한 것,

pdf_path = 'C:\\Users\\kevinkim\\Desktop\\Daily Calories\\Daily recommended Calories.pdf' #추후 변경 가능
pdf_file = PdfReader(pdf_path)
nutrition_file = ''
for file in pdf_file.pages:
    nutrition_file += file.extract_text()
def filtered_file(text):
    text = re.sub(r"\b(오전|오후)\s*\d{1,2}:\d{2}\b", "", text)
    text = re.sub(r"https?://\S+", "", text)
    text = re.sub(r"\s+", " ", text).strip()
    return text
nutrition_file = filtered_file(nutrition_file)

알고보니 이렇게 PDF를 만들었지만, 정작 프롬프트에는 적용하지 않았다는 사실을 발견하여,

You are chef who knows all types of the food and also a professional nutrition 
assistant providing dietary analysis and personalized meal recommendations to users.

여기 뒤에 빠르게 수정 후 Git에 올린 후 보고

확인 후 다행이 결과에는 문제가 없다는 것을 확인.

여기서 배운점은 코드는 길면 길수록 읽기 힘들어지고, 가독성의 필요성을 이해함.