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

Method category_split

utils/src/induct.py:100–124  ·  view source on GitHub ↗

Split slides into categories based on their functional purpose.

(self)

Source from the content-addressed store, hash-verified

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 """

Callers 1

layout_inductMethod · 0.95

Calls 2

loadMethod · 0.45
to_textMethod · 0.45

Tested by

no test coverage detected