Split slides into categories based on their functional purpose.
(self)
| 98 | return self.slide_induction |
| 99 | |
| 100 | def category_split(self): |
| 101 | """ |
| 102 | Split slides into categories based on their functional purpose. |
| 103 | """ |
| 104 | if pexists(self.split_cache): |
| 105 | split = json.load(open(self.split_cache)) |
| 106 | return set(split["content_slides_index"]), split["functional_cluster"] |
| 107 | category_split_template = Template(open("prompts/category_split.txt").read()) |
| 108 | functional_cluster = llms.language_model( |
| 109 | category_split_template.render(slides=self.prs.to_text()), |
| 110 | return_json=True, |
| 111 | ) |
| 112 | functional_slides = set(sum(functional_cluster.values(), [])) |
| 113 | content_slides_index = set(range(1, len(self.prs) + 1)) - functional_slides |
| 114 | |
| 115 | json.dump( |
| 116 | { |
| 117 | "content_slides_index": list(content_slides_index), |
| 118 | "functional_cluster": functional_cluster, |
| 119 | }, |
| 120 | open(self.split_cache, "w"), |
| 121 | indent=4, |
| 122 | ensure_ascii=False, |
| 123 | ) |
| 124 | return content_slides_index, functional_cluster |
| 125 | |
| 126 | def layout_split(self, content_slides_index: set[int]): |
| 127 | """ |
no test coverage detected