@keymanapp/kmc-model 17.0.154-alpha → 17.0.156-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 +42 -40
- package/build/src/build-trie.d.ts.map +1 -1
- package/build/src/build-trie.js +370 -366
- package/build/src/build-trie.js.map +1 -1
- package/build/src/compiler-callbacks.d.ts +6 -4
- package/build/src/compiler-callbacks.d.ts.map +1 -1
- package/build/src/compiler-callbacks.js +7 -5
- package/build/src/compiler-callbacks.js.map +1 -1
- package/build/src/join-word-breaker-decorator.d.ts +12 -10
- package/build/src/join-word-breaker-decorator.d.ts.map +1 -1
- package/build/src/join-word-breaker-decorator.js +123 -121
- package/build/src/join-word-breaker-decorator.js.map +1 -1
- package/build/src/lexical-model-compiler.d.ts +19 -16
- package/build/src/lexical-model-compiler.d.ts.map +1 -1
- package/build/src/lexical-model-compiler.js +153 -150
- package/build/src/lexical-model-compiler.js.map +1 -1
- package/build/src/lexical-model.d.ts +137 -135
- package/build/src/lexical-model.d.ts.map +1 -1
- package/build/src/lexical-model.js +8 -6
- package/build/src/lexical-model.js.map +1 -1
- package/build/src/main.d.ts +19 -17
- package/build/src/main.d.ts.map +1 -1
- package/build/src/main.js +60 -60
- package/build/src/main.js.map +1 -1
- package/build/src/model-compiler-errors.d.ts +53 -51
- package/build/src/model-compiler-errors.d.ts.map +1 -1
- package/build/src/model-compiler-errors.js +58 -56
- package/build/src/model-compiler-errors.js.map +1 -1
- package/build/src/model-defaults.d.ts +58 -56
- package/build/src/model-defaults.d.ts.map +1 -1
- package/build/src/model-defaults.js +108 -106
- package/build/src/model-defaults.js.map +1 -1
- package/build/src/model-definitions.d.ts +73 -71
- package/build/src/model-definitions.d.ts.map +1 -1
- package/build/src/model-definitions.js +191 -189
- package/build/src/model-definitions.js.map +1 -1
- package/build/src/script-overrides-decorator.d.ts +6 -4
- package/build/src/script-overrides-decorator.d.ts.map +1 -1
- package/build/src/script-overrides-decorator.js +66 -64
- package/build/src/script-overrides-decorator.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="db833885-8485-590d-8312-b220c28096e9")}catch(e){}}();
|
|
2
|
+
/**
|
|
3
|
+
* Interfaces and constants used by the lexical model compiler. These target
|
|
4
|
+
* the LMLayer's internal worker code, so we provide those definitions too.
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
//# debugId=db833885-8485-590d-8312-b220c28096e9
|
|
8
|
+
//# sourceMappingURL=lexical-model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"db833885-8485-590d-8312-b220c28096e9","file":"lexical-model.js","mappings":";AAAA;;;GAGG","names":[],"sourceRoot":"","sources":["../../src/lexical-model.ts"],"version":3}
|
package/build/src/main.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="914ad039-c717-5956-b13a-c57d240219d0")}catch(e){}}();
|
|
2
|
+
import { CompilerCallbacks } from '@keymanapp/common-types';
|
|
3
|
+
import { LexicalModelSource } from './lexical-model.js';
|
|
4
|
+
export { default as LexicalModelCompiler } from './lexical-model-compiler.js';
|
|
5
|
+
/**
|
|
6
|
+
* Compiles a model.ts file, using paths relative to its location.
|
|
7
|
+
*
|
|
8
|
+
* @param filename path to model.ts source.
|
|
9
|
+
* @return model source code, or null on error
|
|
10
|
+
*/
|
|
11
|
+
export declare function compileModel(filename: string, callbacks: CompilerCallbacks): string;
|
|
12
|
+
/**
|
|
13
|
+
* Loads a lexical model's source module from the given filename.
|
|
14
|
+
*
|
|
15
|
+
* @param filename path to the model source file.
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadFromFilename(filename: string, callbacks: CompilerCallbacks): LexicalModelSource;
|
|
18
|
+
//# debugId=914ad039-c717-5956-b13a-c57d240219d0
|
|
19
|
+
//# sourceMappingURL=main.d.ts.map
|
package/build/src/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"914ad039-c717-5956-b13a-c57d240219d0","file":"main.d.ts","mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAE9E;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,MAAM,CAiBnF;AAWD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,kBAAkB,CA6BnG","names":[],"sourceRoot":"","sources":["../../src/main.ts"],"version":3}
|
package/build/src/main.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let
|
|
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
|
-
let
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
//# sourceMappingURL=main.js.map
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f09f4d7a-0757-5697-8d03-cea9f4438922")}catch(e){}}();
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import { setCompilerCallbacks } from './compiler-callbacks.js';
|
|
4
|
+
import LexicalModelCompiler from './lexical-model-compiler.js';
|
|
5
|
+
import { ModelCompilerError, ModelCompilerMessageContext, ModelCompilerMessages } from './model-compiler-errors.js';
|
|
6
|
+
export { default as LexicalModelCompiler } from './lexical-model-compiler.js';
|
|
7
|
+
/**
|
|
8
|
+
* Compiles a model.ts file, using paths relative to its location.
|
|
9
|
+
*
|
|
10
|
+
* @param filename path to model.ts source.
|
|
11
|
+
* @return model source code, or null on error
|
|
12
|
+
*/
|
|
13
|
+
export function compileModel(filename, callbacks) {
|
|
14
|
+
setCompilerCallbacks(callbacks);
|
|
15
|
+
try {
|
|
16
|
+
let modelSource = loadFromFilename(filename, callbacks);
|
|
17
|
+
let containingDirectory = callbacks.path.dirname(filename);
|
|
18
|
+
return (new LexicalModelCompiler(callbacks))
|
|
19
|
+
.generateLexicalModelCode('<unknown>', modelSource, containingDirectory);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
callbacks.reportMessage(e instanceof ModelCompilerError
|
|
23
|
+
? e.event
|
|
24
|
+
: ModelCompilerMessages.Fatal_UnexpectedException({ e: e }));
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Loads a lexical model's source module from the given filename.
|
|
30
|
+
*
|
|
31
|
+
* @param filename path to the model source file.
|
|
32
|
+
*/
|
|
33
|
+
export function loadFromFilename(filename, callbacks) {
|
|
34
|
+
setCompilerCallbacks(callbacks);
|
|
35
|
+
let sourceCode = new TextDecoder().decode(callbacks.loadFile(filename));
|
|
36
|
+
// Compile the module to JavaScript code.
|
|
37
|
+
// NOTE: transpile module does a very simple TS to JS compilation.
|
|
38
|
+
// It DOES NOT check for types!
|
|
39
|
+
let compilationOutput = ts.transpile(sourceCode, {
|
|
40
|
+
// Our runtime only supports ES3 with Node/CommonJS modules on Android 5.0.
|
|
41
|
+
// When we drop Android 5.0 support, we can update this to a `ScriptTarget`
|
|
42
|
+
// matrix against target version of Keyman, here and in
|
|
43
|
+
// lexical-model-compiler.ts.
|
|
44
|
+
target: ts.ScriptTarget.ES3,
|
|
45
|
+
module: ts.ModuleKind.CommonJS,
|
|
46
|
+
});
|
|
47
|
+
// Turn the module into a function in which we can inject a global.
|
|
48
|
+
let moduleCode = '(function(exports){' + compilationOutput + '})';
|
|
49
|
+
// Run the module; its exports will be assigned to `moduleExports`.
|
|
50
|
+
let moduleExports = {};
|
|
51
|
+
let module = eval(moduleCode);
|
|
52
|
+
module(moduleExports);
|
|
53
|
+
if (!moduleExports['__esModule'] || !moduleExports['default']) {
|
|
54
|
+
ModelCompilerMessageContext.filename = filename;
|
|
55
|
+
throw new ModelCompilerError(ModelCompilerMessages.Error_NoDefaultExport());
|
|
56
|
+
}
|
|
57
|
+
return moduleExports['default'];
|
|
58
|
+
}
|
|
59
|
+
//# debugId=f09f4d7a-0757-5697-8d03-cea9f4438922
|
|
60
|
+
//# sourceMappingURL=main.js.map
|
package/build/src/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"f09f4d7a-0757-5697-8d03-cea9f4438922","file":"main.js","mappings":";AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEpH,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,SAA4B;IACzE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAEhC,IAAI;QACF,IAAI,WAAW,GAAG,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QACxD,IAAI,mBAAmB,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAE3D,OAAO,CAAC,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC;aACzC,wBAAwB,CAAC,WAAW,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC;KAC5E;IAAC,OAAM,CAAC,EAAE;QACT,SAAS,CAAC,aAAa,CACrB,CAAC,YAAY,kBAAkB;YAC/B,CAAC,CAAC,CAAC,CAAC,KAAK;YACT,CAAC,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,EA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
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
static
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
static
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
static
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
static
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
static
|
|
28
|
-
static
|
|
29
|
-
static
|
|
30
|
-
static
|
|
31
|
-
static
|
|
32
|
-
static
|
|
33
|
-
static
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
static
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="977901cb-6088-5760-bf53-f91484492baa")}catch(e){}}();
|
|
2
|
+
import { CompilerEvent } from "@keymanapp/common-types";
|
|
3
|
+
export declare class ModelCompilerMessageContext {
|
|
4
|
+
static line: number;
|
|
5
|
+
static filename: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class ModelCompilerMessages {
|
|
8
|
+
static Fatal_UnexpectedException: (o: {
|
|
9
|
+
e: any;
|
|
10
|
+
}) => CompilerEvent;
|
|
11
|
+
static FATAL_UnexpectedException: number;
|
|
12
|
+
static Warn_MixedNormalizationForms: (o: {
|
|
13
|
+
wordform: string;
|
|
14
|
+
}) => CompilerEvent;
|
|
15
|
+
static WARN_MixedNormalizationForms: number;
|
|
16
|
+
static Warn_DuplicateWordInSameFile: (o: {
|
|
17
|
+
wordform: string;
|
|
18
|
+
}) => CompilerEvent;
|
|
19
|
+
static WARN_DuplicateWordInSameFile: number;
|
|
20
|
+
static Error_UnimplementedModelFormat: (o: {
|
|
21
|
+
format: string;
|
|
22
|
+
}) => CompilerEvent;
|
|
23
|
+
static ERROR_UnimplementedModelFormat: number;
|
|
24
|
+
static Error_UnknownModelFormat: (o: {
|
|
25
|
+
format: string;
|
|
26
|
+
}) => CompilerEvent;
|
|
27
|
+
static ERROR_UnknownModelFormat: number;
|
|
28
|
+
static Error_NoDefaultExport: () => CompilerEvent;
|
|
29
|
+
static ERROR_NoDefaultExport: number;
|
|
30
|
+
static Error_SearchTermToKeyMustBeExplicitlySpecified: () => CompilerEvent;
|
|
31
|
+
static ERROR_SearchTermToKeyMustBeExplicitlySpecified: number;
|
|
32
|
+
static Error_UTF16BEUnsupported: () => CompilerEvent;
|
|
33
|
+
static ERROR_UTF16BEUnsupported: number;
|
|
34
|
+
static Error_UnknownWordBreaker: (o: {
|
|
35
|
+
spec: string;
|
|
36
|
+
}) => CompilerEvent;
|
|
37
|
+
static ERROR_UnknownWordBreaker: number;
|
|
38
|
+
static Error_UnsupportedScriptOverride: (o: {
|
|
39
|
+
option: string;
|
|
40
|
+
}) => CompilerEvent;
|
|
41
|
+
static ERROR_UnsupportedScriptOverride: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A ModelCompilerError should be thrown when an unrecoverable error occurs that
|
|
45
|
+
* would block further compilation. It will be caught in the top-most compiler
|
|
46
|
+
* API endpoint and converted into a callback message.
|
|
47
|
+
*/
|
|
48
|
+
export declare class ModelCompilerError extends Error {
|
|
49
|
+
event: CompilerEvent;
|
|
50
|
+
constructor(event: CompilerEvent);
|
|
51
|
+
}
|
|
52
|
+
//# debugId=977901cb-6088-5760-bf53-f91484492baa
|
|
53
|
+
//# sourceMappingURL=model-compiler-errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"977901cb-6088-5760-bf53-f91484492baa","file":"model-compiler-errors.d.ts","mappings":";A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AAK,EAAE,aAAa;gBAApB,KAAK,EAAE,aAAa;CAGxC","names":[],"sourceRoot":"","sources":["../../src/model-compiler-errors.ts"],"version":3}
|
|
@@ -1,56 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
static
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
static
|
|
24
|
-
static
|
|
25
|
-
static
|
|
26
|
-
static
|
|
27
|
-
static
|
|
28
|
-
static
|
|
29
|
-
static
|
|
30
|
-
static
|
|
31
|
-
static
|
|
32
|
-
static
|
|
33
|
-
static
|
|
34
|
-
static
|
|
35
|
-
static
|
|
36
|
-
static
|
|
37
|
-
static
|
|
38
|
-
static
|
|
39
|
-
static
|
|
40
|
-
static
|
|
41
|
-
static
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="910855f3-2bac-5390-9243-33e9f0f90956")}catch(e){}}();
|
|
2
|
+
import { CompilerErrorNamespace, CompilerErrorSeverity } from "@keymanapp/common-types";
|
|
3
|
+
const Namespace = CompilerErrorNamespace.ModelCompiler;
|
|
4
|
+
// const SevInfo = CompilerErrorSeverity.Info | Namespace;
|
|
5
|
+
// const SevHint = CompilerErrorSeverity.Hint | Namespace;
|
|
6
|
+
const SevWarn = CompilerErrorSeverity.Warn | Namespace;
|
|
7
|
+
const SevError = CompilerErrorSeverity.Error | Namespace;
|
|
8
|
+
const SevFatal = CompilerErrorSeverity.Fatal | Namespace;
|
|
9
|
+
const m = (code, message) => {
|
|
10
|
+
return {
|
|
11
|
+
line: ModelCompilerMessageContext.line,
|
|
12
|
+
filename: ModelCompilerMessageContext.filename,
|
|
13
|
+
code,
|
|
14
|
+
message
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export class ModelCompilerMessageContext {
|
|
18
|
+
// Context added to all messages
|
|
19
|
+
static line;
|
|
20
|
+
static filename;
|
|
21
|
+
}
|
|
22
|
+
export class ModelCompilerMessages {
|
|
23
|
+
static Fatal_UnexpectedException = (o) => m(this.FATAL_UnexpectedException, `Unexpected exception: ${(o.e ?? 'unknown error').toString()}\n\nCall stack:\n${(o.e instanceof Error ? o.e.stack : (new Error()).stack)}`);
|
|
24
|
+
static FATAL_UnexpectedException = SevFatal | 0x0001;
|
|
25
|
+
static Warn_MixedNormalizationForms = (o) => m(this.WARN_MixedNormalizationForms, `“${o.wordform}” is not in Unicode NFC. Automatically converting to NFC.`);
|
|
26
|
+
static WARN_MixedNormalizationForms = SevWarn | 0x0002;
|
|
27
|
+
static Warn_DuplicateWordInSameFile = (o) => m(this.WARN_DuplicateWordInSameFile, `duplicate word “${o.wordform}” found in same file; summing counts`);
|
|
28
|
+
static WARN_DuplicateWordInSameFile = SevWarn | 0x0003;
|
|
29
|
+
static Error_UnimplementedModelFormat = (o) => m(this.ERROR_UnimplementedModelFormat, `Unimplemented model format: ${o.format}`);
|
|
30
|
+
static ERROR_UnimplementedModelFormat = SevError | 0x0004;
|
|
31
|
+
static Error_UnknownModelFormat = (o) => m(this.ERROR_UnknownModelFormat, `Unimplemented model format: ${o.format}`);
|
|
32
|
+
static ERROR_UnknownModelFormat = SevError | 0x0005;
|
|
33
|
+
static Error_NoDefaultExport = () => m(this.ERROR_NoDefaultExport, `Model source does have a default export. Did you remember to write \`export default source;\`?`);
|
|
34
|
+
static ERROR_NoDefaultExport = SevError | 0x0006;
|
|
35
|
+
static Error_SearchTermToKeyMustBeExplicitlySpecified = () => m(this.ERROR_SearchTermToKeyMustBeExplicitlySpecified, "searchTermToKey must be explicitly specified");
|
|
36
|
+
static ERROR_SearchTermToKeyMustBeExplicitlySpecified = SevError | 0x0007;
|
|
37
|
+
static Error_UTF16BEUnsupported = () => m(this.ERROR_UTF16BEUnsupported, 'UTF-16BE is unsupported');
|
|
38
|
+
static ERROR_UTF16BEUnsupported = SevError | 0x0008;
|
|
39
|
+
static Error_UnknownWordBreaker = (o) => m(this.ERROR_UnknownWordBreaker, `Unknown word breaker: ${o.spec}`);
|
|
40
|
+
static ERROR_UnknownWordBreaker = SevError | 0x0009;
|
|
41
|
+
static Error_UnsupportedScriptOverride = (o) => m(this.ERROR_UnsupportedScriptOverride, `Unsupported script override: ${o.option}`);
|
|
42
|
+
static ERROR_UnsupportedScriptOverride = SevError | 0x000A;
|
|
43
|
+
}
|
|
44
|
+
;
|
|
45
|
+
/**
|
|
46
|
+
* A ModelCompilerError should be thrown when an unrecoverable error occurs that
|
|
47
|
+
* would block further compilation. It will be caught in the top-most compiler
|
|
48
|
+
* API endpoint and converted into a callback message.
|
|
49
|
+
*/
|
|
50
|
+
export class ModelCompilerError extends Error {
|
|
51
|
+
event;
|
|
52
|
+
constructor(event) {
|
|
53
|
+
super(event.message);
|
|
54
|
+
this.event = event;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# debugId=910855f3-2bac-5390-9243-33e9f0f90956
|
|
58
|
+
//# sourceMappingURL=model-compiler-errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"910855f3-2bac-5390-9243-33e9f0f90956","file":"model-compiler-errors.js","mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAiB,MAAM,yBAAyB,CAAC;AAEvG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AAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACrC,MAAM,CAAC,wBAAwB,GAAG,QAAQ,GAAG,MAAM,CAAC;IAEpD,MAAM,CAAC,+BAA+B,GAAG,CAAC,CAAiB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,+BAA+B,EACpG,gCAAgC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9C,MAAM,CAAC,+BAA+B,GAAG,QAAQ,GAAG,MAAM,CAAC;;AAC5D,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACxB;IAAnB,YAAmB,KAAoB;QACrC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QADJ,UAAK,GAAL,KAAK,CAAe;IAEvC,CAAC;CACF","names":[],"sourceRoot":"","sources":["../../src/model-compiler-errors.ts"],"version":3}
|
|
@@ -1,56 +1,58 @@
|
|
|
1
|
-
/// <reference types="@keymanapp/models-types" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* language
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* language
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
/// <reference types="@keymanapp/models-types" />
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9a5871e0-b721-5738-8625-272cb6f5e965")}catch(e){}}();
|
|
3
|
+
/**
|
|
4
|
+
* Converts wordforms into an indexable form. It does this by
|
|
5
|
+
* normalizing the letter case of characters INDIVIDUALLY (to disregard
|
|
6
|
+
* context-sensitive case transformations), normalizing to NFKD form,
|
|
7
|
+
* and removing common diacritical marks.
|
|
8
|
+
*
|
|
9
|
+
* This is a very speculative implementation, that might work with
|
|
10
|
+
* your language. We don't guarantee that this will be perfect for your
|
|
11
|
+
* language, but it's a start.
|
|
12
|
+
*
|
|
13
|
+
* This uses String.prototype.normalize() to convert normalize into NFKD.
|
|
14
|
+
* NFKD neutralizes some funky distinctions, e.g., ꬲ, e, e should all be the
|
|
15
|
+
* same character; plus, it's an easy way to separate a Latin character from
|
|
16
|
+
* its diacritics; Even then, orthographies regularly use code points
|
|
17
|
+
* that, under NFKD normalization, do NOT decompose appropriately for your
|
|
18
|
+
* language (e.g., SENĆOŦEN, Plains Cree in syllabics).
|
|
19
|
+
*
|
|
20
|
+
* Use this in early iterations of the model. For a production lexical model,
|
|
21
|
+
* you will probably write/generate your own key function, tailored to your
|
|
22
|
+
* language. There is a chance the default will work properly out of the box.
|
|
23
|
+
*/
|
|
24
|
+
export declare function defaultSearchTermToKey(wordform: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Converts wordforms into an indexable form. It does this by
|
|
27
|
+
* normalizing the letter case of characters INDIVIDUALLY (to disregard
|
|
28
|
+
* context-sensitive case transformations), normalizing to NFKD form,
|
|
29
|
+
* and removing common diacritical marks.
|
|
30
|
+
*
|
|
31
|
+
* This is a very speculative implementation, that might work with
|
|
32
|
+
* your language. We don't guarantee that this will be perfect for your
|
|
33
|
+
* language, but it's a start.
|
|
34
|
+
*
|
|
35
|
+
* This uses String.prototype.normalize() to convert normalize into NFKD.
|
|
36
|
+
* NFKD neutralizes some funky distinctions, e.g., ꬲ, e, e should all be the
|
|
37
|
+
* same character; plus, it's an easy way to separate a Latin character from
|
|
38
|
+
* its diacritics; Even then, orthographies regularly use code points
|
|
39
|
+
* that, under NFKD normalization, do NOT decompose appropriately for your
|
|
40
|
+
* language (e.g., SENĆOŦEN, Plains Cree in syllabics).
|
|
41
|
+
*
|
|
42
|
+
* Use this in early iterations of the model. For a production lexical model,
|
|
43
|
+
* you will probably write/generate your own key function, tailored to your
|
|
44
|
+
* language. There is a chance the default will work properly out of the box.
|
|
45
|
+
*/
|
|
46
|
+
export declare function defaultCasedSearchTermToKey(wordform: string, applyCasing: CasingFunction): string;
|
|
47
|
+
/**
|
|
48
|
+
* Specifies default casing behavior for lexical models when `languageUsesCasing` is
|
|
49
|
+
* set to true.
|
|
50
|
+
* @param casing One of 'lower' (lowercased), 'upper' (uppercased), or 'initial'.
|
|
51
|
+
*
|
|
52
|
+
* 'initial' is designed to cover cases like sentence-initial & proper noun capitalization in English.
|
|
53
|
+
* This may be overwritten as appropriate in model-specific implementations.
|
|
54
|
+
* @param text The text to be modified.
|
|
55
|
+
*/
|
|
56
|
+
export declare function defaultApplyCasing(casing: CasingForm, text: string): string;
|
|
57
|
+
//# debugId=9a5871e0-b721-5738-8625-272cb6f5e965
|
|
58
|
+
//# sourceMappingURL=model-defaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"9a5871e0-b721-5738-8625-272cb6f5e965","file":"model-defaults.d.ts","mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAW/D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,GAAG,MAAM,CAiBjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA2B3E","names":[],"sourceRoot":"","sources":["../../src/model-defaults.ts"],"version":3}
|