@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-trie.js","sourceRoot":"","sources":["../../src/build-trie.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACtH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,wCAAwC;AACxC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAW1C;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAmB,EAAE,eAAwC;IACnG,IAAI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B,EAAE,CAAC,CAAC;IACjF,CAAC;SAAM,CAAC;QACN,8CAA8C;QAC9C,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompilerCallbacks } from "@keymanapp/common-types";
|
|
2
|
-
export declare let callbacks: CompilerCallbacks;
|
|
3
|
-
export declare function setCompilerCallbacks(c: CompilerCallbacks): void;
|
|
1
|
+
import { CompilerCallbacks } from "@keymanapp/common-types";
|
|
2
|
+
export declare let callbacks: CompilerCallbacks;
|
|
3
|
+
export declare function setCompilerCallbacks(c: CompilerCallbacks): void;
|
|
4
4
|
//# sourceMappingURL=compiler-callbacks.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export let callbacks;
|
|
2
|
-
export function setCompilerCallbacks(c) {
|
|
3
|
-
callbacks = c;
|
|
4
|
-
}
|
|
1
|
+
export let callbacks;
|
|
2
|
+
export function setCompilerCallbacks(c) {
|
|
3
|
+
callbacks = c;
|
|
4
|
+
}
|
|
5
5
|
//# sourceMappingURL=compiler-callbacks.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/// <reference types="@keymanapp/models-types" />
|
|
2
|
-
/**
|
|
3
|
-
* Returns a word breaker that joins spans of an existing word breaker.
|
|
4
|
-
* Spans are joined if they are connected by a delimiter.
|
|
5
|
-
*
|
|
6
|
-
* @param breaker The word breaker whose results will be decorated.
|
|
7
|
-
* @param joiners What delimiters should be used to join spans.
|
|
8
|
-
*/
|
|
9
|
-
export declare function decorateWithJoin(breaker: WordBreakingFunction, joiners: string[]): WordBreakingFunction;
|
|
1
|
+
/// <reference types="@keymanapp/models-types" />
|
|
2
|
+
/**
|
|
3
|
+
* Returns a word breaker that joins spans of an existing word breaker.
|
|
4
|
+
* Spans are joined if they are connected by a delimiter.
|
|
5
|
+
*
|
|
6
|
+
* @param breaker The word breaker whose results will be decorated.
|
|
7
|
+
* @param joiners What delimiters should be used to join spans.
|
|
8
|
+
*/
|
|
9
|
+
export declare function decorateWithJoin(breaker: WordBreakingFunction, joiners: string[]): WordBreakingFunction;
|
|
10
10
|
//# sourceMappingURL=join-word-breaker-decorator.d.ts.map
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
/// <reference types="@keymanapp/models-types" />
|
|
2
|
-
/**
|
|
3
|
-
* Returns a word breaker that joins spans of an existing word breaker.
|
|
4
|
-
* Spans are joined if they are connected by a delimiter.
|
|
5
|
-
*
|
|
6
|
-
* @param breaker The word breaker whose results will be decorated.
|
|
7
|
-
* @param joiners What delimiters should be used to join spans.
|
|
8
|
-
*/
|
|
9
|
-
export function decorateWithJoin(breaker, joiners) {
|
|
10
|
-
// Make a copy so that if the original array is accidentally mutated, it
|
|
11
|
-
// won't affect the joiner.
|
|
12
|
-
const delimiters = joiners.concat();
|
|
13
|
-
return function (input) {
|
|
14
|
-
let originalSpans = breaker(input);
|
|
15
|
-
// Implements a finite-state transducer (FST) where:
|
|
16
|
-
// - Transductions are pushed onto a stack
|
|
17
|
-
// - There are three states:
|
|
18
|
-
// - empty stack (initial state)
|
|
19
|
-
// - unjoined
|
|
20
|
-
// - joined
|
|
21
|
-
// - all three states are accepting states
|
|
22
|
-
// - there is NO backtracking on the input
|
|
23
|
-
// (hence the for-loop over the input tape)
|
|
24
|
-
// - each state is a JavaScript callback (function)
|
|
25
|
-
let state = emptyStack;
|
|
26
|
-
let stack = [];
|
|
27
|
-
for (let span of originalSpans) {
|
|
28
|
-
state = state(span);
|
|
29
|
-
}
|
|
30
|
-
return stack;
|
|
31
|
-
/******************* States *******************/
|
|
32
|
-
function emptyStack(span) {
|
|
33
|
-
stack.push(span);
|
|
34
|
-
if (isJoiner(span)) {
|
|
35
|
-
return joined;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
return unjoined;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function unjoined(span) {
|
|
42
|
-
// NB: stack has at least one span in it
|
|
43
|
-
if (isJoiner(span)) {
|
|
44
|
-
if (spansAreBackToBack(lastFrom(stack), span)) {
|
|
45
|
-
concatLastSpanInStackWith(span);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// Spans are non-contiguous, so don't join them!
|
|
49
|
-
stack.push(span);
|
|
50
|
-
}
|
|
51
|
-
return joined;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
// Span cannot be joined
|
|
55
|
-
stack.push(span);
|
|
56
|
-
return unjoined;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function joined(span) {
|
|
60
|
-
// NB: stack has at least one span in it
|
|
61
|
-
if (!spansAreBackToBack(lastFrom(stack), span)) {
|
|
62
|
-
// Spans are non-contiguous and cannot be joined:
|
|
63
|
-
stack.push(span);
|
|
64
|
-
return unjoined;
|
|
65
|
-
}
|
|
66
|
-
// Spans are contiguous
|
|
67
|
-
concatLastSpanInStackWith(span);
|
|
68
|
-
if (isJoiner(span)) {
|
|
69
|
-
return joined;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
return unjoined;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/****************** Helpers ******************/
|
|
76
|
-
function concatLastSpanInStackWith(span) {
|
|
77
|
-
let lastIndex = stack.length - 1;
|
|
78
|
-
let top = stack[lastIndex];
|
|
79
|
-
let joinedSpan = concatenateSpans(top, span);
|
|
80
|
-
stack[lastIndex] = joinedSpan;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
function isJoiner(span) {
|
|
84
|
-
return includes(delimiters, span.text);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Returns true when the spans are contiguous.
|
|
88
|
-
* Order matters when calling this function!
|
|
89
|
-
*/
|
|
90
|
-
function spansAreBackToBack(former, latter) {
|
|
91
|
-
return former.end === latter.start;
|
|
92
|
-
}
|
|
93
|
-
function concatenateSpans(former, latter) {
|
|
94
|
-
if (latter.start !== former.end) {
|
|
95
|
-
throw new Error(`Cannot concatenate non-contiguous spans: ${JSON.stringify(former)}/${JSON.stringify(latter)}`);
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
start: former.start,
|
|
99
|
-
end: latter.end,
|
|
100
|
-
length: former.length + latter.length,
|
|
101
|
-
text: former.text + latter.text
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* When Array.prototype.include() doesn't exist:
|
|
106
|
-
*/
|
|
107
|
-
function includes(haystack, needle) {
|
|
108
|
-
for (let item of haystack) {
|
|
109
|
-
if (item === needle)
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Get the last element from the array.
|
|
116
|
-
*/
|
|
117
|
-
function lastFrom(array) {
|
|
118
|
-
return array[array.length - 1];
|
|
119
|
-
}
|
|
120
|
-
}
|
|
1
|
+
/// <reference types="@keymanapp/models-types" />
|
|
2
|
+
/**
|
|
3
|
+
* Returns a word breaker that joins spans of an existing word breaker.
|
|
4
|
+
* Spans are joined if they are connected by a delimiter.
|
|
5
|
+
*
|
|
6
|
+
* @param breaker The word breaker whose results will be decorated.
|
|
7
|
+
* @param joiners What delimiters should be used to join spans.
|
|
8
|
+
*/
|
|
9
|
+
export function decorateWithJoin(breaker, joiners) {
|
|
10
|
+
// Make a copy so that if the original array is accidentally mutated, it
|
|
11
|
+
// won't affect the joiner.
|
|
12
|
+
const delimiters = joiners.concat();
|
|
13
|
+
return function (input) {
|
|
14
|
+
let originalSpans = breaker(input);
|
|
15
|
+
// Implements a finite-state transducer (FST) where:
|
|
16
|
+
// - Transductions are pushed onto a stack
|
|
17
|
+
// - There are three states:
|
|
18
|
+
// - empty stack (initial state)
|
|
19
|
+
// - unjoined
|
|
20
|
+
// - joined
|
|
21
|
+
// - all three states are accepting states
|
|
22
|
+
// - there is NO backtracking on the input
|
|
23
|
+
// (hence the for-loop over the input tape)
|
|
24
|
+
// - each state is a JavaScript callback (function)
|
|
25
|
+
let state = emptyStack;
|
|
26
|
+
let stack = [];
|
|
27
|
+
for (let span of originalSpans) {
|
|
28
|
+
state = state(span);
|
|
29
|
+
}
|
|
30
|
+
return stack;
|
|
31
|
+
/******************* States *******************/
|
|
32
|
+
function emptyStack(span) {
|
|
33
|
+
stack.push(span);
|
|
34
|
+
if (isJoiner(span)) {
|
|
35
|
+
return joined;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return unjoined;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function unjoined(span) {
|
|
42
|
+
// NB: stack has at least one span in it
|
|
43
|
+
if (isJoiner(span)) {
|
|
44
|
+
if (spansAreBackToBack(lastFrom(stack), span)) {
|
|
45
|
+
concatLastSpanInStackWith(span);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Spans are non-contiguous, so don't join them!
|
|
49
|
+
stack.push(span);
|
|
50
|
+
}
|
|
51
|
+
return joined;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// Span cannot be joined
|
|
55
|
+
stack.push(span);
|
|
56
|
+
return unjoined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function joined(span) {
|
|
60
|
+
// NB: stack has at least one span in it
|
|
61
|
+
if (!spansAreBackToBack(lastFrom(stack), span)) {
|
|
62
|
+
// Spans are non-contiguous and cannot be joined:
|
|
63
|
+
stack.push(span);
|
|
64
|
+
return unjoined;
|
|
65
|
+
}
|
|
66
|
+
// Spans are contiguous
|
|
67
|
+
concatLastSpanInStackWith(span);
|
|
68
|
+
if (isJoiner(span)) {
|
|
69
|
+
return joined;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return unjoined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/****************** Helpers ******************/
|
|
76
|
+
function concatLastSpanInStackWith(span) {
|
|
77
|
+
let lastIndex = stack.length - 1;
|
|
78
|
+
let top = stack[lastIndex];
|
|
79
|
+
let joinedSpan = concatenateSpans(top, span);
|
|
80
|
+
stack[lastIndex] = joinedSpan;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
function isJoiner(span) {
|
|
84
|
+
return includes(delimiters, span.text);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns true when the spans are contiguous.
|
|
88
|
+
* Order matters when calling this function!
|
|
89
|
+
*/
|
|
90
|
+
function spansAreBackToBack(former, latter) {
|
|
91
|
+
return former.end === latter.start;
|
|
92
|
+
}
|
|
93
|
+
function concatenateSpans(former, latter) {
|
|
94
|
+
if (latter.start !== former.end) {
|
|
95
|
+
throw new Error(`Cannot concatenate non-contiguous spans: ${JSON.stringify(former)}/${JSON.stringify(latter)}`);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
start: former.start,
|
|
99
|
+
end: latter.end,
|
|
100
|
+
length: former.length + latter.length,
|
|
101
|
+
text: former.text + latter.text
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* When Array.prototype.include() doesn't exist:
|
|
106
|
+
*/
|
|
107
|
+
function includes(haystack, needle) {
|
|
108
|
+
for (let item of haystack) {
|
|
109
|
+
if (item === needle)
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get the last element from the array.
|
|
116
|
+
*/
|
|
117
|
+
function lastFrom(array) {
|
|
118
|
+
return array[array.length - 1];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
121
|
//# sourceMappingURL=join-word-breaker-decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-word-breaker-decorator.js","sourceRoot":"","sources":["../../src/join-word-breaker-decorator.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA6B,EAAE,OAAiB;IAC/E,wEAAwE;IACxE,2BAA2B;IAC3B,MAAM,UAAU,GAAG,OAA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acks, CompilerOptions, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult } from "@keymanapp/common-types";
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
* Internal in-memory build artifacts from a successful compilation
|
|
6
|
-
*/
|
|
7
|
-
export interface LexicalModelCompilerArtifacts extends KeymanCompilerArtifacts {
|
|
8
|
-
/**
|
|
9
|
-
* Javascript model filedata and filename - installable into KeymanWeb,
|
|
10
|
-
* Keyman mobile products
|
|
11
|
-
*/
|
|
12
|
-
js: KeymanCompilerArtifact;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
* Build artifacts from the lexical model compiler
|
|
17
|
-
*/
|
|
18
|
-
export interface LexicalModelCompilerResult extends KeymanCompilerResult {
|
|
19
|
-
/**
|
|
20
|
-
* Internal in-memory build artifacts from a successful compilation. Caller
|
|
21
|
-
* can write these to disk with {@link LexicalModelCompiler.write}
|
|
22
|
-
*/
|
|
23
|
-
artifacts: LexicalModelCompilerArtifacts;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @public
|
|
27
|
-
* Compiles a .model.ts file to a .model.js. The compiler does not read or write
|
|
28
|
-
* from filesystem or network directly, but relies on callbacks for all external
|
|
29
|
-
* IO.
|
|
30
|
-
*/
|
|
31
|
-
export declare class LexicalModelCompiler implements KeymanCompiler {
|
|
32
|
-
/**
|
|
33
|
-
* Initialize the compiler. There are currently no options
|
|
34
|
-
* specific to the lexical model compiler
|
|
35
|
-
* @param callbacks - Callbacks for external interfaces, including message
|
|
36
|
-
* reporting and file io
|
|
37
|
-
* @param options - Compiler options
|
|
38
|
-
* @returns always succeeds and returns true
|
|
39
|
-
*/
|
|
40
|
-
init(callbacks: CompilerCallbacks, _options: CompilerOptions): Promise<boolean>;
|
|
41
|
-
/**
|
|
42
|
-
* Compiles a .model.ts file to .model.js. Returns an object containing binary
|
|
43
|
-
* artifacts on success. The files are passed in by name, and the compiler
|
|
44
|
-
* will use callbacks as passed to the {@link LexicalModelCompiler.init}
|
|
45
|
-
* function to read any input files by disk.
|
|
46
|
-
* @param infile - Path to source file. Path will be parsed to find relative
|
|
47
|
-
* references in the .kmn file, such as icon or On Screen
|
|
48
|
-
* Keyboard file
|
|
49
|
-
* @param outfile - Path to output file. The file will not be written to, but
|
|
50
|
-
* will be included in the result for use by
|
|
51
|
-
* {@link LexicalModelCompiler.write}.
|
|
52
|
-
* @returns Binary artifacts on success, null on failure.
|
|
53
|
-
*/
|
|
54
|
-
run(inputFilename: string, outputFilename?: string): Promise<LexicalModelCompilerResult>;
|
|
55
|
-
/**
|
|
56
|
-
* Write artifacts from a successful compile to disk, via callbacks methods.
|
|
57
|
-
* The artifacts written may include:
|
|
58
|
-
*
|
|
59
|
-
* - .model.js file - Javascript lexical model for web and touch platforms
|
|
60
|
-
*
|
|
61
|
-
* @param artifacts - object containing artifact binary data to write out
|
|
62
|
-
* @returns always returns true
|
|
63
|
-
*/
|
|
64
|
-
write(artifacts: LexicalModelCompilerArtifacts): Promise<boolean>;
|
|
65
|
-
/**
|
|
66
|
-
* @internal
|
|
67
|
-
* Loads a lexical model's source module from the given filename.
|
|
68
|
-
*
|
|
69
|
-
* @param filename - path to the model source file.
|
|
70
|
-
*/
|
|
71
|
-
loadFromFilename(filename: string): LexicalModelSource;
|
|
72
|
-
/**
|
|
73
|
-
* @internal
|
|
74
|
-
* Returns the generated code for the model that will ultimately be loaded by
|
|
75
|
-
* the LMLayer worker. This code contains all model parameters, and specifies
|
|
76
|
-
* word breakers and auxilary functions that may be required.
|
|
77
|
-
*
|
|
78
|
-
* @param model_id - The model ID. TODO: not sure if this is actually required!
|
|
79
|
-
* @param modelSource - A specification of the model to compile
|
|
80
|
-
* @param sourcePath - Where to find auxilary sources files
|
|
81
|
-
*/
|
|
82
|
-
generateLexicalModelCode(model_id: string, modelSource: LexicalModelSource, sourcePath: string): string;
|
|
83
|
-
/**
|
|
84
|
-
* @internal
|
|
85
|
-
*/
|
|
86
|
-
transpileSources(sources: Array<string>): Array<string>;
|
|
87
|
-
}
|
|
1
|
+
import { LexicalModelSource } from "./lexical-model.js";
|
|
2
|
+
import { CompilerCallbacks, CompilerOptions, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult } from "@keymanapp/common-types";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* Internal in-memory build artifacts from a successful compilation
|
|
6
|
+
*/
|
|
7
|
+
export interface LexicalModelCompilerArtifacts extends KeymanCompilerArtifacts {
|
|
8
|
+
/**
|
|
9
|
+
* Javascript model filedata and filename - installable into KeymanWeb,
|
|
10
|
+
* Keyman mobile products
|
|
11
|
+
*/
|
|
12
|
+
js: KeymanCompilerArtifact;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
* Build artifacts from the lexical model compiler
|
|
17
|
+
*/
|
|
18
|
+
export interface LexicalModelCompilerResult extends KeymanCompilerResult {
|
|
19
|
+
/**
|
|
20
|
+
* Internal in-memory build artifacts from a successful compilation. Caller
|
|
21
|
+
* can write these to disk with {@link LexicalModelCompiler.write}
|
|
22
|
+
*/
|
|
23
|
+
artifacts: LexicalModelCompilerArtifacts;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
* Compiles a .model.ts file to a .model.js. The compiler does not read or write
|
|
28
|
+
* from filesystem or network directly, but relies on callbacks for all external
|
|
29
|
+
* IO.
|
|
30
|
+
*/
|
|
31
|
+
export declare class LexicalModelCompiler implements KeymanCompiler {
|
|
32
|
+
/**
|
|
33
|
+
* Initialize the compiler. There are currently no options
|
|
34
|
+
* specific to the lexical model compiler
|
|
35
|
+
* @param callbacks - Callbacks for external interfaces, including message
|
|
36
|
+
* reporting and file io
|
|
37
|
+
* @param options - Compiler options
|
|
38
|
+
* @returns always succeeds and returns true
|
|
39
|
+
*/
|
|
40
|
+
init(callbacks: CompilerCallbacks, _options: CompilerOptions): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Compiles a .model.ts file to .model.js. Returns an object containing binary
|
|
43
|
+
* artifacts on success. The files are passed in by name, and the compiler
|
|
44
|
+
* will use callbacks as passed to the {@link LexicalModelCompiler.init}
|
|
45
|
+
* function to read any input files by disk.
|
|
46
|
+
* @param infile - Path to source file. Path will be parsed to find relative
|
|
47
|
+
* references in the .kmn file, such as icon or On Screen
|
|
48
|
+
* Keyboard file
|
|
49
|
+
* @param outfile - Path to output file. The file will not be written to, but
|
|
50
|
+
* will be included in the result for use by
|
|
51
|
+
* {@link LexicalModelCompiler.write}.
|
|
52
|
+
* @returns Binary artifacts on success, null on failure.
|
|
53
|
+
*/
|
|
54
|
+
run(inputFilename: string, outputFilename?: string): Promise<LexicalModelCompilerResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Write artifacts from a successful compile to disk, via callbacks methods.
|
|
57
|
+
* The artifacts written may include:
|
|
58
|
+
*
|
|
59
|
+
* - .model.js file - Javascript lexical model for web and touch platforms
|
|
60
|
+
*
|
|
61
|
+
* @param artifacts - object containing artifact binary data to write out
|
|
62
|
+
* @returns always returns true
|
|
63
|
+
*/
|
|
64
|
+
write(artifacts: LexicalModelCompilerArtifacts): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
* Loads a lexical model's source module from the given filename.
|
|
68
|
+
*
|
|
69
|
+
* @param filename - path to the model source file.
|
|
70
|
+
*/
|
|
71
|
+
loadFromFilename(filename: string): LexicalModelSource;
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
* Returns the generated code for the model that will ultimately be loaded by
|
|
75
|
+
* the LMLayer worker. This code contains all model parameters, and specifies
|
|
76
|
+
* word breakers and auxilary functions that may be required.
|
|
77
|
+
*
|
|
78
|
+
* @param model_id - The model ID. TODO: not sure if this is actually required!
|
|
79
|
+
* @param modelSource - A specification of the model to compile
|
|
80
|
+
* @param sourcePath - Where to find auxilary sources files
|
|
81
|
+
*/
|
|
82
|
+
generateLexicalModelCode(model_id: string, modelSource: LexicalModelSource, sourcePath: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
transpileSources(sources: Array<string>): Array<string>;
|
|
87
|
+
}
|
|
88
88
|
//# sourceMappingURL=lexical-model-compiler.d.ts.map
|