Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.
feat: add education domain templates (course concept graph, curriculum structure)
Frankie-Xu55a47a3723c4
diff --git a/hyperextract/templates/presets/education/course_concept_graph.yaml b/hyperextract/templates/presets/education/course_concept_graph.yamlnew file mode 100644index 0000000..1267d28--- /dev/null+++ b/hyperextract/templates/presets/education/course_concept_graph.yaml@@ -0,0 +1,110 @@+language: [zh, en]++name: course_concept_graph+type: graph+tags: [education, course, concept, prerequisite, pedagogy]++description:+ zh: '课程概念图模板 - 从教材、讲义和课程材料中提取知识点及其先修、组成与相关关系'+ en: 'Course Concept Graph Template - Extract knowledge points and their prerequisite, part-whole, and related links from textbooks, lecture notes, and course materials'++output:+ description:+ zh: '课程知识点及其教学依赖关系网络'+ en: 'Network of course knowledge points and pedagogical dependencies'+ entities:+ description:+ zh: '课程材料中需要学习的知识点、技能、方法或例题'+ en: 'Knowledge points, skills, procedures, or examples that the course material treats as things to learn'+ fields:+ - name: name+ type: str+ description:+ zh: '知识点名称,使用标题、定义句或首次规范表述中的术语'+ en: 'Knowledge-point name, using the term from a heading, definition sentence, or first canonical mention'+ required: true+ - name: type+ type: str+ description:+ zh: '知识点类型:概念/技能/方法/原理/例题等'+ en: 'Knowledge-point type: concept/skill/procedure/principle/example, etc.'+ required: true+ - name: description+ type: str+ description:+ zh: '该知识点在文本中的简要定义或说明'+ en: 'Brief definition or gloss of the knowledge point as given in the text'+ required: false+ relations:+ description:+ zh: '知识点之间的先修、组成、相关或示例关系'+ en: 'Prerequisite, part-whole, related, or example relationships between knowledge points'+ fields:+ - name: source+ type: str+ description:+ zh: '关系起点知识点名称'+ en: 'Source knowledge-point name'+ required: true+ - name: target+ type: str+ description:+ zh: '关系终点知识点名称'+ en: 'Target knowledge-point name'+ required: true+ - name: type+ type: str+ description:+ zh: '关系类型:先修/组成/相关/示例'+ en: 'Relation type: prerequisite_of/part_of/related_to/example_of'+ required: true+ - name: description+ type: str+ description:+ zh: '关系依据的简要说明,优先引用文本中的关系用语'+ en: 'Brief note of the textual basis, preferring relation wording that appears in the source'+ required: false++guideline:+ target:+ zh: '你是一位课程知识图谱专家,擅长从教材、讲义和课程材料中提取知识点及其教学依赖关系,而不是通用本体分类。'+ en: 'You are a course knowledge-graph expert skilled at extracting knowledge points and pedagogical dependencies from textbooks, lecture notes, and course materials, not general ontologies.'+ rules_for_entities:+ zh:+ - '只提取文本明确当作学习对象的知识点、技能、方法、原理或例题'+ - '名称使用标题、定义句或首次规范表述中的术语;同一知识点全文保持同一名称'+ - '若文本给出别名(如“哈希表(又称散列表)”),只保留一个名称,优先用标题或首次规范表述'+ - '不要把周次、页码、学分、教师姓名、课程或模块标题本身抽成知识点,除非文本将其定义为一个要学习的概念'+ - '不要提取无独立指代的泛称,如“本章内容”“上述方法”“基本概念”'+ en:+ - 'Extract only knowledge points, skills, procedures, principles, or examples that the text treats as things to learn'+ - 'Use the term from a heading, definition sentence, or first canonical mention; keep one name for the same point throughout'+ - 'If the text gives an alias (e.g., "hash table (also called hash map)"), keep one name, preferring the heading or first canonical form'+ - 'Do not extract week numbers, page numbers, credit hours, instructor names, or course/module titles as knowledge points unless the text defines them as a concept to learn'+ - 'Do not extract generic phrases with no independent referent, such as "this chapter", "the method above", or "basic concepts"'+ rules_for_relations:+ zh:+ - 'type 只能是先修、组成、相关、示例四类之一;不要抽取属于、导致等本体或因果边'+ - '先修:仅当文本明确写出学习顺序或预备要求时创建,如“须先掌握”“先修”“学习X之前应复习Y”“X是Y的先修”。方向为先学内容→后学内容。不要仅因章节先后或共现而推断先修'+ - '组成:仅当文本明确写出部分-整体时创建,如“A是B的组成部分”“B包括A”“A属于B这一章的内容”。方向为部分→整体。不要仅因同一段落出现两个术语而创建组成边'+ - '相关:仅当文本在排除先修和组成之后仍明确陈述二者有关联时创建,如“密切相关”“常与……对照”“也称作与……有关”。不要把共现默认写成相关'+ - '示例:仅当文本把A当作B的例子、例题或实例时创建,如“例如”“比如”“以……为例”。方向为例子→被说明的知识点'+ - 'source 与 target 都必须是已提取的知识点;关系两端名称必须与实体名称完全一致'+ en:+ - 'type must be one of prerequisite_of, part_of, related_to, or example_of; do not extract taxonomy or causal edges such as is_a or causes'+ - 'prerequisite_of: create only when the text states a learning-order requirement (e.g., "requires prior knowledge of", "prerequisite", "before studying X, review Y", "X is a prerequisite for Y"). Direction: earlier topic → later topic. Do not infer prerequisites from chapter order or co-occurrence'+ - 'part_of: create only when the text states a part-whole link (e.g., "A is part of B", "B includes A", "A is a topic under B"). Direction: part → whole. Do not create part_of merely because two terms appear in the same paragraph'+ - 'related_to: create only when the text explicitly associates two points after prerequisite and part-whole have been ruled out (e.g., "closely related to", "compared with", "connected with"). Do not default co-occurrence to related_to'+ - 'example_of: create only when the text presents A as an example, exercise, or illustration of B (e.g., "for example", "e.g.", "consider the case of"). Direction: example → concept'+ - 'Both source and target must be extracted knowledge points; endpoint names must match entity names exactly'++identifiers:+ entity_id: name+ relation_id: '{source}|{type}|{target}'+ relation_members:+ source: source+ target: target++display:+ entity_label: '{name}'+ relation_label: '{type}'diff --git a/hyperextract/templates/presets/education/curriculum_structure.yaml b/hyperextract/templates/presets/education/curriculum_structure.yamlnew file mode 100644index 0000000..e5318e0--- /dev/null+++ b/hyperextract/templates/presets/education/curriculum_structure.yaml@@ -0,0 +1,120 @@+language: [zh, en]++name: curriculum_structure+type: hypergraph+tags: [education, curriculum, syllabus, assessment, module]++description:+ zh: '课程结构超图模板 - 从教学大纲、培养方案和课程简介中提取课程、模块、知识点与考核的多元结构'+ en: 'Curriculum Structure Template - Extract course–module–concept–assessment structure from syllabi, program plans, and course outlines'++output:+ description:+ zh: '以教学单元为超边的课程结构,连接所属课程、所授知识点、考核方式与学习成果'+ en: 'Curriculum structure as teaching-unit hyperedges linking parent courses, taught concepts, assessments, and learning outcomes'+ entities:+ description:+ zh: '大纲中的课程结构要素:课程、模块、知识点、考核、学习成果'+ en: 'Curriculum elements in the syllabus: courses, modules, concepts, assessments, and learning outcomes'+ fields:+ - name: name+ type: str+ description:+ zh: '要素名称,使用大纲中最稳定的称呼,如课程名、模块名、考核名'+ en: 'Element name, using the most stable designation in the syllabus, such as course, module, or assessment title'+ required: true+ - name: type+ type: str+ description:+ zh: '要素类型:课程/模块/知识点/考核/成果等'+ en: 'Element type: course/module/concept/assessment/outcome, etc.'+ required: true+ - name: description+ type: str+ description:+ zh: '对该要素的补充说明,如学分、周次或考核形式,仅在文本写明时填写'+ en: 'Supplementary gloss such as credits, week number, or assessment format, only when the text states it'+ required: false+ relations:+ description:+ zh: '一个教学单元超边,将所属课程、所授知识点、考核和学习成果按角色分组'+ en: 'One teaching-unit hyperedge grouping parent courses, taught concepts, assessments, and learning outcomes by role'+ fields:+ - name: unit_name+ type: str+ description:+ zh: '教学单元名称,通常为模块、周次或课程级单元的标题'+ en: 'Teaching-unit name, usually a module, week, or course-level unit title'+ required: true+ - name: courses+ type: list+ description:+ zh: '该单元所属的一门或多门课程名称'+ en: 'One or more parent course names this unit belongs to'+ required: true+ - name: concepts+ type: list+ description:+ zh: '该单元明确覆盖或讲授的知识点名称列表'+ en: 'Knowledge-point names this unit is explicitly said to cover or teach'+ required: false+ - name: assessments+ type: list+ description:+ zh: '该单元明确对应的考核名称列表,如测验、作业、实验、考试'+ en: 'Assessment names explicitly assigned to this unit, such as quiz, homework, lab, or exam'+ required: false+ - name: outcomes+ type: list+ description:+ zh: '该单元或课程明确写出的学习成果名称列表'+ en: 'Learning-outcome names explicitly stated for this unit or course'+ required: false++guideline:+ target:+ zh: '你是一位教学设计专家,负责从教学大纲、培养方案和课程简介中准确提取课程结构,而不是从教材正文抽取概念依赖。'+ en: 'You are an instructional-design expert responsible for extracting curriculum structure from syllabi, program plans, and course outlines, not concept dependencies from textbook prose.'+ rules_for_entities:+ zh:+ - '提取课程名称作为课程实体;提取模块、单元、周次标题作为模块实体'+ - '提取大纲写明要讲授或覆盖的知识点作为知识点实体'+ - '提取测验、作业、实验、项目、期中期末考试等作为考核实体'+ - '仅当文本写出学习成果、课程目标或“学生应能够……”时,提取成果实体'+ - '不要把学分、学时、上课时间、教师、办公室地点抽成独立实体;这些信息如需保留,写入对应实体的 description'+ - '同一要素全文使用同一名称;模块名在不同课程中重复时,将 unit_name 写成“课程名 / 模块名”'+ en:+ - 'Extract course titles as course entities; extract module, unit, or week headings as module entities'+ - 'Extract topics the syllabus says will be taught or covered as concept entities'+ - 'Extract quizzes, homework, labs, projects, and midterm/final exams as assessment entities'+ - 'Extract outcome entities only when the text states learning outcomes, course objectives, or "students will be able to"'+ - 'Do not extract credits, contact hours, meeting times, instructors, or office locations as standalone entities; put such facts in description when needed'+ - 'Use one name for the same element throughout; if a module title repeats across courses, write unit_name as "Course / Module"'+ rules_for_relations:+ zh:+ - '大纲点名的每一个模块、单元或周次创建一条超边;unit_name 使用该模块标题,并同步提取为模块实体'+ - 'courses 必须填入所属课程名称;这些名称也必须作为课程实体存在'+ - 'concepts 只填该单元被明确覆盖的知识点;不要把其他模块的内容复制进来'+ - 'assessments 只填文本指定属于该单元的考核。若某考核“覆盖全部模块”或未指定模块,不要把它复制到每个模块,而应另建一条课程级超边:unit_name 使用课程名,courses 为该课程,assessments 放入该考核'+ - 'outcomes 只填文本明确写出的学习成果。课程级成果放入课程级超边;模块级成果放入对应模块超边。不要根据布鲁姆分类自行编造成果'+ - '若大纲没有模块划分、只有课程级主题与考核列表,则只创建一条课程级超边,unit_name 与课程名相同'+ - '允许列表为空:没有考核的模块应将 assessments 留空,而不是删除字段或臆造测验'+ - '同一 unit_name 不要生成重复超边;相同结构合并为一条'+ en:+ - 'Create one hyperedge per module, unit, or week the syllabus names; set unit_name to that heading and also extract it as a module entity'+ - 'courses must contain the parent course name(s); those names must also exist as course entities'+ - 'concepts may list only topics this unit is explicitly said to cover; do not copy topics from other modules'+ - 'assessments may list only assessments the text assigns to this unit. If an assessment "covers all modules" or has no module assignment, do not copy it onto every module; create a course-level hyperedge whose unit_name is the course name, courses is that course, and assessments holds that item'+ - 'outcomes may list only learning outcomes the text states. Put course-level outcomes on the course-level hyperedge and module-level outcomes on the matching module hyperedge. Do not invent Bloom-taxonomy outcomes'+ - 'If the syllabus has no modules, only course-level topics and assessments, create a single course-level hyperedge whose unit_name equals the course name'+ - 'Empty lists are allowed: a module with no stated assessment should leave assessments empty rather than dropping the field or inventing a quiz'+ - 'Do not emit duplicate hyperedges for the same unit_name; merge identical structures into one record'++identifiers:+ entity_id: name+ relation_id: '{unit_name}'+ relation_members: [courses, concepts, assessments, outcomes]++display:+ entity_label: '{name}'+ relation_label: '{unit_name}'