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

Method to_text

utils/src/presentation.py:1125–1143  ·  view source on GitHub ↗

Represent the slide page in text.

(self, show_image: bool = False)

Source from the content-addressed store, hash-verified

1123 return "\n".join([shape.to_pptc() for shape in self.shapes])
1124
1125 def to_text(self, show_image: bool = False) -> str:
1126 """
1127 Represent the slide page in text.
1128 """
1129 text_content = "\n".join(
1130 [
1131 shape.text_frame.text.strip()
1132 for shape in self.shapes
1133 if shape.text_frame.is_textframe
1134 ]
1135 )
1136 if show_image:
1137 for image in self.shape_filter(Picture):
1138 if not image.caption:
1139 raise ValueError(
1140 f"caption not found for picture {image.shape_idx} of slide {image.slide_idx}"
1141 )
1142 text_content += "\n" + "Image: " + image.caption
1143 return text_content
1144
1145 @property
1146 def text_length(self):

Callers 7

to_textMethod · 0.45
prs_dedupFunction · 0.45
category_splitMethod · 0.45
dataset_statFunction · 0.45
get_pplFunction · 0.45
eval_generalFunction · 0.45
pres_scoreFunction · 0.45

Calls 1

shape_filterMethod · 0.95

Tested by

no test coverage detected