Yasu777 commited on
Commit
8f1268d
ยท
verified ยท
1 Parent(s): 9489f3d

Update headline_generator.py

Browse files
Files changed (1) hide show
  1. headline_generator.py +2 -2
headline_generator.py CHANGED
@@ -18,8 +18,8 @@ def generate_headlines_and_subheadings(keyword, ngram_text):
18
  response = openai.ChatCompletion.create(
19
  model="gpt-4-0125-preview",
20
  messages=[
21
- {"role": "system", "content": "You are a writing expert. Please structure the headings according to the PREP method (Point, Reason, Example, Point). Ensure that the text is generated in Japanese. Do not create similar sentences within the text. You may use the same word up to three times."},
22
- {"role": "user", "content": f"""Based on the sentiment analysis of '{keyword}', generate engaging titles and headings. Include '{keyword}' in the title and ensure consistency using the PREP method. The first half of the article should address the search intent ({ngram_text}) related to '{keyword}'. If specific service or product names enclosed in quotation marks ('""', 'ใ€Œใ€', '๏ผˆ๏ผ‰') are mentioned, use these as product or service names in the headings. If not, use related keywords to structure the article. Organize the information as follows: <h1>Title including '{keyword}'</h1>, up to four <h2> main headings each with up to two <h3> subheadings. Conclude with a <h2>Summary</h2> section. Avoid redundancy in headings and subheadings. Ensure all content is written in Japanese, and aim to meet the searcher's intent. Do not include descriptions under each heading or subheading."""
23
  }],
24
  temperature=0.7,
25
  max_tokens=2000
 
18
  response = openai.ChatCompletion.create(
19
  model="gpt-4-0125-preview",
20
  messages=[
21
+ {"role": "system", "content": "ใ‚ใชใŸใฏใƒฉใ‚คใƒ†ใ‚ฃใƒณใ‚ฐใฎๅฐ‚้–€ๅฎถใงใ™ใ€‚PREPๆณ•๏ผˆ็ต่ซ–ใƒป็†็”ฑใƒปๅ…ทไฝ“ไพ‹ใƒป็ต่ซ–ใฎๆตใ‚Œ๏ผ‰ใซๅ‰‡ใฃใฆ่ฆ‹ๅ‡บใ—ใ‚’ๆง‹ๆˆใ—ใฆใใ ใ•ใ„ใ€‚ใƒ†ใ‚ญใ‚นใƒˆใฏๅฟ…ใšๆ—ฅๆœฌ่ชžใง็”Ÿๆˆใ—ใฆใใ ใ•ใ„ใ€‚ใƒ†ใ‚ญใ‚นใƒˆๅ†…ใซไผผใŸๆ–‡็ซ ใ‚’ไฝœใ‚‰ใชใ„ใงใใ ใ•ใ„ใ€‚ๅŒใ˜ๅ˜่ชžใฏ3ๅ›žใพใงไฝฟใฃใฆใ„ใ„ใ‚‚ใฎใจใ—ใพใ™ใ€‚"},
22
+ {"role": "user", "content": f"""ใ€Œ{keyword}ใ€ใฎๆ„Ÿๆƒ…ๅˆ†ๆžใ‚’่กŒใฃใŸ็ตๆžœใซๅŸบใฅใ„ใฆใ€่ˆˆๅ‘ณใ‚„้–ขๅฟƒใ‚’ๅผ•ใใคใ‘ใ‚‹ใ€Œ{keyword}ใ€ใ‚’ๅซใ‚ใŸใ‚ฟใ‚คใƒˆใƒซใ€่ˆˆๅ‘ณใ‚„้–ขๅฟƒใ‚’ๅผ•ใใคใ‘ใ‚‹ใ€Œ่ฆ‹ๅ‡บใ—ใ€ใ‚’็”Ÿๆˆใ—ใฆใใ ใ•ใ„ใ€‚ใใ—ใฆใใ‚Œใžใ‚Œใฎ่ฆ‹ๅ‡บใ—ใซๆฒฟใฃใฆใ€Œๅฐ่ฆ‹ๅ‡บใ—ใ€ใ‚’้ฉๅฎœ็”Ÿๆˆใ—ใฆใใ ใ•ใ„ใ€‚ๆœ€ๅพŒใซใ€่จ˜ไบ‹ใ‚’็ท ใ‚ใใใ‚‹ใ€Œ<h2>ใพใจใ‚</h2>ใ€ใฎใ‚ปใ‚ฏใ‚ทใƒงใƒณใ‚’่ฟฝๅŠ ใ—ใฆใใ ใ•ใ„ใ€‚ใ‚ฟใ‚คใƒˆใƒซใ€่ฆ‹ๅ‡บใ—ใ€ๅฐ่ฆ‹ๅ‡บใ—ใฏPREPๆณ•ใซๅŸบใฅใ„ใฆไธ€่ฒซๆ€งใฎใ‚ใ‚‹ใ‚‚ใฎใจใ—ใ€่จ˜ไบ‹ใฎๅ‰ๅŠ้ƒจๅˆ†ใงใ€Œ{keyword}ใ€ใฎๆคœ็ดขๆ„ๅ›ณ๏ผˆ{ngram_text}๏ผ‰ใ‚’ๆบ€ใŸใ™่จ˜ไบ‹ๆง‹ๆˆๅ†…ๅฎนใซใ—ใฆใใ ใ•ใ„ใ€‚็‰นๅฎšใฎใ‚ตใƒผใƒ“ใ‚นใ‚„่ฃฝๅ“ๅใŒๅผ•็”จ็ฌฆ๏ผˆใ€Œ""ใ€,ใ€Œใ€Œใ€ใ€,ใ€Œ๏ผˆ๏ผ‰ใ€๏ผ‰ใงๅ›ฒใพใ‚Œใฆ่จ€ๅŠใ•ใ‚Œใฆใ„ใ‚‹ๅ ดๅˆใ€ใใ‚Œไปฅๅค–ใฎๅ ดๅˆใฏใ€้–ข้€ฃใ‚ญใƒผใƒฏใƒผใƒ‰ใ‚’ไฝฟ็”จใ—ใฆ่จ˜ไบ‹ใ‚’ๆง‹้€ ๅŒ–ใ—ใฆใใ ใ•ใ„ใ€‚ๆƒ…ๅ ฑใ‚’ๆฌกใฎใ‚ˆใ†ใซๆ•ด็†ใ—ใฆใใ ใ•ใ„๏ผšใ‚ฟใ‚คใƒˆใƒซใ€่ฆ‹ๅ‡บใ—ใŠใ‚ˆใณๅฐ่ฆ‹ๅ‡บใ—ใฏ้ †ใซใ€Œ<h1>ใ€Œ{keyword}ใ€ใ‚’ๅซใ‚ใŸใ‚ฟใ‚คใƒˆใƒซ</h1>ใ€ใ€Œ<h2>1.่ฆ‹ๅ‡บใ—</h2>ใ€ใ€Œ<h3>1-1 ๅฐ่ฆ‹ๅ‡บใ— ใจใฏ</h3>ใ€<h3>1-2 ๅฐ่ฆ‹ๅ‡บใ— ใจใฏ</h3>ใ€ใ€Œ<h2>2.่ฆ‹ๅ‡บใ—</h2>ใ€ใ€Œ<h3>2-1 ๅฐ่ฆ‹ๅ‡บใ— ใจใฏ</h3>ใ€<h3>2-2 ๅฐ่ฆ‹ๅ‡บใ— ใจใฏ</h3>ใ€ใจใ„ใ†ใ‚ˆใ†ใซใ„ใใคใ‹ใฎ่ฆ‹ๅ‡บใ—ใจๅฐ่ฆ‹ๅ‡บใ—ใงๆง‹ๆˆใ—ใฆใใ ใ•ใ„ใ€‚ใŸใ ใ—ใ€่ฆ‹ๅ‡บใ—ใฏๆœ€ๅคง4ใคใ€ๅฐ่ฆ‹ๅ‡บใ—ใฏๆœ€ๅคง8ใคใพใงใฎๆง‹ๆˆใจใ—ใพใ™ใ€‚ๅ„่ฆ‹ๅ‡บใ—ใ€ๅฐ่ฆ‹ๅ‡บใ—ใซ่ชฌๆ˜Žๆ–‡ใฏไธ่ฆใงใ™ใ€‚ใ‚ฟใ‚คใƒˆใƒซใ€่ฆ‹ๅ‡บใ—ใ€ใใ—ใฆๅฐ่ฆ‹ๅ‡บใ—ใฏๆคœ็ดข่€…ใŒๆฑ‚ใ‚ใ‚‹ๆƒ…ๅ ฑใ‚’ๆ•ด็†ใ—ใฆ่จ˜่ผ‰ใ™ใ‚‹ใ‚ˆใ†ใซใ—ใฆใใ ใ•ใ„ใ€‚่ฆ‹ๅ‡บใ—ใจๅฐ่ฆ‹ๅ‡บใ—ใฎๅ†—้•ทๆ€งใ‚’้ฟใ‘ใฆใใ ใ•ใ„ใ€‚ใ™ในใฆใฎใ‚ณใƒณใƒ†ใƒณใƒ„ใฏๆ—ฅๆœฌ่ชžใงๆ›ธใ‹ใ‚Œใฆใ„ใ‚‹ๅฟ…่ฆใŒใ‚ใ‚Šใ€ๆคœ็ดข่€…ใฎๆ„ๅ›ณใ‚’ๆบ€ใŸใ™ใ“ใจใ‚’็›ฎๆŒ‡ใ—ใฆใใ ใ•ใ„ใ€‚"""
23
  }],
24
  temperature=0.7,
25
  max_tokens=2000