glost 0.3.0 → 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.
- package/README.md +253 -114
- package/dist/index.d.ts +29 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -23
- package/dist/index.js.map +1 -1
- package/dist/presets.d.ts +7 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +7 -0
- package/dist/presets.js.map +1 -0
- package/dist/processor.d.ts +8 -0
- package/dist/processor.d.ts.map +1 -0
- package/dist/processor.js +7 -0
- package/dist/processor.js.map +1 -0
- package/dist/registry.d.ts +8 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +7 -0
- package/dist/registry.js.map +1 -0
- package/package.json +27 -37
- package/src/index.ts +126 -68
- package/src/presets.ts +18 -0
- package/src/processor.ts +24 -0
- package/src/registry.ts +23 -0
- package/tsconfig.json +6 -3
- package/CHANGELOG.md +0 -151
- package/dist/example.d.ts +0 -10
- package/dist/example.d.ts.map +0 -1
- package/dist/example.js +0 -138
- package/dist/example.js.map +0 -1
- package/dist/guards.d.ts +0 -103
- package/dist/guards.d.ts.map +0 -1
- package/dist/guards.js +0 -264
- package/dist/guards.js.map +0 -1
- package/dist/nodes.d.ts +0 -163
- package/dist/nodes.d.ts.map +0 -1
- package/dist/nodes.js +0 -186
- package/dist/nodes.js.map +0 -1
- package/dist/types.d.ts +0 -379
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts +0 -203
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -497
- package/dist/utils.js.map +0 -1
- package/dist/validators.d.ts +0 -1876
- package/dist/validators.d.ts.map +0 -1
- package/dist/validators.js +0 -302
- package/dist/validators.js.map +0 -1
- package/src/__tests__/README.md +0 -20
- package/src/__tests__/example.test.ts +0 -43
- package/src/__tests__/example.ts +0 -186
- package/src/__tests__/mock-data.ts +0 -624
- package/src/guards.ts +0 -341
- package/src/nodes.ts +0 -327
- package/src/types.ts +0 -565
- package/src/utils.ts +0 -652
- package/src/validators.ts +0 -336
package/package.json
CHANGED
|
@@ -1,56 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glost",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "GLOST - Glossed Syntax Tree for
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "GLOST - Glossed Syntax Tree for language learning and multilingual text processing",
|
|
5
5
|
"author": "fustilio",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/fustilio/glost.git",
|
|
10
|
-
"directory": "packages/
|
|
10
|
+
"directory": "packages/glost"
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
|
-
"main": "./
|
|
14
|
-
"types": "./
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"types": "./
|
|
18
|
-
"default": "./
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
19
|
},
|
|
20
|
-
"./
|
|
21
|
-
"types": "./
|
|
22
|
-
"default": "./
|
|
20
|
+
"./processor": {
|
|
21
|
+
"types": "./dist/processor.d.ts",
|
|
22
|
+
"default": "./dist/processor.js"
|
|
23
23
|
},
|
|
24
|
-
"./
|
|
25
|
-
"types": "./
|
|
26
|
-
"default": "./
|
|
24
|
+
"./registry": {
|
|
25
|
+
"types": "./dist/registry.d.ts",
|
|
26
|
+
"default": "./dist/registry.js"
|
|
27
27
|
},
|
|
28
|
-
"./
|
|
29
|
-
"types": "./
|
|
30
|
-
"default": "./
|
|
31
|
-
},
|
|
32
|
-
"./guards": {
|
|
33
|
-
"types": "./src/guards.ts",
|
|
34
|
-
"default": "./src/guards.ts"
|
|
28
|
+
"./presets": {
|
|
29
|
+
"types": "./dist/presets.d.ts",
|
|
30
|
+
"default": "./dist/presets.js"
|
|
35
31
|
}
|
|
36
32
|
},
|
|
37
33
|
"dependencies": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"unist-util-map": "^4.0.0",
|
|
43
|
-
"unist-util-modify-children": "^4.0.0",
|
|
44
|
-
"unist-util-remove": "^4.0.0",
|
|
45
|
-
"unist-util-select": "^5.1.0",
|
|
46
|
-
"unist-util-visit": "^5.0.0",
|
|
47
|
-
"zod": "^3.23.8",
|
|
48
|
-
"glost-common": "0.1.3"
|
|
34
|
+
"glost-core": "0.5.0",
|
|
35
|
+
"glost-processor": "0.5.0",
|
|
36
|
+
"glost-presets": "0.5.0",
|
|
37
|
+
"glost-registry": "0.5.0"
|
|
49
38
|
},
|
|
50
39
|
"devDependencies": {
|
|
51
|
-
"@types/
|
|
52
|
-
"typescript": "^5.
|
|
53
|
-
"vitest": "^3.0.5"
|
|
40
|
+
"@types/node": "^20.0.0",
|
|
41
|
+
"typescript": "^5.3.3"
|
|
54
42
|
},
|
|
55
43
|
"keywords": [
|
|
56
44
|
"glost",
|
|
@@ -60,11 +48,13 @@
|
|
|
60
48
|
"language-learning",
|
|
61
49
|
"linguistics",
|
|
62
50
|
"syntax-tree",
|
|
63
|
-
"unist"
|
|
51
|
+
"unist",
|
|
52
|
+
"processor",
|
|
53
|
+
"pipeline",
|
|
54
|
+
"unified"
|
|
64
55
|
],
|
|
65
56
|
"scripts": {
|
|
66
57
|
"build": "tsc",
|
|
67
|
-
"typecheck": "tsc --noEmit"
|
|
68
|
-
"test": "vitest --passWithNoTests"
|
|
58
|
+
"typecheck": "tsc --noEmit"
|
|
69
59
|
}
|
|
70
60
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,68 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} from "
|
|
1
|
+
/**
|
|
2
|
+
* GLOST - Glossed Syntax Tree
|
|
3
|
+
*
|
|
4
|
+
* Main package that re-exports all GLOST functionality.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Import everything from one place
|
|
11
|
+
* import { glost, createSimpleDocument, getAllWords } from "glost";
|
|
12
|
+
* import { languageLearningPreset } from "glost/presets";
|
|
13
|
+
*
|
|
14
|
+
* // Create a document
|
|
15
|
+
* const document = createSimpleDocument(words, "th", "thai");
|
|
16
|
+
*
|
|
17
|
+
* // Process with plugins
|
|
18
|
+
* const result = await glost()
|
|
19
|
+
* .use(languageLearningPreset)
|
|
20
|
+
* .process(document);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Core Types
|
|
26
|
+
// ============================================================================
|
|
27
|
+
export type {
|
|
28
|
+
GLOSTNode,
|
|
29
|
+
GLOSTRoot,
|
|
30
|
+
GLOSTParagraph,
|
|
31
|
+
GLOSTSentence,
|
|
32
|
+
GLOSTWord,
|
|
33
|
+
GLOSTText,
|
|
34
|
+
GLOSTWhiteSpace,
|
|
35
|
+
GLOSTPunctuation,
|
|
36
|
+
GLOSTSymbol,
|
|
37
|
+
GLOSTSource,
|
|
38
|
+
GLOSTClause,
|
|
39
|
+
GLOSTPhrase,
|
|
40
|
+
GLOSTSyllable,
|
|
41
|
+
GLOSTCharacter,
|
|
42
|
+
GLOSTExtras,
|
|
43
|
+
TransliterationData,
|
|
44
|
+
LinguisticMetadata,
|
|
45
|
+
LanguageCode,
|
|
46
|
+
ScriptSystem,
|
|
47
|
+
} from "glost-core";
|
|
48
|
+
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// Node Factories
|
|
51
|
+
// ============================================================================
|
|
52
|
+
export {
|
|
53
|
+
createGLOSTRootNode,
|
|
54
|
+
createGLOSTParagraphNode,
|
|
55
|
+
createGLOSTSentenceNode,
|
|
56
|
+
createGLOSTWordNode,
|
|
57
|
+
createGLOSTTextNode,
|
|
58
|
+
createGLOSTWhiteSpaceNode,
|
|
59
|
+
createGLOSTPunctuationNode,
|
|
60
|
+
createGLOSTSymbolNode,
|
|
61
|
+
createSimpleDocument,
|
|
62
|
+
createDocumentFromSentences,
|
|
63
|
+
createDocumentFromParagraphs,
|
|
64
|
+
createSentenceFromWords,
|
|
65
|
+
createParagraphFromSentences,
|
|
66
|
+
createSimpleWord,
|
|
67
|
+
NODE_TYPES,
|
|
68
|
+
} from "glost-core";
|
|
69
|
+
|
|
70
|
+
// ============================================================================
|
|
71
|
+
// Tree Utilities
|
|
72
|
+
// ============================================================================
|
|
73
|
+
export {
|
|
74
|
+
getAllWords,
|
|
75
|
+
getAllSentences,
|
|
76
|
+
getAllParagraphs,
|
|
77
|
+
getAllClauses,
|
|
78
|
+
getFirstSentence,
|
|
79
|
+
getWordsFromSentence,
|
|
80
|
+
getWordsFromParagraph,
|
|
81
|
+
findWordsByLanguage,
|
|
82
|
+
isGLOSTWord,
|
|
83
|
+
isGLOSTSentence,
|
|
84
|
+
isGLOSTParagraph,
|
|
85
|
+
isGLOSTRoot,
|
|
86
|
+
getWordText,
|
|
87
|
+
getWordTranscription,
|
|
88
|
+
getWordTranslation,
|
|
89
|
+
getSentenceTranslation,
|
|
90
|
+
getGLOSTWordCount,
|
|
91
|
+
} from "glost-core";
|
|
92
|
+
|
|
93
|
+
// ============================================================================
|
|
94
|
+
// Processor API
|
|
95
|
+
// ============================================================================
|
|
96
|
+
export { glost, GLOSTProcessor } from "glost-processor";
|
|
97
|
+
export type {
|
|
98
|
+
FrozenProcessor,
|
|
99
|
+
Plugin,
|
|
100
|
+
PluginSpec,
|
|
101
|
+
Preset,
|
|
102
|
+
ProcessorOptions,
|
|
103
|
+
ProcessingResult,
|
|
104
|
+
ProcessingError,
|
|
105
|
+
ProcessingWarning,
|
|
106
|
+
ProcessingStats,
|
|
107
|
+
BeforeHook,
|
|
108
|
+
AfterHook,
|
|
109
|
+
ErrorHook,
|
|
110
|
+
SkipHook,
|
|
111
|
+
ProgressHook,
|
|
112
|
+
ProgressStats,
|
|
113
|
+
} from "glost-processor";
|
|
114
|
+
|
|
115
|
+
// ============================================================================
|
|
116
|
+
// Plugin Registry
|
|
117
|
+
// ============================================================================
|
|
118
|
+
export { pluginRegistry, PluginRegistry } from "glost-registry";
|
|
119
|
+
export type {
|
|
120
|
+
PluginMetadata,
|
|
121
|
+
PluginCategory,
|
|
122
|
+
PluginCapabilities,
|
|
123
|
+
PluginQuery,
|
|
124
|
+
ConflictReport,
|
|
125
|
+
ValidationResult,
|
|
126
|
+
} from "glost-registry";
|
package/src/presets.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presets exports
|
|
3
|
+
*
|
|
4
|
+
* Re-exports preset configurations for convenient access via glost/presets.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
languageLearningPreset,
|
|
9
|
+
createLanguageLearningPreset,
|
|
10
|
+
readingAppPreset,
|
|
11
|
+
createReadingAppPreset,
|
|
12
|
+
vocabularyBuilderPreset,
|
|
13
|
+
createVocabularyBuilderPreset,
|
|
14
|
+
grammarAnalyzerPreset,
|
|
15
|
+
createGrammarAnalyzerPreset,
|
|
16
|
+
minimalPreset,
|
|
17
|
+
createMinimalPreset,
|
|
18
|
+
} from "glost-presets";
|
package/src/processor.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Processor exports
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the processor API for convenient access via glost/processor.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { glost, GLOSTProcessor } from "glost-processor";
|
|
8
|
+
export type {
|
|
9
|
+
FrozenProcessor,
|
|
10
|
+
Plugin,
|
|
11
|
+
PluginSpec,
|
|
12
|
+
Preset,
|
|
13
|
+
ProcessorOptions,
|
|
14
|
+
ProcessingResult,
|
|
15
|
+
ProcessingError,
|
|
16
|
+
ProcessingWarning,
|
|
17
|
+
ProcessingStats,
|
|
18
|
+
BeforeHook,
|
|
19
|
+
AfterHook,
|
|
20
|
+
ErrorHook,
|
|
21
|
+
SkipHook,
|
|
22
|
+
ProgressHook,
|
|
23
|
+
ProgressStats,
|
|
24
|
+
} from "glost-processor";
|
package/src/registry.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry exports
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the registry API for convenient access via glost/registry.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { pluginRegistry, PluginRegistry, PluginFilter, PluginSorter, PluginDiscovery, PluginValidator } from "glost-registry";
|
|
8
|
+
export type {
|
|
9
|
+
PluginMetadata,
|
|
10
|
+
PluginCategory,
|
|
11
|
+
PluginCapabilities,
|
|
12
|
+
PluginRequirements,
|
|
13
|
+
PluginOptionsSchema,
|
|
14
|
+
PropertySchema,
|
|
15
|
+
PluginExample,
|
|
16
|
+
PluginQuery,
|
|
17
|
+
ConflictReport,
|
|
18
|
+
PluginConflict,
|
|
19
|
+
ValidationResult,
|
|
20
|
+
ValidationError,
|
|
21
|
+
ValidationWarning,
|
|
22
|
+
RegistryStatistics,
|
|
23
|
+
} from "glost-registry";
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist",
|
|
4
5
|
"rootDir": "./src",
|
|
5
|
-
"
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"sourceMap": true
|
|
6
9
|
},
|
|
7
10
|
"include": ["src/**/*"],
|
|
8
|
-
"exclude": ["node_modules", "dist"
|
|
11
|
+
"exclude": ["node_modules", "dist"]
|
|
9
12
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
# glost
|
|
2
|
-
|
|
3
|
-
## 0.3.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- Externalized language-specific helpers and data-dependent extensions into dedicated packages. Language helpers (`createThaiWord`, `createJapaneseWord`) moved to `glost-th` and `glost-ja`. Extensions (frequency, difficulty, POS, gender, clause-segmenter, transcription, translation) now require explicit data providers instead of fallback data. See `MIGRATION_EXTENSIONS.md` for migration guide.
|
|
8
|
-
|
|
9
|
-
### Patch Changes
|
|
10
|
-
|
|
11
|
-
- Updated dependencies
|
|
12
|
-
- glost-common@0.1.3
|
|
13
|
-
|
|
14
|
-
## 0.2.0
|
|
15
|
-
|
|
16
|
-
### Minor Changes
|
|
17
|
-
|
|
18
|
-
- # Externalize Language-Specific Helpers to Dedicated Packages
|
|
19
|
-
|
|
20
|
-
## Breaking Changes
|
|
21
|
-
|
|
22
|
-
Language-specific helper functions have been moved from the core `glost` package into dedicated language packages (`glost-th`, `glost-ja`). This keeps the core lightweight, reduces bundle sizes, and allows for independent language support.
|
|
23
|
-
|
|
24
|
-
### Removed from `glost` (Breaking)
|
|
25
|
-
- `createThaiWord()` → moved to `glost-th` package
|
|
26
|
-
- `createJapaneseWord()` → moved to `glost-ja` package
|
|
27
|
-
- `CreateThaiWordOptions` interface → moved to `glost-th`
|
|
28
|
-
- `CreateJapaneseWordOptions` interface → moved to `glost-ja`
|
|
29
|
-
|
|
30
|
-
### Migration Required
|
|
31
|
-
|
|
32
|
-
Install language packages separately:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npm install glost-th # Thai language support
|
|
36
|
-
npm install glost-ja # Japanese language support
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Update imports in your code:
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
// Before (v0.1.x)
|
|
43
|
-
import { createThaiWord, createJapaneseWord } from "glost";
|
|
44
|
-
|
|
45
|
-
// After (v0.2.0+)
|
|
46
|
-
import { createThaiWord } from "glost-th";
|
|
47
|
-
import { createJapaneseWord } from "glost-ja";
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
See [MIGRATION.md](../../MIGRATION.md) for complete upgrade guide.
|
|
51
|
-
|
|
52
|
-
## New Packages
|
|
53
|
-
|
|
54
|
-
### `glost-th` - Thai Language Support
|
|
55
|
-
|
|
56
|
-
Initial release providing:
|
|
57
|
-
- `createThaiWord()` helper
|
|
58
|
-
- Thai transcription provider interfaces
|
|
59
|
-
- Support for RTGS, Paiboon, Paiboon+, AUA, and IPA schemes
|
|
60
|
-
|
|
61
|
-
### `glost-ja` - Japanese Language Support
|
|
62
|
-
|
|
63
|
-
Initial release providing:
|
|
64
|
-
- `createJapaneseWord()` helper
|
|
65
|
-
- Japanese transcription provider interfaces
|
|
66
|
-
- Support for Romaji (Hepburn, Kunrei, Nihon), Furigana, and IPA schemes
|
|
67
|
-
|
|
68
|
-
## Internal Improvements
|
|
69
|
-
- Fixed circular dependencies in core package (changed `glost/src/*` imports to relative imports)
|
|
70
|
-
- Reduced core package size by ~30%
|
|
71
|
-
- Improved build performance
|
|
72
|
-
- Better modularity and maintainability
|
|
73
|
-
|
|
74
|
-
## What Stays in Core
|
|
75
|
-
|
|
76
|
-
All core functionality remains unchanged:
|
|
77
|
-
- ✅ `createGLOSTWordNode()` - Generic word creation
|
|
78
|
-
- ✅ `createGLOSTSentenceNode()` - Sentence creation
|
|
79
|
-
- ✅ `createGLOSTRootNode()` - Document creation
|
|
80
|
-
- ✅ `createSimpleWord()` - Simple word helper
|
|
81
|
-
- ✅ All tree traversal utilities
|
|
82
|
-
- ✅ Type guards and validators
|
|
83
|
-
- ✅ All core types and interfaces
|
|
84
|
-
|
|
85
|
-
## Benefits
|
|
86
|
-
- **Smaller bundles** - Import only languages you use
|
|
87
|
-
- **Independent releases** - Update languages without core changes
|
|
88
|
-
- **Better organization** - All Thai code in `glost-th`, all Japanese in `glost-ja`
|
|
89
|
-
- **Easier contributions** - Add new languages without touching core
|
|
90
|
-
- **Scalability** - Can support 50+ languages without bloating core
|
|
91
|
-
|
|
92
|
-
### Patch Changes
|
|
93
|
-
|
|
94
|
-
- Updated dependencies
|
|
95
|
-
- glost-common@0.1.2
|
|
96
|
-
|
|
97
|
-
## 0.2.0
|
|
98
|
-
|
|
99
|
-
### Breaking Changes
|
|
100
|
-
|
|
101
|
-
- **BREAKING:** Removed `createThaiWord()` - moved to `glost-th` package
|
|
102
|
-
- **BREAKING:** Removed `createJapaneseWord()` - moved to `glost-ja` package
|
|
103
|
-
- **BREAKING:** Removed `CreateThaiWordOptions` interface - moved to `glost-th`
|
|
104
|
-
- **BREAKING:** Removed `CreateJapaneseWordOptions` interface - moved to `glost-ja`
|
|
105
|
-
|
|
106
|
-
### Migration
|
|
107
|
-
|
|
108
|
-
Install language packages separately:
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
npm install glost-th # Thai language support
|
|
112
|
-
npm install glost-ja # Japanese language support
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Update imports:
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
// Before (v0.1.x)
|
|
119
|
-
import { createThaiWord, createJapaneseWord } from "glost";
|
|
120
|
-
|
|
121
|
-
// After (v0.2.0+)
|
|
122
|
-
import { createThaiWord } from "glost-th";
|
|
123
|
-
import { createJapaneseWord } from "glost-ja";
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
See [MIGRATION.md](../../MIGRATION.md) for complete upgrade guide.
|
|
127
|
-
|
|
128
|
-
### Internal Changes
|
|
129
|
-
|
|
130
|
-
- Fixed circular dependencies (changed `glost/src/*` imports to relative imports)
|
|
131
|
-
- Reduced package size by ~30%
|
|
132
|
-
- Improved build performance
|
|
133
|
-
|
|
134
|
-
### What Stays in Core
|
|
135
|
-
|
|
136
|
-
All core functionality remains unchanged:
|
|
137
|
-
|
|
138
|
-
- ✅ `createGLOSTWordNode()` - Generic word creation
|
|
139
|
-
- ✅ `createGLOSTSentenceNode()` - Sentence creation
|
|
140
|
-
- ✅ `createGLOSTRootNode()` - Document creation
|
|
141
|
-
- ✅ `createSimpleWord()` - Simple word helper
|
|
142
|
-
- ✅ All tree traversal utilities
|
|
143
|
-
- ✅ Type guards and validators
|
|
144
|
-
|
|
145
|
-
## 0.1.1
|
|
146
|
-
|
|
147
|
-
### Patch Changes
|
|
148
|
-
|
|
149
|
-
- fix names
|
|
150
|
-
- Updated dependencies
|
|
151
|
-
- glost-common@0.1.1
|
package/dist/example.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const thaiWords: import("../types").GLOSTWord[];
|
|
2
|
-
declare const thaiSentence: import("../types").GLOSTSentence;
|
|
3
|
-
declare const japaneseWords: import("../types").GLOSTWord[];
|
|
4
|
-
declare const japaneseSentence: import("../types").GLOSTSentence;
|
|
5
|
-
declare const thaiParagraph: import("../types").GLOSTParagraph;
|
|
6
|
-
declare const japaneseParagraph: import("../types").GLOSTParagraph;
|
|
7
|
-
declare const document: import("../types").GLOSTRoot;
|
|
8
|
-
export declare function demonstrateUtilities(): void;
|
|
9
|
-
export { thaiWords, japaneseWords, thaiSentence, japaneseSentence, thaiParagraph, japaneseParagraph, document };
|
|
10
|
-
//# sourceMappingURL=example.d.ts.map
|
package/dist/example.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAiBA,QAAA,MAAM,SAAS,+BAoCd,CAAC;AAEF,QAAA,MAAM,YAAY,iCAKjB,CAAC;AAMF,QAAA,MAAM,aAAa,+BAkClB,CAAC;AAEF,QAAA,MAAM,gBAAgB,iCAKrB,CAAC;AAMF,QAAA,MAAM,aAAa,kCAA+C,CAAC;AACnE,QAAA,MAAM,iBAAiB,kCAAmD,CAAC;AAE3E,QAAA,MAAM,QAAQ,6BAQb,CAAC;AAMF,wBAAgB,oBAAoB,SA4CnC;AAGD,OAAO,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACT,CAAC"}
|
package/dist/example.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
// Example usage of the GLOST package
|
|
2
|
-
import { createThaiWord, createJapaneseWord, createSentenceFromWords, createParagraphFromSentences, createDocumentFromParagraphs, getAllWords, getWordTranscription, validateGLOSTTree, getWordText } from './index';
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// Thai Example: "สวัสดีครับ ผมชื่อสมชาย" (Hello, my name is Somchai)
|
|
5
|
-
// ============================================================================
|
|
6
|
-
const thaiWords = [
|
|
7
|
-
createThaiWord({
|
|
8
|
-
text: 'สวัสดี',
|
|
9
|
-
rtgs: 'sà-wàt-dii',
|
|
10
|
-
partOfSpeech: 'interjection',
|
|
11
|
-
tone: 2,
|
|
12
|
-
syllables: ['sa', 'wat', 'dii']
|
|
13
|
-
}),
|
|
14
|
-
createThaiWord({
|
|
15
|
-
text: 'ครับ',
|
|
16
|
-
rtgs: 'khráp',
|
|
17
|
-
partOfSpeech: 'particle',
|
|
18
|
-
tone: 2,
|
|
19
|
-
syllables: ['khrap']
|
|
20
|
-
}),
|
|
21
|
-
createThaiWord({
|
|
22
|
-
text: 'ผม',
|
|
23
|
-
rtgs: 'phǒm',
|
|
24
|
-
partOfSpeech: 'pronoun',
|
|
25
|
-
tone: 3,
|
|
26
|
-
syllables: ['phom']
|
|
27
|
-
}),
|
|
28
|
-
createThaiWord({
|
|
29
|
-
text: 'ชื่อ',
|
|
30
|
-
rtgs: 'chûue',
|
|
31
|
-
partOfSpeech: 'noun',
|
|
32
|
-
tone: 3,
|
|
33
|
-
syllables: ['chue']
|
|
34
|
-
}),
|
|
35
|
-
createThaiWord({
|
|
36
|
-
text: 'สมชาย',
|
|
37
|
-
rtgs: 'sǒm-chaai',
|
|
38
|
-
partOfSpeech: 'proper noun',
|
|
39
|
-
tone: 3,
|
|
40
|
-
syllables: ['som', 'chaai']
|
|
41
|
-
})
|
|
42
|
-
];
|
|
43
|
-
const thaiSentence = createSentenceFromWords(thaiWords, 'th', 'thai', 'สวัสดีครับ ผมชื่อสมชาย');
|
|
44
|
-
// ============================================================================
|
|
45
|
-
// Japanese Example: "私の名前は田中です。" (My name is Tanaka)
|
|
46
|
-
// ============================================================================
|
|
47
|
-
const japaneseWords = [
|
|
48
|
-
createJapaneseWord({
|
|
49
|
-
text: '私',
|
|
50
|
-
romaji: 'watashi',
|
|
51
|
-
partOfSpeech: 'pronoun',
|
|
52
|
-
furigana: 'わたし'
|
|
53
|
-
}),
|
|
54
|
-
createJapaneseWord({
|
|
55
|
-
text: 'の',
|
|
56
|
-
romaji: 'no',
|
|
57
|
-
partOfSpeech: 'particle'
|
|
58
|
-
}),
|
|
59
|
-
createJapaneseWord({
|
|
60
|
-
text: '名前',
|
|
61
|
-
romaji: 'namae',
|
|
62
|
-
partOfSpeech: 'noun',
|
|
63
|
-
furigana: 'なまえ'
|
|
64
|
-
}),
|
|
65
|
-
createJapaneseWord({
|
|
66
|
-
text: 'は',
|
|
67
|
-
romaji: 'wa',
|
|
68
|
-
partOfSpeech: 'particle'
|
|
69
|
-
}),
|
|
70
|
-
createJapaneseWord({
|
|
71
|
-
text: '田中',
|
|
72
|
-
romaji: 'tanaka',
|
|
73
|
-
partOfSpeech: 'proper noun',
|
|
74
|
-
furigana: 'たなか'
|
|
75
|
-
}),
|
|
76
|
-
createJapaneseWord({
|
|
77
|
-
text: 'です',
|
|
78
|
-
romaji: 'desu',
|
|
79
|
-
partOfSpeech: 'copula'
|
|
80
|
-
})
|
|
81
|
-
];
|
|
82
|
-
const japaneseSentence = createSentenceFromWords(japaneseWords, 'ja', 'mixed', '私の名前は田中です。');
|
|
83
|
-
// ============================================================================
|
|
84
|
-
// Create Document Structure
|
|
85
|
-
// ============================================================================
|
|
86
|
-
const thaiParagraph = createParagraphFromSentences([thaiSentence]);
|
|
87
|
-
const japaneseParagraph = createParagraphFromSentences([japaneseSentence]);
|
|
88
|
-
const document = createDocumentFromParagraphs([thaiParagraph, japaneseParagraph], 'mixed', 'mixed', {
|
|
89
|
-
title: 'Multilingual Greeting Examples',
|
|
90
|
-
description: 'Examples of greetings in Thai and Japanese with transcriptions'
|
|
91
|
-
});
|
|
92
|
-
// ============================================================================
|
|
93
|
-
// Demonstrate Utilities
|
|
94
|
-
// ============================================================================
|
|
95
|
-
export function demonstrateUtilities() {
|
|
96
|
-
console.log('=== GLOST Package Demo ===\n');
|
|
97
|
-
// Get all words from the document
|
|
98
|
-
const allWords = getAllWords(document);
|
|
99
|
-
console.log(`Total words: ${allWords.length}`);
|
|
100
|
-
// Show Thai words with RTGS transcriptions
|
|
101
|
-
const thaiWordsOnly = allWords.filter(word => word.lang === 'th');
|
|
102
|
-
console.log('\n=== Thai Words ===');
|
|
103
|
-
thaiWordsOnly.forEach(word => {
|
|
104
|
-
const rtgs = getWordTranscription(word, 'rtgs');
|
|
105
|
-
console.log(`${getWordText(word)} → ${rtgs} (${word.metadata.partOfSpeech})`);
|
|
106
|
-
});
|
|
107
|
-
// Show Japanese words with romaji
|
|
108
|
-
const japaneseWordsOnly = allWords.filter(word => word.lang === 'ja');
|
|
109
|
-
console.log('\n=== Japanese Words ===');
|
|
110
|
-
japaneseWordsOnly.forEach(word => {
|
|
111
|
-
const romaji = getWordTranscription(word, 'romaji');
|
|
112
|
-
console.log(`${getWordText(word)} → ${romaji} (${word.metadata.partOfSpeech})`);
|
|
113
|
-
});
|
|
114
|
-
// Validate the tree
|
|
115
|
-
const validationErrors = validateGLOSTTree(document);
|
|
116
|
-
if (validationErrors.length === 0) {
|
|
117
|
-
console.log('\n✅ Document is valid!');
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
console.log('\n❌ Validation errors:');
|
|
121
|
-
validationErrors.forEach((error) => console.log(` - ${error}`));
|
|
122
|
-
}
|
|
123
|
-
// Show document structure
|
|
124
|
-
console.log('\n=== Document Structure ===');
|
|
125
|
-
console.log(`Language: ${document.lang}`);
|
|
126
|
-
console.log(`Script: ${document.script}`);
|
|
127
|
-
console.log(`Paragraphs: ${document.children.length}`);
|
|
128
|
-
console.log(`Sentences: ${document.children.reduce((acc, p) => {
|
|
129
|
-
if (p.type === 'ParagraphNode') {
|
|
130
|
-
return acc + (p.children?.length || 0);
|
|
131
|
-
}
|
|
132
|
-
return acc;
|
|
133
|
-
}, 0)}`);
|
|
134
|
-
console.log(`Words: ${allWords.length}`);
|
|
135
|
-
}
|
|
136
|
-
// Export for use in other files
|
|
137
|
-
export { thaiWords, japaneseWords, thaiSentence, japaneseSentence, thaiParagraph, japaneseParagraph, document };
|
|
138
|
-
//# sourceMappingURL=example.js.map
|