@keymanapp/kmc-model 18.0.16-alpha → 18.0.18-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.js +377 -376
- package/build/src/build-trie.js.map +1 -1
- package/build/src/compiler-callbacks.js +7 -6
- package/build/src/compiler-callbacks.js.map +1 -1
- package/build/src/join-word-breaker-decorator.js +123 -122
- package/build/src/join-word-breaker-decorator.js.map +1 -1
- package/build/src/lexical-model-compiler.js +263 -262
- package/build/src/lexical-model-compiler.js.map +1 -1
- package/build/src/lexical-model.js +8 -7
- package/build/src/lexical-model.js.map +1 -1
- package/build/src/main.js +5 -4
- package/build/src/main.js.map +1 -1
- package/build/src/model-compiler-messages.js +66 -65
- package/build/src/model-compiler-messages.js.map +1 -1
- package/build/src/model-defaults.js +104 -103
- package/build/src/model-defaults.js.map +1 -1
- package/build/src/model-definitions.js +191 -190
- package/build/src/model-definitions.js.map +1 -1
- package/build/src/script-overrides-decorator.js +66 -65
- package/build/src/script-overrides-decorator.js.map +1 -1
- package/package.json +6 -5
|
@@ -1,66 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
static
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
static
|
|
33
|
-
static
|
|
34
|
-
static
|
|
35
|
-
static
|
|
36
|
-
static
|
|
37
|
-
static
|
|
38
|
-
static
|
|
39
|
-
static
|
|
40
|
-
static
|
|
41
|
-
static
|
|
42
|
-
static
|
|
43
|
-
static
|
|
44
|
-
static
|
|
45
|
-
static
|
|
46
|
-
static
|
|
47
|
-
static
|
|
48
|
-
static
|
|
49
|
-
static
|
|
50
|
-
static
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
1
|
+
|
|
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]="01ca3db7-cbc6-516d-9c09-2fd9d1e8ca5d")}catch(e){}}();
|
|
3
|
+
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
|
|
4
|
+
const Namespace = CompilerErrorNamespace.ModelCompiler;
|
|
5
|
+
// const SevInfo = CompilerErrorSeverity.Info | Namespace;
|
|
6
|
+
const SevHint = CompilerErrorSeverity.Hint | Namespace;
|
|
7
|
+
// const SevWarn = CompilerErrorSeverity.Warn | Namespace;
|
|
8
|
+
const SevError = CompilerErrorSeverity.Error | Namespace;
|
|
9
|
+
const SevFatal = CompilerErrorSeverity.Fatal | Namespace;
|
|
10
|
+
const m = (code, message) => ({
|
|
11
|
+
...CompilerMessageSpec(code, message),
|
|
12
|
+
line: ModelCompilerMessageContext.line,
|
|
13
|
+
filename: ModelCompilerMessageContext.filename,
|
|
14
|
+
});
|
|
15
|
+
const m_e = (code, message, exceptionVar) => ({
|
|
16
|
+
...CompilerMessageSpecWithException(code, message, exceptionVar),
|
|
17
|
+
line: ModelCompilerMessageContext.line,
|
|
18
|
+
filename: ModelCompilerMessageContext.filename,
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export class ModelCompilerMessageContext {
|
|
24
|
+
// Context added to all messages
|
|
25
|
+
static line;
|
|
26
|
+
static filename;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export class ModelCompilerMessages {
|
|
32
|
+
static FATAL_UnexpectedException = SevFatal | 0x0001;
|
|
33
|
+
static Fatal_UnexpectedException = (o) => m_e(this.FATAL_UnexpectedException, null, o.e ?? 'unknown error');
|
|
34
|
+
static HINT_MixedNormalizationForms = SevHint | 0x0002;
|
|
35
|
+
static Hint_MixedNormalizationForms = (o) => m(this.HINT_MixedNormalizationForms, `“${def(o.wordform)}” is not in Unicode NFC. Automatically converting to NFC.`);
|
|
36
|
+
static HINT_DuplicateWordInSameFile = SevHint | 0x0003;
|
|
37
|
+
static Hint_DuplicateWordInSameFile = (o) => m(this.HINT_DuplicateWordInSameFile, `duplicate word “${def(o.wordform)}” found in same file; summing counts`);
|
|
38
|
+
static ERROR_UnimplementedModelFormat = SevError | 0x0004;
|
|
39
|
+
static Error_UnimplementedModelFormat = (o) => m(this.ERROR_UnimplementedModelFormat, `Unimplemented model format: ${def(o.format)}`);
|
|
40
|
+
static ERROR_UnknownModelFormat = SevError | 0x0005;
|
|
41
|
+
static Error_UnknownModelFormat = (o) => m(this.ERROR_UnknownModelFormat, `Unimplemented model format: ${def(o.format)}`);
|
|
42
|
+
static ERROR_NoDefaultExport = SevError | 0x0006;
|
|
43
|
+
static Error_NoDefaultExport = () => m(this.ERROR_NoDefaultExport, `Model source does have a default export. Did you remember to write \`export default source;\`?`);
|
|
44
|
+
static ERROR_SearchTermToKeyMustBeExplicitlySpecified = SevError | 0x0007;
|
|
45
|
+
static Error_SearchTermToKeyMustBeExplicitlySpecified = () => m(this.ERROR_SearchTermToKeyMustBeExplicitlySpecified, "searchTermToKey must be explicitly specified");
|
|
46
|
+
static ERROR_UTF16BEUnsupported = SevError | 0x0008;
|
|
47
|
+
static Error_UTF16BEUnsupported = () => m(this.ERROR_UTF16BEUnsupported, 'UTF-16BE is unsupported');
|
|
48
|
+
static ERROR_UnknownWordBreaker = SevError | 0x0009;
|
|
49
|
+
static Error_UnknownWordBreaker = (o) => m(this.ERROR_UnknownWordBreaker, `Unknown word breaker: ${def(o.spec)}`);
|
|
50
|
+
static ERROR_UnsupportedScriptOverride = SevError | 0x000A;
|
|
51
|
+
static Error_UnsupportedScriptOverride = (o) => m(this.ERROR_UnsupportedScriptOverride, `Unsupported script override: ${def(o.option)}`);
|
|
52
|
+
}
|
|
53
|
+
;
|
|
54
|
+
/**
|
|
55
|
+
* A ModelCompilerError should be thrown when an unrecoverable error occurs that
|
|
56
|
+
* would block further compilation. It will be caught in the top-most compiler
|
|
57
|
+
* API endpoint and converted into a callback message.
|
|
58
|
+
*/
|
|
59
|
+
export class ModelCompilerError extends Error {
|
|
60
|
+
event;
|
|
61
|
+
constructor(event) {
|
|
62
|
+
super(event.message);
|
|
63
|
+
this.event = event;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
66
|
//# sourceMappingURL=model-compiler-messages.js.map
|
|
67
|
+
//# debugId=01ca3db7-cbc6-516d-9c09-2fd9d1e8ca5d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"version":3,"file":"model-compiler-messages.js","sources":["../../src/model-compiler-messages.ts"],"sourceRoot":"","names":[],"mappings":";;AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAiB,mBAAmB,EAAE,kBAAkB,IAAI,GAAG,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAEzL,MAAM,SAAS,GAAG,sBAAsB,CAAC,aAAa,CAAC;AACvD,0DAA0D;AAC1D,MAAM,OAAO,GAAG,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC;AACvD,0DAA0D;AAC1D,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,GAAG,SAAS,CAAC;AACzD,MA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-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Converts wordforms into an indexable form. It does this by
|
|
3
|
+
* normalizing the letter case of characters INDIVIDUALLY (to disregard
|
|
4
|
+
* context-sensitive case transformations), normalizing to NFKD form,
|
|
5
|
+
* and removing common diacritical marks.
|
|
6
|
+
*
|
|
7
|
+
* This is a very speculative implementation, that might work with
|
|
8
|
+
* your language. We don't guarantee that this will be perfect for your
|
|
9
|
+
* language, but it's a start.
|
|
10
|
+
*
|
|
11
|
+
* This uses String.prototype.normalize() to convert normalize into NFKD.
|
|
12
|
+
* NFKD neutralizes some funky distinctions, e.g., ꬲ, e, e should all be the
|
|
13
|
+
* same character; plus, it's an easy way to separate a Latin character from
|
|
14
|
+
* its diacritics; Even then, orthographies regularly use code points
|
|
15
|
+
* that, under NFKD normalization, do NOT decompose appropriately for your
|
|
16
|
+
* language (e.g., SENĆOŦEN, Plains Cree in syllabics).
|
|
17
|
+
*
|
|
18
|
+
* Use this in early iterations of the model. For a production lexical model,
|
|
19
|
+
* you will probably write/generate your own key function, tailored to your
|
|
20
|
+
* language. There is a chance the default will work properly out of the box.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
!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]="85495a1e-2cde-5517-addc-9128a8efdae6")}catch(e){}}();
|
|
24
|
+
export function defaultSearchTermToKey(wordform) {
|
|
25
|
+
return wordform
|
|
26
|
+
.normalize('NFKD')
|
|
27
|
+
// Remove any combining diacritics (if input is in NFKD)
|
|
28
|
+
.replace(/[\u0300-\u036F]/g, '')
|
|
29
|
+
// Replace directional quotation marks with plain apostrophes
|
|
30
|
+
.replace(/[‘’]/g, "'")
|
|
31
|
+
// Also double-quote marks.
|
|
32
|
+
.replace(/[“”]/g, '"');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Converts wordforms into an indexable form. It does this by
|
|
36
|
+
* normalizing the letter case of characters INDIVIDUALLY (to disregard
|
|
37
|
+
* context-sensitive case transformations), normalizing to NFKD form,
|
|
38
|
+
* and removing common diacritical marks.
|
|
39
|
+
*
|
|
40
|
+
* This is a very speculative implementation, that might work with
|
|
41
|
+
* your language. We don't guarantee that this will be perfect for your
|
|
42
|
+
* language, but it's a start.
|
|
43
|
+
*
|
|
44
|
+
* This uses String.prototype.normalize() to convert normalize into NFKD.
|
|
45
|
+
* NFKD neutralizes some funky distinctions, e.g., ꬲ, e, e should all be the
|
|
46
|
+
* same character; plus, it's an easy way to separate a Latin character from
|
|
47
|
+
* its diacritics; Even then, orthographies regularly use code points
|
|
48
|
+
* that, under NFKD normalization, do NOT decompose appropriately for your
|
|
49
|
+
* language (e.g., SENĆOŦEN, Plains Cree in syllabics).
|
|
50
|
+
*
|
|
51
|
+
* Use this in early iterations of the model. For a production lexical model,
|
|
52
|
+
* you will probably write/generate your own key function, tailored to your
|
|
53
|
+
* language. There is a chance the default will work properly out of the box.
|
|
54
|
+
*/
|
|
55
|
+
export function defaultCasedSearchTermToKey(wordform, applyCasing) {
|
|
56
|
+
// While this is a bit WET, as the basic `defaultSearchTermToKey` exists and performs some of
|
|
57
|
+
// the same functions, repetition is the easiest way to allow the function to be safely compiled
|
|
58
|
+
// with ease by use of `.toString()`.
|
|
59
|
+
return Array.from(wordform
|
|
60
|
+
.normalize('NFKD')
|
|
61
|
+
// Remove any combining diacritics (if input is in NFKD)
|
|
62
|
+
.replace(/[\u0300-\u036F]/g, '')) // end of `Array.from`
|
|
63
|
+
.map(function (c) { return applyCasing('lower', c); })
|
|
64
|
+
.join('')
|
|
65
|
+
// Replace directional quotation marks with plain apostrophes
|
|
66
|
+
.replace(/[‘’]/g, "'")
|
|
67
|
+
// Also double-quote marks.
|
|
68
|
+
.replace(/[“”]/g, '"');
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Specifies default casing behavior for lexical models when `languageUsesCasing` is
|
|
72
|
+
* set to true.
|
|
73
|
+
* @param casing One of 'lower' (lowercased), 'upper' (uppercased), or 'initial'.
|
|
74
|
+
*
|
|
75
|
+
* 'initial' is designed to cover cases like sentence-initial & proper noun capitalization in English.
|
|
76
|
+
* This may be overwritten as appropriate in model-specific implementations.
|
|
77
|
+
* @param text The text to be modified.
|
|
78
|
+
*/
|
|
79
|
+
export function defaultApplyCasing(casing, text) {
|
|
80
|
+
switch (casing) {
|
|
81
|
+
case 'lower':
|
|
82
|
+
return text.toLowerCase();
|
|
83
|
+
case 'upper':
|
|
84
|
+
return text.toUpperCase();
|
|
85
|
+
case 'initial':
|
|
86
|
+
var headCode = text.charCodeAt(0);
|
|
87
|
+
// The length of the first code unit, as measured in code points.
|
|
88
|
+
var headUnitLength = 1;
|
|
89
|
+
// Is the first character a high surrogate, indicating possible use of UTF-16
|
|
90
|
+
// surrogate pairs? Also, is the string long enough for there to BE a pair?
|
|
91
|
+
if (text.length > 1 && headCode >= 0xD800 && headCode <= 0xDBFF) {
|
|
92
|
+
// It's possible, so now we check for low surrogates.
|
|
93
|
+
var lowSurrogateCode = text.charCodeAt(1);
|
|
94
|
+
if (lowSurrogateCode >= 0xDC00 && lowSurrogateCode <= 0xDFFF) {
|
|
95
|
+
// We have a surrogate pair; this pair is the 'first' character.
|
|
96
|
+
headUnitLength++;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Capitalizes the first code unit of the string, leaving the rest intact.
|
|
100
|
+
return text.substring(0, headUnitLength).toUpperCase() // head - uppercased
|
|
101
|
+
.concat(text.substring(headUnitLength)); // tail - lowercased
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
104
|
//# sourceMappingURL=model-defaults.js.map
|
|
105
|
+
//# debugId=85495a1e-2cde-5517-addc-9128a8efdae6
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"version":3,"file":"model-defaults.js","sources":["../../src/model-defaults.ts"],"sourceRoot":"","names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAgB;IACrD,OAAO,QAAQ;SACV,SAAS,CAAC,MAAM,CAAC;QAClB,wDAAwD;SACvD,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAChC,6DAA6D;SAC5D,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;QACtB,2BAA2B;SAC1B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,2BAA2B,CAAC,QAAgB,EAAE,WAA2B;IACvF,6FAA6F;IAC7F,gGAAgG;IAChG,qCAAqC;IACrC,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ;SACnB,SAAS,CAAC,MAAM,CAAC;QAClB,wDAAwD;SACvD,OAAO,CAAC,kBAAkB,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