@keymanapp/kmc-model 18.0.53-alpha → 18.0.55-alpha
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/build/src/build-trie.d.ts +39 -39
- package/build/src/build-trie.js +374 -374
- package/build/src/build-trie.js.map +1 -1
- package/build/src/compiler-callbacks.d.ts +3 -3
- package/build/src/compiler-callbacks.js +4 -4
- package/build/src/join-word-breaker-decorator.d.ts +9 -9
- package/build/src/join-word-breaker-decorator.js +120 -120
- package/build/src/join-word-breaker-decorator.js.map +1 -1
- package/build/src/lexical-model-compiler.d.ts +87 -87
- package/build/src/lexical-model-compiler.js +260 -260
- package/build/src/lexical-model-compiler.js.map +1 -1
- package/build/src/lexical-model.d.ts +143 -143
- package/build/src/lexical-model.js +5 -5
- package/build/src/main.d.ts +3 -3
- package/build/src/main.js +2 -2
- package/build/src/model-compiler-messages.d.ts +56 -56
- package/build/src/model-compiler-messages.js +63 -63
- package/build/src/model-defaults.d.ts +55 -55
- package/build/src/model-defaults.js +101 -101
- package/build/src/model-defaults.js.map +1 -1
- package/build/src/model-definitions.d.ts +70 -70
- package/build/src/model-definitions.js +182 -182
- package/build/src/model-definitions.js.map +1 -1
- package/build/src/script-overrides-decorator.d.ts +3 -3
- package/build/src/script-overrides-decorator.js +63 -63
- package/build/src/script-overrides-decorator.js.map +1 -1
- package/package.json +8 -9
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interfaces and constants used by the lexical model compiler. These target
|
|
3
|
-
* the LMLayer's internal worker code, so we provide those definitions too.
|
|
4
|
-
*/
|
|
5
|
-
/// <reference types="@keymanapp/models-types" />
|
|
6
|
-
export interface LexicalModelDeclaration {
|
|
7
|
-
readonly format: 'trie-1.0' | 'fst-foma-1.0' | 'custom-1.0';
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
* Keyman 14.0+ word breaker specification:
|
|
12
|
-
*
|
|
13
|
-
* Can support all old word breaking specification,
|
|
14
|
-
* but can also be extended with options.
|
|
15
|
-
*
|
|
16
|
-
* @since 14.0
|
|
17
|
-
*/
|
|
18
|
-
export interface WordBreakerSpec {
|
|
19
|
-
readonly use: SimpleWordBreakerSpec;
|
|
20
|
-
/**
|
|
21
|
-
* If present, joins words that were split by the word breaker
|
|
22
|
-
* together at the given strings. e.g.,
|
|
23
|
-
*
|
|
24
|
-
* joinWordsAt: ['-'] // to keep hyphenated items together
|
|
25
|
-
*
|
|
26
|
-
* @since 14.0
|
|
27
|
-
*/
|
|
28
|
-
readonly joinWordsAt?: string[];
|
|
29
|
-
/**
|
|
30
|
-
* Overrides word splitting behaviour for certain scripts.
|
|
31
|
-
* For example, specifing that spaces break words in certain South-East
|
|
32
|
-
* Asian scripts that otherwise do not use spaces.
|
|
33
|
-
*
|
|
34
|
-
* @since 14.0
|
|
35
|
-
*/
|
|
36
|
-
readonly overrideScriptDefaults?: OverrideScriptDefaults;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* @public
|
|
40
|
-
* Simplified word breaker specification.
|
|
41
|
-
*
|
|
42
|
-
* @since 11.0
|
|
43
|
-
*/
|
|
44
|
-
export type SimpleWordBreakerSpec = 'default' | 'ascii' | WordBreakingFunction;
|
|
45
|
-
/**
|
|
46
|
-
* @public
|
|
47
|
-
* Simplifies input text to facilitate finding entries within a lexical model's
|
|
48
|
-
* lexicon.
|
|
49
|
-
* @since 11.0
|
|
50
|
-
*/
|
|
51
|
-
export type SimpleWordformToKeySpec = (term: string) => string;
|
|
52
|
-
/**
|
|
53
|
-
* @public
|
|
54
|
-
* Simplifies input text to facilitate finding entries within a lexical model's
|
|
55
|
-
* lexicon, using the model's `applyCasing` function to assist in the keying process.
|
|
56
|
-
* @since 14.0
|
|
57
|
-
*/
|
|
58
|
-
export type CasedWordformToKeySpec = (term: string, applyCasing?: CasingFunction) => string;
|
|
59
|
-
/**
|
|
60
|
-
* @public
|
|
61
|
-
* Simplifies input text to facilitate finding entries within a lexical model's
|
|
62
|
-
* lexicon.
|
|
63
|
-
*/
|
|
64
|
-
export type WordformToKeySpec = SimpleWordformToKeySpec | CasedWordformToKeySpec;
|
|
65
|
-
/**
|
|
66
|
-
* Override the default word breaking behaviour for some scripts.
|
|
67
|
-
*
|
|
68
|
-
* There is currently only one option:
|
|
69
|
-
*
|
|
70
|
-
* 'break-words-at-spaces'
|
|
71
|
-
* : some South-East Asian scripts conventionally do not use space or any
|
|
72
|
-
* explicit word boundary character to write word breaks. These scripts are:
|
|
73
|
-
*
|
|
74
|
-
* * Burmese
|
|
75
|
-
* * Khmer
|
|
76
|
-
* * Thai
|
|
77
|
-
* * Laos
|
|
78
|
-
*
|
|
79
|
-
* (this list may be incomplete and extended in the future)
|
|
80
|
-
*
|
|
81
|
-
* For these scripts, the default word breaker breaks at **every**
|
|
82
|
-
* letter/syllable/ideograph. However, in languages that use these scripts BUT
|
|
83
|
-
* use spaces (or some other delimier) as word breaks, enable
|
|
84
|
-
* 'break-words-at-spaces'; enabling 'break-words-at-spaces' prevents the word
|
|
85
|
-
* breaker from making too many breaks in these scripts.
|
|
86
|
-
*
|
|
87
|
-
* @since 14.0
|
|
88
|
-
*/
|
|
89
|
-
export type OverrideScriptDefaults = 'break-words-at-spaces';
|
|
90
|
-
/**
|
|
91
|
-
* @public
|
|
92
|
-
* Base interface for a lexical model source definition
|
|
93
|
-
*/
|
|
94
|
-
export interface LexicalModelSource extends LexicalModelDeclaration {
|
|
95
|
-
readonly sources: Array<string>;
|
|
96
|
-
/**
|
|
97
|
-
* The name of the type to instantiate (without parameters) as the base object for a custom predictive model.
|
|
98
|
-
*/
|
|
99
|
-
readonly rootClass?: string;
|
|
100
|
-
/**
|
|
101
|
-
* When set to `true`, suggestions will attempt to match the case of the input text even if
|
|
102
|
-
* the lexicon entries use a different casing scheme due to search term keying effects.
|
|
103
|
-
* @since 14.0
|
|
104
|
-
*/
|
|
105
|
-
readonly languageUsesCasing?: boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Specifies the casing rules for a language. Should implement three casing forms:
|
|
108
|
-
* - 'lower' -- a fully-lowercased version of the text appropriate for the language's
|
|
109
|
-
* use of the writing system.
|
|
110
|
-
* - 'upper' -- a fully-uppercased version of the text
|
|
111
|
-
* - 'initial' -- a version preserving the input casing aside from the initial character,
|
|
112
|
-
* which is uppercased (like with proper nouns and sentence-initial words in English
|
|
113
|
-
* sentences.)
|
|
114
|
-
*
|
|
115
|
-
* This is only utilized if `languageUsesCasing` is defined and set to `true`.
|
|
116
|
-
* @since 14.0
|
|
117
|
-
*/
|
|
118
|
-
readonly applyCasing?: CasingFunction;
|
|
119
|
-
/**
|
|
120
|
-
* Which word breaker to use. Choose from:
|
|
121
|
-
*
|
|
122
|
-
* - 'default' -- breaks according to Unicode UAX #29 §4.1 Default Word
|
|
123
|
-
* Boundary Specification, which works well for *most* languages.
|
|
124
|
-
* - 'ascii' -- a very simple word breaker, for demonstration purposes only.
|
|
125
|
-
* - word breaking function -- provide your own function that breaks words.
|
|
126
|
-
* - class-based word-breaker - may be supported in the future.
|
|
127
|
-
*/
|
|
128
|
-
readonly wordBreaker?: WordBreakerSpec | SimpleWordBreakerSpec;
|
|
129
|
-
/**
|
|
130
|
-
* How to simplify words, to convert them into simplified search keys
|
|
131
|
-
* This often involves removing accents, lowercasing, etc.
|
|
132
|
-
*/
|
|
133
|
-
readonly searchTermToKey?: WordformToKeySpec;
|
|
134
|
-
/**
|
|
135
|
-
* Punctuation and spacing suggested by the model.
|
|
136
|
-
*
|
|
137
|
-
* @see LexicalModelPunctuation
|
|
138
|
-
*/
|
|
139
|
-
readonly punctuation?: LexicalModelPunctuation;
|
|
140
|
-
}
|
|
141
|
-
export interface LexicalModelCompiled extends LexicalModelDeclaration {
|
|
142
|
-
readonly id: string;
|
|
143
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Interfaces and constants used by the lexical model compiler. These target
|
|
3
|
+
* the LMLayer's internal worker code, so we provide those definitions too.
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="@keymanapp/models-types" />
|
|
6
|
+
export interface LexicalModelDeclaration {
|
|
7
|
+
readonly format: 'trie-1.0' | 'fst-foma-1.0' | 'custom-1.0';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
* Keyman 14.0+ word breaker specification:
|
|
12
|
+
*
|
|
13
|
+
* Can support all old word breaking specification,
|
|
14
|
+
* but can also be extended with options.
|
|
15
|
+
*
|
|
16
|
+
* @since 14.0
|
|
17
|
+
*/
|
|
18
|
+
export interface WordBreakerSpec {
|
|
19
|
+
readonly use: SimpleWordBreakerSpec;
|
|
20
|
+
/**
|
|
21
|
+
* If present, joins words that were split by the word breaker
|
|
22
|
+
* together at the given strings. e.g.,
|
|
23
|
+
*
|
|
24
|
+
* joinWordsAt: ['-'] // to keep hyphenated items together
|
|
25
|
+
*
|
|
26
|
+
* @since 14.0
|
|
27
|
+
*/
|
|
28
|
+
readonly joinWordsAt?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Overrides word splitting behaviour for certain scripts.
|
|
31
|
+
* For example, specifing that spaces break words in certain South-East
|
|
32
|
+
* Asian scripts that otherwise do not use spaces.
|
|
33
|
+
*
|
|
34
|
+
* @since 14.0
|
|
35
|
+
*/
|
|
36
|
+
readonly overrideScriptDefaults?: OverrideScriptDefaults;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
* Simplified word breaker specification.
|
|
41
|
+
*
|
|
42
|
+
* @since 11.0
|
|
43
|
+
*/
|
|
44
|
+
export type SimpleWordBreakerSpec = 'default' | 'ascii' | WordBreakingFunction;
|
|
45
|
+
/**
|
|
46
|
+
* @public
|
|
47
|
+
* Simplifies input text to facilitate finding entries within a lexical model's
|
|
48
|
+
* lexicon.
|
|
49
|
+
* @since 11.0
|
|
50
|
+
*/
|
|
51
|
+
export type SimpleWordformToKeySpec = (term: string) => string;
|
|
52
|
+
/**
|
|
53
|
+
* @public
|
|
54
|
+
* Simplifies input text to facilitate finding entries within a lexical model's
|
|
55
|
+
* lexicon, using the model's `applyCasing` function to assist in the keying process.
|
|
56
|
+
* @since 14.0
|
|
57
|
+
*/
|
|
58
|
+
export type CasedWordformToKeySpec = (term: string, applyCasing?: CasingFunction) => string;
|
|
59
|
+
/**
|
|
60
|
+
* @public
|
|
61
|
+
* Simplifies input text to facilitate finding entries within a lexical model's
|
|
62
|
+
* lexicon.
|
|
63
|
+
*/
|
|
64
|
+
export type WordformToKeySpec = SimpleWordformToKeySpec | CasedWordformToKeySpec;
|
|
65
|
+
/**
|
|
66
|
+
* Override the default word breaking behaviour for some scripts.
|
|
67
|
+
*
|
|
68
|
+
* There is currently only one option:
|
|
69
|
+
*
|
|
70
|
+
* 'break-words-at-spaces'
|
|
71
|
+
* : some South-East Asian scripts conventionally do not use space or any
|
|
72
|
+
* explicit word boundary character to write word breaks. These scripts are:
|
|
73
|
+
*
|
|
74
|
+
* * Burmese
|
|
75
|
+
* * Khmer
|
|
76
|
+
* * Thai
|
|
77
|
+
* * Laos
|
|
78
|
+
*
|
|
79
|
+
* (this list may be incomplete and extended in the future)
|
|
80
|
+
*
|
|
81
|
+
* For these scripts, the default word breaker breaks at **every**
|
|
82
|
+
* letter/syllable/ideograph. However, in languages that use these scripts BUT
|
|
83
|
+
* use spaces (or some other delimier) as word breaks, enable
|
|
84
|
+
* 'break-words-at-spaces'; enabling 'break-words-at-spaces' prevents the word
|
|
85
|
+
* breaker from making too many breaks in these scripts.
|
|
86
|
+
*
|
|
87
|
+
* @since 14.0
|
|
88
|
+
*/
|
|
89
|
+
export type OverrideScriptDefaults = 'break-words-at-spaces';
|
|
90
|
+
/**
|
|
91
|
+
* @public
|
|
92
|
+
* Base interface for a lexical model source definition
|
|
93
|
+
*/
|
|
94
|
+
export interface LexicalModelSource extends LexicalModelDeclaration {
|
|
95
|
+
readonly sources: Array<string>;
|
|
96
|
+
/**
|
|
97
|
+
* The name of the type to instantiate (without parameters) as the base object for a custom predictive model.
|
|
98
|
+
*/
|
|
99
|
+
readonly rootClass?: string;
|
|
100
|
+
/**
|
|
101
|
+
* When set to `true`, suggestions will attempt to match the case of the input text even if
|
|
102
|
+
* the lexicon entries use a different casing scheme due to search term keying effects.
|
|
103
|
+
* @since 14.0
|
|
104
|
+
*/
|
|
105
|
+
readonly languageUsesCasing?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Specifies the casing rules for a language. Should implement three casing forms:
|
|
108
|
+
* - 'lower' -- a fully-lowercased version of the text appropriate for the language's
|
|
109
|
+
* use of the writing system.
|
|
110
|
+
* - 'upper' -- a fully-uppercased version of the text
|
|
111
|
+
* - 'initial' -- a version preserving the input casing aside from the initial character,
|
|
112
|
+
* which is uppercased (like with proper nouns and sentence-initial words in English
|
|
113
|
+
* sentences.)
|
|
114
|
+
*
|
|
115
|
+
* This is only utilized if `languageUsesCasing` is defined and set to `true`.
|
|
116
|
+
* @since 14.0
|
|
117
|
+
*/
|
|
118
|
+
readonly applyCasing?: CasingFunction;
|
|
119
|
+
/**
|
|
120
|
+
* Which word breaker to use. Choose from:
|
|
121
|
+
*
|
|
122
|
+
* - 'default' -- breaks according to Unicode UAX #29 §4.1 Default Word
|
|
123
|
+
* Boundary Specification, which works well for *most* languages.
|
|
124
|
+
* - 'ascii' -- a very simple word breaker, for demonstration purposes only.
|
|
125
|
+
* - word breaking function -- provide your own function that breaks words.
|
|
126
|
+
* - class-based word-breaker - may be supported in the future.
|
|
127
|
+
*/
|
|
128
|
+
readonly wordBreaker?: WordBreakerSpec | SimpleWordBreakerSpec;
|
|
129
|
+
/**
|
|
130
|
+
* How to simplify words, to convert them into simplified search keys
|
|
131
|
+
* This often involves removing accents, lowercasing, etc.
|
|
132
|
+
*/
|
|
133
|
+
readonly searchTermToKey?: WordformToKeySpec;
|
|
134
|
+
/**
|
|
135
|
+
* Punctuation and spacing suggested by the model.
|
|
136
|
+
*
|
|
137
|
+
* @see LexicalModelPunctuation
|
|
138
|
+
*/
|
|
139
|
+
readonly punctuation?: LexicalModelPunctuation;
|
|
140
|
+
}
|
|
141
|
+
export interface LexicalModelCompiled extends LexicalModelDeclaration {
|
|
142
|
+
readonly id: string;
|
|
143
|
+
}
|
|
144
144
|
//# sourceMappingURL=lexical-model.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interfaces and constants used by the lexical model compiler. These target
|
|
3
|
-
* the LMLayer's internal worker code, so we provide those definitions too.
|
|
4
|
-
*/
|
|
5
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Interfaces and constants used by the lexical model compiler. These target
|
|
3
|
+
* the LMLayer's internal worker code, so we provide those definitions too.
|
|
4
|
+
*/
|
|
5
|
+
export {};
|
|
6
6
|
//# sourceMappingURL=lexical-model.js.map
|
package/build/src/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { LexicalModelCompiler, LexicalModelCompilerResult, LexicalModelCompilerArtifacts } from './lexical-model-compiler.js';
|
|
2
|
-
export { LexicalModelSource, WordformToKeySpec, SimpleWordformToKeySpec, CasedWordformToKeySpec, WordBreakerSpec, SimpleWordBreakerSpec, } from './lexical-model.js';
|
|
3
|
-
export { ModelCompilerMessages } from './model-compiler-messages.js';
|
|
1
|
+
export { LexicalModelCompiler, LexicalModelCompilerResult, LexicalModelCompilerArtifacts } from './lexical-model-compiler.js';
|
|
2
|
+
export { LexicalModelSource, WordformToKeySpec, SimpleWordformToKeySpec, CasedWordformToKeySpec, WordBreakerSpec, SimpleWordBreakerSpec, } from './lexical-model.js';
|
|
3
|
+
export { ModelCompilerMessages } from './model-compiler-messages.js';
|
|
4
4
|
//# sourceMappingURL=main.d.ts.map
|
package/build/src/main.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { LexicalModelCompiler } from './lexical-model-compiler.js';
|
|
2
|
-
export { ModelCompilerMessages } from './model-compiler-messages.js';
|
|
1
|
+
export { LexicalModelCompiler } from './lexical-model-compiler.js';
|
|
2
|
+
export { ModelCompilerMessages } from './model-compiler-messages.js';
|
|
3
3
|
//# sourceMappingURL=main.js.map
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { CompilerEvent } from "@keymanapp/common-types";
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export declare class ModelCompilerMessageContext {
|
|
6
|
-
static line: number;
|
|
7
|
-
static filename: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare class ModelCompilerMessages {
|
|
13
|
-
static FATAL_UnexpectedException: number;
|
|
14
|
-
static Fatal_UnexpectedException: (o: {
|
|
15
|
-
e: any;
|
|
16
|
-
}) => CompilerEvent;
|
|
17
|
-
static HINT_MixedNormalizationForms: number;
|
|
18
|
-
static Hint_MixedNormalizationForms: (o: {
|
|
19
|
-
wordform: string;
|
|
20
|
-
}) => CompilerEvent;
|
|
21
|
-
static HINT_DuplicateWordInSameFile: number;
|
|
22
|
-
static Hint_DuplicateWordInSameFile: (o: {
|
|
23
|
-
wordform: string;
|
|
24
|
-
}) => CompilerEvent;
|
|
25
|
-
static ERROR_UnimplementedModelFormat: number;
|
|
26
|
-
static Error_UnimplementedModelFormat: (o: {
|
|
27
|
-
format: string;
|
|
28
|
-
}) => CompilerEvent;
|
|
29
|
-
static ERROR_UnknownModelFormat: number;
|
|
30
|
-
static Error_UnknownModelFormat: (o: {
|
|
31
|
-
format: string;
|
|
32
|
-
}) => CompilerEvent;
|
|
33
|
-
static ERROR_NoDefaultExport: number;
|
|
34
|
-
static Error_NoDefaultExport: () => CompilerEvent;
|
|
35
|
-
static ERROR_SearchTermToKeyMustBeExplicitlySpecified: number;
|
|
36
|
-
static Error_SearchTermToKeyMustBeExplicitlySpecified: () => CompilerEvent;
|
|
37
|
-
static ERROR_UTF16BEUnsupported: number;
|
|
38
|
-
static Error_UTF16BEUnsupported: () => CompilerEvent;
|
|
39
|
-
static ERROR_UnknownWordBreaker: number;
|
|
40
|
-
static Error_UnknownWordBreaker: (o: {
|
|
41
|
-
spec: string;
|
|
42
|
-
}) => CompilerEvent;
|
|
43
|
-
static ERROR_UnsupportedScriptOverride: number;
|
|
44
|
-
static Error_UnsupportedScriptOverride: (o: {
|
|
45
|
-
option: string;
|
|
46
|
-
}) => CompilerEvent;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* A ModelCompilerError should be thrown when an unrecoverable error occurs that
|
|
50
|
-
* would block further compilation. It will be caught in the top-most compiler
|
|
51
|
-
* API endpoint and converted into a callback message.
|
|
52
|
-
*/
|
|
53
|
-
export declare class ModelCompilerError extends Error {
|
|
54
|
-
event: CompilerEvent;
|
|
55
|
-
constructor(event: CompilerEvent);
|
|
56
|
-
}
|
|
1
|
+
import { CompilerEvent } from "@keymanapp/common-types";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare class ModelCompilerMessageContext {
|
|
6
|
+
static line: number;
|
|
7
|
+
static filename: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare class ModelCompilerMessages {
|
|
13
|
+
static FATAL_UnexpectedException: number;
|
|
14
|
+
static Fatal_UnexpectedException: (o: {
|
|
15
|
+
e: any;
|
|
16
|
+
}) => CompilerEvent;
|
|
17
|
+
static HINT_MixedNormalizationForms: number;
|
|
18
|
+
static Hint_MixedNormalizationForms: (o: {
|
|
19
|
+
wordform: string;
|
|
20
|
+
}) => CompilerEvent;
|
|
21
|
+
static HINT_DuplicateWordInSameFile: number;
|
|
22
|
+
static Hint_DuplicateWordInSameFile: (o: {
|
|
23
|
+
wordform: string;
|
|
24
|
+
}) => CompilerEvent;
|
|
25
|
+
static ERROR_UnimplementedModelFormat: number;
|
|
26
|
+
static Error_UnimplementedModelFormat: (o: {
|
|
27
|
+
format: string;
|
|
28
|
+
}) => CompilerEvent;
|
|
29
|
+
static ERROR_UnknownModelFormat: number;
|
|
30
|
+
static Error_UnknownModelFormat: (o: {
|
|
31
|
+
format: string;
|
|
32
|
+
}) => CompilerEvent;
|
|
33
|
+
static ERROR_NoDefaultExport: number;
|
|
34
|
+
static Error_NoDefaultExport: () => CompilerEvent;
|
|
35
|
+
static ERROR_SearchTermToKeyMustBeExplicitlySpecified: number;
|
|
36
|
+
static Error_SearchTermToKeyMustBeExplicitlySpecified: () => CompilerEvent;
|
|
37
|
+
static ERROR_UTF16BEUnsupported: number;
|
|
38
|
+
static Error_UTF16BEUnsupported: () => CompilerEvent;
|
|
39
|
+
static ERROR_UnknownWordBreaker: number;
|
|
40
|
+
static Error_UnknownWordBreaker: (o: {
|
|
41
|
+
spec: string;
|
|
42
|
+
}) => CompilerEvent;
|
|
43
|
+
static ERROR_UnsupportedScriptOverride: number;
|
|
44
|
+
static Error_UnsupportedScriptOverride: (o: {
|
|
45
|
+
option: string;
|
|
46
|
+
}) => CompilerEvent;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A ModelCompilerError should be thrown when an unrecoverable error occurs that
|
|
50
|
+
* would block further compilation. It will be caught in the top-most compiler
|
|
51
|
+
* API endpoint and converted into a callback message.
|
|
52
|
+
*/
|
|
53
|
+
export declare class ModelCompilerError extends Error {
|
|
54
|
+
event: CompilerEvent;
|
|
55
|
+
constructor(event: CompilerEvent);
|
|
56
|
+
}
|
|
57
57
|
//# sourceMappingURL=model-compiler-messages.d.ts.map
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
|
|
2
|
-
const Namespace = CompilerErrorNamespace.ModelCompiler;
|
|
3
|
-
// const SevInfo = CompilerErrorSeverity.Info | Namespace;
|
|
4
|
-
const SevHint = CompilerErrorSeverity.Hint | Namespace;
|
|
5
|
-
// const SevWarn = CompilerErrorSeverity.Warn | Namespace;
|
|
6
|
-
const SevError = CompilerErrorSeverity.Error | Namespace;
|
|
7
|
-
const SevFatal = CompilerErrorSeverity.Fatal | Namespace;
|
|
8
|
-
const m = (code, message) => ({
|
|
9
|
-
...CompilerMessageSpec(code, message),
|
|
10
|
-
line: ModelCompilerMessageContext.line,
|
|
11
|
-
filename: ModelCompilerMessageContext.filename,
|
|
12
|
-
});
|
|
13
|
-
const m_e = (code, message, exceptionVar) => ({
|
|
14
|
-
...CompilerMessageSpecWithException(code, message, exceptionVar),
|
|
15
|
-
line: ModelCompilerMessageContext.line,
|
|
16
|
-
filename: ModelCompilerMessageContext.filename,
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export class ModelCompilerMessageContext {
|
|
22
|
-
// Context added to all messages
|
|
23
|
-
static line;
|
|
24
|
-
static filename;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
export class ModelCompilerMessages {
|
|
30
|
-
static FATAL_UnexpectedException = SevFatal | 0x0001;
|
|
31
|
-
static Fatal_UnexpectedException = (o) => m_e(this.FATAL_UnexpectedException, null, o.e ?? 'unknown error');
|
|
32
|
-
static HINT_MixedNormalizationForms = SevHint | 0x0002;
|
|
33
|
-
static Hint_MixedNormalizationForms = (o) => m(this.HINT_MixedNormalizationForms, `“${def(o.wordform)}” is not in Unicode NFC. Automatically converting to NFC.`);
|
|
34
|
-
static HINT_DuplicateWordInSameFile = SevHint | 0x0003;
|
|
35
|
-
static Hint_DuplicateWordInSameFile = (o) => m(this.HINT_DuplicateWordInSameFile, `duplicate word “${def(o.wordform)}” found in same file; summing counts`);
|
|
36
|
-
static ERROR_UnimplementedModelFormat = SevError | 0x0004;
|
|
37
|
-
static Error_UnimplementedModelFormat = (o) => m(this.ERROR_UnimplementedModelFormat, `Unimplemented model format: ${def(o.format)}`);
|
|
38
|
-
static ERROR_UnknownModelFormat = SevError | 0x0005;
|
|
39
|
-
static Error_UnknownModelFormat = (o) => m(this.ERROR_UnknownModelFormat, `Unimplemented model format: ${def(o.format)}`);
|
|
40
|
-
static ERROR_NoDefaultExport = SevError | 0x0006;
|
|
41
|
-
static Error_NoDefaultExport = () => m(this.ERROR_NoDefaultExport, `Model source does have a default export. Did you remember to write \`export default source;\`?`);
|
|
42
|
-
static ERROR_SearchTermToKeyMustBeExplicitlySpecified = SevError | 0x0007;
|
|
43
|
-
static Error_SearchTermToKeyMustBeExplicitlySpecified = () => m(this.ERROR_SearchTermToKeyMustBeExplicitlySpecified, "searchTermToKey must be explicitly specified");
|
|
44
|
-
static ERROR_UTF16BEUnsupported = SevError | 0x0008;
|
|
45
|
-
static Error_UTF16BEUnsupported = () => m(this.ERROR_UTF16BEUnsupported, 'UTF-16BE is unsupported');
|
|
46
|
-
static ERROR_UnknownWordBreaker = SevError | 0x0009;
|
|
47
|
-
static Error_UnknownWordBreaker = (o) => m(this.ERROR_UnknownWordBreaker, `Unknown word breaker: ${def(o.spec)}`);
|
|
48
|
-
static ERROR_UnsupportedScriptOverride = SevError | 0x000A;
|
|
49
|
-
static Error_UnsupportedScriptOverride = (o) => m(this.ERROR_UnsupportedScriptOverride, `Unsupported script override: ${def(o.option)}`);
|
|
50
|
-
}
|
|
51
|
-
;
|
|
52
|
-
/**
|
|
53
|
-
* A ModelCompilerError should be thrown when an unrecoverable error occurs that
|
|
54
|
-
* would block further compilation. It will be caught in the top-most compiler
|
|
55
|
-
* API endpoint and converted into a callback message.
|
|
56
|
-
*/
|
|
57
|
-
export class ModelCompilerError extends Error {
|
|
58
|
-
event;
|
|
59
|
-
constructor(event) {
|
|
60
|
-
super(event.message);
|
|
61
|
-
this.event = event;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
|
|
2
|
+
const Namespace = CompilerErrorNamespace.ModelCompiler;
|
|
3
|
+
// const SevInfo = CompilerErrorSeverity.Info | Namespace;
|
|
4
|
+
const SevHint = CompilerErrorSeverity.Hint | Namespace;
|
|
5
|
+
// const SevWarn = CompilerErrorSeverity.Warn | Namespace;
|
|
6
|
+
const SevError = CompilerErrorSeverity.Error | Namespace;
|
|
7
|
+
const SevFatal = CompilerErrorSeverity.Fatal | Namespace;
|
|
8
|
+
const m = (code, message) => ({
|
|
9
|
+
...CompilerMessageSpec(code, message),
|
|
10
|
+
line: ModelCompilerMessageContext.line,
|
|
11
|
+
filename: ModelCompilerMessageContext.filename,
|
|
12
|
+
});
|
|
13
|
+
const m_e = (code, message, exceptionVar) => ({
|
|
14
|
+
...CompilerMessageSpecWithException(code, message, exceptionVar),
|
|
15
|
+
line: ModelCompilerMessageContext.line,
|
|
16
|
+
filename: ModelCompilerMessageContext.filename,
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export class ModelCompilerMessageContext {
|
|
22
|
+
// Context added to all messages
|
|
23
|
+
static line;
|
|
24
|
+
static filename;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export class ModelCompilerMessages {
|
|
30
|
+
static FATAL_UnexpectedException = SevFatal | 0x0001;
|
|
31
|
+
static Fatal_UnexpectedException = (o) => m_e(this.FATAL_UnexpectedException, null, o.e ?? 'unknown error');
|
|
32
|
+
static HINT_MixedNormalizationForms = SevHint | 0x0002;
|
|
33
|
+
static Hint_MixedNormalizationForms = (o) => m(this.HINT_MixedNormalizationForms, `“${def(o.wordform)}” is not in Unicode NFC. Automatically converting to NFC.`);
|
|
34
|
+
static HINT_DuplicateWordInSameFile = SevHint | 0x0003;
|
|
35
|
+
static Hint_DuplicateWordInSameFile = (o) => m(this.HINT_DuplicateWordInSameFile, `duplicate word “${def(o.wordform)}” found in same file; summing counts`);
|
|
36
|
+
static ERROR_UnimplementedModelFormat = SevError | 0x0004;
|
|
37
|
+
static Error_UnimplementedModelFormat = (o) => m(this.ERROR_UnimplementedModelFormat, `Unimplemented model format: ${def(o.format)}`);
|
|
38
|
+
static ERROR_UnknownModelFormat = SevError | 0x0005;
|
|
39
|
+
static Error_UnknownModelFormat = (o) => m(this.ERROR_UnknownModelFormat, `Unimplemented model format: ${def(o.format)}`);
|
|
40
|
+
static ERROR_NoDefaultExport = SevError | 0x0006;
|
|
41
|
+
static Error_NoDefaultExport = () => m(this.ERROR_NoDefaultExport, `Model source does have a default export. Did you remember to write \`export default source;\`?`);
|
|
42
|
+
static ERROR_SearchTermToKeyMustBeExplicitlySpecified = SevError | 0x0007;
|
|
43
|
+
static Error_SearchTermToKeyMustBeExplicitlySpecified = () => m(this.ERROR_SearchTermToKeyMustBeExplicitlySpecified, "searchTermToKey must be explicitly specified");
|
|
44
|
+
static ERROR_UTF16BEUnsupported = SevError | 0x0008;
|
|
45
|
+
static Error_UTF16BEUnsupported = () => m(this.ERROR_UTF16BEUnsupported, 'UTF-16BE is unsupported');
|
|
46
|
+
static ERROR_UnknownWordBreaker = SevError | 0x0009;
|
|
47
|
+
static Error_UnknownWordBreaker = (o) => m(this.ERROR_UnknownWordBreaker, `Unknown word breaker: ${def(o.spec)}`);
|
|
48
|
+
static ERROR_UnsupportedScriptOverride = SevError | 0x000A;
|
|
49
|
+
static Error_UnsupportedScriptOverride = (o) => m(this.ERROR_UnsupportedScriptOverride, `Unsupported script override: ${def(o.option)}`);
|
|
50
|
+
}
|
|
51
|
+
;
|
|
52
|
+
/**
|
|
53
|
+
* A ModelCompilerError should be thrown when an unrecoverable error occurs that
|
|
54
|
+
* would block further compilation. It will be caught in the top-most compiler
|
|
55
|
+
* API endpoint and converted into a callback message.
|
|
56
|
+
*/
|
|
57
|
+
export class ModelCompilerError extends Error {
|
|
58
|
+
event;
|
|
59
|
+
constructor(event) {
|
|
60
|
+
super(event.message);
|
|
61
|
+
this.event = event;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
64
|
//# sourceMappingURL=model-compiler-messages.js.map
|