Spaces:
Paused
Paused
File size: 3,965 Bytes
cb1a5c9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # filename: analysis_config.py
from log_config import get_logger
logger = get_logger('GetAnalysisPrompts')
def get_analysis_prompts(raw_text: str) -> dict:
"""
Generate analysis prompts for a given text.
Args:
raw_text (str): The text to analyze.
Returns:
dict: A dictionary containing prompts for various types of analysis.
"""
logger.info("Creating analysis prompts.")
prompt_template = (
"<prompt>\n"
" <task>{task} (output in Simplified Chinese):</task>\n"
" <text>{raw_text}</text>\n"
"{details}"
"</prompt>"
)
prompts = {
"Summary": prompt_template.format(
task="Provide a concise summary of this text",
raw_text=raw_text,
details=""
),
"Characters": prompt_template.format(
task="Analyze the characters in this text",
raw_text=raw_text,
details=(
" <details>\n"
" Provide a list of major characters with brief descriptions of their personality traits and roles in the story.\n"
" Try to identify relationships between characters (friends, enemies, family, etc.).\n"
" Comment on any significant character development or arcs.\n"
" </details>\n"
)
),
"Plot": prompt_template.format(
task="Analyze the plot structure of this text",
raw_text=raw_text,
details=(
" <details>\n"
" Try to identify key plot points (e.g., exposition, rising action, climax, falling action, resolution).\n"
" Outline the overall conflict or driving tension in the narrative.\n"
" </details>\n"
)
),
"Themes": prompt_template.format(
task="Discuss the main themes explored in this text",
raw_text=raw_text,
details=(
" <details>\n"
" Identify and analyze the central ideas, messages, or insights the author seems to be conveying through the story.\n"
" Consider how these themes are developed and their significance.\n"
" </details>\n"
)
),
"Techniques": prompt_template.format(
task="Analyze the writing techniques used in this text",
raw_text=raw_text,
details=(
" <details>\n"
" Look for notable examples of literary devices, narrative strategies, or stylistic choices the author employs.\n"
" Consider how these techniques contribute to the overall effect or meaning of the work.\n"
" </details>\n"
)
),
"Emotional Core": prompt_template.format(
task="Discuss the emotional core of this text",
raw_text=raw_text,
details=(
" <details>\n"
" Identify the primary emotions evoked by the story and how the author elicits these feelings in the reader.\n"
" Consider the emotional journey of the characters and the reader's empathetic response.\n"
" </details>\n"
)
),
"Narrative Perspective": prompt_template.format(
task="Analyze the narrative perspective used in this text",
raw_text=raw_text,
details=(
" <details>\n"
" Identify the point of view (e.g., first-person, third-person limited, omniscient) and consider how this perspective shapes the reader's understanding of events and characters.\n"
" </details>\n"
)
)
}
logger.info("Analysis prompts created successfully.")
return prompts
# file: analysis_config.py (end) |