glost 0.4.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 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -24
- 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 -40
- package/src/index.ts +126 -69
- 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 -296
- package/dist/cli/migrate.d.ts +0 -8
- package/dist/cli/migrate.d.ts.map +0 -1
- package/dist/cli/migrate.js +0 -229
- package/dist/cli/migrate.js.map +0 -1
- package/dist/errors.d.ts +0 -168
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -300
- package/dist/errors.js.map +0 -1
- 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 -185
- package/dist/nodes.js.map +0 -1
- package/dist/types.d.ts +0 -395
- 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/cli/migrate.ts +0 -294
- package/src/errors.ts +0 -394
- package/src/guards.ts +0 -341
- package/src/nodes.ts +0 -326
- package/src/types.ts +0 -581
- package/src/utils.ts +0 -652
- package/src/validators.ts +0 -336
package/dist/types.d.ts
DELETED
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
import type { Literal as NlcstLiteral, Paragraph as NlcstParagraph, Punctuation as NlcstPunctuation, Root as NlcstRoot, Sentence as NlcstSentence, Source as NlcstSource, Symbol as NlcstSymbol, Text as NlcstText, WhiteSpace as NlcstWhiteSpace, Word as NlcstWord } from "nlcst";
|
|
2
|
-
/**
|
|
3
|
-
* Linguistic level of a text segment
|
|
4
|
-
*/
|
|
5
|
-
export type LinguisticLevel = "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
6
|
-
/**
|
|
7
|
-
* Context for pronunciation variants
|
|
8
|
-
*/
|
|
9
|
-
export type PronunciationContext = "formal" | "informal" | "historical" | "regional" | "dialectal";
|
|
10
|
-
/**
|
|
11
|
-
* Transcription system identifiers
|
|
12
|
-
*/
|
|
13
|
-
export type TranscriptionSystem = "rtgs" | "aua" | "paiboon" | "romaji" | "furigana" | "ipa" | "pinyin" | "hangul" | string;
|
|
14
|
-
/**
|
|
15
|
-
* Language codes following BCP-47 format (RFC 5646)
|
|
16
|
-
* Format: language[-script][-region][-variant]
|
|
17
|
-
* Examples: th-TH, ja-JP, zh-CN, ko-KR, en-US, fr-FR, de-DE
|
|
18
|
-
*/
|
|
19
|
-
export type LanguageCode = "th-TH" | "th" | "ja-JP" | "ja" | "zh-CN" | "zh-TW" | "zh-HK" | "zh" | "ko-KR" | "ko-KP" | "ko" | "en-US" | "en-GB" | "en-CA" | "en-AU" | "en" | "fr-FR" | "fr-CA" | "fr-BE" | "fr" | "de-DE" | "de-AT" | "de-CH" | "de" | "es-ES" | "es-MX" | "es-AR" | "es" | "it-IT" | "it-CH" | "it" | "pt-PT" | "pt-BR" | "pt" | "ru-RU" | "ru" | "ar-SA" | "ar-EG" | "ar" | "hi-IN" | "hi" | string;
|
|
20
|
-
/**
|
|
21
|
-
* Script system identifiers
|
|
22
|
-
*/
|
|
23
|
-
export type ScriptSystem = "thai" | "hiragana" | "katakana" | "kanji" | "hanzi" | "hangul" | "latin" | "mixed" | string;
|
|
24
|
-
/**
|
|
25
|
-
* Quick translations in different languages using BCP-47 format
|
|
26
|
-
*/
|
|
27
|
-
export type QuickTranslations = {
|
|
28
|
-
/** English translations */
|
|
29
|
-
"en-US"?: string;
|
|
30
|
-
"en-GB"?: string;
|
|
31
|
-
"en"?: string;
|
|
32
|
-
/** Thai translations */
|
|
33
|
-
"th-TH"?: string;
|
|
34
|
-
"th"?: string;
|
|
35
|
-
/** Japanese translations */
|
|
36
|
-
"ja-JP"?: string;
|
|
37
|
-
"ja"?: string;
|
|
38
|
-
/** Chinese translations */
|
|
39
|
-
"zh-CN"?: string;
|
|
40
|
-
"zh-TW"?: string;
|
|
41
|
-
"zh"?: string;
|
|
42
|
-
/** Korean translations */
|
|
43
|
-
"ko-KR"?: string;
|
|
44
|
-
"ko"?: string;
|
|
45
|
-
/** French translations */
|
|
46
|
-
"fr-FR"?: string;
|
|
47
|
-
"fr-CA"?: string;
|
|
48
|
-
"fr"?: string;
|
|
49
|
-
/** German translations */
|
|
50
|
-
"de-DE"?: string;
|
|
51
|
-
"de"?: string;
|
|
52
|
-
/** Spanish translations */
|
|
53
|
-
"es-ES"?: string;
|
|
54
|
-
"es-MX"?: string;
|
|
55
|
-
"es"?: string;
|
|
56
|
-
/** Custom language translations using BCP-47 format */
|
|
57
|
-
[lang: string]: string | undefined;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Extended metadata for enhanced functionality
|
|
61
|
-
*/
|
|
62
|
-
export type ExtendedMetadata = {
|
|
63
|
-
/** Quick translations in multiple languages */
|
|
64
|
-
translations?: QuickTranslations;
|
|
65
|
-
/** Difficulty level for learners */
|
|
66
|
-
difficulty?: "beginner" | "intermediate" | "advanced" | 1 | 2 | 3 | 4 | 5 | string;
|
|
67
|
-
/** Frequency in common usage */
|
|
68
|
-
frequency?: "rare" | "uncommon" | "common" | "very-common";
|
|
69
|
-
/** Cultural notes */
|
|
70
|
-
culturalNotes?: string;
|
|
71
|
-
/** Related words or concepts */
|
|
72
|
-
related?: string[];
|
|
73
|
-
/** Example sentences */
|
|
74
|
-
examples?: string[];
|
|
75
|
-
/** Custom extensions */
|
|
76
|
-
[key: string]: any;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Extras field for extending GLOST nodes
|
|
80
|
-
*
|
|
81
|
-
* This interface can be augmented by extension packages via declaration merging.
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```typescript
|
|
85
|
-
* // In an extension package
|
|
86
|
-
* declare module "glost" {
|
|
87
|
-
* interface GLOSTExtras {
|
|
88
|
-
* frequency?: {
|
|
89
|
-
* rank: number;
|
|
90
|
-
* category: "very-common" | "common" | "uncommon" | "rare";
|
|
91
|
-
* };
|
|
92
|
-
* }
|
|
93
|
-
* }
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
export interface GLOSTExtras {
|
|
97
|
-
/** Quick translations */
|
|
98
|
-
translations?: QuickTranslations;
|
|
99
|
-
/** Extended metadata */
|
|
100
|
-
metadata?: ExtendedMetadata;
|
|
101
|
-
/** Custom extensions - allows any string key with unknown value */
|
|
102
|
-
[key: string]: unknown;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Pronunciation variant for a text segment
|
|
106
|
-
*/
|
|
107
|
-
export type PronunciationVariant = {
|
|
108
|
-
/** The variant text in the transcription system */
|
|
109
|
-
text: string;
|
|
110
|
-
/** Context where this variant is used */
|
|
111
|
-
context: PronunciationContext;
|
|
112
|
-
/** Additional notes about this variant */
|
|
113
|
-
notes?: string;
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Transcription information for a text segment
|
|
117
|
-
*
|
|
118
|
-
* Note: The transcription system is not stored in this object.
|
|
119
|
-
* It is the key in the TransliterationData record.
|
|
120
|
-
*/
|
|
121
|
-
export type TranscriptionInfo = {
|
|
122
|
-
/** The transcription text */
|
|
123
|
-
text: string;
|
|
124
|
-
/** Pronunciation variants */
|
|
125
|
-
variants?: PronunciationVariant[];
|
|
126
|
-
/** Tone information (for tonal languages) */
|
|
127
|
-
tone?: number;
|
|
128
|
-
/** Syllable breakdown */
|
|
129
|
-
syllables?: string[];
|
|
130
|
-
/** Additional phonetic information */
|
|
131
|
-
phonetic?: string;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Complete transliteration data for a text segment
|
|
135
|
-
*/
|
|
136
|
-
export type TransliterationData = {
|
|
137
|
-
/** Map of transcription systems to their data */
|
|
138
|
-
[system: string]: TranscriptionInfo;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Linguistic metadata for a text segment
|
|
142
|
-
*/
|
|
143
|
-
export type LinguisticMetadata = {
|
|
144
|
-
/** @deprecated Use extras.translations instead */
|
|
145
|
-
meaning?: string;
|
|
146
|
-
/** Part of speech */
|
|
147
|
-
partOfSpeech: string;
|
|
148
|
-
/** Usage notes */
|
|
149
|
-
usage?: string;
|
|
150
|
-
/** Etymology information */
|
|
151
|
-
etymology?: string;
|
|
152
|
-
/** Example usage */
|
|
153
|
-
examples?: string[];
|
|
154
|
-
/** Frequency information */
|
|
155
|
-
frequency?: "high" | "medium" | "low";
|
|
156
|
-
/** Formality level */
|
|
157
|
-
formality?: "formal" | "neutral" | "informal";
|
|
158
|
-
/** Register (academic, colloquial, etc.) */
|
|
159
|
-
register?: string;
|
|
160
|
-
/** @deprecated Use extras.translations instead */
|
|
161
|
-
shortDefinition?: string;
|
|
162
|
-
/** @deprecated Use extras.translations instead */
|
|
163
|
-
fullDefinition?: string;
|
|
164
|
-
/** @deprecated Use metadata enrichment extensions instead */
|
|
165
|
-
difficulty?: "beginner" | "intermediate" | "advanced" | 1 | 2 | 3 | 4 | 5 | string;
|
|
166
|
-
};
|
|
167
|
-
/**
|
|
168
|
-
* Union type for all GLOST nodes
|
|
169
|
-
*/
|
|
170
|
-
export type GLOSTNode = GLOSTWord | GLOSTSentence | GLOSTParagraph | GLOSTRoot | GLOSTText | GLOSTSymbol | GLOSTPunctuation | GLOSTWhiteSpace | GLOSTSource | GLOSTClause | GLOSTPhrase | GLOSTSyllable | GLOSTCharacter;
|
|
171
|
-
/**
|
|
172
|
-
* GLOST nodes that extend nlcst Literal (have a value property)
|
|
173
|
-
*/
|
|
174
|
-
export type GLOSTLiteral = NlcstLiteral & {
|
|
175
|
-
/** Language code for this node */
|
|
176
|
-
lang?: LanguageCode;
|
|
177
|
-
/** Script system used */
|
|
178
|
-
script?: ScriptSystem;
|
|
179
|
-
/** Linguistic level of this segment */
|
|
180
|
-
level?: LinguisticLevel;
|
|
181
|
-
/** Extras field for extensions */
|
|
182
|
-
extras?: GLOSTExtras;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* GLOST Punctuation node (extends nlcst PunctuationNode)
|
|
186
|
-
*/
|
|
187
|
-
export type GLOSTPunctuation = NlcstPunctuation & {};
|
|
188
|
-
/**
|
|
189
|
-
* GLOST WhiteSpace node (extends nlcst WhiteSpaceNode)
|
|
190
|
-
*/
|
|
191
|
-
export type GLOSTWhiteSpace = NlcstWhiteSpace & {};
|
|
192
|
-
/**
|
|
193
|
-
* GLOST Symbol node (extends nlcst SymbolNode)
|
|
194
|
-
*/
|
|
195
|
-
export type GLOSTSymbol = NlcstSymbol & {};
|
|
196
|
-
/**
|
|
197
|
-
* GLOST Text node (extends nlcst TextNode)
|
|
198
|
-
*/
|
|
199
|
-
export type GLOSTText = NlcstText & {};
|
|
200
|
-
/**
|
|
201
|
-
* GLOST Source node (extends nlcst SourceNode)
|
|
202
|
-
*/
|
|
203
|
-
export type GLOSTSource = NlcstSource & {};
|
|
204
|
-
/**
|
|
205
|
-
* Extended word node with transcription support
|
|
206
|
-
* Extends nlcst WordNode and adds GLOST-specific properties
|
|
207
|
-
*/
|
|
208
|
-
export type GLOSTWord = Omit<NlcstWord, "children"> & {
|
|
209
|
-
/** Transcription data */
|
|
210
|
-
transcription: TransliterationData;
|
|
211
|
-
/** Linguistic metadata */
|
|
212
|
-
metadata: LinguisticMetadata;
|
|
213
|
-
/** @deprecated Use extras.translations instead */
|
|
214
|
-
shortDefinition?: string;
|
|
215
|
-
/** @deprecated Use extras.translations instead */
|
|
216
|
-
fullDefinition?: string;
|
|
217
|
-
/** @deprecated Use metadata enrichment extensions instead */
|
|
218
|
-
difficulty?: "beginner" | "intermediate" | "advanced" | 1 | 2 | 3 | 4 | 5 | string;
|
|
219
|
-
/** Language code for this node */
|
|
220
|
-
lang?: LanguageCode;
|
|
221
|
-
/** Script system used */
|
|
222
|
-
script?: ScriptSystem;
|
|
223
|
-
/** Linguistic level of this segment */
|
|
224
|
-
level?: LinguisticLevel;
|
|
225
|
-
/** Extras field for extensions */
|
|
226
|
-
extras?: GLOSTExtras;
|
|
227
|
-
/** Children nodes - must contain at least one Text node */
|
|
228
|
-
children: GLOSTWordContent[];
|
|
229
|
-
};
|
|
230
|
-
/**
|
|
231
|
-
* Extended sentence node
|
|
232
|
-
* Extends nlcst SentenceNode and adds GLOST-specific properties
|
|
233
|
-
*/
|
|
234
|
-
export type GLOSTSentence = Omit<NlcstSentence, "children"> & {
|
|
235
|
-
/** Language of the sentence */
|
|
236
|
-
lang: LanguageCode;
|
|
237
|
-
/** Script system used */
|
|
238
|
-
script: ScriptSystem;
|
|
239
|
-
/** Original text */
|
|
240
|
-
originalText: string;
|
|
241
|
-
/** Transcription data for the entire sentence */
|
|
242
|
-
transcription?: TransliterationData;
|
|
243
|
-
/** Extras field for extensions */
|
|
244
|
-
extras?: GLOSTExtras;
|
|
245
|
-
/** Children nodes - must be nlcst-compliant */
|
|
246
|
-
children: GLOSTSentenceContent[];
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* Extended paragraph node
|
|
250
|
-
*/
|
|
251
|
-
export type GLOSTParagraph = Omit<NlcstParagraph, "children"> & {
|
|
252
|
-
/** Language of the paragraph */
|
|
253
|
-
lang?: LanguageCode;
|
|
254
|
-
/** Script system used */
|
|
255
|
-
script?: ScriptSystem;
|
|
256
|
-
/** Extras field for extensions */
|
|
257
|
-
extras?: GLOSTExtras;
|
|
258
|
-
/** Children nodes - must be nlcst-compliant */
|
|
259
|
-
children: GLOSTParagraphContent[];
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* Extended root node
|
|
263
|
-
*/
|
|
264
|
-
export type GLOSTRoot = Omit<NlcstRoot, "children"> & {
|
|
265
|
-
/** Primary language of the document */
|
|
266
|
-
lang: LanguageCode;
|
|
267
|
-
/** Primary script system */
|
|
268
|
-
script: ScriptSystem;
|
|
269
|
-
/** Extras field for extensions */
|
|
270
|
-
extras?: GLOSTExtras;
|
|
271
|
-
/** Document metadata */
|
|
272
|
-
metadata?: {
|
|
273
|
-
title?: string;
|
|
274
|
-
author?: string;
|
|
275
|
-
date?: string;
|
|
276
|
-
description?: string;
|
|
277
|
-
};
|
|
278
|
-
/** Children nodes - must be nlcst-compliant */
|
|
279
|
-
children: GLOSTRootContent[];
|
|
280
|
-
};
|
|
281
|
-
/**
|
|
282
|
-
* Clause node - represents grammatical clauses within sentences
|
|
283
|
-
* Created by ClauseSegmenterExtension transformer
|
|
284
|
-
*/
|
|
285
|
-
export type GLOSTClause = {
|
|
286
|
-
type: "ClauseNode";
|
|
287
|
-
/** Type of clause */
|
|
288
|
-
clauseType: "main" | "subordinate" | "relative" | "adverbial";
|
|
289
|
-
/** Children nodes - phrases, words, or punctuation */
|
|
290
|
-
children: (GLOSTPhrase | GLOSTWord | GLOSTPunctuation)[];
|
|
291
|
-
/** Language code for this clause */
|
|
292
|
-
lang?: LanguageCode;
|
|
293
|
-
/** Script system used */
|
|
294
|
-
script?: ScriptSystem;
|
|
295
|
-
/** Extras field for extensions */
|
|
296
|
-
extras?: GLOSTExtras & {
|
|
297
|
-
/** Whether this clause has been negated */
|
|
298
|
-
isNegated?: boolean;
|
|
299
|
-
/** Grammatical mood */
|
|
300
|
-
mood?: "declarative" | "interrogative" | "imperative" | "conditional";
|
|
301
|
-
/** Tense information */
|
|
302
|
-
tense?: string;
|
|
303
|
-
/** Original form before transformation */
|
|
304
|
-
originalForm?: string;
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
|
-
/**
|
|
308
|
-
* Phrase node - groups words into grammatical phrases
|
|
309
|
-
* Created by PhraseSegmenterExtension transformer
|
|
310
|
-
*/
|
|
311
|
-
export type GLOSTPhrase = {
|
|
312
|
-
type: "PhraseNode";
|
|
313
|
-
/** Type of phrase */
|
|
314
|
-
phraseType: "noun" | "verb" | "prepositional" | "adjectival" | "adverbial";
|
|
315
|
-
/** Main word of the phrase (head) */
|
|
316
|
-
headWord?: string;
|
|
317
|
-
/** Children nodes - words or punctuation */
|
|
318
|
-
children: (GLOSTWord | GLOSTPunctuation)[];
|
|
319
|
-
/** Language code for this phrase */
|
|
320
|
-
lang?: LanguageCode;
|
|
321
|
-
/** Script system used */
|
|
322
|
-
script?: ScriptSystem;
|
|
323
|
-
/** Extras field for extensions */
|
|
324
|
-
extras?: GLOSTExtras & {
|
|
325
|
-
/** Grammatical role in the clause/sentence */
|
|
326
|
-
role?: "subject" | "object" | "complement" | "modifier";
|
|
327
|
-
};
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
* Syllable node - represents phonological syllable structure
|
|
331
|
-
* Created by SyllableSegmenterExtension transformer (language-specific)
|
|
332
|
-
*/
|
|
333
|
-
export type GLOSTSyllable = {
|
|
334
|
-
type: "SyllableNode";
|
|
335
|
-
/** Syllable structure information */
|
|
336
|
-
structure: {
|
|
337
|
-
/** Initial consonant(s) - Generic (e.g., "h" in "hello") */
|
|
338
|
-
onset?: string;
|
|
339
|
-
/** Vowel - Generic (e.g., "e" in "hello") */
|
|
340
|
-
nucleus: string;
|
|
341
|
-
/** Final consonant(s) - Generic (e.g., "l" in "hello") */
|
|
342
|
-
coda?: string;
|
|
343
|
-
/** Initial consonant (Thai: พยัญชนะต้น) */
|
|
344
|
-
Ci?: string;
|
|
345
|
-
/** Vowel (Thai: สระ) */
|
|
346
|
-
V?: string;
|
|
347
|
-
/** Final consonant (Thai: ตัวสะกด) */
|
|
348
|
-
Cf?: string;
|
|
349
|
-
/** Tone mark (Thai: วรรณยุกต์) */
|
|
350
|
-
T?: string;
|
|
351
|
-
};
|
|
352
|
-
/** Children nodes - individual characters */
|
|
353
|
-
children: GLOSTCharacter[];
|
|
354
|
-
/** Language code for this syllable */
|
|
355
|
-
lang?: LanguageCode;
|
|
356
|
-
/** Script system used */
|
|
357
|
-
script?: ScriptSystem;
|
|
358
|
-
/** Tone number (for tonal languages like Thai, Mandarin) */
|
|
359
|
-
tone?: number;
|
|
360
|
-
/** Stress level (for stress languages like English) */
|
|
361
|
-
stress?: "primary" | "secondary" | "unstressed";
|
|
362
|
-
/** Extras field for extensions */
|
|
363
|
-
extras?: GLOSTExtras;
|
|
364
|
-
};
|
|
365
|
-
/**
|
|
366
|
-
* Character node - represents individual characters with linguistic roles
|
|
367
|
-
* Created by SyllableSegmenterExtension or CharacterSegmenterExtension
|
|
368
|
-
*/
|
|
369
|
-
export type GLOSTCharacter = {
|
|
370
|
-
type: "CharacterNode";
|
|
371
|
-
/** The character value (single character) */
|
|
372
|
-
value: string;
|
|
373
|
-
/** Linguistic role of the character */
|
|
374
|
-
role?: "consonant" | "vowel" | "tone" | "diacritic" | "modifier";
|
|
375
|
-
/** Placement in the syllable/word (renamed from 'position' to avoid conflict with unist Position) */
|
|
376
|
-
placement?: "initial" | "medial" | "final" | "above" | "below" | "before" | "after";
|
|
377
|
-
/** Language code for this character */
|
|
378
|
-
lang?: LanguageCode;
|
|
379
|
-
/** Script system used */
|
|
380
|
-
script?: ScriptSystem;
|
|
381
|
-
/** Extras field for extensions */
|
|
382
|
-
extras?: GLOSTExtras & {
|
|
383
|
-
/** Unicode code point (e.g., "U+0E04") */
|
|
384
|
-
unicode?: string;
|
|
385
|
-
/** Thai consonant class (high/mid/low) */
|
|
386
|
-
class?: "high" | "mid" | "low";
|
|
387
|
-
/** Phonological sound class */
|
|
388
|
-
soundClass?: string;
|
|
389
|
-
};
|
|
390
|
-
};
|
|
391
|
-
export type GLOSTRootContent = GLOSTParagraph | GLOSTSentence | GLOSTWord | GLOSTText | GLOSTSymbol | GLOSTPunctuation | GLOSTWhiteSpace | GLOSTSource;
|
|
392
|
-
export type GLOSTParagraphContent = GLOSTSentence | GLOSTPunctuation | GLOSTSymbol | GLOSTWhiteSpace | GLOSTSource;
|
|
393
|
-
export type GLOSTSentenceContent = GLOSTClause | GLOSTWord | GLOSTPunctuation | GLOSTSymbol | GLOSTWhiteSpace | GLOSTSource;
|
|
394
|
-
export type GLOSTWordContent = GLOSTSyllable | GLOSTText | GLOSTSymbol | GLOSTPunctuation | GLOSTWhiteSpace | GLOSTSource;
|
|
395
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,SAAS,IAAI,cAAc,EAAE,WAAW,IAAI,gBAAgB,EAAE,IAAI,IAAI,SAAS,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,IAAI,WAAW,EAAE,IAAI,IAAI,SAAS,EAAE,UAAU,IAAI,eAAe,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,OAAO,CAAC;AAUpR;;GA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G,WAAW,CAAC;AACnH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,SAAS,GAAG,gBAAgB,GAAG,WAAW,GAAG,eAAe,GAAG,WAAW,CAAC;AAC5H,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,eAAe,GAAG,WAAW,CAAC"}
|
package/dist/types.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
// ============================================================================
|
|
3
|
-
// Utility Types
|
|
4
|
-
// ============================================================================
|
|
5
|
-
// Type guards are now implemented in utils.ts using unist-util-is
|
|
6
|
-
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAgkBA,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,kEAAkE"}
|
package/dist/utils.d.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import type { LanguageCode, GLOSTCharacter, GLOSTClause, GLOSTNode, GLOSTParagraph, GLOSTPhrase, GLOSTRoot, GLOSTSentence, GLOSTSyllable, GLOSTWord, TranscriptionSystem } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Parse a BCP-47 language tag into its components
|
|
4
|
-
* Format: language[-script][-region][-variant]
|
|
5
|
-
*/
|
|
6
|
-
export declare function parseLanguageTag(tag: string): {
|
|
7
|
-
language: string;
|
|
8
|
-
script?: string;
|
|
9
|
-
region?: string;
|
|
10
|
-
variant?: string;
|
|
11
|
-
fullTag: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Get the base language from a BCP-47 tag
|
|
15
|
-
* Examples: "en-US" -> "en", "zh-CN" -> "zh"
|
|
16
|
-
*/
|
|
17
|
-
export declare function getBaseLanguage(tag: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Check if two language tags are compatible (same base language)
|
|
20
|
-
* Examples: "en-US" and "en-GB" are compatible
|
|
21
|
-
*/
|
|
22
|
-
export declare function areLanguagesCompatible(tag1: string, tag2: string): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Find the best matching language tag from available options
|
|
25
|
-
* Prioritizes exact matches, then region matches, then base language matches
|
|
26
|
-
*/
|
|
27
|
-
export declare function findBestLanguageMatch(target: string, available: string[]): string | null;
|
|
28
|
-
/**
|
|
29
|
-
* Get a fallback language tag when the exact one isn't available
|
|
30
|
-
* Examples: "en-US" -> "en", "zh-CN" -> "zh"
|
|
31
|
-
*/
|
|
32
|
-
export declare function getLanguageFallback(tag: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Normalize a language tag to standard format
|
|
35
|
-
* Converts to lowercase and ensures proper formatting
|
|
36
|
-
*/
|
|
37
|
-
export declare function normalizeLanguageTag(tag: string): string;
|
|
38
|
-
/**
|
|
39
|
-
* Check if a language tag is valid BCP-47 format
|
|
40
|
-
*/
|
|
41
|
-
export declare function isValidLanguageTag(tag: string): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Get all word nodes from an GLOST tree
|
|
44
|
-
*/
|
|
45
|
-
export declare function getAllWords(node: GLOSTNode): GLOSTWord[];
|
|
46
|
-
/**
|
|
47
|
-
* Get all sentence nodes from an GLOST tree
|
|
48
|
-
*/
|
|
49
|
-
export declare function getAllSentences(node: GLOSTNode): GLOSTSentence[];
|
|
50
|
-
/**
|
|
51
|
-
* Get all paragraph nodes from an GLOST tree
|
|
52
|
-
*/
|
|
53
|
-
export declare function getAllParagraphs(node: GLOSTNode): GLOSTParagraph[];
|
|
54
|
-
/**
|
|
55
|
-
* Get all clause nodes from an GLOST tree
|
|
56
|
-
*/
|
|
57
|
-
export declare function getAllClauses(node: GLOSTNode): GLOSTClause[];
|
|
58
|
-
/**
|
|
59
|
-
* Get all phrase nodes from an GLOST tree
|
|
60
|
-
*/
|
|
61
|
-
export declare function getAllPhrases(node: GLOSTNode): GLOSTPhrase[];
|
|
62
|
-
/**
|
|
63
|
-
* Get all syllable nodes from an GLOST tree
|
|
64
|
-
*/
|
|
65
|
-
export declare function getAllSyllables(node: GLOSTNode): GLOSTSyllable[];
|
|
66
|
-
/**
|
|
67
|
-
* Get all character nodes from an GLOST tree
|
|
68
|
-
*/
|
|
69
|
-
export declare function getAllCharacters(node: GLOSTNode): GLOSTCharacter[];
|
|
70
|
-
/**
|
|
71
|
-
* Find nodes by type with better typing
|
|
72
|
-
*/
|
|
73
|
-
export declare function findNodesByType<T extends GLOSTNode>(node: GLOSTNode, type: string): T[];
|
|
74
|
-
/**
|
|
75
|
-
* Get all words from a document with proper typing
|
|
76
|
-
*/
|
|
77
|
-
export declare function getWordsFromDocument(doc: GLOSTRoot): GLOSTWord[];
|
|
78
|
-
/**
|
|
79
|
-
* Get the first sentence from a document
|
|
80
|
-
*/
|
|
81
|
-
export declare function getFirstSentence(doc: GLOSTRoot): GLOSTSentence | null;
|
|
82
|
-
/**
|
|
83
|
-
* Get words from a specific sentence
|
|
84
|
-
*/
|
|
85
|
-
export declare function getWordsFromSentence(sentence: GLOSTSentence): GLOSTWord[];
|
|
86
|
-
/**
|
|
87
|
-
* Get words from a specific paragraph
|
|
88
|
-
*/
|
|
89
|
-
export declare function getWordsFromParagraph(paragraph: GLOSTParagraph): GLOSTWord[];
|
|
90
|
-
/**
|
|
91
|
-
* Find word nodes with specific language
|
|
92
|
-
*/
|
|
93
|
-
export declare function findWordsByLanguage(node: GLOSTNode, lang: LanguageCode): GLOSTWord[];
|
|
94
|
-
/**
|
|
95
|
-
* Find word nodes with specific transcription system
|
|
96
|
-
*/
|
|
97
|
-
export declare function findWordsByTranscriptionSystem(node: GLOSTNode, system: TranscriptionSystem): GLOSTWord[];
|
|
98
|
-
/**
|
|
99
|
-
* Enhanced type guards for the new GLOST types
|
|
100
|
-
*/
|
|
101
|
-
export declare function isGLOSTWord(node: any): node is GLOSTWord;
|
|
102
|
-
export declare function isGLOSTSentence(node: any): node is GLOSTSentence;
|
|
103
|
-
export declare function isGLOSTParagraph(node: any): node is GLOSTParagraph;
|
|
104
|
-
export declare function isGLOSTRoot(node: any): node is GLOSTRoot;
|
|
105
|
-
/**
|
|
106
|
-
* Type guard for GLOSTClause nodes
|
|
107
|
-
*/
|
|
108
|
-
export declare function isGLOSTClause(node: any): node is GLOSTClause;
|
|
109
|
-
/**
|
|
110
|
-
* Type guard for GLOSTPhrase nodes
|
|
111
|
-
*/
|
|
112
|
-
export declare function isGLOSTPhrase(node: any): node is GLOSTPhrase;
|
|
113
|
-
/**
|
|
114
|
-
* Type guard for GLOSTSyllable nodes
|
|
115
|
-
*/
|
|
116
|
-
export declare function isGLOSTSyllable(node: any): node is GLOSTSyllable;
|
|
117
|
-
/**
|
|
118
|
-
* Type guard for GLOSTCharacter nodes
|
|
119
|
-
*/
|
|
120
|
-
export declare function isGLOSTCharacter(node: any): node is GLOSTCharacter;
|
|
121
|
-
/**
|
|
122
|
-
* Extract text value from a word node
|
|
123
|
-
*/
|
|
124
|
-
export declare function getWordText(word: GLOSTWord): string;
|
|
125
|
-
/**
|
|
126
|
-
* Get transcription for a specific system
|
|
127
|
-
*/
|
|
128
|
-
export declare function getWordTranscription(word: GLOSTWord, system: TranscriptionSystem): string | null;
|
|
129
|
-
/**
|
|
130
|
-
* Check if a word has transcription for a specific system
|
|
131
|
-
*/
|
|
132
|
-
export declare function hasWordTranscription(word: GLOSTWord, system: TranscriptionSystem): boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Get word translation for a specific language
|
|
135
|
-
* @param word - The word node
|
|
136
|
-
* @param language - Target language code (default: "en-US")
|
|
137
|
-
* @returns Translation string or empty string if not found
|
|
138
|
-
*/
|
|
139
|
-
export declare function getWordTranslation(word: GLOSTWord, language?: string): string;
|
|
140
|
-
/**
|
|
141
|
-
* Get word meaning/definition
|
|
142
|
-
* @deprecated Use getWordTranslation for multi-language support.
|
|
143
|
-
* This function is kept for backward compatibility.
|
|
144
|
-
*/
|
|
145
|
-
export declare function getWordMeaning(word: GLOSTWord): string;
|
|
146
|
-
/**
|
|
147
|
-
* Get word part of speech
|
|
148
|
-
*/
|
|
149
|
-
export declare function getWordPartOfSpeech(word: GLOSTWord): string;
|
|
150
|
-
/**
|
|
151
|
-
* Get word difficulty
|
|
152
|
-
*/
|
|
153
|
-
export declare function getWordDifficulty(word: GLOSTWord): string | number;
|
|
154
|
-
/**
|
|
155
|
-
* Get sentence translation
|
|
156
|
-
*/
|
|
157
|
-
export declare function getSentenceTranslation(sentence: GLOSTSentence, language?: string): string | null;
|
|
158
|
-
/**
|
|
159
|
-
* Generic paragraph structure for word count calculation
|
|
160
|
-
* This interface allows converting external paragraph structures to GLOST format
|
|
161
|
-
*/
|
|
162
|
-
export type ParagraphLike = {
|
|
163
|
-
sentences: Array<{
|
|
164
|
-
sentence: string;
|
|
165
|
-
translation?: string;
|
|
166
|
-
}>;
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Convert a paragraph-like structure to GLOST format for word count calculation
|
|
170
|
-
* This is a minimal adapter that only converts what's needed for word counting
|
|
171
|
-
*
|
|
172
|
-
* @param paragraph - Paragraph structure with sentences containing text and optional translations
|
|
173
|
-
* @returns GLOST paragraph node
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* ```ts
|
|
177
|
-
* const paragraph = {
|
|
178
|
-
* sentences: [
|
|
179
|
-
* { sentence: "Hello", translation: "สวัสดี" },
|
|
180
|
-
* { sentence: "World", translation: "โลก" }
|
|
181
|
-
* ]
|
|
182
|
-
* };
|
|
183
|
-
* const mtstParagraph = adaptParagraphLikeToGLOST(paragraph);
|
|
184
|
-
* const wordCount = getGLOSTWordCount(mtstParagraph);
|
|
185
|
-
* ```
|
|
186
|
-
*/
|
|
187
|
-
export declare function adaptParagraphLikeToGLOST(paragraph: ParagraphLike): GLOSTParagraph;
|
|
188
|
-
/**
|
|
189
|
-
* Calculate word count from GLOST content
|
|
190
|
-
* Counts words from sentence translations or original text
|
|
191
|
-
*
|
|
192
|
-
* @param content - GLOST paragraph, sentence, or root node
|
|
193
|
-
* @param language - Optional language code for translation preference (default: 'en')
|
|
194
|
-
* @returns Word count as a number, or undefined if content is empty
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* ```ts
|
|
198
|
-
* const wordCount = getGLOSTWordCount(paragraph, 'en');
|
|
199
|
-
* // Returns: 245
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
export declare function getGLOSTWordCount(content: GLOSTParagraph | GLOSTSentence | GLOSTRoot, language?: string): number | undefined;
|
|
203
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,EACT,cAAc,EACd,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,SAAS,EACT,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAMpB;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAgCA;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EAAE,GAClB,MAAM,GAAG,IAAI,CA2Bf;A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