glost 0.1.1 → 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.
- package/CHANGELOG.md +131 -0
- package/README.md +123 -9
- package/dist/example.d.ts +7 -7
- package/dist/example.js +68 -12
- package/dist/example.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/nodes.d.ts +119 -24
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +60 -55
- package/dist/nodes.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/validators.d.ts +24 -24
- package/package.json +2 -6
- package/src/__tests__/README.md +20 -0
- package/src/__tests__/example.test.ts +43 -0
- package/src/{example.ts → __tests__/example.ts} +71 -71
- package/src/{mock-data.ts → __tests__/mock-data.ts} +117 -128
- package/src/index.ts +0 -1
- package/src/nodes.ts +144 -118
- package/src/types.ts +1 -1
- package/src/utils.ts +0 -1
- package/tsconfig.json +1 -1
- package/dist/mock-data.d.ts +0 -35
- package/dist/mock-data.d.ts.map +0 -1
- package/dist/mock-data.js +0 -494
- package/dist/mock-data.js.map +0 -1
package/dist/validators.d.ts
CHANGED
|
@@ -275,6 +275,7 @@ export declare const GLOSTWordNodeSchema: z.ZodObject<{
|
|
|
275
275
|
};
|
|
276
276
|
children: any[];
|
|
277
277
|
type: "GLOSTWordNode";
|
|
278
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
278
279
|
transcription: Record<string, {
|
|
279
280
|
text: string;
|
|
280
281
|
system: string;
|
|
@@ -287,7 +288,6 @@ export declare const GLOSTWordNodeSchema: z.ZodObject<{
|
|
|
287
288
|
syllables?: string[] | undefined;
|
|
288
289
|
phonetic?: string | undefined;
|
|
289
290
|
}>;
|
|
290
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
291
291
|
value: string;
|
|
292
292
|
position?: any;
|
|
293
293
|
lang?: string | undefined;
|
|
@@ -304,6 +304,7 @@ export declare const GLOSTWordNodeSchema: z.ZodObject<{
|
|
|
304
304
|
register?: string | undefined;
|
|
305
305
|
};
|
|
306
306
|
type: "GLOSTWordNode";
|
|
307
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
307
308
|
transcription: Record<string, {
|
|
308
309
|
text: string;
|
|
309
310
|
system: string;
|
|
@@ -316,7 +317,6 @@ export declare const GLOSTWordNodeSchema: z.ZodObject<{
|
|
|
316
317
|
syllables?: string[] | undefined;
|
|
317
318
|
phonetic?: string | undefined;
|
|
318
319
|
}>;
|
|
319
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
320
320
|
value: string;
|
|
321
321
|
children?: any[] | undefined;
|
|
322
322
|
position?: any;
|
|
@@ -384,6 +384,7 @@ export declare const GLOSTSentenceNodeSchema: z.ZodObject<{
|
|
|
384
384
|
script: string;
|
|
385
385
|
originalText: string;
|
|
386
386
|
position?: any;
|
|
387
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
387
388
|
transcription?: Record<string, {
|
|
388
389
|
text: string;
|
|
389
390
|
system: string;
|
|
@@ -396,7 +397,6 @@ export declare const GLOSTSentenceNodeSchema: z.ZodObject<{
|
|
|
396
397
|
syllables?: string[] | undefined;
|
|
397
398
|
phonetic?: string | undefined;
|
|
398
399
|
}> | undefined;
|
|
399
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
400
400
|
}, {
|
|
401
401
|
type: "GLOSTSentenceNode";
|
|
402
402
|
lang: string;
|
|
@@ -404,6 +404,7 @@ export declare const GLOSTSentenceNodeSchema: z.ZodObject<{
|
|
|
404
404
|
originalText: string;
|
|
405
405
|
children?: any[] | undefined;
|
|
406
406
|
position?: any;
|
|
407
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
407
408
|
transcription?: Record<string, {
|
|
408
409
|
text: string;
|
|
409
410
|
system: string;
|
|
@@ -416,7 +417,6 @@ export declare const GLOSTSentenceNodeSchema: z.ZodObject<{
|
|
|
416
417
|
syllables?: string[] | undefined;
|
|
417
418
|
phonetic?: string | undefined;
|
|
418
419
|
}> | undefined;
|
|
419
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
420
420
|
}>;
|
|
421
421
|
/**
|
|
422
422
|
* GLOST paragraph node schema
|
|
@@ -594,6 +594,7 @@ export declare const GLOSTNodeSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
594
594
|
};
|
|
595
595
|
children: any[];
|
|
596
596
|
type: "GLOSTWordNode";
|
|
597
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
597
598
|
transcription: Record<string, {
|
|
598
599
|
text: string;
|
|
599
600
|
system: string;
|
|
@@ -606,7 +607,6 @@ export declare const GLOSTNodeSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
606
607
|
syllables?: string[] | undefined;
|
|
607
608
|
phonetic?: string | undefined;
|
|
608
609
|
}>;
|
|
609
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
610
610
|
value: string;
|
|
611
611
|
position?: any;
|
|
612
612
|
lang?: string | undefined;
|
|
@@ -623,6 +623,7 @@ export declare const GLOSTNodeSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
623
623
|
register?: string | undefined;
|
|
624
624
|
};
|
|
625
625
|
type: "GLOSTWordNode";
|
|
626
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
626
627
|
transcription: Record<string, {
|
|
627
628
|
text: string;
|
|
628
629
|
system: string;
|
|
@@ -635,7 +636,6 @@ export declare const GLOSTNodeSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
635
636
|
syllables?: string[] | undefined;
|
|
636
637
|
phonetic?: string | undefined;
|
|
637
638
|
}>;
|
|
638
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
639
639
|
value: string;
|
|
640
640
|
children?: any[] | undefined;
|
|
641
641
|
position?: any;
|
|
@@ -699,6 +699,7 @@ export declare const GLOSTNodeSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
699
699
|
script: string;
|
|
700
700
|
originalText: string;
|
|
701
701
|
position?: any;
|
|
702
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
702
703
|
transcription?: Record<string, {
|
|
703
704
|
text: string;
|
|
704
705
|
system: string;
|
|
@@ -711,7 +712,6 @@ export declare const GLOSTNodeSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
711
712
|
syllables?: string[] | undefined;
|
|
712
713
|
phonetic?: string | undefined;
|
|
713
714
|
}> | undefined;
|
|
714
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
715
715
|
}, {
|
|
716
716
|
type: "GLOSTSentenceNode";
|
|
717
717
|
lang: string;
|
|
@@ -719,6 +719,7 @@ export declare const GLOSTNodeSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
719
719
|
originalText: string;
|
|
720
720
|
children?: any[] | undefined;
|
|
721
721
|
position?: any;
|
|
722
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
722
723
|
transcription?: Record<string, {
|
|
723
724
|
text: string;
|
|
724
725
|
system: string;
|
|
@@ -731,7 +732,6 @@ export declare const GLOSTNodeSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
731
732
|
syllables?: string[] | undefined;
|
|
732
733
|
phonetic?: string | undefined;
|
|
733
734
|
}> | undefined;
|
|
734
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
735
735
|
}>, z.ZodObject<{
|
|
736
736
|
level: z.ZodOptional<z.ZodEnum<["character", "syllable", "word", "phrase", "sentence", "paragraph"]>>;
|
|
737
737
|
position: z.ZodOptional<z.ZodAny>;
|
|
@@ -840,6 +840,7 @@ export declare function parseGLOSTNode(data: unknown): z.SafeParseReturnType<{
|
|
|
840
840
|
register?: string | undefined;
|
|
841
841
|
};
|
|
842
842
|
type: "GLOSTWordNode";
|
|
843
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
843
844
|
transcription: Record<string, {
|
|
844
845
|
text: string;
|
|
845
846
|
system: string;
|
|
@@ -852,7 +853,6 @@ export declare function parseGLOSTNode(data: unknown): z.SafeParseReturnType<{
|
|
|
852
853
|
syllables?: string[] | undefined;
|
|
853
854
|
phonetic?: string | undefined;
|
|
854
855
|
}>;
|
|
855
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
856
856
|
value: string;
|
|
857
857
|
children?: any[] | undefined;
|
|
858
858
|
position?: any;
|
|
@@ -865,6 +865,7 @@ export declare function parseGLOSTNode(data: unknown): z.SafeParseReturnType<{
|
|
|
865
865
|
originalText: string;
|
|
866
866
|
children?: any[] | undefined;
|
|
867
867
|
position?: any;
|
|
868
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
868
869
|
transcription?: Record<string, {
|
|
869
870
|
text: string;
|
|
870
871
|
system: string;
|
|
@@ -877,7 +878,6 @@ export declare function parseGLOSTNode(data: unknown): z.SafeParseReturnType<{
|
|
|
877
878
|
syllables?: string[] | undefined;
|
|
878
879
|
phonetic?: string | undefined;
|
|
879
880
|
}> | undefined;
|
|
880
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
881
881
|
} | {
|
|
882
882
|
type: "GLOSTParagraphNode";
|
|
883
883
|
lang: string;
|
|
@@ -911,6 +911,7 @@ export declare function parseGLOSTNode(data: unknown): z.SafeParseReturnType<{
|
|
|
911
911
|
};
|
|
912
912
|
children: any[];
|
|
913
913
|
type: "GLOSTWordNode";
|
|
914
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
914
915
|
transcription: Record<string, {
|
|
915
916
|
text: string;
|
|
916
917
|
system: string;
|
|
@@ -923,7 +924,6 @@ export declare function parseGLOSTNode(data: unknown): z.SafeParseReturnType<{
|
|
|
923
924
|
syllables?: string[] | undefined;
|
|
924
925
|
phonetic?: string | undefined;
|
|
925
926
|
}>;
|
|
926
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
927
927
|
value: string;
|
|
928
928
|
position?: any;
|
|
929
929
|
lang?: string | undefined;
|
|
@@ -935,6 +935,7 @@ export declare function parseGLOSTNode(data: unknown): z.SafeParseReturnType<{
|
|
|
935
935
|
script: string;
|
|
936
936
|
originalText: string;
|
|
937
937
|
position?: any;
|
|
938
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
938
939
|
transcription?: Record<string, {
|
|
939
940
|
text: string;
|
|
940
941
|
system: string;
|
|
@@ -947,7 +948,6 @@ export declare function parseGLOSTNode(data: unknown): z.SafeParseReturnType<{
|
|
|
947
948
|
syllables?: string[] | undefined;
|
|
948
949
|
phonetic?: string | undefined;
|
|
949
950
|
}> | undefined;
|
|
950
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
951
951
|
} | {
|
|
952
952
|
children: any[];
|
|
953
953
|
type: "GLOSTParagraphNode";
|
|
@@ -984,6 +984,7 @@ export declare function parseGLOSTWordNode(data: unknown): z.SafeParseReturnType
|
|
|
984
984
|
register?: string | undefined;
|
|
985
985
|
};
|
|
986
986
|
type: "GLOSTWordNode";
|
|
987
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
987
988
|
transcription: Record<string, {
|
|
988
989
|
text: string;
|
|
989
990
|
system: string;
|
|
@@ -996,7 +997,6 @@ export declare function parseGLOSTWordNode(data: unknown): z.SafeParseReturnType
|
|
|
996
997
|
syllables?: string[] | undefined;
|
|
997
998
|
phonetic?: string | undefined;
|
|
998
999
|
}>;
|
|
999
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1000
1000
|
value: string;
|
|
1001
1001
|
children?: any[] | undefined;
|
|
1002
1002
|
position?: any;
|
|
@@ -1015,6 +1015,7 @@ export declare function parseGLOSTWordNode(data: unknown): z.SafeParseReturnType
|
|
|
1015
1015
|
};
|
|
1016
1016
|
children: any[];
|
|
1017
1017
|
type: "GLOSTWordNode";
|
|
1018
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1018
1019
|
transcription: Record<string, {
|
|
1019
1020
|
text: string;
|
|
1020
1021
|
system: string;
|
|
@@ -1027,7 +1028,6 @@ export declare function parseGLOSTWordNode(data: unknown): z.SafeParseReturnType
|
|
|
1027
1028
|
syllables?: string[] | undefined;
|
|
1028
1029
|
phonetic?: string | undefined;
|
|
1029
1030
|
}>;
|
|
1030
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1031
1031
|
value: string;
|
|
1032
1032
|
position?: any;
|
|
1033
1033
|
lang?: string | undefined;
|
|
@@ -1043,6 +1043,7 @@ export declare function parseGLOSTSentenceNode(data: unknown): z.SafeParseReturn
|
|
|
1043
1043
|
originalText: string;
|
|
1044
1044
|
children?: any[] | undefined;
|
|
1045
1045
|
position?: any;
|
|
1046
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1046
1047
|
transcription?: Record<string, {
|
|
1047
1048
|
text: string;
|
|
1048
1049
|
system: string;
|
|
@@ -1055,7 +1056,6 @@ export declare function parseGLOSTSentenceNode(data: unknown): z.SafeParseReturn
|
|
|
1055
1056
|
syllables?: string[] | undefined;
|
|
1056
1057
|
phonetic?: string | undefined;
|
|
1057
1058
|
}> | undefined;
|
|
1058
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1059
1059
|
}, {
|
|
1060
1060
|
children: any[];
|
|
1061
1061
|
type: "GLOSTSentenceNode";
|
|
@@ -1063,6 +1063,7 @@ export declare function parseGLOSTSentenceNode(data: unknown): z.SafeParseReturn
|
|
|
1063
1063
|
script: string;
|
|
1064
1064
|
originalText: string;
|
|
1065
1065
|
position?: any;
|
|
1066
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1066
1067
|
transcription?: Record<string, {
|
|
1067
1068
|
text: string;
|
|
1068
1069
|
system: string;
|
|
@@ -1075,7 +1076,6 @@ export declare function parseGLOSTSentenceNode(data: unknown): z.SafeParseReturn
|
|
|
1075
1076
|
syllables?: string[] | undefined;
|
|
1076
1077
|
phonetic?: string | undefined;
|
|
1077
1078
|
}> | undefined;
|
|
1078
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1079
1079
|
}>;
|
|
1080
1080
|
/**
|
|
1081
1081
|
* Parse and validate GLOST paragraph node with error details
|
|
@@ -1354,6 +1354,7 @@ export declare const schemas: {
|
|
|
1354
1354
|
};
|
|
1355
1355
|
children: any[];
|
|
1356
1356
|
type: "GLOSTWordNode";
|
|
1357
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1357
1358
|
transcription: Record<string, {
|
|
1358
1359
|
text: string;
|
|
1359
1360
|
system: string;
|
|
@@ -1366,7 +1367,6 @@ export declare const schemas: {
|
|
|
1366
1367
|
syllables?: string[] | undefined;
|
|
1367
1368
|
phonetic?: string | undefined;
|
|
1368
1369
|
}>;
|
|
1369
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1370
1370
|
value: string;
|
|
1371
1371
|
position?: any;
|
|
1372
1372
|
lang?: string | undefined;
|
|
@@ -1383,6 +1383,7 @@ export declare const schemas: {
|
|
|
1383
1383
|
register?: string | undefined;
|
|
1384
1384
|
};
|
|
1385
1385
|
type: "GLOSTWordNode";
|
|
1386
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1386
1387
|
transcription: Record<string, {
|
|
1387
1388
|
text: string;
|
|
1388
1389
|
system: string;
|
|
@@ -1395,7 +1396,6 @@ export declare const schemas: {
|
|
|
1395
1396
|
syllables?: string[] | undefined;
|
|
1396
1397
|
phonetic?: string | undefined;
|
|
1397
1398
|
}>;
|
|
1398
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1399
1399
|
value: string;
|
|
1400
1400
|
children?: any[] | undefined;
|
|
1401
1401
|
position?: any;
|
|
@@ -1459,6 +1459,7 @@ export declare const schemas: {
|
|
|
1459
1459
|
script: string;
|
|
1460
1460
|
originalText: string;
|
|
1461
1461
|
position?: any;
|
|
1462
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1462
1463
|
transcription?: Record<string, {
|
|
1463
1464
|
text: string;
|
|
1464
1465
|
system: string;
|
|
@@ -1471,7 +1472,6 @@ export declare const schemas: {
|
|
|
1471
1472
|
syllables?: string[] | undefined;
|
|
1472
1473
|
phonetic?: string | undefined;
|
|
1473
1474
|
}> | undefined;
|
|
1474
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1475
1475
|
}, {
|
|
1476
1476
|
type: "GLOSTSentenceNode";
|
|
1477
1477
|
lang: string;
|
|
@@ -1479,6 +1479,7 @@ export declare const schemas: {
|
|
|
1479
1479
|
originalText: string;
|
|
1480
1480
|
children?: any[] | undefined;
|
|
1481
1481
|
position?: any;
|
|
1482
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1482
1483
|
transcription?: Record<string, {
|
|
1483
1484
|
text: string;
|
|
1484
1485
|
system: string;
|
|
@@ -1491,7 +1492,6 @@ export declare const schemas: {
|
|
|
1491
1492
|
syllables?: string[] | undefined;
|
|
1492
1493
|
phonetic?: string | undefined;
|
|
1493
1494
|
}> | undefined;
|
|
1494
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1495
1495
|
}>, z.ZodObject<{
|
|
1496
1496
|
level: z.ZodOptional<z.ZodEnum<["character", "syllable", "word", "phrase", "sentence", "paragraph"]>>;
|
|
1497
1497
|
position: z.ZodOptional<z.ZodAny>;
|
|
@@ -1658,6 +1658,7 @@ export declare const schemas: {
|
|
|
1658
1658
|
};
|
|
1659
1659
|
children: any[];
|
|
1660
1660
|
type: "GLOSTWordNode";
|
|
1661
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1661
1662
|
transcription: Record<string, {
|
|
1662
1663
|
text: string;
|
|
1663
1664
|
system: string;
|
|
@@ -1670,7 +1671,6 @@ export declare const schemas: {
|
|
|
1670
1671
|
syllables?: string[] | undefined;
|
|
1671
1672
|
phonetic?: string | undefined;
|
|
1672
1673
|
}>;
|
|
1673
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1674
1674
|
value: string;
|
|
1675
1675
|
position?: any;
|
|
1676
1676
|
lang?: string | undefined;
|
|
@@ -1687,6 +1687,7 @@ export declare const schemas: {
|
|
|
1687
1687
|
register?: string | undefined;
|
|
1688
1688
|
};
|
|
1689
1689
|
type: "GLOSTWordNode";
|
|
1690
|
+
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1690
1691
|
transcription: Record<string, {
|
|
1691
1692
|
text: string;
|
|
1692
1693
|
system: string;
|
|
@@ -1699,7 +1700,6 @@ export declare const schemas: {
|
|
|
1699
1700
|
syllables?: string[] | undefined;
|
|
1700
1701
|
phonetic?: string | undefined;
|
|
1701
1702
|
}>;
|
|
1702
|
-
level: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph";
|
|
1703
1703
|
value: string;
|
|
1704
1704
|
children?: any[] | undefined;
|
|
1705
1705
|
position?: any;
|
|
@@ -1764,6 +1764,7 @@ export declare const schemas: {
|
|
|
1764
1764
|
script: string;
|
|
1765
1765
|
originalText: string;
|
|
1766
1766
|
position?: any;
|
|
1767
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1767
1768
|
transcription?: Record<string, {
|
|
1768
1769
|
text: string;
|
|
1769
1770
|
system: string;
|
|
@@ -1776,7 +1777,6 @@ export declare const schemas: {
|
|
|
1776
1777
|
syllables?: string[] | undefined;
|
|
1777
1778
|
phonetic?: string | undefined;
|
|
1778
1779
|
}> | undefined;
|
|
1779
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1780
1780
|
}, {
|
|
1781
1781
|
type: "GLOSTSentenceNode";
|
|
1782
1782
|
lang: string;
|
|
@@ -1784,6 +1784,7 @@ export declare const schemas: {
|
|
|
1784
1784
|
originalText: string;
|
|
1785
1785
|
children?: any[] | undefined;
|
|
1786
1786
|
position?: any;
|
|
1787
|
+
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1787
1788
|
transcription?: Record<string, {
|
|
1788
1789
|
text: string;
|
|
1789
1790
|
system: string;
|
|
@@ -1796,7 +1797,6 @@ export declare const schemas: {
|
|
|
1796
1797
|
syllables?: string[] | undefined;
|
|
1797
1798
|
phonetic?: string | undefined;
|
|
1798
1799
|
}> | undefined;
|
|
1799
|
-
level?: "character" | "syllable" | "word" | "phrase" | "sentence" | "paragraph" | undefined;
|
|
1800
1800
|
}>;
|
|
1801
1801
|
GLOSTParagraphNode: z.ZodObject<{
|
|
1802
1802
|
level: z.ZodOptional<z.ZodEnum<["character", "syllable", "word", "phrase", "sentence", "paragraph"]>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glost",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "GLOST - Glossed Syntax Tree for augmenting text with language learning metadata",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"unist-util-select": "^5.1.0",
|
|
39
39
|
"unist-util-visit": "^5.0.0",
|
|
40
40
|
"zod": "^3.23.8",
|
|
41
|
-
"glost-common": "0.1.
|
|
41
|
+
"glost-common": "0.1.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/nlcst": "^2.0.3",
|
|
@@ -52,10 +52,6 @@
|
|
|
52
52
|
"multilingual",
|
|
53
53
|
"language-learning",
|
|
54
54
|
"linguistics",
|
|
55
|
-
"thai",
|
|
56
|
-
"japanese",
|
|
57
|
-
"chinese",
|
|
58
|
-
"korean",
|
|
59
55
|
"syntax-tree",
|
|
60
56
|
"unist"
|
|
61
57
|
],
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Test Fixtures
|
|
2
|
+
|
|
3
|
+
This directory contains mock data and fixtures for testing purposes only.
|
|
4
|
+
|
|
5
|
+
**Important:** Files in this directory should **NOT** be imported by production code to avoid bundling test data with the main library.
|
|
6
|
+
|
|
7
|
+
## Usage in Tests
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
// In your test files
|
|
11
|
+
import { thaiDocumentWithExtras, japaneseDocumentWithExtras } from '../__fixtures__/mock-data';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Available Fixtures
|
|
15
|
+
|
|
16
|
+
- `mock-data.ts` - Sample GLOST documents with enhanced Thai and Japanese examples including:
|
|
17
|
+
- Word-level annotations with multiple transcription systems
|
|
18
|
+
- Translations in multiple languages
|
|
19
|
+
- Cultural notes and metadata
|
|
20
|
+
- Example sentences and usage patterns
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Example test file showing how to use fixtures
|
|
2
|
+
// This demonstrates that fixtures are only imported in test files
|
|
3
|
+
|
|
4
|
+
import { describe, it, expect } from 'vitest';
|
|
5
|
+
import {
|
|
6
|
+
thaiDocumentWithExtras,
|
|
7
|
+
japaneseDocumentWithExtras,
|
|
8
|
+
getQuickTranslation,
|
|
9
|
+
getDifficulty
|
|
10
|
+
} from './mock-data.js';
|
|
11
|
+
import { getAllWords } from '../utils.js';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
describe('Using mock data fixtures', () => {
|
|
15
|
+
it('should load Thai document with extras', () => {
|
|
16
|
+
expect(thaiDocumentWithExtras.type).toBe('RootNode');
|
|
17
|
+
expect(thaiDocumentWithExtras.lang).toBe('th');
|
|
18
|
+
|
|
19
|
+
const words = getAllWords(thaiDocumentWithExtras);
|
|
20
|
+
expect(words.length).toBeGreaterThan(0);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should load Japanese document with extras', () => {
|
|
24
|
+
expect(japaneseDocumentWithExtras.type).toBe('RootNode');
|
|
25
|
+
expect(japaneseDocumentWithExtras.lang).toBe('ja');
|
|
26
|
+
|
|
27
|
+
const words = getAllWords(japaneseDocumentWithExtras);
|
|
28
|
+
expect(words.length).toBeGreaterThan(0);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should access translation data from fixtures', () => {
|
|
32
|
+
const words = getAllWords(thaiDocumentWithExtras);
|
|
33
|
+
const firstWord = words[0];
|
|
34
|
+
|
|
35
|
+
if (firstWord) {
|
|
36
|
+
const englishTranslation = getQuickTranslation(firstWord, 'en');
|
|
37
|
+
expect(englishTranslation).toBeDefined();
|
|
38
|
+
|
|
39
|
+
const difficulty = getDifficulty(firstWord);
|
|
40
|
+
expect(difficulty).toBeDefined();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Example usage of the GLOST package
|
|
2
2
|
import {
|
|
3
|
-
createThaiWord,
|
|
4
|
-
createJapaneseWord,
|
|
5
3
|
createSentenceFromWords,
|
|
6
4
|
createParagraphFromSentences,
|
|
7
5
|
createDocumentFromParagraphs,
|
|
@@ -9,48 +7,50 @@ import {
|
|
|
9
7
|
getWordTranscription,
|
|
10
8
|
validateGLOSTTree,
|
|
11
9
|
getWordText
|
|
12
|
-
} from '
|
|
10
|
+
} from '../index';
|
|
11
|
+
import { createThaiWord } from 'glost-th';
|
|
12
|
+
import { createJapaneseWord } from 'glost-ja';
|
|
13
13
|
|
|
14
14
|
// ============================================================================
|
|
15
15
|
// Thai Example: "สวัสดีครับ ผมชื่อสมชาย" (Hello, my name is Somchai)
|
|
16
16
|
// ============================================================================
|
|
17
17
|
|
|
18
18
|
const thaiWords = [
|
|
19
|
-
createThaiWord(
|
|
20
|
-
'สวัสดี',
|
|
21
|
-
'sà-wàt-dii',
|
|
22
|
-
'interjection',
|
|
23
|
-
2,
|
|
24
|
-
['sa', 'wat', 'dii']
|
|
25
|
-
),
|
|
26
|
-
createThaiWord(
|
|
27
|
-
'ครับ',
|
|
28
|
-
'khráp',
|
|
29
|
-
'particle',
|
|
30
|
-
2,
|
|
31
|
-
['khrap']
|
|
32
|
-
),
|
|
33
|
-
createThaiWord(
|
|
34
|
-
'ผม',
|
|
35
|
-
'phǒm',
|
|
36
|
-
'pronoun',
|
|
37
|
-
3,
|
|
38
|
-
['phom']
|
|
39
|
-
),
|
|
40
|
-
createThaiWord(
|
|
41
|
-
'ชื่อ',
|
|
42
|
-
'chûue',
|
|
43
|
-
'noun',
|
|
44
|
-
3,
|
|
45
|
-
['chue']
|
|
46
|
-
),
|
|
47
|
-
createThaiWord(
|
|
48
|
-
'สมชาย',
|
|
49
|
-
'sǒm-chaai',
|
|
50
|
-
'proper noun',
|
|
51
|
-
3,
|
|
52
|
-
['som', 'chaai']
|
|
53
|
-
)
|
|
19
|
+
createThaiWord({
|
|
20
|
+
text: 'สวัสดี',
|
|
21
|
+
rtgs: 'sà-wàt-dii',
|
|
22
|
+
partOfSpeech: 'interjection',
|
|
23
|
+
tone: 2,
|
|
24
|
+
syllables: ['sa', 'wat', 'dii']
|
|
25
|
+
}),
|
|
26
|
+
createThaiWord({
|
|
27
|
+
text: 'ครับ',
|
|
28
|
+
rtgs: 'khráp',
|
|
29
|
+
partOfSpeech: 'particle',
|
|
30
|
+
tone: 2,
|
|
31
|
+
syllables: ['khrap']
|
|
32
|
+
}),
|
|
33
|
+
createThaiWord({
|
|
34
|
+
text: 'ผม',
|
|
35
|
+
rtgs: 'phǒm',
|
|
36
|
+
partOfSpeech: 'pronoun',
|
|
37
|
+
tone: 3,
|
|
38
|
+
syllables: ['phom']
|
|
39
|
+
}),
|
|
40
|
+
createThaiWord({
|
|
41
|
+
text: 'ชื่อ',
|
|
42
|
+
rtgs: 'chûue',
|
|
43
|
+
partOfSpeech: 'noun',
|
|
44
|
+
tone: 3,
|
|
45
|
+
syllables: ['chue']
|
|
46
|
+
}),
|
|
47
|
+
createThaiWord({
|
|
48
|
+
text: 'สมชาย',
|
|
49
|
+
rtgs: 'sǒm-chaai',
|
|
50
|
+
partOfSpeech: 'proper noun',
|
|
51
|
+
tone: 3,
|
|
52
|
+
syllables: ['som', 'chaai']
|
|
53
|
+
})
|
|
54
54
|
];
|
|
55
55
|
|
|
56
56
|
const thaiSentence = createSentenceFromWords(
|
|
@@ -65,39 +65,39 @@ const thaiSentence = createSentenceFromWords(
|
|
|
65
65
|
// ============================================================================
|
|
66
66
|
|
|
67
67
|
const japaneseWords = [
|
|
68
|
-
createJapaneseWord(
|
|
69
|
-
'私',
|
|
70
|
-
'watashi',
|
|
71
|
-
'pronoun',
|
|
72
|
-
'わたし'
|
|
73
|
-
),
|
|
74
|
-
createJapaneseWord(
|
|
75
|
-
'の',
|
|
76
|
-
'no',
|
|
77
|
-
'particle'
|
|
78
|
-
),
|
|
79
|
-
createJapaneseWord(
|
|
80
|
-
'名前',
|
|
81
|
-
'namae',
|
|
82
|
-
'noun',
|
|
83
|
-
'なまえ'
|
|
84
|
-
),
|
|
85
|
-
createJapaneseWord(
|
|
86
|
-
'は',
|
|
87
|
-
'wa',
|
|
88
|
-
'particle'
|
|
89
|
-
),
|
|
90
|
-
createJapaneseWord(
|
|
91
|
-
'田中',
|
|
92
|
-
'tanaka',
|
|
93
|
-
'proper noun',
|
|
94
|
-
'たなか'
|
|
95
|
-
),
|
|
96
|
-
createJapaneseWord(
|
|
97
|
-
'です',
|
|
98
|
-
'desu',
|
|
99
|
-
'copula'
|
|
100
|
-
)
|
|
68
|
+
createJapaneseWord({
|
|
69
|
+
text: '私',
|
|
70
|
+
romaji: 'watashi',
|
|
71
|
+
partOfSpeech: 'pronoun',
|
|
72
|
+
furigana: 'わたし'
|
|
73
|
+
}),
|
|
74
|
+
createJapaneseWord({
|
|
75
|
+
text: 'の',
|
|
76
|
+
romaji: 'no',
|
|
77
|
+
partOfSpeech: 'particle'
|
|
78
|
+
}),
|
|
79
|
+
createJapaneseWord({
|
|
80
|
+
text: '名前',
|
|
81
|
+
romaji: 'namae',
|
|
82
|
+
partOfSpeech: 'noun',
|
|
83
|
+
furigana: 'なまえ'
|
|
84
|
+
}),
|
|
85
|
+
createJapaneseWord({
|
|
86
|
+
text: 'は',
|
|
87
|
+
romaji: 'wa',
|
|
88
|
+
partOfSpeech: 'particle'
|
|
89
|
+
}),
|
|
90
|
+
createJapaneseWord({
|
|
91
|
+
text: '田中',
|
|
92
|
+
romaji: 'tanaka',
|
|
93
|
+
partOfSpeech: 'proper noun',
|
|
94
|
+
furigana: 'たなか'
|
|
95
|
+
}),
|
|
96
|
+
createJapaneseWord({
|
|
97
|
+
text: 'です',
|
|
98
|
+
romaji: 'desu',
|
|
99
|
+
partOfSpeech: 'copula'
|
|
100
|
+
})
|
|
101
101
|
];
|
|
102
102
|
|
|
103
103
|
const japaneseSentence = createSentenceFromWords(
|