@mailwoman/sentencepiece-wasm 9.1.0 → 9.3.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/binding.cpp CHANGED
@@ -4,7 +4,7 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
6
  * Embind wrapper for google/sentencepiece v0.2.2 — the mailwoman tokenizer's WASM core (task #26,
7
- * the SP 0.2.2 native-offsets lever from the 2026-07-30 Latin tokenizer survey).
7
+ * the SP 0.2.2 native-offsets change from the 2026-07-30 Latin tokenizer survey).
8
8
  *
9
9
  * Why this exists: the previous runtime (`@sctg/sentencepiece-js`, an emscripten build of an older
10
10
  * sentencepiece) exposed pieces + ids but never bound the offset-carrying proto API, forcing
@@ -21,7 +21,7 @@
21
21
  * - `encodeWithOffsets(text)` — returns { pieces: string[], ids: Int32Array-like, begins, ends }
22
22
  * where begins/ends are UTF-8 BYTE offsets into the input. The TS layer owns the byte→UTF-16
23
23
  * conversion (exact, via a code-point walk — see neural/tokenizer.ts).
24
- * - `decodeIds(ids)` — detokenize back to a string.
24
+ * - `decodeIDs(ids)` — detokenize back to a string.
25
25
  *
26
26
  * Build: `./build.sh` (fetches sentencepiece at the pinned tag, emcmake+emmake, links this file
27
27
  * with embind, emits the committed single-file ESM artifact `sentencepiece.mjs`).
@@ -96,7 +96,7 @@ public:
96
96
  * Detokenize ids back to text. Invalid ids surface as the empty string plus the error field on
97
97
  * the wrapper's contract being violated upstream — the TS layer validates lengths.
98
98
  */
99
- std::string decodeIds(const std::vector<int>& ids) const {
99
+ std::string decodeIDs(const std::vector<int>& ids) const {
100
100
  std::string out;
101
101
  const auto status = processor_.Decode(ids, &out);
102
102
  return status.ok() ? out : std::string();
@@ -115,5 +115,5 @@ EMSCRIPTEN_BINDINGS(sentencepiece_wasm) {
115
115
  .constructor<>()
116
116
  .function("loadFromSerializedProto", &SentencePieceWASM::loadFromSerializedProto)
117
117
  .function("encodeWithOffsets", &SentencePieceWASM::encodeWithOffsets)
118
- .function("decodeIds", &SentencePieceWASM::decodeIds);
118
+ .function("decodeIDs", &SentencePieceWASM::decodeIDs);
119
119
  }
package/index.d.ts CHANGED
@@ -36,7 +36,7 @@ export declare class SentencePieceProcessor {
36
36
  */
37
37
  loadFromSerializedProto(serialized: Uint8Array): string
38
38
  encodeWithOffsets(text: string): EncodeWithOffsetsResult
39
- decodeIds(ids: IntVector): string
39
+ decodeIDs(ids: IntVector): string
40
40
  /**
41
41
  * Embind object lifetime: the processor owns WASM-heap memory — call when done (long-lived singletons in practice
42
42
  * never do).
package/package.json CHANGED
@@ -1,20 +1,28 @@
1
1
  {
2
2
  "name": "@mailwoman/sentencepiece-wasm",
3
- "version": "9.1.0",
3
+ "version": "9.3.0",
4
4
  "description": "google/sentencepiece v0.2.2 compiled to WASM with a native-offsets binding — the tokenizer core for @mailwoman/neural. Single-file ESM (wasm embedded), no runtime deps; per-piece byte offsets come from SentencePiece itself instead of TS-side reconstruction.",
5
5
  "license": "AGPL-3.0-only OR LicenseRef-Commercial",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/sister-software/mailwoman.git",
9
- "directory": "sentencepiece-wasm"
9
+ "directory": "packages/sentencepiece-wasm"
10
10
  },
11
11
  "files": [
12
12
  "sentencepiece.mjs",
13
13
  "index.d.ts",
14
14
  "binding.cpp",
15
- "build.sh"
15
+ "build.sh",
16
+ "!test/**"
16
17
  ],
17
18
  "type": "module",
19
+ "imports": {
20
+ "#*": {
21
+ "types": "./out/*.d.ts",
22
+ "node": "./out/*.js",
23
+ "default": "./out/*.js"
24
+ }
25
+ },
18
26
  "exports": {
19
27
  "./package.json": "./package.json",
20
28
  ".": {
@@ -29,6 +37,13 @@
29
37
  "types": "./index.d.ts",
30
38
  "default": "./sentencepiece.mjs"
31
39
  }
40
+ },
41
+ "imports": {
42
+ "#*": {
43
+ "types": "./out/*.d.ts",
44
+ "node": "./out/*.js",
45
+ "default": "./out/*.js"
46
+ }
32
47
  }
33
48
  }
34
49
  }
package/sentencepiece.mjs CHANGED
Binary file