Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(template-import): classify page types by whole keywords, as the analyzer does

hugohe3c0ce24203e1d
diff --git a/skills/ppt-master/scripts/template_import/manifest.py b/skills/ppt-master/scripts/template_import/manifest.py
index 89d5c346..071d049a 100644
--- a/skills/ppt-master/scripts/template_import/manifest.py
+++ b/skills/ppt-master/scripts/template_import/manifest.py
@@ -28,6 +28,8 @@ from pathlib import Path, PurePosixPath
from typing import Any
from xml.etree import ElementTree as ET
+# Latin keywords match whole words ("qa" must not fire on "Qatar").
+from pptx_ooxml.analyzer import _has_keyword
from pptx_to_svg.ooxml_loader import (
blip_embed_relationship_ids,
parse_ooxml_boolean,
@@ -404,11 +406,11 @@ def count_slide_shapes(root: ET.Element | None) -> int:
def classify_slide(index: int, total: int, texts: list[str], image_count: int, shape_count: int) -> str:
joined = " ".join(texts).lower()
- if any(keyword in joined for keyword in THANKS_KEYWORDS):
+ if _has_keyword(joined, THANKS_KEYWORDS):
return "ending_candidate"
- if any(keyword in joined for keyword in TOC_KEYWORDS):
+ if _has_keyword(joined, TOC_KEYWORDS):
return "toc_candidate"
- if any(keyword in joined for keyword in CHAPTER_KEYWORDS):
+ if _has_keyword(joined, CHAPTER_KEYWORDS):
return "chapter_candidate"
if index == 1 and image_count <= 3:
return "cover_candidate"
diff --git a/skills/ppt-master/scripts/tests/test_template_flow_batch4.py b/skills/ppt-master/scripts/tests/test_template_flow_batch4.py
index 8a656c7d..5646b5a4 100644
--- a/skills/ppt-master/scripts/tests/test_template_flow_batch4.py
+++ b/skills/ppt-master/scripts/tests/test_template_flow_batch4.py
@@ -205,3 +205,14 @@ class TemplateFlowBatch4Tests(unittest.TestCase):
result = SVGQualityChecker().check_file(str(path))
recurrence = [issue for issue in result['errors'] if 'typography-size recurrence:' in issue]
self.assertEqual(bool(recurrence), layer is None, result)
+
+
+class SlideClassificationKeywordTests(unittest.TestCase):
+ def test_latin_keywords_do_not_fire_inside_other_words(self) -> None:
+ from template_import.manifest import classify_slide
+
+ body = ["Revenue", "Costs", "Profit"]
+ for title in ("Qatar economy", "Discontent among workers", "Department results"):
+ with self.subTest(title=title):
+ self.assertEqual(classify_slide(2, 8, [title, *body], 0, 20), "content_candidate")
+ self.assertEqual(classify_slide(2, 8, ["Q&A", *body], 0, 20), "ending_candidate")