tomos 0.1.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.
- checksums.yaml +7 -0
- data/Cargo.lock +825 -0
- data/Cargo.toml +6 -0
- data/ext/tomos/Cargo.toml +16 -0
- data/ext/tomos/extconf.rb +4 -0
- data/ext/tomos/src/lib.rs +89 -0
- data/lib/tomos/tomos.bundle +0 -0
- data/lib/tomos/version.rb +5 -0
- data/lib/tomos.rb +4 -0
- metadata +62 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7c74f281acc538880271bcdb2face54257d5f9bcf052545ed2fc1dd14a3fd14d
|
|
4
|
+
data.tar.gz: 6e5ad11384eb2a1a201abb3c9ecf0a2cc3fb4fbebcb06bd3894ab339a5b20c05
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2b760a8366624a206bac3263b00ec5e741ac95af3d4e1022f3ac92ba5607bd9d70cf9b867c3fba5779faee89eab77f81f1d8675770d0ac16e02f84f0bf04a50d
|
|
7
|
+
data.tar.gz: 1320c81c79e91005731657752acb25f2b8e4449bb22e413489b3de4a137826ee85d1d08c836818eae3146003441388963cf789c46682219cefb1ab490284a5a0
|
data/Cargo.lock
ADDED
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "ahash"
|
|
7
|
+
version = "0.8.12"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"cfg-if",
|
|
12
|
+
"getrandom",
|
|
13
|
+
"once_cell",
|
|
14
|
+
"version_check",
|
|
15
|
+
"zerocopy",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[[package]]
|
|
19
|
+
name = "aho-corasick"
|
|
20
|
+
version = "1.1.4"
|
|
21
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
22
|
+
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
|
23
|
+
dependencies = [
|
|
24
|
+
"memchr",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[[package]]
|
|
28
|
+
name = "anyhow"
|
|
29
|
+
version = "1.0.102"
|
|
30
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
31
|
+
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
|
|
32
|
+
|
|
33
|
+
[[package]]
|
|
34
|
+
name = "auto_enums"
|
|
35
|
+
version = "0.8.8"
|
|
36
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
37
|
+
checksum = "65398a2893f41bce5c9259f6e1a4f03fbae40637c1bdc755b4f387f48c613b03"
|
|
38
|
+
dependencies = [
|
|
39
|
+
"derive_utils",
|
|
40
|
+
"proc-macro2",
|
|
41
|
+
"quote",
|
|
42
|
+
"syn",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[[package]]
|
|
46
|
+
name = "base64"
|
|
47
|
+
version = "0.22.1"
|
|
48
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
49
|
+
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
|
50
|
+
|
|
51
|
+
[[package]]
|
|
52
|
+
name = "bindgen"
|
|
53
|
+
version = "0.69.5"
|
|
54
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
+
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
|
|
56
|
+
dependencies = [
|
|
57
|
+
"bitflags",
|
|
58
|
+
"cexpr",
|
|
59
|
+
"clang-sys",
|
|
60
|
+
"itertools 0.12.1",
|
|
61
|
+
"lazy_static",
|
|
62
|
+
"lazycell",
|
|
63
|
+
"proc-macro2",
|
|
64
|
+
"quote",
|
|
65
|
+
"regex",
|
|
66
|
+
"rustc-hash",
|
|
67
|
+
"shlex",
|
|
68
|
+
"syn",
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[[package]]
|
|
72
|
+
name = "bit-set"
|
|
73
|
+
version = "0.5.3"
|
|
74
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
75
|
+
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
|
|
76
|
+
dependencies = [
|
|
77
|
+
"bit-vec",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "bit-vec"
|
|
82
|
+
version = "0.6.3"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
|
85
|
+
|
|
86
|
+
[[package]]
|
|
87
|
+
name = "bitflags"
|
|
88
|
+
version = "2.11.0"
|
|
89
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
+
checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
|
|
91
|
+
|
|
92
|
+
[[package]]
|
|
93
|
+
name = "bstr"
|
|
94
|
+
version = "1.12.1"
|
|
95
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
96
|
+
checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab"
|
|
97
|
+
dependencies = [
|
|
98
|
+
"memchr",
|
|
99
|
+
"regex-automata",
|
|
100
|
+
"serde",
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
[[package]]
|
|
104
|
+
name = "cexpr"
|
|
105
|
+
version = "0.6.0"
|
|
106
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
107
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
|
108
|
+
dependencies = [
|
|
109
|
+
"nom",
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
[[package]]
|
|
113
|
+
name = "cfg-if"
|
|
114
|
+
version = "1.0.4"
|
|
115
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
116
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
117
|
+
|
|
118
|
+
[[package]]
|
|
119
|
+
name = "clang-sys"
|
|
120
|
+
version = "1.8.1"
|
|
121
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
+
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
|
123
|
+
dependencies = [
|
|
124
|
+
"glob",
|
|
125
|
+
"libc",
|
|
126
|
+
"libloading",
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
[[package]]
|
|
130
|
+
name = "core_maths"
|
|
131
|
+
version = "0.1.1"
|
|
132
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
133
|
+
checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"
|
|
134
|
+
dependencies = [
|
|
135
|
+
"libm",
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
[[package]]
|
|
139
|
+
name = "derive_utils"
|
|
140
|
+
version = "0.15.1"
|
|
141
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
142
|
+
checksum = "362f47930db19fe7735f527e6595e4900316b893ebf6d48ad3d31be928d57dd6"
|
|
143
|
+
dependencies = [
|
|
144
|
+
"proc-macro2",
|
|
145
|
+
"quote",
|
|
146
|
+
"syn",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
[[package]]
|
|
150
|
+
name = "displaydoc"
|
|
151
|
+
version = "0.2.5"
|
|
152
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
153
|
+
checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
|
154
|
+
dependencies = [
|
|
155
|
+
"proc-macro2",
|
|
156
|
+
"quote",
|
|
157
|
+
"syn",
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
[[package]]
|
|
161
|
+
name = "either"
|
|
162
|
+
version = "1.15.0"
|
|
163
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
164
|
+
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
|
165
|
+
|
|
166
|
+
[[package]]
|
|
167
|
+
name = "fancy-regex"
|
|
168
|
+
version = "0.13.0"
|
|
169
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
170
|
+
checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2"
|
|
171
|
+
dependencies = [
|
|
172
|
+
"bit-set",
|
|
173
|
+
"regex-automata",
|
|
174
|
+
"regex-syntax",
|
|
175
|
+
]
|
|
176
|
+
|
|
177
|
+
[[package]]
|
|
178
|
+
name = "getrandom"
|
|
179
|
+
version = "0.3.4"
|
|
180
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
181
|
+
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
|
182
|
+
dependencies = [
|
|
183
|
+
"cfg-if",
|
|
184
|
+
"libc",
|
|
185
|
+
"r-efi",
|
|
186
|
+
"wasip2",
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
[[package]]
|
|
190
|
+
name = "glob"
|
|
191
|
+
version = "0.3.3"
|
|
192
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
193
|
+
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
|
194
|
+
|
|
195
|
+
[[package]]
|
|
196
|
+
name = "heck"
|
|
197
|
+
version = "0.5.0"
|
|
198
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
199
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
200
|
+
|
|
201
|
+
[[package]]
|
|
202
|
+
name = "icu_collections"
|
|
203
|
+
version = "2.1.1"
|
|
204
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
205
|
+
checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"
|
|
206
|
+
dependencies = [
|
|
207
|
+
"displaydoc",
|
|
208
|
+
"potential_utf",
|
|
209
|
+
"yoke",
|
|
210
|
+
"zerofrom",
|
|
211
|
+
"zerovec",
|
|
212
|
+
]
|
|
213
|
+
|
|
214
|
+
[[package]]
|
|
215
|
+
name = "icu_locale"
|
|
216
|
+
version = "2.1.1"
|
|
217
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
218
|
+
checksum = "532b11722e350ab6bf916ba6eb0efe3ee54b932666afec989465f9243fe6dd60"
|
|
219
|
+
dependencies = [
|
|
220
|
+
"icu_collections",
|
|
221
|
+
"icu_locale_core",
|
|
222
|
+
"icu_locale_data",
|
|
223
|
+
"icu_provider",
|
|
224
|
+
"potential_utf",
|
|
225
|
+
"tinystr",
|
|
226
|
+
"zerovec",
|
|
227
|
+
]
|
|
228
|
+
|
|
229
|
+
[[package]]
|
|
230
|
+
name = "icu_locale_core"
|
|
231
|
+
version = "2.1.1"
|
|
232
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
233
|
+
checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"
|
|
234
|
+
dependencies = [
|
|
235
|
+
"displaydoc",
|
|
236
|
+
"litemap",
|
|
237
|
+
"serde",
|
|
238
|
+
"tinystr",
|
|
239
|
+
"writeable",
|
|
240
|
+
"zerovec",
|
|
241
|
+
]
|
|
242
|
+
|
|
243
|
+
[[package]]
|
|
244
|
+
name = "icu_locale_data"
|
|
245
|
+
version = "2.1.2"
|
|
246
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
+
checksum = "1c5f1d16b4c3a2642d3a719f18f6b06070ab0aef246a6418130c955ae08aa831"
|
|
248
|
+
|
|
249
|
+
[[package]]
|
|
250
|
+
name = "icu_provider"
|
|
251
|
+
version = "2.1.1"
|
|
252
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
253
|
+
checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"
|
|
254
|
+
dependencies = [
|
|
255
|
+
"displaydoc",
|
|
256
|
+
"icu_locale_core",
|
|
257
|
+
"serde",
|
|
258
|
+
"stable_deref_trait",
|
|
259
|
+
"writeable",
|
|
260
|
+
"yoke",
|
|
261
|
+
"zerofrom",
|
|
262
|
+
"zerotrie",
|
|
263
|
+
"zerovec",
|
|
264
|
+
]
|
|
265
|
+
|
|
266
|
+
[[package]]
|
|
267
|
+
name = "icu_segmenter"
|
|
268
|
+
version = "2.1.2"
|
|
269
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
270
|
+
checksum = "a807a7488f3f758629ae86d99d9d30dce24da2fb2945d74c80a4f4a62c71db73"
|
|
271
|
+
dependencies = [
|
|
272
|
+
"core_maths",
|
|
273
|
+
"icu_collections",
|
|
274
|
+
"icu_locale",
|
|
275
|
+
"icu_provider",
|
|
276
|
+
"icu_segmenter_data",
|
|
277
|
+
"potential_utf",
|
|
278
|
+
"utf8_iter",
|
|
279
|
+
"zerovec",
|
|
280
|
+
]
|
|
281
|
+
|
|
282
|
+
[[package]]
|
|
283
|
+
name = "icu_segmenter_data"
|
|
284
|
+
version = "2.1.1"
|
|
285
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
286
|
+
checksum = "6ebbb7321d9e21d25f5660366cb6c08201d0175898a3a6f7a41ee9685af21c80"
|
|
287
|
+
|
|
288
|
+
[[package]]
|
|
289
|
+
name = "itertools"
|
|
290
|
+
version = "0.12.1"
|
|
291
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
292
|
+
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
|
|
293
|
+
dependencies = [
|
|
294
|
+
"either",
|
|
295
|
+
]
|
|
296
|
+
|
|
297
|
+
[[package]]
|
|
298
|
+
name = "itertools"
|
|
299
|
+
version = "0.14.0"
|
|
300
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
301
|
+
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
|
|
302
|
+
dependencies = [
|
|
303
|
+
"either",
|
|
304
|
+
]
|
|
305
|
+
|
|
306
|
+
[[package]]
|
|
307
|
+
name = "lazy_static"
|
|
308
|
+
version = "1.5.0"
|
|
309
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
310
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
311
|
+
|
|
312
|
+
[[package]]
|
|
313
|
+
name = "lazycell"
|
|
314
|
+
version = "1.3.0"
|
|
315
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
316
|
+
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|
317
|
+
|
|
318
|
+
[[package]]
|
|
319
|
+
name = "libc"
|
|
320
|
+
version = "0.2.182"
|
|
321
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
322
|
+
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
|
|
323
|
+
|
|
324
|
+
[[package]]
|
|
325
|
+
name = "libloading"
|
|
326
|
+
version = "0.8.9"
|
|
327
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
328
|
+
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
|
329
|
+
dependencies = [
|
|
330
|
+
"cfg-if",
|
|
331
|
+
"windows-link",
|
|
332
|
+
]
|
|
333
|
+
|
|
334
|
+
[[package]]
|
|
335
|
+
name = "libm"
|
|
336
|
+
version = "0.2.16"
|
|
337
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
338
|
+
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
|
339
|
+
|
|
340
|
+
[[package]]
|
|
341
|
+
name = "litemap"
|
|
342
|
+
version = "0.8.1"
|
|
343
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
344
|
+
checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
|
|
345
|
+
|
|
346
|
+
[[package]]
|
|
347
|
+
name = "magnus"
|
|
348
|
+
version = "0.8.2"
|
|
349
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
350
|
+
checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
|
|
351
|
+
dependencies = [
|
|
352
|
+
"magnus-macros",
|
|
353
|
+
"rb-sys",
|
|
354
|
+
"rb-sys-env",
|
|
355
|
+
"seq-macro",
|
|
356
|
+
]
|
|
357
|
+
|
|
358
|
+
[[package]]
|
|
359
|
+
name = "magnus-macros"
|
|
360
|
+
version = "0.8.0"
|
|
361
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
362
|
+
checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
|
|
363
|
+
dependencies = [
|
|
364
|
+
"proc-macro2",
|
|
365
|
+
"quote",
|
|
366
|
+
"syn",
|
|
367
|
+
]
|
|
368
|
+
|
|
369
|
+
[[package]]
|
|
370
|
+
name = "memchr"
|
|
371
|
+
version = "2.8.0"
|
|
372
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
373
|
+
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
|
374
|
+
|
|
375
|
+
[[package]]
|
|
376
|
+
name = "minimal-lexical"
|
|
377
|
+
version = "0.2.1"
|
|
378
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
379
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
380
|
+
|
|
381
|
+
[[package]]
|
|
382
|
+
name = "nom"
|
|
383
|
+
version = "7.1.3"
|
|
384
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
385
|
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
|
386
|
+
dependencies = [
|
|
387
|
+
"memchr",
|
|
388
|
+
"minimal-lexical",
|
|
389
|
+
]
|
|
390
|
+
|
|
391
|
+
[[package]]
|
|
392
|
+
name = "once_cell"
|
|
393
|
+
version = "1.21.3"
|
|
394
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
395
|
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
396
|
+
|
|
397
|
+
[[package]]
|
|
398
|
+
name = "potential_utf"
|
|
399
|
+
version = "0.1.4"
|
|
400
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
401
|
+
checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"
|
|
402
|
+
dependencies = [
|
|
403
|
+
"serde_core",
|
|
404
|
+
"writeable",
|
|
405
|
+
"zerovec",
|
|
406
|
+
]
|
|
407
|
+
|
|
408
|
+
[[package]]
|
|
409
|
+
name = "proc-macro2"
|
|
410
|
+
version = "1.0.106"
|
|
411
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
412
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
413
|
+
dependencies = [
|
|
414
|
+
"unicode-ident",
|
|
415
|
+
]
|
|
416
|
+
|
|
417
|
+
[[package]]
|
|
418
|
+
name = "pulldown-cmark"
|
|
419
|
+
version = "0.13.1"
|
|
420
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
421
|
+
checksum = "83c41efbf8f90ac44de7f3a868f0867851d261b56291732d0cbf7cceaaeb55a6"
|
|
422
|
+
dependencies = [
|
|
423
|
+
"bitflags",
|
|
424
|
+
"memchr",
|
|
425
|
+
"unicase",
|
|
426
|
+
]
|
|
427
|
+
|
|
428
|
+
[[package]]
|
|
429
|
+
name = "quote"
|
|
430
|
+
version = "1.0.45"
|
|
431
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
432
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
433
|
+
dependencies = [
|
|
434
|
+
"proc-macro2",
|
|
435
|
+
]
|
|
436
|
+
|
|
437
|
+
[[package]]
|
|
438
|
+
name = "r-efi"
|
|
439
|
+
version = "5.3.0"
|
|
440
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
441
|
+
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
|
442
|
+
|
|
443
|
+
[[package]]
|
|
444
|
+
name = "rb-sys"
|
|
445
|
+
version = "0.9.124"
|
|
446
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
447
|
+
checksum = "c85c4188462601e2aa1469def389c17228566f82ea72f137ed096f21591bc489"
|
|
448
|
+
dependencies = [
|
|
449
|
+
"rb-sys-build",
|
|
450
|
+
]
|
|
451
|
+
|
|
452
|
+
[[package]]
|
|
453
|
+
name = "rb-sys-build"
|
|
454
|
+
version = "0.9.124"
|
|
455
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
456
|
+
checksum = "568068db4102230882e6d4ae8de6632e224ca75fe5970f6e026a04e91ed635d3"
|
|
457
|
+
dependencies = [
|
|
458
|
+
"bindgen",
|
|
459
|
+
"lazy_static",
|
|
460
|
+
"proc-macro2",
|
|
461
|
+
"quote",
|
|
462
|
+
"regex",
|
|
463
|
+
"shell-words",
|
|
464
|
+
"syn",
|
|
465
|
+
]
|
|
466
|
+
|
|
467
|
+
[[package]]
|
|
468
|
+
name = "rb-sys-env"
|
|
469
|
+
version = "0.2.3"
|
|
470
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
471
|
+
checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
|
|
472
|
+
|
|
473
|
+
[[package]]
|
|
474
|
+
name = "regex"
|
|
475
|
+
version = "1.12.3"
|
|
476
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
477
|
+
checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
|
|
478
|
+
dependencies = [
|
|
479
|
+
"aho-corasick",
|
|
480
|
+
"memchr",
|
|
481
|
+
"regex-automata",
|
|
482
|
+
"regex-syntax",
|
|
483
|
+
]
|
|
484
|
+
|
|
485
|
+
[[package]]
|
|
486
|
+
name = "regex-automata"
|
|
487
|
+
version = "0.4.14"
|
|
488
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
489
|
+
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
|
490
|
+
dependencies = [
|
|
491
|
+
"aho-corasick",
|
|
492
|
+
"memchr",
|
|
493
|
+
"regex-syntax",
|
|
494
|
+
]
|
|
495
|
+
|
|
496
|
+
[[package]]
|
|
497
|
+
name = "regex-syntax"
|
|
498
|
+
version = "0.8.10"
|
|
499
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
500
|
+
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
|
501
|
+
|
|
502
|
+
[[package]]
|
|
503
|
+
name = "rustc-hash"
|
|
504
|
+
version = "1.1.0"
|
|
505
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
506
|
+
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|
507
|
+
|
|
508
|
+
[[package]]
|
|
509
|
+
name = "seq-macro"
|
|
510
|
+
version = "0.3.6"
|
|
511
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
512
|
+
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
|
513
|
+
|
|
514
|
+
[[package]]
|
|
515
|
+
name = "serde"
|
|
516
|
+
version = "1.0.228"
|
|
517
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
518
|
+
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
|
519
|
+
dependencies = [
|
|
520
|
+
"serde_core",
|
|
521
|
+
"serde_derive",
|
|
522
|
+
]
|
|
523
|
+
|
|
524
|
+
[[package]]
|
|
525
|
+
name = "serde_core"
|
|
526
|
+
version = "1.0.228"
|
|
527
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
528
|
+
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
|
529
|
+
dependencies = [
|
|
530
|
+
"serde_derive",
|
|
531
|
+
]
|
|
532
|
+
|
|
533
|
+
[[package]]
|
|
534
|
+
name = "serde_derive"
|
|
535
|
+
version = "1.0.228"
|
|
536
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
537
|
+
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|
538
|
+
dependencies = [
|
|
539
|
+
"proc-macro2",
|
|
540
|
+
"quote",
|
|
541
|
+
"syn",
|
|
542
|
+
]
|
|
543
|
+
|
|
544
|
+
[[package]]
|
|
545
|
+
name = "shell-words"
|
|
546
|
+
version = "1.1.1"
|
|
547
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
548
|
+
checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
|
|
549
|
+
|
|
550
|
+
[[package]]
|
|
551
|
+
name = "shlex"
|
|
552
|
+
version = "1.3.0"
|
|
553
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
554
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
555
|
+
|
|
556
|
+
[[package]]
|
|
557
|
+
name = "stable_deref_trait"
|
|
558
|
+
version = "1.2.1"
|
|
559
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
560
|
+
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
|
561
|
+
|
|
562
|
+
[[package]]
|
|
563
|
+
name = "strum"
|
|
564
|
+
version = "0.27.2"
|
|
565
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
566
|
+
checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf"
|
|
567
|
+
dependencies = [
|
|
568
|
+
"strum_macros",
|
|
569
|
+
]
|
|
570
|
+
|
|
571
|
+
[[package]]
|
|
572
|
+
name = "strum_macros"
|
|
573
|
+
version = "0.27.2"
|
|
574
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
575
|
+
checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7"
|
|
576
|
+
dependencies = [
|
|
577
|
+
"heck",
|
|
578
|
+
"proc-macro2",
|
|
579
|
+
"quote",
|
|
580
|
+
"syn",
|
|
581
|
+
]
|
|
582
|
+
|
|
583
|
+
[[package]]
|
|
584
|
+
name = "syn"
|
|
585
|
+
version = "2.0.117"
|
|
586
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
587
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
588
|
+
dependencies = [
|
|
589
|
+
"proc-macro2",
|
|
590
|
+
"quote",
|
|
591
|
+
"unicode-ident",
|
|
592
|
+
]
|
|
593
|
+
|
|
594
|
+
[[package]]
|
|
595
|
+
name = "synstructure"
|
|
596
|
+
version = "0.13.2"
|
|
597
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
598
|
+
checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
|
|
599
|
+
dependencies = [
|
|
600
|
+
"proc-macro2",
|
|
601
|
+
"quote",
|
|
602
|
+
"syn",
|
|
603
|
+
]
|
|
604
|
+
|
|
605
|
+
[[package]]
|
|
606
|
+
name = "text-splitter"
|
|
607
|
+
version = "0.29.3"
|
|
608
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
609
|
+
checksum = "2979ebb41243f6c8adc1c1adb76f35fe4e59ba2bc07f7863bb56bcc838798bf4"
|
|
610
|
+
dependencies = [
|
|
611
|
+
"ahash",
|
|
612
|
+
"auto_enums",
|
|
613
|
+
"either",
|
|
614
|
+
"icu_provider",
|
|
615
|
+
"icu_segmenter",
|
|
616
|
+
"itertools 0.14.0",
|
|
617
|
+
"memchr",
|
|
618
|
+
"pulldown-cmark",
|
|
619
|
+
"strum",
|
|
620
|
+
"thiserror",
|
|
621
|
+
"tiktoken-rs",
|
|
622
|
+
]
|
|
623
|
+
|
|
624
|
+
[[package]]
|
|
625
|
+
name = "thiserror"
|
|
626
|
+
version = "2.0.18"
|
|
627
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
628
|
+
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
|
|
629
|
+
dependencies = [
|
|
630
|
+
"thiserror-impl",
|
|
631
|
+
]
|
|
632
|
+
|
|
633
|
+
[[package]]
|
|
634
|
+
name = "thiserror-impl"
|
|
635
|
+
version = "2.0.18"
|
|
636
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
637
|
+
checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
|
|
638
|
+
dependencies = [
|
|
639
|
+
"proc-macro2",
|
|
640
|
+
"quote",
|
|
641
|
+
"syn",
|
|
642
|
+
]
|
|
643
|
+
|
|
644
|
+
[[package]]
|
|
645
|
+
name = "tiktoken-rs"
|
|
646
|
+
version = "0.9.1"
|
|
647
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
648
|
+
checksum = "3a19830747d9034cd9da43a60eaa8e552dfda7712424aebf187b7a60126bae0d"
|
|
649
|
+
dependencies = [
|
|
650
|
+
"anyhow",
|
|
651
|
+
"base64",
|
|
652
|
+
"bstr",
|
|
653
|
+
"fancy-regex",
|
|
654
|
+
"lazy_static",
|
|
655
|
+
"regex",
|
|
656
|
+
"rustc-hash",
|
|
657
|
+
]
|
|
658
|
+
|
|
659
|
+
[[package]]
|
|
660
|
+
name = "tinystr"
|
|
661
|
+
version = "0.8.2"
|
|
662
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
663
|
+
checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"
|
|
664
|
+
dependencies = [
|
|
665
|
+
"displaydoc",
|
|
666
|
+
"serde_core",
|
|
667
|
+
"zerovec",
|
|
668
|
+
]
|
|
669
|
+
|
|
670
|
+
[[package]]
|
|
671
|
+
name = "tomos"
|
|
672
|
+
version = "0.1.0"
|
|
673
|
+
dependencies = [
|
|
674
|
+
"magnus",
|
|
675
|
+
"rb-sys",
|
|
676
|
+
"text-splitter",
|
|
677
|
+
"tiktoken-rs",
|
|
678
|
+
]
|
|
679
|
+
|
|
680
|
+
[[package]]
|
|
681
|
+
name = "unicase"
|
|
682
|
+
version = "2.9.0"
|
|
683
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
684
|
+
checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
|
|
685
|
+
|
|
686
|
+
[[package]]
|
|
687
|
+
name = "unicode-ident"
|
|
688
|
+
version = "1.0.24"
|
|
689
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
690
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
691
|
+
|
|
692
|
+
[[package]]
|
|
693
|
+
name = "utf8_iter"
|
|
694
|
+
version = "1.0.4"
|
|
695
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
696
|
+
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
|
697
|
+
|
|
698
|
+
[[package]]
|
|
699
|
+
name = "version_check"
|
|
700
|
+
version = "0.9.5"
|
|
701
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
702
|
+
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
|
703
|
+
|
|
704
|
+
[[package]]
|
|
705
|
+
name = "wasip2"
|
|
706
|
+
version = "1.0.2+wasi-0.2.9"
|
|
707
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
708
|
+
checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"
|
|
709
|
+
dependencies = [
|
|
710
|
+
"wit-bindgen",
|
|
711
|
+
]
|
|
712
|
+
|
|
713
|
+
[[package]]
|
|
714
|
+
name = "windows-link"
|
|
715
|
+
version = "0.2.1"
|
|
716
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
717
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
718
|
+
|
|
719
|
+
[[package]]
|
|
720
|
+
name = "wit-bindgen"
|
|
721
|
+
version = "0.51.0"
|
|
722
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
723
|
+
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
|
|
724
|
+
|
|
725
|
+
[[package]]
|
|
726
|
+
name = "writeable"
|
|
727
|
+
version = "0.6.2"
|
|
728
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
729
|
+
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
|
730
|
+
|
|
731
|
+
[[package]]
|
|
732
|
+
name = "yoke"
|
|
733
|
+
version = "0.8.1"
|
|
734
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
735
|
+
checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"
|
|
736
|
+
dependencies = [
|
|
737
|
+
"stable_deref_trait",
|
|
738
|
+
"yoke-derive",
|
|
739
|
+
"zerofrom",
|
|
740
|
+
]
|
|
741
|
+
|
|
742
|
+
[[package]]
|
|
743
|
+
name = "yoke-derive"
|
|
744
|
+
version = "0.8.1"
|
|
745
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
746
|
+
checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
|
|
747
|
+
dependencies = [
|
|
748
|
+
"proc-macro2",
|
|
749
|
+
"quote",
|
|
750
|
+
"syn",
|
|
751
|
+
"synstructure",
|
|
752
|
+
]
|
|
753
|
+
|
|
754
|
+
[[package]]
|
|
755
|
+
name = "zerocopy"
|
|
756
|
+
version = "0.8.40"
|
|
757
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
758
|
+
checksum = "a789c6e490b576db9f7e6b6d661bcc9799f7c0ac8352f56ea20193b2681532e5"
|
|
759
|
+
dependencies = [
|
|
760
|
+
"zerocopy-derive",
|
|
761
|
+
]
|
|
762
|
+
|
|
763
|
+
[[package]]
|
|
764
|
+
name = "zerocopy-derive"
|
|
765
|
+
version = "0.8.40"
|
|
766
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
767
|
+
checksum = "f65c489a7071a749c849713807783f70672b28094011623e200cb86dcb835953"
|
|
768
|
+
dependencies = [
|
|
769
|
+
"proc-macro2",
|
|
770
|
+
"quote",
|
|
771
|
+
"syn",
|
|
772
|
+
]
|
|
773
|
+
|
|
774
|
+
[[package]]
|
|
775
|
+
name = "zerofrom"
|
|
776
|
+
version = "0.1.6"
|
|
777
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
778
|
+
checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
|
|
779
|
+
dependencies = [
|
|
780
|
+
"zerofrom-derive",
|
|
781
|
+
]
|
|
782
|
+
|
|
783
|
+
[[package]]
|
|
784
|
+
name = "zerofrom-derive"
|
|
785
|
+
version = "0.1.6"
|
|
786
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
787
|
+
checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
|
|
788
|
+
dependencies = [
|
|
789
|
+
"proc-macro2",
|
|
790
|
+
"quote",
|
|
791
|
+
"syn",
|
|
792
|
+
"synstructure",
|
|
793
|
+
]
|
|
794
|
+
|
|
795
|
+
[[package]]
|
|
796
|
+
name = "zerotrie"
|
|
797
|
+
version = "0.2.3"
|
|
798
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
799
|
+
checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"
|
|
800
|
+
dependencies = [
|
|
801
|
+
"displaydoc",
|
|
802
|
+
]
|
|
803
|
+
|
|
804
|
+
[[package]]
|
|
805
|
+
name = "zerovec"
|
|
806
|
+
version = "0.11.5"
|
|
807
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
808
|
+
checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"
|
|
809
|
+
dependencies = [
|
|
810
|
+
"serde",
|
|
811
|
+
"yoke",
|
|
812
|
+
"zerofrom",
|
|
813
|
+
"zerovec-derive",
|
|
814
|
+
]
|
|
815
|
+
|
|
816
|
+
[[package]]
|
|
817
|
+
name = "zerovec-derive"
|
|
818
|
+
version = "0.11.2"
|
|
819
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
820
|
+
checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
|
|
821
|
+
dependencies = [
|
|
822
|
+
"proc-macro2",
|
|
823
|
+
"quote",
|
|
824
|
+
"syn",
|
|
825
|
+
]
|
data/Cargo.toml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "tomos"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
license = "MIT"
|
|
6
|
+
publish = false
|
|
7
|
+
|
|
8
|
+
[lib]
|
|
9
|
+
name = "tomos"
|
|
10
|
+
crate-type = ["cdylib"]
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
text-splitter = { version = "0.29", features = ["tiktoken-rs", "markdown"] }
|
|
14
|
+
tiktoken-rs = "0.9"
|
|
15
|
+
magnus = "0.8"
|
|
16
|
+
rb-sys = { version = "0.9", features = ["stable-api-compiled-fallback"] }
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
use magnus::{function, method, prelude::*, Error, Ruby};
|
|
2
|
+
use text_splitter::{ChunkConfig, MarkdownSplitter, TextSplitter};
|
|
3
|
+
use tiktoken_rs::get_bpe_from_model;
|
|
4
|
+
|
|
5
|
+
type RbResult<T> = Result<T, Error>;
|
|
6
|
+
|
|
7
|
+
fn build_chunk_config(
|
|
8
|
+
ruby: &Ruby,
|
|
9
|
+
model: &str,
|
|
10
|
+
capacity: usize,
|
|
11
|
+
overlap: usize,
|
|
12
|
+
) -> RbResult<ChunkConfig<tiktoken_rs::CoreBPE>> {
|
|
13
|
+
let bpe = get_bpe_from_model(model).map_err(|e| {
|
|
14
|
+
Error::new(
|
|
15
|
+
ruby.exception_arg_error(),
|
|
16
|
+
format!("unrecognized tiktoken model '{model}': {e}"),
|
|
17
|
+
)
|
|
18
|
+
})?;
|
|
19
|
+
|
|
20
|
+
let config = ChunkConfig::new(capacity)
|
|
21
|
+
.with_overlap(overlap)
|
|
22
|
+
.map_err(|e| {
|
|
23
|
+
Error::new(
|
|
24
|
+
ruby.exception_arg_error(),
|
|
25
|
+
format!("invalid chunk config: {e}"),
|
|
26
|
+
)
|
|
27
|
+
})?
|
|
28
|
+
.with_sizer(bpe);
|
|
29
|
+
|
|
30
|
+
Ok(config)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// Splits unstructured text along Unicode boundaries (sentences, words,
|
|
34
|
+
/// grapheme clusters). Works well on transcripts and content with no
|
|
35
|
+
/// paragraph or section structure.
|
|
36
|
+
#[magnus::wrap(class = "Tomos::Text", free_immediately, size)]
|
|
37
|
+
struct RbText {
|
|
38
|
+
splitter: TextSplitter<tiktoken_rs::CoreBPE>,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
impl RbText {
|
|
42
|
+
fn new(ruby: &Ruby, model: String, capacity: usize, overlap: usize) -> RbResult<Self> {
|
|
43
|
+
let config = build_chunk_config(ruby, &model, capacity, overlap)?;
|
|
44
|
+
Ok(Self {
|
|
45
|
+
splitter: TextSplitter::new(config),
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fn chunks(&self, text: String) -> Vec<String> {
|
|
50
|
+
self.splitter.chunks(&text).map(str::to_owned).collect()
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// Splits CommonMark/GFM markdown along structural boundaries (headings,
|
|
55
|
+
/// code fences, list items, block elements) in addition to the Unicode
|
|
56
|
+
/// levels that `RbText` uses. Degrades gracefully to plain-text splitting
|
|
57
|
+
/// when the input contains no markdown structure.
|
|
58
|
+
#[magnus::wrap(class = "Tomos::Markdown", free_immediately, size)]
|
|
59
|
+
struct RbMarkdown {
|
|
60
|
+
splitter: MarkdownSplitter<tiktoken_rs::CoreBPE>,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
impl RbMarkdown {
|
|
64
|
+
fn new(ruby: &Ruby, model: String, capacity: usize, overlap: usize) -> RbResult<Self> {
|
|
65
|
+
let config = build_chunk_config(ruby, &model, capacity, overlap)?;
|
|
66
|
+
Ok(Self {
|
|
67
|
+
splitter: MarkdownSplitter::new(config),
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
fn chunks(&self, text: String) -> Vec<String> {
|
|
72
|
+
self.splitter.chunks(&text).map(str::to_owned).collect()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#[magnus::init]
|
|
77
|
+
fn init(ruby: &Ruby) -> RbResult<()> {
|
|
78
|
+
let module = ruby.define_module("Tomos")?;
|
|
79
|
+
|
|
80
|
+
let text = module.define_class("Text", ruby.class_object())?;
|
|
81
|
+
text.define_singleton_method("new", function!(RbText::new, 3))?;
|
|
82
|
+
text.define_method("chunks", method!(RbText::chunks, 1))?;
|
|
83
|
+
|
|
84
|
+
let markdown = module.define_class("Markdown", ruby.class_object())?;
|
|
85
|
+
markdown.define_singleton_method("new", function!(RbMarkdown::new, 3))?;
|
|
86
|
+
markdown.define_method("chunks", method!(RbMarkdown::chunks, 1))?;
|
|
87
|
+
|
|
88
|
+
Ok(())
|
|
89
|
+
}
|
|
Binary file
|
data/lib/tomos.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: tomos
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Dan Frenette
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: rb_sys
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
email:
|
|
27
|
+
- dan.r.frenette@gmail.com
|
|
28
|
+
executables: []
|
|
29
|
+
extensions:
|
|
30
|
+
- ext/tomos/extconf.rb
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
files:
|
|
33
|
+
- Cargo.lock
|
|
34
|
+
- Cargo.toml
|
|
35
|
+
- ext/tomos/Cargo.toml
|
|
36
|
+
- ext/tomos/extconf.rb
|
|
37
|
+
- ext/tomos/src/lib.rs
|
|
38
|
+
- lib/tomos.rb
|
|
39
|
+
- lib/tomos/tomos.bundle
|
|
40
|
+
- lib/tomos/version.rb
|
|
41
|
+
homepage: https://github.com/danfrenette/tomos
|
|
42
|
+
licenses:
|
|
43
|
+
- MIT
|
|
44
|
+
metadata: {}
|
|
45
|
+
rdoc_options: []
|
|
46
|
+
require_paths:
|
|
47
|
+
- lib
|
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: 4.0.1
|
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '0'
|
|
58
|
+
requirements: []
|
|
59
|
+
rubygems_version: 4.0.3
|
|
60
|
+
specification_version: 4
|
|
61
|
+
summary: Token-aware text chunking for RAG pipelines, powered by Rust
|
|
62
|
+
test_files: []
|