@keymanapp/kmc-model 17.0.256-alpha → 17.0.258-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.
@@ -1,42 +1,40 @@
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]="82977ed1-376e-5f0d-8872-7a0c42176370")}catch(e){}}();
2
- /**
3
- * A word list is (conceptually) an array of pairs: the concrete word form itself + a
4
- * non-negative count.
5
- *
6
- * Since each word should only appear once within the list, we represent it with
7
- * an associative array pattern keyed by the wordform.
8
- */
9
- export type WordList = {
10
- [wordform: string]: number;
11
- };
12
- /**
13
- * Returns a data structure that can be loaded by the TrieModel.
14
- *
15
- * It implements a **weighted** trie, whose indices (paths down the trie) are
16
- * generated by a search key, and not concrete wordforms themselves.
17
- *
18
- * @param sourceFiles an array of source files that will be read to generate the trie.
19
- */
20
- export declare function createTrieDataStructure(filenames: string[], searchTermToKey?: (wf: string) => string): string;
21
- /**
22
- * Parses a word list from a file, merging duplicate entries.
23
- *
24
- * The word list may be encoded in:
25
- *
26
- * - UTF-8, with or without BOM [exported by most software]
27
- * - UTF-16, little endian, with BOM [exported by Microsoft Excel]
28
- *
29
- * @param wordlist word list to merge entries into (may have existing entries)
30
- * @param filename filename of the word list
31
- */
32
- export declare function parseWordListFromFilename(wordlist: WordList, filename: string): void;
33
- /**
34
- * Parses a word list from a string. The string should have multiple lines
35
- * with LF or CRLF line terminators.
36
- *
37
- * @param wordlist word list to merge entries into (may have existing entries)
38
- * @param filename filename of the word list
39
- */
40
- export declare function parseWordListFromContents(wordlist: WordList, contents: string): void;
41
- //# debugId=82977ed1-376e-5f0d-8872-7a0c42176370
42
- //# sourceMappingURL=build-trie.d.ts.map
1
+ /**
2
+ * A word list is (conceptually) an array of pairs: the concrete word form itself + a
3
+ * non-negative count.
4
+ *
5
+ * Since each word should only appear once within the list, we represent it with
6
+ * an associative array pattern keyed by the wordform.
7
+ */
8
+ export type WordList = {
9
+ [wordform: string]: number;
10
+ };
11
+ /**
12
+ * Returns a data structure that can be loaded by the TrieModel.
13
+ *
14
+ * It implements a **weighted** trie, whose indices (paths down the trie) are
15
+ * generated by a search key, and not concrete wordforms themselves.
16
+ *
17
+ * @param sourceFiles an array of source files that will be read to generate the trie.
18
+ */
19
+ export declare function createTrieDataStructure(filenames: string[], searchTermToKey?: (wf: string) => string): string;
20
+ /**
21
+ * Parses a word list from a file, merging duplicate entries.
22
+ *
23
+ * The word list may be encoded in:
24
+ *
25
+ * - UTF-8, with or without BOM [exported by most software]
26
+ * - UTF-16, little endian, with BOM [exported by Microsoft Excel]
27
+ *
28
+ * @param wordlist word list to merge entries into (may have existing entries)
29
+ * @param filename filename of the word list
30
+ */
31
+ export declare function parseWordListFromFilename(wordlist: WordList, filename: string): void;
32
+ /**
33
+ * Parses a word list from a string. The string should have multiple lines
34
+ * with LF or CRLF line terminators.
35
+ *
36
+ * @param wordlist word list to merge entries into (may have existing entries)
37
+ * @param filename filename of the word list
38
+ */
39
+ export declare function parseWordListFromContents(wordlist: WordList, contents: string): void;
40
+ //# sourceMappingURL=build-trie.d.ts.map
@@ -1 +1 @@
1
- {"debug_id":"82977ed1-376e-5f0d-8872-7a0c42176370","file":"build-trie.d.ts","mappings":";AAMA;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG;IAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAU7G;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGpF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGpF","names":[],"sourceRoot":"","sources":["../../src/build-trie.ts"],"version":3}
1
+ {"version":3,"file":"build-trie.d.ts","sourceRoot":"","sources":["../../src/build-trie.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG;IAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAU7G;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGpF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGpF"}
@@ -1,6 +1,4 @@
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]="5109171c-973d-5245-a6d1-34f3dcd574be")}catch(e){}}();
2
- import { CompilerCallbacks } from "@keymanapp/common-types";
3
- export declare let callbacks: CompilerCallbacks;
4
- export declare function setCompilerCallbacks(c: CompilerCallbacks): void;
5
- //# debugId=5109171c-973d-5245-a6d1-34f3dcd574be
6
- //# sourceMappingURL=compiler-callbacks.d.ts.map
1
+ import { CompilerCallbacks } from "@keymanapp/common-types";
2
+ export declare let callbacks: CompilerCallbacks;
3
+ export declare function setCompilerCallbacks(c: CompilerCallbacks): void;
4
+ //# sourceMappingURL=compiler-callbacks.d.ts.map
@@ -1 +1 @@
1
- {"debug_id":"5109171c-973d-5245-a6d1-34f3dcd574be","file":"compiler-callbacks.d.ts","mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,eAAO,IAAI,SAAS,EAAE,iBAAiB,CAAC;AAExC,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,iBAAiB,QAExD","names":[],"sourceRoot":"","sources":["../../src/compiler-callbacks.ts"],"version":3}
1
+ {"version":3,"file":"compiler-callbacks.d.ts","sourceRoot":"","sources":["../../src/compiler-callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,eAAO,IAAI,SAAS,EAAE,iBAAiB,CAAC;AAExC,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,iBAAiB,QAExD"}
@@ -1,12 +1,10 @@
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]="ca1f6008-5474-5b1f-a8e0-5e03178980fa")}catch(e){}}();
3
- /**
4
- * Returns a word breaker that joins spans of an existing word breaker.
5
- * Spans are joined if they are connected by a delimiter.
6
- *
7
- * @param breaker The word breaker whose results will be decorated.
8
- * @param joiners What delimiters should be used to join spans.
9
- */
10
- export declare function decorateWithJoin(breaker: WordBreakingFunction, joiners: string[]): WordBreakingFunction;
11
- //# debugId=ca1f6008-5474-5b1f-a8e0-5e03178980fa
12
- //# sourceMappingURL=join-word-breaker-decorator.d.ts.map
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
+ //# sourceMappingURL=join-word-breaker-decorator.d.ts.map
@@ -1 +1 @@
1
- {"debug_id":"ca1f6008-5474-5b1f-a8e0-5e03178980fa","file":"join-word-breaker-decorator.d.ts","mappings":";;AAEA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,oBAAoB,CA4HvG","names":[],"sourceRoot":"","sources":["../../src/join-word-breaker-decorator.ts"],"version":3}
1
+ {"version":3,"file":"join-word-breaker-decorator.d.ts","sourceRoot":"","sources":["../../src/join-word-breaker-decorator.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,oBAAoB,CA4HvG"}
@@ -1,33 +1,31 @@
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]="1bc80df3-48dc-5244-9634-1f202c49337f")}catch(e){}}();
2
- import { LexicalModelSource } from "./lexical-model.js";
3
- import { CompilerCallbacks, CompilerOptions, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult } from "@keymanapp/common-types";
4
- export interface LexicalModelCompilerArtifacts extends KeymanCompilerArtifacts {
5
- js: KeymanCompilerArtifact;
6
- }
7
- export interface LexicalModelCompilerResult extends KeymanCompilerResult {
8
- artifacts: LexicalModelCompilerArtifacts;
9
- }
10
- export declare class LexicalModelCompiler implements KeymanCompiler {
11
- init(callbacks: CompilerCallbacks, _options: CompilerOptions): Promise<boolean>;
12
- run(inputFilename: string, outputFilename?: string): Promise<LexicalModelCompilerResult>;
13
- write(artifacts: LexicalModelCompilerArtifacts): Promise<boolean>;
14
- /**
15
- * Loads a lexical model's source module from the given filename.
16
- *
17
- * @param filename path to the model source file.
18
- */
19
- loadFromFilename(filename: string): LexicalModelSource;
20
- /**
21
- * Returns the generated code for the model that will ultimately be loaded by
22
- * the LMLayer worker. This code contains all model parameters, and specifies
23
- * word breakers and auxilary functions that may be required.
24
- *
25
- * @param model_id The model ID. TODO: not sure if this is actually required!
26
- * @param modelSource A specification of the model to compile
27
- * @param sourcePath Where to find auxilary sources files
28
- */
29
- generateLexicalModelCode(model_id: string, modelSource: LexicalModelSource, sourcePath: string): string;
30
- transpileSources(sources: Array<string>): Array<string>;
31
- }
32
- //# debugId=1bc80df3-48dc-5244-9634-1f202c49337f
33
- //# sourceMappingURL=lexical-model-compiler.d.ts.map
1
+ import { LexicalModelSource } from "./lexical-model.js";
2
+ import { CompilerCallbacks, CompilerOptions, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult } from "@keymanapp/common-types";
3
+ export interface LexicalModelCompilerArtifacts extends KeymanCompilerArtifacts {
4
+ js: KeymanCompilerArtifact;
5
+ }
6
+ export interface LexicalModelCompilerResult extends KeymanCompilerResult {
7
+ artifacts: LexicalModelCompilerArtifacts;
8
+ }
9
+ export declare class LexicalModelCompiler implements KeymanCompiler {
10
+ init(callbacks: CompilerCallbacks, _options: CompilerOptions): Promise<boolean>;
11
+ run(inputFilename: string, outputFilename?: string): Promise<LexicalModelCompilerResult>;
12
+ write(artifacts: LexicalModelCompilerArtifacts): Promise<boolean>;
13
+ /**
14
+ * Loads a lexical model's source module from the given filename.
15
+ *
16
+ * @param filename path to the model source file.
17
+ */
18
+ loadFromFilename(filename: string): LexicalModelSource;
19
+ /**
20
+ * Returns the generated code for the model that will ultimately be loaded by
21
+ * the LMLayer worker. This code contains all model parameters, and specifies
22
+ * word breakers and auxilary functions that may be required.
23
+ *
24
+ * @param model_id The model ID. TODO: not sure if this is actually required!
25
+ * @param modelSource A specification of the model to compile
26
+ * @param sourcePath Where to find auxilary sources files
27
+ */
28
+ generateLexicalModelCode(model_id: string, modelSource: LexicalModelSource, sourcePath: string): string;
29
+ transpileSources(sources: Array<string>): Array<string>;
30
+ }
31
+ //# sourceMappingURL=lexical-model-compiler.d.ts.map
@@ -1 +1 @@
1
- {"debug_id":"1bc80df3-48dc-5244-9634-1f202c49337f","file":"lexical-model-compiler.d.ts","mappings":";AASA,OAAO,EAAE,kBAAkB,EAA0C,MAAM,oBAAoB,CAAC;AAGhG,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAWpK,MAAM,WAAW,6BAA8B,SAAQ,uBAAuB;IAC5E,EAAE,EAAE,sBAAsB,CAAC;CAC5B;AAED,MAAM,WAAW,0BAA2B,SAAQ,oBAAoB;IACtE,SAAS,EAAE,6BAA6B,CAAC;CAC1C;AAED,qBAAa,oBAAqB,YAAW,cAAc;IAEnD,IAAI,CAAC,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/E,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAwBxF,KAAK,CAAC,SAAS,EAAE,6BAA6B,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvE;;;;OAIG;IACI,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB;IA8B7D;;;;;;;;OAQG;IACH,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM;IAiE9F,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;CAUxD","names":[],"sourceRoot":"","sources":["../../src/lexical-model-compiler.ts"],"version":3}
1
+ {"version":3,"file":"lexical-model-compiler.d.ts","sourceRoot":"","sources":["../../src/lexical-model-compiler.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAA0C,MAAM,oBAAoB,CAAC;AAGhG,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAWpK,MAAM,WAAW,6BAA8B,SAAQ,uBAAuB;IAC5E,EAAE,EAAE,sBAAsB,CAAC;CAC5B;AAED,MAAM,WAAW,0BAA2B,SAAQ,oBAAoB;IACtE,SAAS,EAAE,6BAA6B,CAAC;CAC1C;AAED,qBAAa,oBAAqB,YAAW,cAAc;IAEnD,IAAI,CAAC,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/E,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAwBxF,KAAK,CAAC,SAAS,EAAE,6BAA6B,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvE;;;;OAIG;IACI,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB;IA8B7D;;;;;;;;OAQG;IACH,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM;IAiE9F,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;CAUxD"}
@@ -1,137 +1,135 @@
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]="94f66ee3-becb-53a9-9cc1-28e99f0ada0e")}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
- /// <reference types="@keymanapp/models-types" />
7
- export interface LexicalModelDeclaration {
8
- readonly format: 'trie-1.0' | 'fst-foma-1.0' | 'custom-1.0';
9
- }
10
- /**
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
- * Simplified word breaker specification.
40
- *
41
- * @since 11.0
42
- */
43
- export type SimpleWordBreakerSpec = 'default' | 'ascii' | WordBreakingFunction;
44
- /**
45
- * Simplifies input text to facilitate finding entries within a lexical model's
46
- * lexicon.
47
- * @since 11.0
48
- */
49
- export type SimpleWordformToKeySpec = (term: string) => string;
50
- /**
51
- * Simplifies input text to facilitate finding entries within a lexical model's
52
- * lexicon, using the model's `applyCasing` function to assist in the keying process.
53
- * @since 14.0
54
- */
55
- export type CasedWordformToKeySpec = (term: string, applyCasing?: CasingFunction) => string;
56
- /**
57
- * Simplifies input text to facilitate finding entries within a lexical model's
58
- * lexicon.
59
- */
60
- export type WordformToKeySpec = SimpleWordformToKeySpec | CasedWordformToKeySpec;
61
- /**
62
- * Override the default word breaking behaviour for some scripts.
63
- *
64
- * There is currently only one option:
65
- *
66
- * 'break-words-at-spaces'
67
- * : some South-East Asian scripts conventionally do not use space or any
68
- * explicit word boundary character to write word breaks. These scripts are:
69
- *
70
- * * Burmese
71
- * * Khmer
72
- * * Thai
73
- * * Laos
74
- *
75
- * (this list may be incomplete and extended in the future)
76
- *
77
- * For these scripts, the default word breaker breaks at **every**
78
- * letter/syllable/ideograph. However, in languages that use these scripts BUT
79
- * use spaces (or some other delimier) as word breaks, enable
80
- * 'break-words-at-spaces'; enabling 'break-words-at-spaces' prevents the word
81
- * breaker from making too many breaks in these scripts.
82
- *
83
- * @since 14.0
84
- */
85
- export type OverrideScriptDefaults = 'break-words-at-spaces';
86
- export interface LexicalModelSource extends LexicalModelDeclaration {
87
- readonly sources: Array<string>;
88
- /**
89
- * The name of the type to instantiate (without parameters) as the base object for a custom predictive model.
90
- */
91
- readonly rootClass?: string;
92
- /**
93
- * When set to `true`, suggestions will attempt to match the case of the input text even if
94
- * the lexicon entries use a different casing scheme due to search term keying effects.
95
- * @since 14.0
96
- */
97
- readonly languageUsesCasing?: boolean;
98
- /**
99
- * Specifies the casing rules for a language. Should implement three casing forms:
100
- * - 'lower' -- a fully-lowercased version of the text appropriate for the language's
101
- * use of the writing system.
102
- * - 'upper' -- a fully-uppercased version of the text
103
- * - 'initial' -- a version preserving the input casing aside from the initial character,
104
- * which is uppercased (like with proper nouns and sentence-initial words in English
105
- * sentences.)
106
- *
107
- * This is only utilized if `languageUsesCasing` is defined and set to `true`.
108
- * @since 14.0
109
- */
110
- readonly applyCasing?: CasingFunction;
111
- /**
112
- * Which word breaker to use. Choose from:
113
- *
114
- * - 'default' -- breaks according to Unicode UAX #29 §4.1 Default Word
115
- * Boundary Specification, which works well for *most* languages.
116
- * - 'ascii' -- a very simple word breaker, for demonstration purposes only.
117
- * - word breaking function -- provide your own function that breaks words.
118
- * - class-based word-breaker - may be supported in the future.
119
- */
120
- readonly wordBreaker?: WordBreakerSpec | SimpleWordBreakerSpec;
121
- /**
122
- * How to simplify words, to convert them into simplified search keys
123
- * This often involves removing accents, lowercasing, etc.
124
- */
125
- readonly searchTermToKey?: WordformToKeySpec;
126
- /**
127
- * Punctuation and spacing suggested by the model.
128
- *
129
- * @see LexicalModelPunctuation
130
- */
131
- readonly punctuation?: LexicalModelPunctuation;
132
- }
133
- export interface LexicalModelCompiled extends LexicalModelDeclaration {
134
- readonly id: string;
135
- }
136
- //# debugId=94f66ee3-becb-53a9-9cc1-28e99f0ada0e
137
- //# sourceMappingURL=lexical-model.d.ts.map
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
+ * Keyman 14.0+ word breaker specification:
11
+ *
12
+ * Can support all old word breaking specification,
13
+ * but can also be extended with options.
14
+ *
15
+ * @since 14.0
16
+ */
17
+ export interface WordBreakerSpec {
18
+ readonly use: SimpleWordBreakerSpec;
19
+ /**
20
+ * If present, joins words that were split by the word breaker
21
+ * together at the given strings. e.g.,
22
+ *
23
+ * joinWordsAt: ['-'] // to keep hyphenated items together
24
+ *
25
+ * @since 14.0
26
+ */
27
+ readonly joinWordsAt?: string[];
28
+ /**
29
+ * Overrides word splitting behaviour for certain scripts.
30
+ * For example, specifing that spaces break words in certain South-East
31
+ * Asian scripts that otherwise do not use spaces.
32
+ *
33
+ * @since 14.0
34
+ */
35
+ readonly overrideScriptDefaults?: OverrideScriptDefaults;
36
+ }
37
+ /**
38
+ * Simplified word breaker specification.
39
+ *
40
+ * @since 11.0
41
+ */
42
+ export type SimpleWordBreakerSpec = 'default' | 'ascii' | WordBreakingFunction;
43
+ /**
44
+ * Simplifies input text to facilitate finding entries within a lexical model's
45
+ * lexicon.
46
+ * @since 11.0
47
+ */
48
+ export type SimpleWordformToKeySpec = (term: string) => string;
49
+ /**
50
+ * Simplifies input text to facilitate finding entries within a lexical model's
51
+ * lexicon, using the model's `applyCasing` function to assist in the keying process.
52
+ * @since 14.0
53
+ */
54
+ export type CasedWordformToKeySpec = (term: string, applyCasing?: CasingFunction) => string;
55
+ /**
56
+ * Simplifies input text to facilitate finding entries within a lexical model's
57
+ * lexicon.
58
+ */
59
+ export type WordformToKeySpec = SimpleWordformToKeySpec | CasedWordformToKeySpec;
60
+ /**
61
+ * Override the default word breaking behaviour for some scripts.
62
+ *
63
+ * There is currently only one option:
64
+ *
65
+ * 'break-words-at-spaces'
66
+ * : some South-East Asian scripts conventionally do not use space or any
67
+ * explicit word boundary character to write word breaks. These scripts are:
68
+ *
69
+ * * Burmese
70
+ * * Khmer
71
+ * * Thai
72
+ * * Laos
73
+ *
74
+ * (this list may be incomplete and extended in the future)
75
+ *
76
+ * For these scripts, the default word breaker breaks at **every**
77
+ * letter/syllable/ideograph. However, in languages that use these scripts BUT
78
+ * use spaces (or some other delimier) as word breaks, enable
79
+ * 'break-words-at-spaces'; enabling 'break-words-at-spaces' prevents the word
80
+ * breaker from making too many breaks in these scripts.
81
+ *
82
+ * @since 14.0
83
+ */
84
+ export type OverrideScriptDefaults = 'break-words-at-spaces';
85
+ export interface LexicalModelSource extends LexicalModelDeclaration {
86
+ readonly sources: Array<string>;
87
+ /**
88
+ * The name of the type to instantiate (without parameters) as the base object for a custom predictive model.
89
+ */
90
+ readonly rootClass?: string;
91
+ /**
92
+ * When set to `true`, suggestions will attempt to match the case of the input text even if
93
+ * the lexicon entries use a different casing scheme due to search term keying effects.
94
+ * @since 14.0
95
+ */
96
+ readonly languageUsesCasing?: boolean;
97
+ /**
98
+ * Specifies the casing rules for a language. Should implement three casing forms:
99
+ * - 'lower' -- a fully-lowercased version of the text appropriate for the language's
100
+ * use of the writing system.
101
+ * - 'upper' -- a fully-uppercased version of the text
102
+ * - 'initial' -- a version preserving the input casing aside from the initial character,
103
+ * which is uppercased (like with proper nouns and sentence-initial words in English
104
+ * sentences.)
105
+ *
106
+ * This is only utilized if `languageUsesCasing` is defined and set to `true`.
107
+ * @since 14.0
108
+ */
109
+ readonly applyCasing?: CasingFunction;
110
+ /**
111
+ * Which word breaker to use. Choose from:
112
+ *
113
+ * - 'default' -- breaks according to Unicode UAX #29 §4.1 Default Word
114
+ * Boundary Specification, which works well for *most* languages.
115
+ * - 'ascii' -- a very simple word breaker, for demonstration purposes only.
116
+ * - word breaking function -- provide your own function that breaks words.
117
+ * - class-based word-breaker - may be supported in the future.
118
+ */
119
+ readonly wordBreaker?: WordBreakerSpec | SimpleWordBreakerSpec;
120
+ /**
121
+ * How to simplify words, to convert them into simplified search keys
122
+ * This often involves removing accents, lowercasing, etc.
123
+ */
124
+ readonly searchTermToKey?: WordformToKeySpec;
125
+ /**
126
+ * Punctuation and spacing suggested by the model.
127
+ *
128
+ * @see LexicalModelPunctuation
129
+ */
130
+ readonly punctuation?: LexicalModelPunctuation;
131
+ }
132
+ export interface LexicalModelCompiled extends LexicalModelDeclaration {
133
+ readonly id: string;
134
+ }
135
+ //# sourceMappingURL=lexical-model.d.ts.map
@@ -1 +1 @@
1
- {"debug_id":"94f66ee3-becb-53a9-9cc1-28e99f0ada0e","file":"lexical-model.d.ts","mappings":";AAAA;;;GAGG;;AAEH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAC,cAAc,GAAC,YAAY,CAAC;CAEzD;AAED;;;;;;;GAOG;AACF,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC;IACpC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhC;;;;;;OAMG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CAC1D;AAED;;;;GAIG;AACF,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,OAAO,GAAG,oBAAoB,CAAC;AAEhF;;;;GAIG;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,cAAc,KAAK,MAAM,CAAC;AAE5F;;;GAGG;AACF,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAG7D,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IACjE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAErC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,cAAc,CAAA;IAErC;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,GAAG,qBAAqB,CAAC;IAE/D;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAE7C;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC;CAChD;AAED,MAAM,WAAW,oBAAqB,SAAQ,uBAAuB;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB","names":[],"sourceRoot":"","sources":["../../src/lexical-model.ts"],"version":3}
1
+ {"version":3,"file":"lexical-model.d.ts","sourceRoot":"","sources":["../../src/lexical-model.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAC,cAAc,GAAC,YAAY,CAAC;CAEzD;AAED;;;;;;;GAOG;AACF,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC;IACpC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhC;;;;;;OAMG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CAC1D;AAED;;;;GAIG;AACF,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,OAAO,GAAG,oBAAoB,CAAC;AAEhF;;;;GAIG;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,cAAc,KAAK,MAAM,CAAC;AAE5F;;;GAGG;AACF,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAG7D,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IACjE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAErC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,cAAc,CAAA;IAErC;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,GAAG,qBAAqB,CAAC;IAE/D;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAE7C;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC;CAChD;AAED,MAAM,WAAW,oBAAqB,SAAQ,uBAAuB;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB"}
@@ -1,5 +1,3 @@
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]="70705a10-2a85-53de-a527-92aa4f2e19d0")}catch(e){}}();
2
- export { LexicalModelCompiler } from './lexical-model-compiler.js';
3
- export { ModelCompilerMessages } from './model-compiler-messages.js';
4
- //# debugId=70705a10-2a85-53de-a527-92aa4f2e19d0
5
- //# sourceMappingURL=main.d.ts.map
1
+ export { LexicalModelCompiler } from './lexical-model-compiler.js';
2
+ export { ModelCompilerMessages } from './model-compiler-messages.js';
3
+ //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"debug_id":"70705a10-2a85-53de-a527-92aa4f2e19d0","file":"main.d.ts","mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC","names":[],"sourceRoot":"","sources":["../../src/main.ts"],"version":3}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1,53 +1,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]="d754c5c8-0a2c-5d7a-895e-3a8bec5326f4")}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 Hint_MixedNormalizationForms: (o: {
13
- wordform: string;
14
- }) => CompilerEvent;
15
- static HINT_MixedNormalizationForms: number;
16
- static Hint_DuplicateWordInSameFile: (o: {
17
- wordform: string;
18
- }) => CompilerEvent;
19
- static HINT_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=d754c5c8-0a2c-5d7a-895e-3a8bec5326f4
53
- //# sourceMappingURL=model-compiler-messages.d.ts.map
1
+ import { CompilerEvent } from "@keymanapp/common-types";
2
+ export declare class ModelCompilerMessageContext {
3
+ static line: number;
4
+ static filename: string;
5
+ }
6
+ export declare class ModelCompilerMessages {
7
+ static Fatal_UnexpectedException: (o: {
8
+ e: any;
9
+ }) => CompilerEvent;
10
+ static FATAL_UnexpectedException: number;
11
+ static Hint_MixedNormalizationForms: (o: {
12
+ wordform: string;
13
+ }) => CompilerEvent;
14
+ static HINT_MixedNormalizationForms: number;
15
+ static Hint_DuplicateWordInSameFile: (o: {
16
+ wordform: string;
17
+ }) => CompilerEvent;
18
+ static HINT_DuplicateWordInSameFile: number;
19
+ static Error_UnimplementedModelFormat: (o: {
20
+ format: string;
21
+ }) => CompilerEvent;
22
+ static ERROR_UnimplementedModelFormat: number;
23
+ static Error_UnknownModelFormat: (o: {
24
+ format: string;
25
+ }) => CompilerEvent;
26
+ static ERROR_UnknownModelFormat: number;
27
+ static Error_NoDefaultExport: () => CompilerEvent;
28
+ static ERROR_NoDefaultExport: number;
29
+ static Error_SearchTermToKeyMustBeExplicitlySpecified: () => CompilerEvent;
30
+ static ERROR_SearchTermToKeyMustBeExplicitlySpecified: number;
31
+ static Error_UTF16BEUnsupported: () => CompilerEvent;
32
+ static ERROR_UTF16BEUnsupported: number;
33
+ static Error_UnknownWordBreaker: (o: {
34
+ spec: string;
35
+ }) => CompilerEvent;
36
+ static ERROR_UnknownWordBreaker: number;
37
+ static Error_UnsupportedScriptOverride: (o: {
38
+ option: string;
39
+ }) => CompilerEvent;
40
+ static ERROR_UnsupportedScriptOverride: number;
41
+ }
42
+ /**
43
+ * A ModelCompilerError should be thrown when an unrecoverable error occurs that
44
+ * would block further compilation. It will be caught in the top-most compiler
45
+ * API endpoint and converted into a callback message.
46
+ */
47
+ export declare class ModelCompilerError extends Error {
48
+ event: CompilerEvent;
49
+ constructor(event: CompilerEvent);
50
+ }
51
+ //# sourceMappingURL=model-compiler-messages.d.ts.map
@@ -1 +1 @@
1
- {"debug_id":"d754c5c8-0a2c-5d7a-895e-3a8bec5326f4","file":"model-compiler-messages.d.ts","mappings":";AAAA,OAAO,EAAiD,aAAa,EAAuB,MAAM,yBAAyB,CAAC;AAe5H,qBAAa,2BAA2B;IAEtC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,qBAAqB;IAEhC,MAAM,CAAC,yBAAyB,MAAM;QAAC,CAAC,EAAE,GAAG,CAAA;KAAC,mBAAqE;IACnH,MAAM,CAAC,yBAAyB,SAAqB;IAErD,MAAM,CAAC,4BAA4B,MAAM;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC,mBACkB;IAC7E,MAAM,CAAC,4BAA4B,SAAoB;IAEvD,MAAM,CAAC,4BAA4B,MAAM;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC,mBACY;IACvE,MAAM,CAAC,4BAA4B,SAAoB;IAEvD,MAAM,CAAC,8BAA8B,MAAM;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,mBACd;IAC7C,MAAM,CAAC,8BAA8B,SAAqB;IAE1D,MAAM,CAAC,wBAAwB,MAAM;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,mBACR;IAC7C,MAAM,CAAC,wBAAwB,SAAqB;IAEpD,MAAM,CAAC,qBAAqB,sBACwE;IACpG,MAAM,CAAC,qBAAqB,SAAqB;IAEjD,MAAM,CAAC,8CAA8C,sBACH;IAClD,MAAM,CAAC,8CAA8C,SAAqB;IAE1E,MAAM,CAAC,wBAAwB,sBAAqE;IACpG,MAAM,CAAC,wBAAwB,SAAqB;IAEpD,MAAM,CAAC,wBAAwB,MAAM;QAAC,IAAI,EAAC,MAAM,CAAA;KAAC,mBACb;IACrC,MAAM,CAAC,wBAAwB,SAAqB;IAEpD,MAAM,CAAC,+BAA+B,MAAM;QAAC,MAAM,EAAC,MAAM,CAAA;KAAC,mBACb;IAC9C,MAAM,CAAC,+BAA+B,SAAqB;CAC5D;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IACxB,KAAK,EAAE,aAAa;gBAApB,KAAK,EAAE,aAAa;CAGxC","names":[],"sourceRoot":"","sources":["../../src/model-compiler-messages.ts"],"version":3}
1
+ {"version":3,"file":"model-compiler-messages.d.ts","sourceRoot":"","sources":["../../src/model-compiler-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,aAAa,EAAuB,MAAM,yBAAyB,CAAC;AAe5H,qBAAa,2BAA2B;IAEtC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,qBAAqB;IAEhC,MAAM,CAAC,yBAAyB,MAAM;QAAC,CAAC,EAAE,GAAG,CAAA;KAAC,mBAAqE;IACnH,MAAM,CAAC,yBAAyB,SAAqB;IAErD,MAAM,CAAC,4BAA4B,MAAM;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC,mBACkB;IAC7E,MAAM,CAAC,4BAA4B,SAAoB;IAEvD,MAAM,CAAC,4BAA4B,MAAM;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC,mBACY;IACvE,MAAM,CAAC,4BAA4B,SAAoB;IAEvD,MAAM,CAAC,8BAA8B,MAAM;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,mBACd;IAC7C,MAAM,CAAC,8BAA8B,SAAqB;IAE1D,MAAM,CAAC,wBAAwB,MAAM;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,mBACR;IAC7C,MAAM,CAAC,wBAAwB,SAAqB;IAEpD,MAAM,CAAC,qBAAqB,sBACwE;IACpG,MAAM,CAAC,qBAAqB,SAAqB;IAEjD,MAAM,CAAC,8CAA8C,sBACH;IAClD,MAAM,CAAC,8CAA8C,SAAqB;IAE1E,MAAM,CAAC,wBAAwB,sBAAqE;IACpG,MAAM,CAAC,wBAAwB,SAAqB;IAEpD,MAAM,CAAC,wBAAwB,MAAM;QAAC,IAAI,EAAC,MAAM,CAAA;KAAC,mBACb;IACrC,MAAM,CAAC,wBAAwB,SAAqB;IAEpD,MAAM,CAAC,+BAA+B,MAAM;QAAC,MAAM,EAAC,MAAM,CAAA;KAAC,mBACb;IAC9C,MAAM,CAAC,+BAA+B,SAAqB;CAC5D;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IACxB,KAAK,EAAE,aAAa;gBAApB,KAAK,EAAE,aAAa;CAGxC"}
@@ -1,58 +1,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
+ /// <reference types="@keymanapp/models-types" />
2
+ /**
3
+ * Converts wordforms into an indexable form. It does this by
4
+ * normalizing the letter case of characters INDIVIDUALLY (to disregard
5
+ * context-sensitive case transformations), normalizing to NFKD form,
6
+ * and removing common diacritical marks.
7
+ *
8
+ * This is a very speculative implementation, that might work with
9
+ * your language. We don't guarantee that this will be perfect for your
10
+ * language, but it's a start.
11
+ *
12
+ * This uses String.prototype.normalize() to convert normalize into NFKD.
13
+ * NFKD neutralizes some funky distinctions, e.g., ꬲ, e, e should all be the
14
+ * same character; plus, it's an easy way to separate a Latin character from
15
+ * its diacritics; Even then, orthographies regularly use code points
16
+ * that, under NFKD normalization, do NOT decompose appropriately for your
17
+ * language (e.g., SENĆOŦEN, Plains Cree in syllabics).
18
+ *
19
+ * Use this in early iterations of the model. For a production lexical model,
20
+ * you will probably write/generate your own key function, tailored to your
21
+ * language. There is a chance the default will work properly out of the box.
22
+ */
23
+ export declare function defaultSearchTermToKey(wordform: string): string;
24
+ /**
25
+ * Converts wordforms into an indexable form. It does this by
26
+ * normalizing the letter case of characters INDIVIDUALLY (to disregard
27
+ * context-sensitive case transformations), normalizing to NFKD form,
28
+ * and removing common diacritical marks.
29
+ *
30
+ * This is a very speculative implementation, that might work with
31
+ * your language. We don't guarantee that this will be perfect for your
32
+ * language, but it's a start.
33
+ *
34
+ * This uses String.prototype.normalize() to convert normalize into NFKD.
35
+ * NFKD neutralizes some funky distinctions, e.g., ꬲ, e, e should all be the
36
+ * same character; plus, it's an easy way to separate a Latin character from
37
+ * its diacritics; Even then, orthographies regularly use code points
38
+ * that, under NFKD normalization, do NOT decompose appropriately for your
39
+ * language (e.g., SENĆOŦEN, Plains Cree in syllabics).
40
+ *
41
+ * Use this in early iterations of the model. For a production lexical model,
42
+ * you will probably write/generate your own key function, tailored to your
43
+ * language. There is a chance the default will work properly out of the box.
44
+ */
45
+ export declare function defaultCasedSearchTermToKey(wordform: string, applyCasing: CasingFunction): string;
46
+ /**
47
+ * Specifies default casing behavior for lexical models when `languageUsesCasing` is
48
+ * set to true.
49
+ * @param casing One of 'lower' (lowercased), 'upper' (uppercased), or 'initial'.
50
+ *
51
+ * 'initial' is designed to cover cases like sentence-initial & proper noun capitalization in English.
52
+ * This may be overwritten as appropriate in model-specific implementations.
53
+ * @param text The text to be modified.
54
+ */
55
+ export declare function defaultApplyCasing(casing: CasingForm, text: string): string;
56
+ //# sourceMappingURL=model-defaults.d.ts.map
@@ -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}
1
+ {"version":3,"file":"model-defaults.d.ts","sourceRoot":"","sources":["../../src/model-defaults.ts"],"names":[],"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"}
@@ -1,73 +1,71 @@
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]="da50a2a7-71d5-57a0-9a0c-c905d304ad11")}catch(e){}}();
3
- import { LexicalModelSource, WordformToKeySpec } from "./lexical-model.js";
4
- /**
5
- * Processes certain defined model behaviors in such a way that the needed closures
6
- * may be safely compiled to a JS file and loaded within the LMLayer.
7
- *
8
- * This is accomplished by writing out a 'pseudoclosure' within the model's IIFE,
9
- * then used to build _actual_ closures at LMLayer load time. This 'pseudoclosure'
10
- * will very closely match the organizational patterns of this class in order to
11
- * facilitate the maintenance of this approach.
12
- */
13
- export declare class ModelDefinitions {
14
- static readonly COMPILED_NAME = "definitions";
15
- /**
16
- * A closure fully implementing the model's defined `applyCasing` behavior with
17
- * the function parameter preset to the version-appropriate default.
18
- * `defaults.applyCasing` is captured as part of the closure.
19
- *
20
- * During compilation of some models (such as Trie-based wordlist templated models),
21
- * this closure will be directly used as part of searchTermToKey.
22
- *
23
- * In compiled code, this will instead be defined in-line as an autogenerated closure
24
- * using the other properties of the pseudoclosure.
25
- */
26
- applyCasing?: CasingFunction;
27
- /**
28
- * A closure fully implementing the model's defined `searchTermToKey` behavior
29
- * based upon the model's specified casing rules. The `applyCasing` closure is
30
- * itself captured within this closure.
31
- *
32
- * During compilation of some models (such as Trie-based wordlist templated models),
33
- * this closure will be directly utilized when compiling the lexicon.
34
- *
35
- * In compiled code, this will instead be defined in-line as an autogenerated closure
36
- * using the other properties of the pseudoclosure.
37
- */
38
- searchTermToKey?: WordformToKeySpec;
39
- /**
40
- * Contains embedded 'default' implementations that may be needed for
41
- * closures in the compiled version, annotated with the current version
42
- * of Developer.
43
- */
44
- private defaults;
45
- /**
46
- * Contains the model-specific definitions specified in the model's source.
47
- *
48
- * These definitions may expect `defaults.applyCasing` as a parameter in
49
- * their final closures.
50
- */
51
- private model;
52
- constructor(modelSource: LexicalModelSource);
53
- /**
54
- * Writes out a compiled JS version of the pseudoclosure, preserving all function
55
- * implementations.
56
- *
57
- * This should be written to the file within the same IIFE as the model but BEFORE
58
- * the model itself, as the model will need to refer to the definitions herein.
59
- */
60
- compileDefinitions(): string;
61
- /**
62
- * Compiles the model-options entry for `searchTermToKey` in reference to the
63
- * compiled pseudoclosure.
64
- */
65
- compileSearchTermToKey(): string;
66
- /**
67
- * Compiles the model-options entry for `applyCasing` in reference to the
68
- * compiled pseudoclosure.
69
- */
70
- compileApplyCasing(): string;
71
- }
72
- //# debugId=da50a2a7-71d5-57a0-9a0c-c905d304ad11
73
- //# sourceMappingURL=model-definitions.d.ts.map
1
+ /// <reference types="@keymanapp/models-types" />
2
+ import { LexicalModelSource, WordformToKeySpec } from "./lexical-model.js";
3
+ /**
4
+ * Processes certain defined model behaviors in such a way that the needed closures
5
+ * may be safely compiled to a JS file and loaded within the LMLayer.
6
+ *
7
+ * This is accomplished by writing out a 'pseudoclosure' within the model's IIFE,
8
+ * then used to build _actual_ closures at LMLayer load time. This 'pseudoclosure'
9
+ * will very closely match the organizational patterns of this class in order to
10
+ * facilitate the maintenance of this approach.
11
+ */
12
+ export declare class ModelDefinitions {
13
+ static readonly COMPILED_NAME = "definitions";
14
+ /**
15
+ * A closure fully implementing the model's defined `applyCasing` behavior with
16
+ * the function parameter preset to the version-appropriate default.
17
+ * `defaults.applyCasing` is captured as part of the closure.
18
+ *
19
+ * During compilation of some models (such as Trie-based wordlist templated models),
20
+ * this closure will be directly used as part of searchTermToKey.
21
+ *
22
+ * In compiled code, this will instead be defined in-line as an autogenerated closure
23
+ * using the other properties of the pseudoclosure.
24
+ */
25
+ applyCasing?: CasingFunction;
26
+ /**
27
+ * A closure fully implementing the model's defined `searchTermToKey` behavior
28
+ * based upon the model's specified casing rules. The `applyCasing` closure is
29
+ * itself captured within this closure.
30
+ *
31
+ * During compilation of some models (such as Trie-based wordlist templated models),
32
+ * this closure will be directly utilized when compiling the lexicon.
33
+ *
34
+ * In compiled code, this will instead be defined in-line as an autogenerated closure
35
+ * using the other properties of the pseudoclosure.
36
+ */
37
+ searchTermToKey?: WordformToKeySpec;
38
+ /**
39
+ * Contains embedded 'default' implementations that may be needed for
40
+ * closures in the compiled version, annotated with the current version
41
+ * of Developer.
42
+ */
43
+ private defaults;
44
+ /**
45
+ * Contains the model-specific definitions specified in the model's source.
46
+ *
47
+ * These definitions may expect `defaults.applyCasing` as a parameter in
48
+ * their final closures.
49
+ */
50
+ private model;
51
+ constructor(modelSource: LexicalModelSource);
52
+ /**
53
+ * Writes out a compiled JS version of the pseudoclosure, preserving all function
54
+ * implementations.
55
+ *
56
+ * This should be written to the file within the same IIFE as the model but BEFORE
57
+ * the model itself, as the model will need to refer to the definitions herein.
58
+ */
59
+ compileDefinitions(): string;
60
+ /**
61
+ * Compiles the model-options entry for `searchTermToKey` in reference to the
62
+ * compiled pseudoclosure.
63
+ */
64
+ compileSearchTermToKey(): string;
65
+ /**
66
+ * Compiles the model-options entry for `applyCasing` in reference to the
67
+ * compiled pseudoclosure.
68
+ */
69
+ compileApplyCasing(): string;
70
+ }
71
+ //# sourceMappingURL=model-definitions.d.ts.map
@@ -1 +1 @@
1
- {"debug_id":"da50a2a7-71d5-57a0-9a0c-c905d304ad11","file":"model-definitions.d.ts","mappings":";;AAMA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE3E;;;;;;;;GAQG;AACH,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,aAAa,iBAAiB;IAC9C;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAE7B;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAEpC;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAKd;IAEF;;;;;OAKG;IACH,OAAO,CAAC,KAAK,CAGN;gBAEK,WAAW,EAAE,kBAAkB;IAsD3C;;;;;;OAMG;IACH,kBAAkB,IAAI,MAAM;IAuE5B;;;OAGG;IACH,sBAAsB,IAAI,MAAM;IAMhC;;;OAGG;IACH,kBAAkB,IAAI,MAAM;CAI7B","names":[],"sourceRoot":"","sources":["../../src/model-definitions.ts"],"version":3}
1
+ {"version":3,"file":"model-definitions.d.ts","sourceRoot":"","sources":["../../src/model-definitions.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE3E;;;;;;;;GAQG;AACH,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,aAAa,iBAAiB;IAC9C;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAE7B;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAEpC;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAKd;IAEF;;;;;OAKG;IACH,OAAO,CAAC,KAAK,CAGN;gBAEK,WAAW,EAAE,kBAAkB;IAsD3C;;;;;;OAMG;IACH,kBAAkB,IAAI,MAAM;IAuE5B;;;OAGG;IACH,sBAAsB,IAAI,MAAM;IAMhC;;;OAGG;IACH,kBAAkB,IAAI,MAAM;CAI7B"}
@@ -1,6 +1,4 @@
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]="82b84a7e-8421-59a6-8b07-a1c5850d036b")}catch(e){}}();
3
- import { OverrideScriptDefaults } from "./lexical-model.js";
4
- export declare function decorateWithScriptOverrides(breaker: WordBreakingFunction, option: OverrideScriptDefaults): (phrase: string) => Span[];
5
- //# debugId=82b84a7e-8421-59a6-8b07-a1c5850d036b
6
- //# sourceMappingURL=script-overrides-decorator.d.ts.map
1
+ /// <reference types="@keymanapp/models-types" />
2
+ import { OverrideScriptDefaults } from "./lexical-model.js";
3
+ export declare function decorateWithScriptOverrides(breaker: WordBreakingFunction, option: OverrideScriptDefaults): (phrase: string) => Span[];
4
+ //# sourceMappingURL=script-overrides-decorator.d.ts.map
@@ -1 +1 @@
1
- {"debug_id":"82b84a7e-8421-59a6-8b07-a1c5850d036b","file":"script-overrides-decorator.d.ts","mappings":";;AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,sBAAsB,YAgB/D,MAAM,KAAG,IAAI,EAAE,CAwDxD","names":[],"sourceRoot":"","sources":["../../src/script-overrides-decorator.ts"],"version":3}
1
+ {"version":3,"file":"script-overrides-decorator.d.ts","sourceRoot":"","sources":["../../src/script-overrides-decorator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,sBAAsB,YAgB/D,MAAM,KAAG,IAAI,EAAE,CAwDxD"}
package/package.json CHANGED
@@ -30,13 +30,13 @@
30
30
  "url": "https://github.com/keymanapp/keyman/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@keymanapp/common-types": "17.0.256-alpha",
34
- "@keymanapp/keyman-version": "17.0.256-alpha",
35
- "@keymanapp/models-types": "17.0.256-alpha",
33
+ "@keymanapp/common-types": "17.0.258-alpha",
34
+ "@keymanapp/keyman-version": "17.0.258-alpha",
35
+ "@keymanapp/models-types": "17.0.258-alpha",
36
36
  "typescript": "^4.9.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@keymanapp/developer-test-helpers": "17.0.256-alpha",
39
+ "@keymanapp/developer-test-helpers": "17.0.258-alpha",
40
40
  "@types/chai": "^4.1.7",
41
41
  "@types/mocha": "^5.2.7",
42
42
  "@types/node": "^20.4.1",
@@ -69,5 +69,5 @@
69
69
  "type": "git",
70
70
  "url": "git+https://github.com/keymanapp/keyman.git"
71
71
  },
72
- "version": "17.0.256-alpha"
72
+ "version": "17.0.258-alpha"
73
73
  }