MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / get_slide_content

Function get_slide_content

utils/src/utils.py:96–113  ·  view source on GitHub ↗
(doc_json: dict, slide_title: str, slide: dict)

Source from the content-addressed store, hash-verified

94
95
96def get_slide_content(doc_json: dict, slide_title: str, slide: dict):
97 slide_desc = slide.get("description", "")
98 slide_content = f"Slide Purpose: {slide_title}\nSlide Description: {slide_desc}\n"
99 for key in slide.get("subsections", []):
100 slide_content += "Slide Content Source: "
101 for section in doc_json["sections"]:
102 subsections = section.get("subsections", [])
103 if isinstance(subsections, dict) and len(subsections) == 1:
104 subsections = [
105 {"title": k, "content": v} for k, v in subsections.items()
106 ]
107 for subsection in subsections:
108 try:
109 if edit_distance(key, subsection["title"]) > 0.9:
110 slide_content += f"# {key} \n{subsection['content']}\n"
111 except:
112 pass
113 return slide_content
114
115
116def tenacity_log(retry_state: RetryCallState):

Callers 2

_generate_slideMethod · 0.90
_generate_slideMethod · 0.90

Calls 1

edit_distanceFunction · 0.70

Tested by

no test coverage detected