learngraph 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/LICENSE +190 -21
  2. package/README.md +187 -5
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/cjs/parsers/base.js +189 -0
  5. package/dist/cjs/parsers/base.js.map +1 -0
  6. package/dist/cjs/parsers/demo.js +159 -0
  7. package/dist/cjs/parsers/demo.js.map +1 -0
  8. package/dist/cjs/parsers/extractor.js +191 -0
  9. package/dist/cjs/parsers/extractor.js.map +1 -0
  10. package/dist/cjs/parsers/index.js +43 -4
  11. package/dist/cjs/parsers/index.js.map +1 -1
  12. package/dist/cjs/parsers/json.js +157 -0
  13. package/dist/cjs/parsers/json.js.map +1 -0
  14. package/dist/cjs/parsers/markdown.js +168 -0
  15. package/dist/cjs/parsers/markdown.js.map +1 -0
  16. package/dist/cjs/parsers/samples.js +139 -0
  17. package/dist/cjs/parsers/samples.js.map +1 -0
  18. package/dist/cjs/storage/base.js +231 -0
  19. package/dist/cjs/storage/base.js.map +1 -0
  20. package/dist/cjs/storage/errors.js +128 -0
  21. package/dist/cjs/storage/errors.js.map +1 -0
  22. package/dist/cjs/storage/index.js +92 -5
  23. package/dist/cjs/storage/index.js.map +1 -1
  24. package/dist/cjs/storage/levelgraph.js +855 -0
  25. package/dist/cjs/storage/levelgraph.js.map +1 -0
  26. package/dist/cjs/storage/memory.js +447 -0
  27. package/dist/cjs/storage/memory.js.map +1 -0
  28. package/dist/cjs/storage/neo4j.js +866 -0
  29. package/dist/cjs/storage/neo4j.js.map +1 -0
  30. package/dist/cjs/storage/seeds.js +565 -0
  31. package/dist/cjs/storage/seeds.js.map +1 -0
  32. package/dist/cjs/types/parser.js +8 -0
  33. package/dist/cjs/types/parser.js.map +1 -0
  34. package/dist/esm/index.js +1 -1
  35. package/dist/esm/parsers/base.js +179 -0
  36. package/dist/esm/parsers/base.js.map +1 -0
  37. package/dist/esm/parsers/demo.js +154 -0
  38. package/dist/esm/parsers/demo.js.map +1 -0
  39. package/dist/esm/parsers/extractor.js +187 -0
  40. package/dist/esm/parsers/extractor.js.map +1 -0
  41. package/dist/esm/parsers/index.js +24 -5
  42. package/dist/esm/parsers/index.js.map +1 -1
  43. package/dist/esm/parsers/json.js +153 -0
  44. package/dist/esm/parsers/json.js.map +1 -0
  45. package/dist/esm/parsers/markdown.js +164 -0
  46. package/dist/esm/parsers/markdown.js.map +1 -0
  47. package/dist/esm/parsers/samples.js +136 -0
  48. package/dist/esm/parsers/samples.js.map +1 -0
  49. package/dist/esm/storage/base.js +221 -0
  50. package/dist/esm/storage/base.js.map +1 -0
  51. package/dist/esm/storage/errors.js +116 -0
  52. package/dist/esm/storage/errors.js.map +1 -0
  53. package/dist/esm/storage/index.js +71 -6
  54. package/dist/esm/storage/index.js.map +1 -1
  55. package/dist/esm/storage/levelgraph.js +818 -0
  56. package/dist/esm/storage/levelgraph.js.map +1 -0
  57. package/dist/esm/storage/memory.js +443 -0
  58. package/dist/esm/storage/memory.js.map +1 -0
  59. package/dist/esm/storage/neo4j.js +829 -0
  60. package/dist/esm/storage/neo4j.js.map +1 -0
  61. package/dist/esm/storage/seeds.js +561 -0
  62. package/dist/esm/storage/seeds.js.map +1 -0
  63. package/dist/esm/types/parser.js +7 -0
  64. package/dist/esm/types/parser.js.map +1 -0
  65. package/dist/types/index.d.ts +1 -1
  66. package/dist/types/parsers/base.d.ts +39 -0
  67. package/dist/types/parsers/base.d.ts.map +1 -0
  68. package/dist/types/parsers/demo.d.ts +87 -0
  69. package/dist/types/parsers/demo.d.ts.map +1 -0
  70. package/dist/types/parsers/extractor.d.ts +43 -0
  71. package/dist/types/parsers/extractor.d.ts.map +1 -0
  72. package/dist/types/parsers/index.d.ts +10 -0
  73. package/dist/types/parsers/index.d.ts.map +1 -1
  74. package/dist/types/parsers/json.d.ts +71 -0
  75. package/dist/types/parsers/json.d.ts.map +1 -0
  76. package/dist/types/parsers/markdown.d.ts +43 -0
  77. package/dist/types/parsers/markdown.d.ts.map +1 -0
  78. package/dist/types/parsers/samples.d.ts +27 -0
  79. package/dist/types/parsers/samples.d.ts.map +1 -0
  80. package/dist/types/storage/base.d.ts +39 -0
  81. package/dist/types/storage/base.d.ts.map +1 -0
  82. package/dist/types/storage/errors.d.ts +74 -0
  83. package/dist/types/storage/errors.d.ts.map +1 -0
  84. package/dist/types/storage/index.d.ts +50 -2
  85. package/dist/types/storage/index.d.ts.map +1 -1
  86. package/dist/types/storage/levelgraph.d.ts +92 -0
  87. package/dist/types/storage/levelgraph.d.ts.map +1 -0
  88. package/dist/types/storage/memory.d.ts +70 -0
  89. package/dist/types/storage/memory.d.ts.map +1 -0
  90. package/dist/types/storage/neo4j.d.ts +88 -0
  91. package/dist/types/storage/neo4j.d.ts.map +1 -0
  92. package/dist/types/storage/seeds.d.ts +27 -0
  93. package/dist/types/storage/seeds.d.ts.map +1 -0
  94. package/dist/types/types/index.d.ts +1 -0
  95. package/dist/types/types/index.d.ts.map +1 -1
  96. package/dist/types/types/parser.d.ts +208 -0
  97. package/dist/types/types/parser.d.ts.map +1 -0
  98. package/package.json +33 -6
  99. package/scripts/postinstall.js +68 -0
package/LICENSE CHANGED
@@ -1,21 +1,190 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 LearnGraph Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 LearnGraph Team
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md CHANGED
@@ -1,8 +1,27 @@
1
- # jali
1
+ # LearnGraph
2
2
 
3
- AI-powered educational knowledge graph infrastructure.
3
+ **The world's first AI-powered learning path generator.**
4
4
 
5
- See the [main README](../../README.md) for full documentation.
5
+ Transform any syllabus into personalized mastery paths with learning science built in. Every student's path to mastery, powered by decades of educational research.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/learngraph.svg)](https://www.npmjs.com/package/learngraph)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ ## Why LearnGraph?
11
+
12
+ **The Problem**: Traditional curricula treat all learners the same. They present content linearly, ignore prerequisite gaps, and fail to adapt to individual progress.
13
+
14
+ **The Solution**: LearnGraph decomposes curricula into skill graphs, automatically identifies each learner's Zone of Proximal Development (ZPD), and generates personalized learning paths that respect cognitive load limits.
15
+
16
+ ### Key Features
17
+
18
+ - **Zone of Proximal Development (ZPD)** - Identifies skills that are challenging but achievable
19
+ - **Bloom's Taxonomy Integration** - Automatic detection and progression through cognitive levels
20
+ - **Bayesian Knowledge Tracing (BKT)** - Probabilistic mastery estimation from performance data
21
+ - **Spaced Repetition** - Optimal review scheduling based on memory science
22
+ - **Prerequisite Mapping** - Hard, soft, and recommended dependency relationships
23
+ - **Threshold Concepts** - Identifies transformative "gateway" skills that unlock understanding
24
+ - **Cognitive Load Management** - Respects working memory limits in session planning
6
25
 
7
26
  ## Installation
8
27
 
@@ -13,13 +32,176 @@ npm install learngraph
13
32
  ## Quick Start
14
33
 
15
34
  ```typescript
16
- import { createSkillId, type SkillNode, detectBloomLevel } from 'learngraph';
35
+ import {
36
+ createSkillId,
37
+ detectBloomLevel,
38
+ hasMastery,
39
+ type SkillNode
40
+ } from 'learngraph';
17
41
 
18
42
  // Detect Bloom's level from a learning objective
19
43
  const level = detectBloomLevel('Calculate the derivative of a polynomial');
20
44
  console.log(level); // 'apply'
45
+
46
+ // Define a skill in the knowledge graph
47
+ const skill: SkillNode = {
48
+ id: createSkillId('derivatives-polynomials'),
49
+ name: 'Polynomial Derivatives',
50
+ description: 'Calculate derivatives of polynomial functions using power rule',
51
+ bloomLevel: 'apply',
52
+ difficulty: 0.4,
53
+ isThresholdConcept: false,
54
+ masteryThreshold: 0.8,
55
+ estimatedMinutes: 30,
56
+ tags: ['calculus', 'derivatives'],
57
+ metadata: {},
58
+ createdAt: new Date().toISOString(),
59
+ updatedAt: new Date().toISOString(),
60
+ };
61
+
62
+ // Check if learner has mastered a skill
63
+ const mastered = hasMastery(0.85); // true (above 0.8 threshold)
21
64
  ```
22
65
 
66
+ ## Educational Research Foundations
67
+
68
+ LearnGraph is built on decades of peer-reviewed educational psychology research:
69
+
70
+ | Framework | Purpose | Key Benefit |
71
+ |-----------|---------|-------------|
72
+ | **Zone of Proximal Development** | Vygotsky's theory of optimal learning challenge | Keeps learners in the "sweet spot" |
73
+ | **Bloom's Taxonomy** | Cognitive complexity hierarchy | Ensures proper skill progression |
74
+ | **Bayesian Knowledge Tracing** | Probabilistic mastery modeling | Accurate knowledge state estimation |
75
+ | **Item Response Theory** | Skill difficulty calibration | Fair assessment across items |
76
+ | **Spaced Repetition** | Memory consolidation optimization | Long-term retention |
77
+ | **Cognitive Load Theory** | Working memory management | Prevents overwhelm |
78
+
79
+ ## Storage Adapters
80
+
81
+ LearnGraph supports multiple storage backends. Use the one that fits your needs:
82
+
83
+ ### In-Memory Storage (Built-in)
84
+
85
+ Perfect for testing, prototyping, and serverless functions:
86
+
87
+ ```typescript
88
+ import { MemoryStorage } from 'learngraph/storage';
89
+
90
+ const storage = new MemoryStorage();
91
+ await storage.connect({ backend: 'memory' });
92
+
93
+ // Create a skill
94
+ const skill = await storage.createSkill({
95
+ name: 'Add Fractions',
96
+ description: 'Add fractions with like denominators',
97
+ bloomLevel: 'apply',
98
+ difficulty: 0.4,
99
+ isThresholdConcept: false,
100
+ masteryThreshold: 0.8,
101
+ estimatedMinutes: 30,
102
+ tags: ['math', 'fractions'],
103
+ metadata: {}
104
+ });
105
+
106
+ // Create prerequisite relationships
107
+ await storage.createPrerequisite({
108
+ sourceId: basicMathSkill.id,
109
+ targetId: skill.id,
110
+ strength: 0.9,
111
+ type: 'hard',
112
+ metadata: {}
113
+ });
114
+
115
+ // Query the graph
116
+ const prerequisites = await storage.getPrerequisitesOf(skill.id);
117
+ const stats = await storage.getStats();
118
+ ```
119
+
120
+ ### LevelGraph Storage (Embedded)
121
+
122
+ For persistent, file-based storage without external databases:
123
+
124
+ ```bash
125
+ npm install level levelgraph
126
+ ```
127
+
128
+ ```typescript
129
+ import { LevelGraphStorage } from 'learngraph/storage';
130
+
131
+ const storage = new LevelGraphStorage();
132
+ await storage.connect({
133
+ backend: 'levelgraph',
134
+ path: './data/learngraph'
135
+ });
136
+ ```
137
+
138
+ ### Neo4j Storage (Production)
139
+
140
+ For production deployments with full graph database capabilities:
141
+
142
+ ```bash
143
+ npm install neo4j-driver
144
+ ```
145
+
146
+ ```typescript
147
+ import { Neo4jStorage } from 'learngraph/storage';
148
+
149
+ const storage = new Neo4jStorage();
150
+ await storage.connect({
151
+ backend: 'neo4j',
152
+ uri: 'bolt://localhost:7687',
153
+ username: 'neo4j',
154
+ password: 'password',
155
+ database: 'learngraph'
156
+ });
157
+ ```
158
+
159
+ ## Submodule Exports
160
+
161
+ ```typescript
162
+ // Core types and utilities
163
+ import { SkillNode, SkillEdge } from 'learngraph';
164
+
165
+ // Storage adapters (Memory, LevelGraph, Neo4j)
166
+ import { MemoryStorage, LevelGraphStorage, Neo4jStorage } from 'learngraph/storage';
167
+
168
+ // LLM integration for curriculum decomposition
169
+ import { LLMProvider } from 'learngraph/llm';
170
+
171
+ // Query builders and ZPD calculation
172
+ import { ZPDResult, LearningPath } from 'learngraph/query';
173
+
174
+ // Educational utilities (Bloom's, mastery, etc.)
175
+ import { detectBloomLevel, hasMastery } from 'learngraph/education';
176
+ ```
177
+
178
+ ## Use Cases
179
+
180
+ - **Intelligent Tutoring Systems (ITS)** - Build adaptive learning platforms
181
+ - **Curriculum Decomposition** - Transform syllabi into skill graphs
182
+ - **Learning Path Generation** - Personalized routes to mastery
183
+ - **Prerequisite Analysis** - Identify and fill knowledge gaps
184
+ - **Competency-Based Education** - Track and verify skill mastery
185
+ - **Corporate Training** - Personalized upskilling programs
186
+
187
+ ## Author
188
+
189
+ **Dr. Ernesto Lee** - Educational technologist and learning scientist
190
+
191
+ - Website: [https://DrLee.ai](https://DrLee.ai)
192
+ - Email: dr.ernesto.lee@gmail.com
193
+ - GitHub: [@fenago](https://github.com/fenago)
194
+
195
+ ## Contributing
196
+
197
+ Contributions are welcome! Please see the [main repository](https://github.com/fenago/Jali) for guidelines.
198
+
23
199
  ## License
24
200
 
25
- MIT
201
+ MIT - See [LICENSE](./LICENSE) for details.
202
+
203
+ ## Links
204
+
205
+ - [GitHub Repository](https://github.com/fenago/Jali)
206
+ - [Issue Tracker](https://github.com/fenago/Jali/issues)
207
+ - [Sponsor](https://github.com/sponsors/fenago)
package/dist/cjs/index.js CHANGED
@@ -53,7 +53,7 @@ __exportStar(require("./types/index.js"), exports);
53
53
  /**
54
54
  * Package version
55
55
  */
56
- exports.VERSION = '0.1.0';
56
+ exports.VERSION = '0.1.1';
57
57
  /**
58
58
  * Package name
59
59
  */
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ /**
3
+ * Base parser utilities
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.DEFAULT_PARSE_OPTIONS = void 0;
9
+ exports.extractTime = extractTime;
10
+ exports.isObjectiveLine = isObjectiveLine;
11
+ exports.cleanText = cleanText;
12
+ exports.objectiveToSkillName = objectiveToSkillName;
13
+ exports.createObjective = createObjective;
14
+ exports.createEmptyResult = createEmptyResult;
15
+ exports.calculateStats = calculateStats;
16
+ const bloom_js_1 = require("../types/bloom.js");
17
+ /**
18
+ * Default parse options
19
+ */
20
+ exports.DEFAULT_PARSE_OPTIONS = {
21
+ detectBloom: true,
22
+ extractTime: true,
23
+ suggestNames: true,
24
+ includeRaw: false,
25
+ sectionHeaders: [
26
+ 'module',
27
+ 'chapter',
28
+ 'unit',
29
+ 'week',
30
+ 'section',
31
+ 'part',
32
+ 'lesson',
33
+ 'topic',
34
+ ],
35
+ objectiveMarkers: [
36
+ 'students will be able to',
37
+ 'learners will',
38
+ 'by the end of this',
39
+ 'learning objectives',
40
+ 'objectives:',
41
+ 'learning outcomes',
42
+ 'outcomes:',
43
+ 'lo:',
44
+ 'swbat',
45
+ '•',
46
+ '-',
47
+ '*',
48
+ ],
49
+ };
50
+ /**
51
+ * Common time patterns in syllabi
52
+ * Note: Decimal hours pattern must come before integer hours pattern
53
+ */
54
+ const TIME_PATTERNS = [
55
+ /(\d+)\s*(?:min(?:ute)?s?|mins?)/i,
56
+ /(\d+\.\d+)\s*(?:hour?s?|hrs?)/i,
57
+ /(\d+)\s*(?:hour?s?|hrs?)/i,
58
+ ];
59
+ /**
60
+ * Extract estimated time from text
61
+ */
62
+ function extractTime(text) {
63
+ for (const pattern of TIME_PATTERNS) {
64
+ const match = text.match(pattern);
65
+ if (match && match[1]) {
66
+ const value = parseFloat(match[1]);
67
+ if (pattern.source.includes('hour')) {
68
+ return Math.round(value * 60);
69
+ }
70
+ return Math.round(value);
71
+ }
72
+ }
73
+ return undefined;
74
+ }
75
+ /**
76
+ * Detect if a line is a learning objective
77
+ */
78
+ function isObjectiveLine(line, markers) {
79
+ const lower = line.toLowerCase().trim();
80
+ return markers.some((marker) => lower.includes(marker.toLowerCase()));
81
+ }
82
+ /**
83
+ * Clean and normalize text
84
+ */
85
+ function cleanText(text) {
86
+ return text
87
+ .replace(/\s+/g, ' ')
88
+ .replace(/^\s*[-•*]\s*/, '')
89
+ .replace(/^\d+\.\s*/, '')
90
+ .trim();
91
+ }
92
+ /**
93
+ * Generate a skill name from an objective
94
+ */
95
+ function objectiveToSkillName(objective) {
96
+ const cleaned = cleanText(objective);
97
+ // Remove common prefixes
98
+ const prefixes = [
99
+ /^students will be able to\s+/i,
100
+ /^learners will\s+/i,
101
+ /^by the end of this [\w\s]+,?\s*/i,
102
+ /^the student will\s+/i,
103
+ /^understand\s+/i,
104
+ /^learn\s+/i,
105
+ ];
106
+ let result = cleaned;
107
+ for (const prefix of prefixes) {
108
+ result = result.replace(prefix, '');
109
+ }
110
+ // Capitalize first letter
111
+ result = result.charAt(0).toUpperCase() + result.slice(1);
112
+ // Truncate if too long
113
+ if (result.length > 80) {
114
+ result = result.substring(0, 77) + '...';
115
+ }
116
+ return result;
117
+ }
118
+ /**
119
+ * Create a learning objective from text
120
+ */
121
+ function createObjective(text, section, week) {
122
+ const cleaned = cleanText(text);
123
+ const bloomLevel = (0, bloom_js_1.detectBloomLevel)(cleaned);
124
+ const objective = {
125
+ text: cleaned,
126
+ bloomLevel,
127
+ bloomConfidence: bloomLevel ? 0.8 : 0,
128
+ suggestedName: objectiveToSkillName(cleaned),
129
+ };
130
+ if (section !== undefined) {
131
+ objective.section = section;
132
+ }
133
+ if (week !== undefined) {
134
+ objective.week = week;
135
+ }
136
+ return objective;
137
+ }
138
+ /**
139
+ * Create empty parse result
140
+ */
141
+ function createEmptyResult(source, format) {
142
+ return {
143
+ metadata: {
144
+ source,
145
+ format,
146
+ parsedAt: new Date().toISOString(),
147
+ },
148
+ modules: [],
149
+ topics: [],
150
+ objectives: [],
151
+ warnings: [],
152
+ stats: {
153
+ moduleCount: 0,
154
+ topicCount: 0,
155
+ objectiveCount: 0,
156
+ bloomDetectedCount: 0,
157
+ durationMs: 0,
158
+ },
159
+ };
160
+ }
161
+ /**
162
+ * Calculate parse statistics
163
+ */
164
+ function calculateStats(result, startTime) {
165
+ let objectiveCount = result.objectives.length;
166
+ let bloomDetectedCount = result.objectives.filter((o) => o.bloomLevel).length;
167
+ for (const topic of result.topics) {
168
+ objectiveCount += topic.objectives.length;
169
+ bloomDetectedCount += topic.objectives.filter((o) => o.bloomLevel).length;
170
+ }
171
+ for (const mod of result.modules) {
172
+ objectiveCount += mod.objectives.length;
173
+ bloomDetectedCount += mod.objectives.filter((o) => o.bloomLevel).length;
174
+ for (const topic of mod.topics) {
175
+ objectiveCount += topic.objectives.length;
176
+ bloomDetectedCount += topic.objectives.filter((o) => o.bloomLevel).length;
177
+ }
178
+ }
179
+ const topicCount = result.topics.length +
180
+ result.modules.reduce((sum, m) => sum + m.topics.length, 0);
181
+ return {
182
+ moduleCount: result.modules.length,
183
+ topicCount,
184
+ objectiveCount,
185
+ bloomDetectedCount,
186
+ durationMs: Date.now() - startTime,
187
+ };
188
+ }
189
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/parsers/base.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA0DH,kCAYC;AAKD,0CAGC;AAKD,8BAMC;AAKD,oDA2BC;AAKD,0CAuBC;AAKD,8CAsBC;AAKD,wCA6BC;AAzMD,gDAAqD;AAErD;;GAEG;AACU,QAAA,qBAAqB,GAA2B;IAC3D,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE;QACd,QAAQ;QACR,SAAS;QACT,MAAM;QACN,MAAM;QACN,SAAS;QACT,MAAM;QACN,QAAQ;QACR,OAAO;KACR;IACD,gBAAgB,EAAE;QAChB,0BAA0B;QAC1B,eAAe;QACf,oBAAoB;QACpB,qBAAqB;QACrB,aAAa;QACb,mBAAmB;QACnB,WAAW;QACX,KAAK;QACL,OAAO;QACP,GAAG;QACH,GAAG;QACH,GAAG;KACJ;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,aAAa,GAAG;IACpB,kCAAkC;IAClC,gCAAgC;IAChC,2BAA2B;CAC5B,CAAC;AAEF;;GAEG;AACH,SAAgB,WAAW,CAAC,IAAY;IACtC,KAAK,MAAM,OAAO,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