glost-presets 0.5.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.
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Reading App Preset
3
+ *
4
+ * Interactive reading features including transcription, translation,
5
+ * and clause segmentation.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { Preset } from "glost-processor";
10
+ /**
11
+ * Reading App Preset
12
+ *
13
+ * Optimized for interactive reading applications.
14
+ *
15
+ * Includes:
16
+ * - Transcription
17
+ * - Translation
18
+ * - Clause segmentation
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { glost } from "glost-processor";
23
+ * import { readingAppPreset } from "glost-presets";
24
+ *
25
+ * const processor = glost()
26
+ * .use(readingAppPreset);
27
+ *
28
+ * const result = await processor.process(document);
29
+ * ```
30
+ */
31
+ export declare const readingAppPreset: Preset;
32
+ /**
33
+ * Create a customized reading app preset
34
+ *
35
+ * @param options - Customization options
36
+ * @returns Customized preset
37
+ */
38
+ export declare function createReadingAppPreset(options?: {
39
+ transcriptionScheme?: string;
40
+ translationTarget?: string;
41
+ includeClauseSegmenter?: boolean;
42
+ }): Preset;
43
+ //# sourceMappingURL=reading-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reading-app.d.ts","sourceRoot":"","sources":["../src/reading-app.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAS9B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE;IAC/C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,MAAM,CAsBT"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Reading App Preset
3
+ *
4
+ * Interactive reading features including transcription, translation,
5
+ * and clause segmentation.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Reading App Preset
11
+ *
12
+ * Optimized for interactive reading applications.
13
+ *
14
+ * Includes:
15
+ * - Transcription
16
+ * - Translation
17
+ * - Clause segmentation
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { glost } from "glost-processor";
22
+ * import { readingAppPreset } from "glost-presets";
23
+ *
24
+ * const processor = glost()
25
+ * .use(readingAppPreset);
26
+ *
27
+ * const result = await processor.process(document);
28
+ * ```
29
+ */
30
+ export const readingAppPreset = {
31
+ id: "reading-app",
32
+ name: "Reading App",
33
+ description: "Interactive reading features with transcription, translation, and clause segmentation",
34
+ plugins: [
35
+ ["transcription", { scheme: "auto" }],
36
+ ["translation", { target: "en" }],
37
+ "clause-segmenter",
38
+ ],
39
+ };
40
+ /**
41
+ * Create a customized reading app preset
42
+ *
43
+ * @param options - Customization options
44
+ * @returns Customized preset
45
+ */
46
+ export function createReadingAppPreset(options) {
47
+ const { transcriptionScheme = "auto", translationTarget = "en", includeClauseSegmenter = true, } = options || {};
48
+ const plugins = [
49
+ ["transcription", { scheme: transcriptionScheme }],
50
+ ["translation", { target: translationTarget }],
51
+ ];
52
+ if (includeClauseSegmenter) {
53
+ plugins.push("clause-segmenter");
54
+ }
55
+ return {
56
+ id: "reading-app-custom",
57
+ name: "Reading App (Custom)",
58
+ description: "Customized reading app preset",
59
+ plugins,
60
+ };
61
+ }
62
+ //# sourceMappingURL=reading-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reading-app.js","sourceRoot":"","sources":["../src/reading-app.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAW;IACtC,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,uFAAuF;IACpG,OAAO,EAAE;QACP,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QACrC,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjC,kBAAkB;KACnB;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAItC;IACC,MAAM,EACJ,mBAAmB,GAAG,MAAM,EAC5B,iBAAiB,GAAG,IAAI,EACxB,sBAAsB,GAAG,IAAI,GAC9B,GAAG,OAAO,IAAI,EAAE,CAAC;IAElB,MAAM,OAAO,GAAsB;QACjC,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;QAClD,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;KAC/C,CAAC;IAEF,IAAI,sBAAsB,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACL,EAAE,EAAE,oBAAoB;QACxB,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EAAE,+BAA+B;QAC5C,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Vocabulary Builder Preset
3
+ *
4
+ * Focus on word frequency and difficulty for vocabulary learning.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ import type { Preset } from "glost-processor";
9
+ /**
10
+ * Vocabulary Builder Preset
11
+ *
12
+ * Optimized for vocabulary learning and word prioritization.
13
+ *
14
+ * Includes:
15
+ * - Frequency data
16
+ * - Difficulty levels
17
+ * - Translation
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { glost } from "glost-processor";
22
+ * import { vocabularyBuilderPreset } from "glost-presets";
23
+ *
24
+ * const processor = glost()
25
+ * .use(vocabularyBuilderPreset);
26
+ *
27
+ * const result = await processor.process(document);
28
+ * ```
29
+ */
30
+ export declare const vocabularyBuilderPreset: Preset;
31
+ /**
32
+ * Create a customized vocabulary builder preset
33
+ *
34
+ * @param options - Customization options
35
+ * @returns Customized preset
36
+ */
37
+ export declare function createVocabularyBuilderPreset(options?: {
38
+ translationTarget?: string;
39
+ includeTranslation?: boolean;
40
+ }): Preset;
41
+ //# sourceMappingURL=vocabulary-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vocabulary-builder.d.ts","sourceRoot":"","sources":["../src/vocabulary-builder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,uBAAuB,EAAE,MASrC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,CAAC,EAAE;IACtD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GAAG,MAAM,CAqBT"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Vocabulary Builder Preset
3
+ *
4
+ * Focus on word frequency and difficulty for vocabulary learning.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ /**
9
+ * Vocabulary Builder Preset
10
+ *
11
+ * Optimized for vocabulary learning and word prioritization.
12
+ *
13
+ * Includes:
14
+ * - Frequency data
15
+ * - Difficulty levels
16
+ * - Translation
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * import { glost } from "glost-processor";
21
+ * import { vocabularyBuilderPreset } from "glost-presets";
22
+ *
23
+ * const processor = glost()
24
+ * .use(vocabularyBuilderPreset);
25
+ *
26
+ * const result = await processor.process(document);
27
+ * ```
28
+ */
29
+ export const vocabularyBuilderPreset = {
30
+ id: "vocabulary-builder",
31
+ name: "Vocabulary Builder",
32
+ description: "Word frequency and difficulty for vocabulary prioritization",
33
+ plugins: [
34
+ "frequency",
35
+ "difficulty",
36
+ ["translation", { target: "en" }],
37
+ ],
38
+ };
39
+ /**
40
+ * Create a customized vocabulary builder preset
41
+ *
42
+ * @param options - Customization options
43
+ * @returns Customized preset
44
+ */
45
+ export function createVocabularyBuilderPreset(options) {
46
+ const { translationTarget = "en", includeTranslation = true, } = options || {};
47
+ const plugins = [
48
+ "frequency",
49
+ "difficulty",
50
+ ];
51
+ if (includeTranslation) {
52
+ plugins.push(["translation", { target: translationTarget }]);
53
+ }
54
+ return {
55
+ id: "vocabulary-builder-custom",
56
+ name: "Vocabulary Builder (Custom)",
57
+ description: "Customized vocabulary builder preset",
58
+ plugins,
59
+ };
60
+ }
61
+ //# sourceMappingURL=vocabulary-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vocabulary-builder.js","sourceRoot":"","sources":["../src/vocabulary-builder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAW;IAC7C,EAAE,EAAE,oBAAoB;IACxB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,6DAA6D;IAC1E,OAAO,EAAE;QACP,WAAW;QACX,YAAY;QACZ,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KAClC;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAG7C;IACC,MAAM,EACJ,iBAAiB,GAAG,IAAI,EACxB,kBAAkB,GAAG,IAAI,GAC1B,GAAG,OAAO,IAAI,EAAE,CAAC;IAElB,MAAM,OAAO,GAAsB;QACjC,WAAW;QACX,YAAY;KACb,CAAC;IAEF,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO;QACL,EAAE,EAAE,2BAA2B;QAC/B,IAAI,EAAE,6BAA6B;QACnC,WAAW,EAAE,sCAAsC;QACnD,OAAO;KACR,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "glost-presets",
3
+ "version": "0.5.0",
4
+ "description": "Preset configurations for common GLOST use cases",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "src",
17
+ "README.md"
18
+ ],
19
+ "keywords": [
20
+ "glost",
21
+ "presets",
22
+ "configuration"
23
+ ],
24
+ "author": "",
25
+ "license": "MIT",
26
+ "dependencies": {
27
+ "glost-core": "0.5.0",
28
+ "glost-processor": "0.5.0"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^20.0.0",
32
+ "typescript": "^5.3.3",
33
+ "vitest": "^1.6.0"
34
+ },
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "test": "vitest run --passWithNoTests",
38
+ "test:watch": "vitest"
39
+ }
40
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Grammar Analyzer Preset
3
+ *
4
+ * Focus on grammatical analysis with POS tagging and clause segmentation.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+
9
+ import type { Preset } from "glost-processor";
10
+
11
+ /**
12
+ * Grammar Analyzer Preset
13
+ *
14
+ * Optimized for grammatical analysis and teaching.
15
+ *
16
+ * Includes:
17
+ * - Part-of-speech tagging
18
+ * - Clause segmentation
19
+ * - Gender (for applicable languages)
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import { glost } from "glost-processor";
24
+ * import { grammarAnalyzerPreset } from "glost-presets";
25
+ *
26
+ * const processor = glost()
27
+ * .use(grammarAnalyzerPreset);
28
+ *
29
+ * const result = await processor.process(document);
30
+ * ```
31
+ */
32
+ export const grammarAnalyzerPreset: Preset = {
33
+ id: "grammar-analyzer",
34
+ name: "Grammar Analyzer",
35
+ description: "POS tagging and clause segmentation for grammar analysis",
36
+ plugins: [
37
+ "pos",
38
+ "clause-segmenter",
39
+ "gender",
40
+ ],
41
+ };
42
+
43
+ /**
44
+ * Create a customized grammar analyzer preset
45
+ *
46
+ * @param options - Customization options
47
+ * @returns Customized preset
48
+ */
49
+ export function createGrammarAnalyzerPreset(options?: {
50
+ includeGender?: boolean;
51
+ }): Preset {
52
+ const {
53
+ includeGender = true,
54
+ } = options || {};
55
+
56
+ const plugins: Preset["plugins"] = [
57
+ "pos",
58
+ "clause-segmenter",
59
+ ];
60
+
61
+ if (includeGender) {
62
+ plugins.push("gender");
63
+ }
64
+
65
+ return {
66
+ id: "grammar-analyzer-custom",
67
+ name: "Grammar Analyzer (Custom)",
68
+ description: "Customized grammar analyzer preset",
69
+ plugins,
70
+ };
71
+ }
package/src/index.ts ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * GLOST Presets
3
+ *
4
+ * Preset configurations for common GLOST use cases.
5
+ *
6
+ * @packageDocumentation
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { glost } from "glost-processor";
11
+ * import { languageLearningPreset } from "glost-presets";
12
+ *
13
+ * const processor = glost()
14
+ * .use(languageLearningPreset);
15
+ *
16
+ * const result = await processor.process(document);
17
+ * ```
18
+ */
19
+
20
+ export {
21
+ languageLearningPreset,
22
+ createLanguageLearningPreset,
23
+ } from "./language-learning.js";
24
+
25
+ export {
26
+ readingAppPreset,
27
+ createReadingAppPreset,
28
+ } from "./reading-app.js";
29
+
30
+ export {
31
+ vocabularyBuilderPreset,
32
+ createVocabularyBuilderPreset,
33
+ } from "./vocabulary-builder.js";
34
+
35
+ export {
36
+ grammarAnalyzerPreset,
37
+ createGrammarAnalyzerPreset,
38
+ } from "./grammar-analyzer.js";
39
+
40
+ export {
41
+ minimalPreset,
42
+ createMinimalPreset,
43
+ } from "./minimal.js";
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Language Learning Preset
3
+ *
4
+ * Complete language learning stack with transcription, translation,
5
+ * frequency, difficulty, and POS tagging.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+
10
+ import type { Preset } from "glost-processor";
11
+
12
+ /**
13
+ * Language Learning Preset
14
+ *
15
+ * Full-featured preset for language learning applications.
16
+ *
17
+ * Includes:
18
+ * - Transcription (with configurable scheme)
19
+ * - Translation (with configurable target)
20
+ * - Frequency data
21
+ * - Difficulty levels
22
+ * - Part-of-speech tagging
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import { glost } from "glost-processor";
27
+ * import { languageLearningPreset } from "glost-presets";
28
+ *
29
+ * const processor = glost()
30
+ * .use(languageLearningPreset);
31
+ *
32
+ * const result = await processor.process(document);
33
+ * ```
34
+ */
35
+ export const languageLearningPreset: Preset = {
36
+ id: "language-learning",
37
+ name: "Language Learning",
38
+ description: "Complete language learning stack with transcription, translation, frequency, difficulty, and POS",
39
+ plugins: [
40
+ ["transcription", { scheme: "auto" }],
41
+ ["translation", { target: "en" }],
42
+ "frequency",
43
+ "difficulty",
44
+ "pos",
45
+ ],
46
+ };
47
+
48
+ /**
49
+ * Create a customized language learning preset
50
+ *
51
+ * @param options - Customization options
52
+ * @returns Customized preset
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * import { createLanguageLearningPreset } from "glost-presets";
57
+ *
58
+ * const preset = createLanguageLearningPreset({
59
+ * transcriptionScheme: "ipa",
60
+ * translationTarget: "es",
61
+ * includePos: false
62
+ * });
63
+ * ```
64
+ */
65
+ export function createLanguageLearningPreset(options?: {
66
+ transcriptionScheme?: string;
67
+ translationTarget?: string;
68
+ includeFrequency?: boolean;
69
+ includeDifficulty?: boolean;
70
+ includePos?: boolean;
71
+ }): Preset {
72
+ const {
73
+ transcriptionScheme = "auto",
74
+ translationTarget = "en",
75
+ includeFrequency = true,
76
+ includeDifficulty = true,
77
+ includePos = true,
78
+ } = options || {};
79
+
80
+ const plugins: Preset["plugins"] = [
81
+ ["transcription", { scheme: transcriptionScheme }],
82
+ ["translation", { target: translationTarget }],
83
+ ];
84
+
85
+ if (includeFrequency) {
86
+ plugins.push("frequency");
87
+ }
88
+
89
+ if (includeDifficulty) {
90
+ plugins.push("difficulty");
91
+ }
92
+
93
+ if (includePos) {
94
+ plugins.push("pos");
95
+ }
96
+
97
+ return {
98
+ id: "language-learning-custom",
99
+ name: "Language Learning (Custom)",
100
+ description: "Customized language learning preset",
101
+ plugins,
102
+ };
103
+ }
package/src/minimal.ts ADDED
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Minimal Preset
3
+ *
4
+ * Just the essentials: transcription and translation.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+
9
+ import type { Preset } from "glost-processor";
10
+
11
+ /**
12
+ * Minimal Preset
13
+ *
14
+ * Lightweight preset with just transcription and translation.
15
+ *
16
+ * Includes:
17
+ * - Transcription
18
+ * - Translation
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { glost } from "glost-processor";
23
+ * import { minimalPreset } from "glost-presets";
24
+ *
25
+ * const processor = glost()
26
+ * .use(minimalPreset);
27
+ *
28
+ * const result = await processor.process(document);
29
+ * ```
30
+ */
31
+ export const minimalPreset: Preset = {
32
+ id: "minimal",
33
+ name: "Minimal",
34
+ description: "Just transcription and translation - the essentials",
35
+ plugins: [
36
+ ["transcription", { scheme: "auto" }],
37
+ ["translation", { target: "en" }],
38
+ ],
39
+ };
40
+
41
+ /**
42
+ * Create a customized minimal preset
43
+ *
44
+ * @param options - Customization options
45
+ * @returns Customized preset
46
+ */
47
+ export function createMinimalPreset(options?: {
48
+ transcriptionScheme?: string;
49
+ translationTarget?: string;
50
+ }): Preset {
51
+ const {
52
+ transcriptionScheme = "auto",
53
+ translationTarget = "en",
54
+ } = options || {};
55
+
56
+ return {
57
+ id: "minimal-custom",
58
+ name: "Minimal (Custom)",
59
+ description: "Customized minimal preset",
60
+ plugins: [
61
+ ["transcription", { scheme: transcriptionScheme }],
62
+ ["translation", { target: translationTarget }],
63
+ ],
64
+ };
65
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Reading App Preset
3
+ *
4
+ * Interactive reading features including transcription, translation,
5
+ * and clause segmentation.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+
10
+ import type { Preset } from "glost-processor";
11
+
12
+ /**
13
+ * Reading App Preset
14
+ *
15
+ * Optimized for interactive reading applications.
16
+ *
17
+ * Includes:
18
+ * - Transcription
19
+ * - Translation
20
+ * - Clause segmentation
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * import { glost } from "glost-processor";
25
+ * import { readingAppPreset } from "glost-presets";
26
+ *
27
+ * const processor = glost()
28
+ * .use(readingAppPreset);
29
+ *
30
+ * const result = await processor.process(document);
31
+ * ```
32
+ */
33
+ export const readingAppPreset: Preset = {
34
+ id: "reading-app",
35
+ name: "Reading App",
36
+ description: "Interactive reading features with transcription, translation, and clause segmentation",
37
+ plugins: [
38
+ ["transcription", { scheme: "auto" }],
39
+ ["translation", { target: "en" }],
40
+ "clause-segmenter",
41
+ ],
42
+ };
43
+
44
+ /**
45
+ * Create a customized reading app preset
46
+ *
47
+ * @param options - Customization options
48
+ * @returns Customized preset
49
+ */
50
+ export function createReadingAppPreset(options?: {
51
+ transcriptionScheme?: string;
52
+ translationTarget?: string;
53
+ includeClauseSegmenter?: boolean;
54
+ }): Preset {
55
+ const {
56
+ transcriptionScheme = "auto",
57
+ translationTarget = "en",
58
+ includeClauseSegmenter = true,
59
+ } = options || {};
60
+
61
+ const plugins: Preset["plugins"] = [
62
+ ["transcription", { scheme: transcriptionScheme }],
63
+ ["translation", { target: translationTarget }],
64
+ ];
65
+
66
+ if (includeClauseSegmenter) {
67
+ plugins.push("clause-segmenter");
68
+ }
69
+
70
+ return {
71
+ id: "reading-app-custom",
72
+ name: "Reading App (Custom)",
73
+ description: "Customized reading app preset",
74
+ plugins,
75
+ };
76
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Vocabulary Builder Preset
3
+ *
4
+ * Focus on word frequency and difficulty for vocabulary learning.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+
9
+ import type { Preset } from "glost-processor";
10
+
11
+ /**
12
+ * Vocabulary Builder Preset
13
+ *
14
+ * Optimized for vocabulary learning and word prioritization.
15
+ *
16
+ * Includes:
17
+ * - Frequency data
18
+ * - Difficulty levels
19
+ * - Translation
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import { glost } from "glost-processor";
24
+ * import { vocabularyBuilderPreset } from "glost-presets";
25
+ *
26
+ * const processor = glost()
27
+ * .use(vocabularyBuilderPreset);
28
+ *
29
+ * const result = await processor.process(document);
30
+ * ```
31
+ */
32
+ export const vocabularyBuilderPreset: Preset = {
33
+ id: "vocabulary-builder",
34
+ name: "Vocabulary Builder",
35
+ description: "Word frequency and difficulty for vocabulary prioritization",
36
+ plugins: [
37
+ "frequency",
38
+ "difficulty",
39
+ ["translation", { target: "en" }],
40
+ ],
41
+ };
42
+
43
+ /**
44
+ * Create a customized vocabulary builder preset
45
+ *
46
+ * @param options - Customization options
47
+ * @returns Customized preset
48
+ */
49
+ export function createVocabularyBuilderPreset(options?: {
50
+ translationTarget?: string;
51
+ includeTranslation?: boolean;
52
+ }): Preset {
53
+ const {
54
+ translationTarget = "en",
55
+ includeTranslation = true,
56
+ } = options || {};
57
+
58
+ const plugins: Preset["plugins"] = [
59
+ "frequency",
60
+ "difficulty",
61
+ ];
62
+
63
+ if (includeTranslation) {
64
+ plugins.push(["translation", { target: translationTarget }]);
65
+ }
66
+
67
+ return {
68
+ id: "vocabulary-builder-custom",
69
+ name: "Vocabulary Builder (Custom)",
70
+ description: "Customized vocabulary builder preset",
71
+ plugins,
72
+ };
73
+ }