@atlaskit/editor-plugin-autocomplete 8.0.0 → 9.0.0
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/CHANGELOG.md +80 -0
- package/dist/cjs/analytics/ufo.js +2 -1
- package/dist/cjs/pm-plugins/artifact-loader.js +135 -0
- package/dist/cjs/pm-plugins/artifacts-manifest.js +3 -0
- package/dist/cjs/pm-plugins/autocomplete-plugin.js +416 -129
- package/dist/cjs/pm-plugins/canonical-lm-scoring.js +371 -0
- package/dist/cjs/pm-plugins/debug-mode.js +90 -7
- package/dist/cjs/pm-plugins/ghost-text-decoration.js +12 -3
- package/dist/cjs/pm-plugins/local-slow-lane-client.js +1202 -453
- package/dist/cjs/pm-plugins/scoring-pipeline.js +164 -19
- package/dist/cjs/pm-plugins/slow-lane-client.js +100 -37
- package/dist/cjs/pm-plugins/text-predictor.js +1951 -273
- package/dist/es2019/analytics/ufo.js +2 -0
- package/dist/es2019/pm-plugins/artifact-loader.js +70 -0
- package/dist/es2019/pm-plugins/artifacts-manifest.js +3 -0
- package/dist/es2019/pm-plugins/autocomplete-plugin.js +425 -130
- package/dist/es2019/pm-plugins/canonical-lm-scoring.js +270 -0
- package/dist/es2019/pm-plugins/debug-mode.js +87 -7
- package/dist/es2019/pm-plugins/ghost-text-decoration.js +12 -3
- package/dist/es2019/pm-plugins/local-slow-lane-client.js +940 -326
- package/dist/es2019/pm-plugins/scoring-pipeline.js +137 -13
- package/dist/es2019/pm-plugins/slow-lane-client.js +94 -37
- package/dist/es2019/pm-plugins/text-predictor.js +1603 -199
- package/dist/esm/analytics/ufo.js +2 -1
- package/dist/esm/pm-plugins/artifact-loader.js +128 -0
- package/dist/esm/pm-plugins/artifacts-manifest.js +3 -0
- package/dist/esm/pm-plugins/autocomplete-plugin.js +419 -132
- package/dist/esm/pm-plugins/canonical-lm-scoring.js +364 -0
- package/dist/esm/pm-plugins/debug-mode.js +89 -6
- package/dist/esm/pm-plugins/ghost-text-decoration.js +12 -3
- package/dist/esm/pm-plugins/local-slow-lane-client.js +1200 -451
- package/dist/esm/pm-plugins/scoring-pipeline.js +163 -18
- package/dist/esm/pm-plugins/slow-lane-client.js +100 -37
- package/dist/esm/pm-plugins/text-predictor.js +1953 -277
- package/dist/types/analytics/ufo.d.ts +1 -0
- package/dist/types/pm-plugins/artifact-loader.d.ts +44 -0
- package/dist/types/pm-plugins/artifacts-manifest.d.ts +3 -0
- package/dist/types/pm-plugins/autocomplete-plugin.d.ts +39 -0
- package/dist/types/pm-plugins/canonical-lm-scoring.d.ts +158 -0
- package/dist/types/pm-plugins/debug-mode.d.ts +36 -1
- package/dist/types/pm-plugins/ghost-text-decoration.d.ts +5 -2
- package/dist/types/pm-plugins/local-slow-lane-client.d.ts +87 -54
- package/dist/types/pm-plugins/scoring-pipeline.d.ts +33 -1
- package/dist/types/pm-plugins/slow-lane-client.d.ts +51 -3
- package/dist/types/pm-plugins/text-predictor.d.ts +120 -2
- package/package.json +2 -2
- package/src/analytics/ufo.ts +5 -0
- package/src/pm-plugins/artifact-loader.ts +92 -0
- package/src/pm-plugins/artifacts-manifest.ts +3 -0
- package/src/pm-plugins/autocomplete-plugin.ts +517 -133
- package/src/pm-plugins/canonical-lm-scoring.ts +412 -0
- package/src/pm-plugins/debug-mode.ts +109 -7
- package/src/pm-plugins/ghost-text-decoration.ts +13 -4
- package/src/pm-plugins/local-slow-lane-client.ts +1302 -386
- package/src/pm-plugins/scoring-pipeline.ts +167 -17
- package/src/pm-plugins/slow-lane-client.ts +147 -62
- package/src/pm-plugins/text-predictor.ts +2006 -255
- package/CANONICAL_FIX__DO_NOT_USE_ME_A/package.json +0 -8
- package/CANONICAL_FIX__DO_NOT_USE_ME_B/package.json +0 -8
- package/CANONICAL_FIX__DO_NOT_USE_ME_C/package.json +0 -8
- package/dist/cjs/entry-points/src-pm-plugins-autocomplete-plugin.js +0 -18
- package/dist/cjs/entry-points/src-pm-plugins-slow-lane-client.js +0 -36
- package/dist/cjs/entry-points/src-pm-plugins-text-predictor.js +0 -66
- package/dist/es2019/entry-points/src-pm-plugins-autocomplete-plugin.js +0 -2
- package/dist/es2019/entry-points/src-pm-plugins-slow-lane-client.js +0 -2
- package/dist/es2019/entry-points/src-pm-plugins-text-predictor.js +0 -2
- package/dist/esm/entry-points/src-pm-plugins-autocomplete-plugin.js +0 -2
- package/dist/esm/entry-points/src-pm-plugins-slow-lane-client.js +0 -2
- package/dist/esm/entry-points/src-pm-plugins-text-predictor.js +0 -2
- package/dist/types/entry-points/src-pm-plugins-autocomplete-plugin.d.ts +0 -2
- package/dist/types/entry-points/src-pm-plugins-slow-lane-client.d.ts +0 -2
- package/dist/types/entry-points/src-pm-plugins-text-predictor.d.ts +0 -2
- package/scripts/gen_first_token_to_words.py +0 -170
- package/src/entry-points/src-pm-plugins-autocomplete-plugin.ts +0 -7
- package/src/entry-points/src-pm-plugins-slow-lane-client.ts +0 -13
- package/src/entry-points/src-pm-plugins-text-predictor.ts +0 -14
- package/src/pm-plugins/autocomplete-plugin/package.json +0 -8
- package/src/pm-plugins/slow-lane-client/package.json +0 -8
- package/src/pm-plugins/text-predictor/package.json +0 -8
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/editor-plugin-autocomplete/CANONICAL_FIX__DO_NOT_USE_ME_A",
|
|
3
|
-
"main": "../dist/cjs/pm-plugins/autocomplete-plugin.js",
|
|
4
|
-
"module": "../dist/esm/pm-plugins/autocomplete-plugin.js",
|
|
5
|
-
"module:es2019": "../dist/es2019/pm-plugins/autocomplete-plugin.js",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/pm-plugins/autocomplete-plugin.d.ts"
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/editor-plugin-autocomplete/CANONICAL_FIX__DO_NOT_USE_ME_B",
|
|
3
|
-
"main": "../dist/cjs/pm-plugins/slow-lane-client.js",
|
|
4
|
-
"module": "../dist/esm/pm-plugins/slow-lane-client.js",
|
|
5
|
-
"module:es2019": "../dist/es2019/pm-plugins/slow-lane-client.js",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/pm-plugins/slow-lane-client.d.ts"
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/editor-plugin-autocomplete/CANONICAL_FIX__DO_NOT_USE_ME_C",
|
|
3
|
-
"main": "../dist/cjs/pm-plugins/text-predictor.js",
|
|
4
|
-
"module": "../dist/esm/pm-plugins/text-predictor.js",
|
|
5
|
-
"module:es2019": "../dist/es2019/pm-plugins/text-predictor.js",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/pm-plugins/text-predictor.d.ts"
|
|
8
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "autocompletePluginKey", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _autocompletePlugin.autocompletePluginKey;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "createAutocompletePlugin", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _autocompletePlugin.createAutocompletePlugin;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _autocompletePlugin = require("../pm-plugins/autocomplete-plugin");
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "createSlowLaneClient", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _slowLaneClient.createSlowLaneClient;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "getStoredContextVector", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _slowLaneClient.getStoredContextVector;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "getStoredLmLogits", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _slowLaneClient.getStoredLmLogits;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "isWordBoundary", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _slowLaneClient.isWordBoundary;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "setDefaultSlowLaneClient", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _slowLaneClient.setDefaultSlowLaneClient;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
var _slowLaneClient = require("../pm-plugins/slow-lane-client");
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "getLastPredictionDebug", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _textPredictor.getLastPredictionDebug;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "getPredictorStatus", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _textPredictor.getPredictorStatus;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "incrementSessionFreq", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _textPredictor.incrementSessionFreq;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "ingestDocumentPage", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _textPredictor.ingestDocumentPage;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "initL3Vocabulary", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _textPredictor.initL3Vocabulary;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "initVectors", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _textPredictor.initVectors;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "initVocabulary", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _textPredictor.initVocabulary;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "loadDefaultVocabulary", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function get() {
|
|
51
|
-
return _textPredictor.loadDefaultVocabulary;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "loadVectorsAsync", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function get() {
|
|
57
|
-
return _textPredictor.loadVectorsAsync;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "predict", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function get() {
|
|
63
|
-
return _textPredictor.predict;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
var _textPredictor = require("../pm-plugins/text-predictor");
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export { getLastPredictionDebug, getPredictorStatus, incrementSessionFreq, ingestDocumentPage, initL3Vocabulary, initVectors, initVocabulary, loadDefaultVocabulary, loadVectorsAsync, predict } from '../pm-plugins/text-predictor';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export { getLastPredictionDebug, getPredictorStatus, incrementSessionFreq, ingestDocumentPage, initL3Vocabulary, initVectors, initVocabulary, loadDefaultVocabulary, loadVectorsAsync, predict } from '../pm-plugins/text-predictor';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { createSlowLaneClient, getStoredContextVector, getStoredLmLogits, isWordBoundary, setDefaultSlowLaneClient, } from '../pm-plugins/slow-lane-client';
|
|
2
|
-
export type { SlowLaneClientConfig, TypeaheadEncodingsRequest, TypeaheadEncodingsResponse, } from '../pm-plugins/slow-lane-client';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { getLastPredictionDebug, getPredictorStatus, incrementSessionFreq, ingestDocumentPage, initL3Vocabulary, initVectors, initVocabulary, loadDefaultVocabulary, loadVectorsAsync, predict, } from '../pm-plugins/text-predictor';
|
|
2
|
-
export type { TenantVocabulary, WeightedTerm } from '../pm-plugins/text-predictor';
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Offline build script: generate `first_token_to_words.json`.
|
|
4
|
-
|
|
5
|
-
This is a ONE-TIME / build-time tool. It is never imported by the plugin and
|
|
6
|
-
never runs in CI. It reproduces the prefix-expansion map that the BE sidecar
|
|
7
|
-
builds in-memory at runtime (`cc-smarts/python-sidecar/src/causal_lm_encoder.py`
|
|
8
|
-
`CausalLMEncoder._ensure_loaded`), so the local (client-only) slow-lane client
|
|
9
|
-
can ship it as a static artifact instead of running a tokenizer in the browser.
|
|
10
|
-
|
|
11
|
-
The output maps each SmolLM2 first-token id to every L2/L3 vocabulary word whose
|
|
12
|
-
space-prefixed encoding starts with that token. The local client loads it and,
|
|
13
|
-
per inference, spreads the next-token logit mass over whole words (masked softmax
|
|
14
|
-
+ prefix expansion) to match the BE's whole-word `lm_logits` payload.
|
|
15
|
-
|
|
16
|
-
Three details MUST match the BE exactly, or the map is silently wrong:
|
|
17
|
-
1. Tokenizer = HuggingFaceTB/SmolLM2-135M (base; vocab identical to Instruct).
|
|
18
|
-
2. Leading space: encode(" " + word) — BPE tokenizes " word" != "word".
|
|
19
|
-
3. add_special_tokens=False — no BOS/EOS, we want the word's own first token.
|
|
20
|
-
|
|
21
|
-
Usage:
|
|
22
|
-
pip install transformers # torch NOT required (SmolLM2 uses a fast tokenizer)
|
|
23
|
-
python scripts/gen_first_token_to_words.py
|
|
24
|
-
|
|
25
|
-
Run it from anywhere — paths are resolved relative to this file's location.
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
import os
|
|
29
|
-
import json
|
|
30
|
-
import collections
|
|
31
|
-
|
|
32
|
-
from transformers import AutoTokenizer
|
|
33
|
-
|
|
34
|
-
# Ground truth: must match the BE tokenizer (causal_lm_encoder.py line 30).
|
|
35
|
-
TOKENIZER_NAME = "HuggingFaceTB/SmolLM2-135M"
|
|
36
|
-
|
|
37
|
-
# Resolve data paths relative to this script, so cwd does not matter.
|
|
38
|
-
_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
39
|
-
_DATA_DIR = os.path.join(_SCRIPT_DIR, "..", "src", "pm-plugins", "data")
|
|
40
|
-
L2_PATH = os.path.join(_DATA_DIR, "vocabulary_10k.json")
|
|
41
|
-
L3_PATH = os.path.join(_DATA_DIR, "l3_vocabulary.json")
|
|
42
|
-
OUT_PATH = os.path.join(_DATA_DIR, "first_token_to_words.json")
|
|
43
|
-
|
|
44
|
-
# Probe words for the post-build sanity check.
|
|
45
|
-
# Must be words that actually appear in vocabulary_10k.json (L2) or l3_vocabulary.json (L3).
|
|
46
|
-
# Common stop words like "the" / "a" are NOT in either vocabulary by design.
|
|
47
|
-
# L2 confirmed: "atlassian", "service", "product", "customer" (vocabulary_10k.json lines 3-18)
|
|
48
|
-
# L3 confirmed: "about", "search", "information", "business" (l3_vocabulary.json lines 2-15)
|
|
49
|
-
_PROBE_WORDS = ["atlassian", "service", "product", "about", "search"]
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def load_l2_words(path):
|
|
53
|
-
"""
|
|
54
|
-
Load the L2 (Atlassian-domain) vocabulary as a set of words.
|
|
55
|
-
|
|
56
|
-
The file shape is {"words": {"<word>": {freq, ...}}}, matching the BE's
|
|
57
|
-
`vocab_data.get("words", {})`. Only the keys are needed.
|
|
58
|
-
|
|
59
|
-
:params:
|
|
60
|
-
path: Absolute path to vocabulary_10k.json
|
|
61
|
-
:returns:
|
|
62
|
-
A set of L2 word strings
|
|
63
|
-
"""
|
|
64
|
-
with open(path, "r") as f:
|
|
65
|
-
data = json.load(f)
|
|
66
|
-
return set(data["words"].keys())
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def load_l3_words(path):
|
|
70
|
-
"""
|
|
71
|
-
Load the L3 (general English) vocabulary as a list of words.
|
|
72
|
-
|
|
73
|
-
The file shape is a flat JSON array of strings, matching the BE's L3 list.
|
|
74
|
-
|
|
75
|
-
:params:
|
|
76
|
-
path: Absolute path to l3_vocabulary.json
|
|
77
|
-
:returns:
|
|
78
|
-
A list of L3 word strings
|
|
79
|
-
"""
|
|
80
|
-
with open(path, "r") as f:
|
|
81
|
-
return json.load(f)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def build_first_token_map(tokenizer, words):
|
|
85
|
-
"""
|
|
86
|
-
Build the first-token-id -> [words] prefix-expansion map.
|
|
87
|
-
|
|
88
|
-
Mirrors the BE loop exactly: each word is encoded with a leading space and
|
|
89
|
-
no special tokens, and the word is bucketed under its first token id. A set
|
|
90
|
-
of words is expected so each word is processed once (L2/L3 overlap removed).
|
|
91
|
-
|
|
92
|
-
:params:
|
|
93
|
-
tokenizer: A HuggingFace tokenizer for SmolLM2
|
|
94
|
-
words: An iterable of unique words (L2 union L3)
|
|
95
|
-
:returns:
|
|
96
|
-
A dict mapping int first-token-id to a list of word strings
|
|
97
|
-
"""
|
|
98
|
-
table = collections.defaultdict(list)
|
|
99
|
-
for word in words:
|
|
100
|
-
ids = tokenizer.encode(" " + word, add_special_tokens=False)
|
|
101
|
-
if ids:
|
|
102
|
-
table[ids[0]].append(word)
|
|
103
|
-
return table
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def verify_map(tokenizer, table, probe_words):
|
|
107
|
-
"""
|
|
108
|
-
Sanity-check the generated map by confirming probe words land in the right
|
|
109
|
-
first-token bucket.
|
|
110
|
-
|
|
111
|
-
:params:
|
|
112
|
-
tokenizer: The same SmolLM2 tokenizer used to build the map
|
|
113
|
-
table: The dict mapping int first-token-id to a list of words
|
|
114
|
-
probe_words: A list of words expected to be present in the map
|
|
115
|
-
:returns:
|
|
116
|
-
None. Raises AssertionError if any probe word is missing or misplaced.
|
|
117
|
-
"""
|
|
118
|
-
for word in probe_words:
|
|
119
|
-
ids = tokenizer.encode(" " + word, add_special_tokens=False)
|
|
120
|
-
assert ids, f"Probe word '{word}' produced no tokens"
|
|
121
|
-
first_token_id = ids[0]
|
|
122
|
-
bucket = table.get(first_token_id, [])
|
|
123
|
-
assert word in bucket, (
|
|
124
|
-
f"Probe word '{word}' missing under token {first_token_id} "
|
|
125
|
-
f"(bucket head: {bucket[:5]})"
|
|
126
|
-
)
|
|
127
|
-
print(f" OK: '{word}' -> token {first_token_id} -> {bucket[:5]}...")
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def main():
|
|
131
|
-
"""
|
|
132
|
-
Generate first_token_to_words.json from the L2 and L3 vocabularies.
|
|
133
|
-
|
|
134
|
-
:params:
|
|
135
|
-
None
|
|
136
|
-
:returns:
|
|
137
|
-
None. Writes the JSON artifact to OUT_PATH and prints a summary.
|
|
138
|
-
"""
|
|
139
|
-
print(f"[gen] Loading tokenizer: {TOKENIZER_NAME} ...")
|
|
140
|
-
tokenizer = AutoTokenizer.from_pretrained(TOKENIZER_NAME)
|
|
141
|
-
|
|
142
|
-
print(f"[gen] Loading vocabularies ...")
|
|
143
|
-
l2_words = load_l2_words(L2_PATH)
|
|
144
|
-
l3_words = load_l3_words(L3_PATH)
|
|
145
|
-
all_words = l2_words.union(l3_words)
|
|
146
|
-
|
|
147
|
-
print(f"[gen] Building prefix-expansion map for {len(all_words)} words ...")
|
|
148
|
-
table = build_first_token_map(tokenizer, all_words)
|
|
149
|
-
|
|
150
|
-
# JSON object keys must be strings; the FE parses them back with Number(key).
|
|
151
|
-
out = {str(token_id): words for token_id, words in table.items()}
|
|
152
|
-
with open(OUT_PATH, "w") as f:
|
|
153
|
-
json.dump(out, f)
|
|
154
|
-
|
|
155
|
-
total_words = sum(len(v) for v in table.values())
|
|
156
|
-
print(
|
|
157
|
-
f"[gen] Mapped {len(all_words)} words ({len(l2_words)} L2) "
|
|
158
|
-
f"-> {len(table)} unique first-tokens ({total_words} word entries)"
|
|
159
|
-
)
|
|
160
|
-
|
|
161
|
-
print(f"[gen] Verifying probe words ...")
|
|
162
|
-
verify_map(tokenizer, table, _PROBE_WORDS)
|
|
163
|
-
|
|
164
|
-
out_abs = os.path.abspath(OUT_PATH)
|
|
165
|
-
size_kb = os.path.getsize(OUT_PATH) / 1024
|
|
166
|
-
print(f"[gen] Wrote {out_abs} ({size_kb:.0f} KB)")
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if __name__ == "__main__":
|
|
170
|
-
main()
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export { autocompletePluginKey, createAutocompletePlugin } from '../pm-plugins/autocomplete-plugin';
|
|
3
|
-
export type {
|
|
4
|
-
AutocompleteContext,
|
|
5
|
-
AutocompletePluginOptions,
|
|
6
|
-
AutocompletePluginState,
|
|
7
|
-
} from '../pm-plugins/autocomplete-plugin';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export {
|
|
3
|
-
createSlowLaneClient,
|
|
4
|
-
getStoredContextVector,
|
|
5
|
-
getStoredLmLogits,
|
|
6
|
-
isWordBoundary,
|
|
7
|
-
setDefaultSlowLaneClient,
|
|
8
|
-
} from '../pm-plugins/slow-lane-client';
|
|
9
|
-
export type {
|
|
10
|
-
SlowLaneClientConfig,
|
|
11
|
-
TypeaheadEncodingsRequest,
|
|
12
|
-
TypeaheadEncodingsResponse,
|
|
13
|
-
} from '../pm-plugins/slow-lane-client';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export {
|
|
3
|
-
getLastPredictionDebug,
|
|
4
|
-
getPredictorStatus,
|
|
5
|
-
incrementSessionFreq,
|
|
6
|
-
ingestDocumentPage,
|
|
7
|
-
initL3Vocabulary,
|
|
8
|
-
initVectors,
|
|
9
|
-
initVocabulary,
|
|
10
|
-
loadDefaultVocabulary,
|
|
11
|
-
loadVectorsAsync,
|
|
12
|
-
predict,
|
|
13
|
-
} from '../pm-plugins/text-predictor';
|
|
14
|
-
export type { TenantVocabulary, WeightedTerm } from '../pm-plugins/text-predictor';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/editor-plugin-autocomplete/src/pm-plugins/autocomplete-plugin",
|
|
3
|
-
"main": "../../../dist/cjs/entry-points/src-pm-plugins-autocomplete-plugin.js",
|
|
4
|
-
"module": "../../../dist/esm/entry-points/src-pm-plugins-autocomplete-plugin.js",
|
|
5
|
-
"module:es2019": "../../../dist/es2019/entry-points/src-pm-plugins-autocomplete-plugin.js",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"types": "../../../dist/types/entry-points/src-pm-plugins-autocomplete-plugin.d.ts"
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/editor-plugin-autocomplete/src/pm-plugins/slow-lane-client",
|
|
3
|
-
"main": "../../../dist/cjs/entry-points/src-pm-plugins-slow-lane-client.js",
|
|
4
|
-
"module": "../../../dist/esm/entry-points/src-pm-plugins-slow-lane-client.js",
|
|
5
|
-
"module:es2019": "../../../dist/es2019/entry-points/src-pm-plugins-slow-lane-client.js",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"types": "../../../dist/types/entry-points/src-pm-plugins-slow-lane-client.d.ts"
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/editor-plugin-autocomplete/src/pm-plugins/text-predictor",
|
|
3
|
-
"main": "../../../dist/cjs/entry-points/src-pm-plugins-text-predictor.js",
|
|
4
|
-
"module": "../../../dist/esm/entry-points/src-pm-plugins-text-predictor.js",
|
|
5
|
-
"module:es2019": "../../../dist/es2019/entry-points/src-pm-plugins-text-predictor.js",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"types": "../../../dist/types/entry-points/src-pm-plugins-text-predictor.d.ts"
|
|
8
|
-
}
|