From ec9ab91935e7094131d3098b3adb0bf7e8c8df50 Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Tue, 6 Feb 2024 22:26:41 +0800 Subject: [PATCH 001/393] push v2 codebase --- .tool-versions | 4 +- Cargo.lock | 1809 ++++++++++++ Cargo.toml | 8 + cli/Cargo.lock | 2602 +++++++++++++++++ cli/Cargo.toml | 14 + cli/src/compile.rs | 44 + cli/src/context.rs | 6 + cli/src/enums.rs | 8 + cli/src/lookup.rs | 62 + cli/src/main.rs | 55 + cli/src/utils.rs | 33 + {cli => go/cli}/alias.go | 0 {cli => go/cli}/app.go | 0 {cli => go/cli}/compile.go | 0 {cli => go/cli}/dump.go | 0 {cli => go/cli}/enums_generated.go | 0 {cli => go/cli}/go.mod | 0 {cli => go/cli}/go.sum | 0 {cli => go/cli}/index.go | 0 {cli => go/cli}/ipc.go | 0 {cli => go/cli}/justfile | 0 {cli => go/cli}/lexicon.go | 0 {cli => go/cli}/lookup.go | 0 {cli => go/cli}/merge.go | 0 {cli => go/cli}/print.go | 0 {cli => go/cli}/search.go | 0 {cli => go/cli}/server.go | 0 {cli => go/cli}/service.go | 0 {cli => go/cli}/service_generated.go | 0 {cli => go/cli}/split.go | 0 {cli => go/cli}/t.go | 0 go.work => go/go.work | 0 go.work.sum => go/go.work.sum | 0 {lib => go/lib}/config/aliases.go | 0 {lib => go/lib}/config/config.go | 0 {lib => go/lib}/config/config_test.go | 0 {lib => go/lib}/config/go.mod | 0 {lib => go/lib}/config/go.sum | 0 {lib => go/lib}/core/compile.go | 0 {lib => go/lib}/core/go.mod | 0 {lib => go/lib}/core/go.sum | 0 {lib => go/lib}/core/lexicon.go | 0 {lib => go/lib}/core/lexicon_test.go | 0 {lib => go/lib}/core/lookup.go | 0 {lib => go/lib}/core/lookup_test.go | 0 {lib => go/lib}/core/merge.go | 0 {lib => go/lib}/core/merge_test.go | 0 {lib => go/lib}/core/read.go | 0 {lib => go/lib}/core/read_test.go | 0 {lib => go/lib}/core/split.go | 0 {lib => go/lib}/core/split_test.go | 0 {lib => go/lib}/core/version.go | 0 {lib => go/lib}/core/write.go | 0 {lib => go/lib}/core/write_test.go | 0 {lib => go/lib}/dump/dump.go | 0 {lib => go/lib}/dump/dump_test.go | 0 {lib => go/lib}/dump/go.mod | 0 {lib => go/lib}/dump/go.sum | 0 {lib => go/lib}/justfile | 0 {lib => go/lib}/search/go.mod | 0 {lib => go/lib}/search/go.sum | 0 {lib => go/lib}/search/index.go | 0 {lib => go/lib}/search/index_test.go | 0 {lib => go/lib}/search/search.go | 0 {lib => go/lib}/search/search_test.go | 0 {lib => go/lib}/server/cache.go | 0 {lib => go/lib}/server/go.mod | 0 {lib => go/lib}/server/go.sum | 0 {lib => go/lib}/server/lookup.go | 0 {lib => go/lib}/server/lookup_test.go | 0 {lib => go/lib}/server/search.go | 0 {lib => go/lib}/server/search_test.go | 0 {lib => go/lib}/server/serve.go | 0 .../lib}/sql/__snapshots__/sql_test.snap | 0 {lib => go/lib}/sql/definitions.go | 0 {lib => go/lib}/sql/dictionaries.go | 0 {lib => go/lib}/sql/entries.go | 0 {lib => go/lib}/sql/etymologies.go | 0 {lib => go/lib}/sql/examples.go | 0 {lib => go/lib}/sql/go.mod | 0 {lib => go/lib}/sql/go.sum | 0 {lib => go/lib}/sql/groups.go | 0 {lib => go/lib}/sql/notes.go | 0 {lib => go/lib}/sql/senses.go | 0 {lib => go/lib}/sql/sql.go | 0 {lib => go/lib}/sql/sql_test.go | 0 {lib => go/lib}/sql/types.go | 0 {lib => go/lib}/sql/utils.go | 0 {lib => go/lib}/test/cleanup.go | 0 {lib => go/lib}/test/go.mod | 0 {lib => go/lib}/test/go.sum | 0 {lib => go/lib}/types/definition.go | 0 {lib => go/lib}/types/dictionary.go | 0 {lib => go/lib}/types/entry.go | 0 {lib => go/lib}/types/enums_generated.go | 0 {lib => go/lib}/types/etymology.go | 0 {lib => go/lib}/types/go.mod | 0 {lib => go/lib}/types/go.sum | 0 {lib => go/lib}/types/group.go | 0 {lib => go/lib}/types/mdstring.go | 0 {lib => go/lib}/types/mdstring_test.go | 0 {lib => go/lib}/types/note.go | 0 {lib => go/lib}/types/pos.go | 0 {lib => go/lib}/types/schema_generated.go | 0 {lib => go/lib}/types/sense.go | 0 {lib => go/lib}/types/types.go | 0 {lib => go/lib}/types/utils.go | 0 {lib => go/lib}/utils/bytes.go | 0 {lib => go/lib}/utils/fs.go | 0 {lib => go/lib}/utils/go.mod | 0 {lib => go/lib}/utils/go.sum | 0 {lib => go/lib}/utils/markdown.go | 0 {lib => go/lib}/utils/markdown_test.go | 0 {lib => go/lib}/utils/serialization.go | 0 {lib => go/lib}/utils/uuid.go | 0 odict.go => go/odict.go | 0 {wasm => go/wasm}/.prettierrc.json | 0 {wasm => go/wasm}/CHANGELOG.md | 0 {wasm => go/wasm}/demo.html | 0 {wasm => go/wasm}/go.mod | 0 {wasm => go/wasm}/jest.config.cjs | 0 {wasm => go/wasm}/justfile | 0 {wasm => go/wasm}/package-lock.json | 0 {wasm => go/wasm}/package.json | 0 .../src/__generated__/compile-payload.ts | 0 {wasm => go/wasm}/src/__generated__/enums.ts | 0 {wasm => go/wasm}/src/__generated__/index.ts | 0 .../wasm}/src/__generated__/lookup-payload.ts | 0 .../src/__generated__/markdown-strategy.ts | 0 {wasm => go/wasm}/src/__generated__/method.ts | 0 .../wasm}/src/__generated__/odict-method.ts | 0 {wasm => go/wasm}/src/__generated__/pos.ts | 0 .../wasm}/src/__generated__/search-payload.ts | 0 .../wasm}/src/__generated__/service.ts | 0 .../wasm}/src/__generated__/split-payload.ts | 0 .../wasm}/src/__generated__/write-payload.ts | 0 {wasm => go/wasm}/src/dictionary.ts | 0 {wasm => go/wasm}/src/index.ts | 0 {wasm => go/wasm}/src/odict.go | 0 {wasm => go/wasm}/src/polyfill.ts | 0 {wasm => go/wasm}/src/service.ts | 0 {wasm => go/wasm}/src/types.ts | 0 {wasm => go/wasm}/src/wasm_exec.js | 0 {wasm => go/wasm}/test/dictionary.spec.ts | 0 {wasm => go/wasm}/tsconfig.json | 0 {xsd => go/xsd}/go.mod | 0 {xsd => go/xsd}/go.sum | 0 {xsd => go/xsd}/justfile | 0 {xsd => go/xsd}/xsd.go | 0 justfile | 18 +- lib/Cargo.toml | 26 + lib/src/core/compile.rs | 52 + lib/src/core/lookup.rs | 138 + lib/src/core/mod.rs | 11 + lib/src/core/read.rs | 90 + lib/src/core/split.rs | 56 + lib/src/core/version.rs | 1 + lib/src/core/write.rs | 14 + lib/src/lib.rs | 21 + lib/src/models/definition.rs | 19 + lib/src/models/dictionary.rs | 63 + lib/src/models/entry.rs | 16 + lib/src/models/etymology.rs | 55 + lib/src/models/example.rs | 8 + lib/src/models/group.rs | 16 + lib/src/models/mdstring.rs | 59 + lib/src/models/mod.rs | 23 + lib/src/models/note.rs | 15 + lib/src/models/pos.rs | 269 ++ lib/src/models/sense.rs | 16 + lib/src/models/serializable.rs | 29 + lib/src/utils.rs | 26 + 172 files changed, 5675 insertions(+), 11 deletions(-) create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 cli/Cargo.lock create mode 100644 cli/Cargo.toml create mode 100644 cli/src/compile.rs create mode 100644 cli/src/context.rs create mode 100644 cli/src/enums.rs create mode 100644 cli/src/lookup.rs create mode 100644 cli/src/main.rs create mode 100644 cli/src/utils.rs rename {cli => go/cli}/alias.go (100%) rename {cli => go/cli}/app.go (100%) rename {cli => go/cli}/compile.go (100%) rename {cli => go/cli}/dump.go (100%) rename {cli => go/cli}/enums_generated.go (100%) rename {cli => go/cli}/go.mod (100%) rename {cli => go/cli}/go.sum (100%) rename {cli => go/cli}/index.go (100%) rename {cli => go/cli}/ipc.go (100%) rename {cli => go/cli}/justfile (100%) rename {cli => go/cli}/lexicon.go (100%) rename {cli => go/cli}/lookup.go (100%) rename {cli => go/cli}/merge.go (100%) rename {cli => go/cli}/print.go (100%) rename {cli => go/cli}/search.go (100%) rename {cli => go/cli}/server.go (100%) rename {cli => go/cli}/service.go (100%) rename {cli => go/cli}/service_generated.go (100%) rename {cli => go/cli}/split.go (100%) rename {cli => go/cli}/t.go (100%) rename go.work => go/go.work (100%) rename go.work.sum => go/go.work.sum (100%) rename {lib => go/lib}/config/aliases.go (100%) rename {lib => go/lib}/config/config.go (100%) rename {lib => go/lib}/config/config_test.go (100%) rename {lib => go/lib}/config/go.mod (100%) rename {lib => go/lib}/config/go.sum (100%) rename {lib => go/lib}/core/compile.go (100%) rename {lib => go/lib}/core/go.mod (100%) rename {lib => go/lib}/core/go.sum (100%) rename {lib => go/lib}/core/lexicon.go (100%) rename {lib => go/lib}/core/lexicon_test.go (100%) rename {lib => go/lib}/core/lookup.go (100%) rename {lib => go/lib}/core/lookup_test.go (100%) rename {lib => go/lib}/core/merge.go (100%) rename {lib => go/lib}/core/merge_test.go (100%) rename {lib => go/lib}/core/read.go (100%) rename {lib => go/lib}/core/read_test.go (100%) rename {lib => go/lib}/core/split.go (100%) rename {lib => go/lib}/core/split_test.go (100%) rename {lib => go/lib}/core/version.go (100%) rename {lib => go/lib}/core/write.go (100%) rename {lib => go/lib}/core/write_test.go (100%) rename {lib => go/lib}/dump/dump.go (100%) rename {lib => go/lib}/dump/dump_test.go (100%) rename {lib => go/lib}/dump/go.mod (100%) rename {lib => go/lib}/dump/go.sum (100%) rename {lib => go/lib}/justfile (100%) rename {lib => go/lib}/search/go.mod (100%) rename {lib => go/lib}/search/go.sum (100%) rename {lib => go/lib}/search/index.go (100%) rename {lib => go/lib}/search/index_test.go (100%) rename {lib => go/lib}/search/search.go (100%) rename {lib => go/lib}/search/search_test.go (100%) rename {lib => go/lib}/server/cache.go (100%) rename {lib => go/lib}/server/go.mod (100%) rename {lib => go/lib}/server/go.sum (100%) rename {lib => go/lib}/server/lookup.go (100%) rename {lib => go/lib}/server/lookup_test.go (100%) rename {lib => go/lib}/server/search.go (100%) rename {lib => go/lib}/server/search_test.go (100%) rename {lib => go/lib}/server/serve.go (100%) rename {lib => go/lib}/sql/__snapshots__/sql_test.snap (100%) rename {lib => go/lib}/sql/definitions.go (100%) rename {lib => go/lib}/sql/dictionaries.go (100%) rename {lib => go/lib}/sql/entries.go (100%) rename {lib => go/lib}/sql/etymologies.go (100%) rename {lib => go/lib}/sql/examples.go (100%) rename {lib => go/lib}/sql/go.mod (100%) rename {lib => go/lib}/sql/go.sum (100%) rename {lib => go/lib}/sql/groups.go (100%) rename {lib => go/lib}/sql/notes.go (100%) rename {lib => go/lib}/sql/senses.go (100%) rename {lib => go/lib}/sql/sql.go (100%) rename {lib => go/lib}/sql/sql_test.go (100%) rename {lib => go/lib}/sql/types.go (100%) rename {lib => go/lib}/sql/utils.go (100%) rename {lib => go/lib}/test/cleanup.go (100%) rename {lib => go/lib}/test/go.mod (100%) rename {lib => go/lib}/test/go.sum (100%) rename {lib => go/lib}/types/definition.go (100%) rename {lib => go/lib}/types/dictionary.go (100%) rename {lib => go/lib}/types/entry.go (100%) rename {lib => go/lib}/types/enums_generated.go (100%) rename {lib => go/lib}/types/etymology.go (100%) rename {lib => go/lib}/types/go.mod (100%) rename {lib => go/lib}/types/go.sum (100%) rename {lib => go/lib}/types/group.go (100%) rename {lib => go/lib}/types/mdstring.go (100%) rename {lib => go/lib}/types/mdstring_test.go (100%) rename {lib => go/lib}/types/note.go (100%) rename {lib => go/lib}/types/pos.go (100%) rename {lib => go/lib}/types/schema_generated.go (100%) rename {lib => go/lib}/types/sense.go (100%) rename {lib => go/lib}/types/types.go (100%) rename {lib => go/lib}/types/utils.go (100%) rename {lib => go/lib}/utils/bytes.go (100%) rename {lib => go/lib}/utils/fs.go (100%) rename {lib => go/lib}/utils/go.mod (100%) rename {lib => go/lib}/utils/go.sum (100%) rename {lib => go/lib}/utils/markdown.go (100%) rename {lib => go/lib}/utils/markdown_test.go (100%) rename {lib => go/lib}/utils/serialization.go (100%) rename {lib => go/lib}/utils/uuid.go (100%) rename odict.go => go/odict.go (100%) rename {wasm => go/wasm}/.prettierrc.json (100%) rename {wasm => go/wasm}/CHANGELOG.md (100%) rename {wasm => go/wasm}/demo.html (100%) rename {wasm => go/wasm}/go.mod (100%) rename {wasm => go/wasm}/jest.config.cjs (100%) rename {wasm => go/wasm}/justfile (100%) rename {wasm => go/wasm}/package-lock.json (100%) rename {wasm => go/wasm}/package.json (100%) rename {wasm => go/wasm}/src/__generated__/compile-payload.ts (100%) rename {wasm => go/wasm}/src/__generated__/enums.ts (100%) rename {wasm => go/wasm}/src/__generated__/index.ts (100%) rename {wasm => go/wasm}/src/__generated__/lookup-payload.ts (100%) rename {wasm => go/wasm}/src/__generated__/markdown-strategy.ts (100%) rename {wasm => go/wasm}/src/__generated__/method.ts (100%) rename {wasm => go/wasm}/src/__generated__/odict-method.ts (100%) rename {wasm => go/wasm}/src/__generated__/pos.ts (100%) rename {wasm => go/wasm}/src/__generated__/search-payload.ts (100%) rename {wasm => go/wasm}/src/__generated__/service.ts (100%) rename {wasm => go/wasm}/src/__generated__/split-payload.ts (100%) rename {wasm => go/wasm}/src/__generated__/write-payload.ts (100%) rename {wasm => go/wasm}/src/dictionary.ts (100%) rename {wasm => go/wasm}/src/index.ts (100%) rename {wasm => go/wasm}/src/odict.go (100%) rename {wasm => go/wasm}/src/polyfill.ts (100%) rename {wasm => go/wasm}/src/service.ts (100%) rename {wasm => go/wasm}/src/types.ts (100%) rename {wasm => go/wasm}/src/wasm_exec.js (100%) rename {wasm => go/wasm}/test/dictionary.spec.ts (100%) rename {wasm => go/wasm}/tsconfig.json (100%) rename {xsd => go/xsd}/go.mod (100%) rename {xsd => go/xsd}/go.sum (100%) rename {xsd => go/xsd}/justfile (100%) rename {xsd => go/xsd}/xsd.go (100%) create mode 100644 lib/Cargo.toml create mode 100644 lib/src/core/compile.rs create mode 100644 lib/src/core/lookup.rs create mode 100644 lib/src/core/mod.rs create mode 100644 lib/src/core/read.rs create mode 100644 lib/src/core/split.rs create mode 100644 lib/src/core/version.rs create mode 100644 lib/src/core/write.rs create mode 100644 lib/src/lib.rs create mode 100644 lib/src/models/definition.rs create mode 100644 lib/src/models/dictionary.rs create mode 100644 lib/src/models/entry.rs create mode 100644 lib/src/models/etymology.rs create mode 100644 lib/src/models/example.rs create mode 100644 lib/src/models/group.rs create mode 100644 lib/src/models/mdstring.rs create mode 100644 lib/src/models/mod.rs create mode 100644 lib/src/models/note.rs create mode 100644 lib/src/models/pos.rs create mode 100644 lib/src/models/sense.rs create mode 100644 lib/src/models/serializable.rs create mode 100644 lib/src/utils.rs diff --git a/.tool-versions b/.tool-versions index cf4f3c52..45821ccb 100644 --- a/.tool-versions +++ b/.tool-versions @@ -5,7 +5,7 @@ gradle 7.5.1 kotlin 1.9.22 java adoptopenjdk-17.0.10+7 nodejs 20.11.0 -just 1.23.0 -flatc 23.3.3 +just 1.23.0 goreleaser 1.21.1 make 4.4.1 +rust 1.75.0 diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..ccdbfbac --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1809 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[package]] +name = "anstream" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "arc-swap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" + +[[package]] +name = "async-trait" +version = "0.1.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + +[[package]] +name = "bitpacking" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c7d2ac73c167c06af4a5f37e6e59d84148d57ccbe4480b76f0273eefea82d7" +dependencies = [ + "crunchy", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "bytecheck" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "census" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4c707c6a209cbe82d10abd08e1ea8995e9ea937d2550646e02798948992be0" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "clap_lex" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "cli" +version = "2.0.0" +dependencies = [ + "clap", + "clio", + "console", + "odict", + "quick-xml", + "regex", + "serde", + "serde_json", +] + +[[package]] +name = "clio" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7fc6734af48458f72f5a3fa7b840903606427d98a710256e808f76a965047d9" +dependencies = [ + "cfg-if", + "is-terminal", + "libc", + "tempfile", + "walkdir", + "windows-sys 0.42.0", +] + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.52.0", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastdivide" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25c7df09945d65ea8d70b3321547ed414bbc540aad5bac6883d021b970f35b04" + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fs4" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "generator" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows", +] + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.7", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.7", + "allocator-api2", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" + +[[package]] +name = "htmlescape" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "jobserver" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "levenshtein_automata" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2cdeb66e45e9f36bfad5bbdb4d2384e70936afbee843c6f6543f0c551ebb25" + +[[package]] +name = "libc" +version = "0.2.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" + +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "loom" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" +dependencies = [ + "cfg-if", + "generator", + "pin-utils", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "lru" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" +dependencies = [ + "hashbrown 0.14.3", +] + +[[package]] +name = "lz4_flex" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "912b45c753ff5f7f5208307e8ace7d2a2e30d024e26d3509f3dce546c044ce15" +dependencies = [ + "twox-hash", +] + +[[package]] +name = "markdown" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef3aab6a1d529b112695f72beec5ee80e729cb45af58663ec902c8fac764ecdd" +dependencies = [ + "lazy_static", + "pipeline", + "regex", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "measure_time" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56220900f1a0923789ecd6bf25fbae8af3b2f1ff3e9e297fc9b6b8674dd4d852" +dependencies = [ + "instant", + "log", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "memmap2" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" +dependencies = [ + "libc", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "murmurhash32" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9380db4c04d219ac5c51d14996bbf2c2e9a15229771b53f8671eb6c83cf44df" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "odict" +version = "0.1.0" +dependencies = [ + "byteorder", + "lz4_flex", + "markdown", + "quick-xml", + "rayon", + "regex", + "rkyv", + "serde", + "serde_json", + "tantivy", + "validation", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "oneshot" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f6640c6bda7731b1fdbab747981a0f896dd1fedaf9f4a53fa237a04a84431f4" +dependencies = [ + "loom", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "ownedbytes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e8a72b918ae8198abb3a18c190288123e1d442b6b9a7d709305fd194688b4b7" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pipeline" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15b6607fa632996eb8a17c9041cb6071cb75ac057abd45dece578723ea8c7c0" + +[[package]] +name = "pkg-config" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "quick-xml" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rayon" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.5", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "rend" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "rkyv" +version = "0.7.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" +dependencies = [ + "bitvec", + "bytecheck", + "bytes", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rust-stemmers" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +dependencies = [ + "bitflags 2.4.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "serde" +version = "1.0.196" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.196" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "serde_json" +version = "1.0.113" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + +[[package]] +name = "sketches-ddsketch" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" +dependencies = [ + "serde", +] + +[[package]] +name = "smallvec" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tantivy" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6083cd777fa94271b8ce0fe4533772cb8110c3044bab048d20f70108329a1f2" +dependencies = [ + "aho-corasick", + "arc-swap", + "async-trait", + "base64", + "bitpacking", + "byteorder", + "census", + "crc32fast", + "crossbeam-channel", + "downcast-rs", + "fastdivide", + "fs4", + "htmlescape", + "itertools", + "levenshtein_automata", + "log", + "lru", + "lz4_flex", + "measure_time", + "memmap2", + "murmurhash32", + "num_cpus", + "once_cell", + "oneshot", + "rayon", + "regex", + "rust-stemmers", + "rustc-hash", + "serde", + "serde_json", + "sketches-ddsketch", + "smallvec", + "tantivy-bitpacker", + "tantivy-columnar", + "tantivy-common", + "tantivy-fst", + "tantivy-query-grammar", + "tantivy-stacker", + "tantivy-tokenizer-api", + "tempfile", + "thiserror", + "time", + "uuid", + "winapi", +] + +[[package]] +name = "tantivy-bitpacker" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecb164321482301f514dd582264fa67f70da2d7eb01872ccd71e35e0d96655a" +dependencies = [ + "bitpacking", +] + +[[package]] +name = "tantivy-columnar" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d85f8019af9a78b3118c11298b36ffd21c2314bd76bbcd9d12e00124cbb7e70" +dependencies = [ + "fastdivide", + "fnv", + "itertools", + "serde", + "tantivy-bitpacker", + "tantivy-common", + "tantivy-sstable", + "tantivy-stacker", +] + +[[package]] +name = "tantivy-common" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af4a3a975e604a2aba6b1106a04505e1e7a025e6def477fab6e410b4126471e1" +dependencies = [ + "async-trait", + "byteorder", + "ownedbytes", + "serde", + "time", +] + +[[package]] +name = "tantivy-fst" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc3c506b1a8443a3a65352df6382a1fb6a7afe1a02e871cee0d25e2c3d5f3944" +dependencies = [ + "byteorder", + "regex-syntax 0.6.29", + "utf8-ranges", +] + +[[package]] +name = "tantivy-query-grammar" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d39c5a03100ac10c96e0c8b07538e2ab8b17da56434ab348309b31f23fada77" +dependencies = [ + "nom", +] + +[[package]] +name = "tantivy-sstable" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0c1bb43e5e8b8e05eb8009610344dbf285f06066c844032fbb3e546b3c71df" +dependencies = [ + "tantivy-common", + "tantivy-fst", + "zstd", +] + +[[package]] +name = "tantivy-stacker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2c078595413f13f218cf6f97b23dcfd48936838f1d3d13a1016e05acd64ed6c" +dependencies = [ + "murmurhash32", + "tantivy-common", +] + +[[package]] +name = "tantivy-tokenizer-api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "347b6fb212b26d3505d224f438e3c4b827ab8bd847fe9953ad5ac6b8f9443b66" +dependencies = [ + "serde", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "thiserror" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "utf8-ranges" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "uuid" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +dependencies = [ + "getrandom", + "serde", +] + +[[package]] +name = "validation" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb8044f0b8a3e94bc8cd089c6a2e42e435553093800b76762418d4bbc3289cc" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" + +[[package]] +name = "web-sys" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "zstd" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "6.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.9+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..3c86303b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[workspace] + +resolver = "2" + +members = [ + "cli", + "lib" +] diff --git a/cli/Cargo.lock b/cli/Cargo.lock new file mode 100644 index 00000000..a4cf3b21 --- /dev/null +++ b/cli/Cargo.lock @@ -0,0 +1,2602 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +dependencies = [ + "cfg-if", + "const-random", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[package]] +name = "anstream" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "arc-swap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" + +[[package]] +name = "async-trait" +version = "0.1.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + +[[package]] +name = "bitpacking" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c7d2ac73c167c06af4a5f37e6e59d84148d57ccbe4480b76f0273eefea82d7" +dependencies = [ + "crunchy", +] + +[[package]] +name = "brotli" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "castaway" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "census" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4c707c6a209cbe82d10abd08e1ea8995e9ea937d2550646e02798948992be0" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "compact_str" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "ryu", + "static_assertions", +] + +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.52.0", +] + +[[package]] +name = "const-random" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastdivide" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25c7df09945d65ea8d70b3321547ed414bbc540aad5bac6883d021b970f35b04" + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "flatbuffers" +version = "23.5.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" +dependencies = [ + "bitflags 1.3.2", + "rustc_version", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fraction" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a78dd758a47a7305478e0e054f9fde4e983b9f9eccda162bf7ca03b79e9d40" +dependencies = [ + "lazy_static", + "num", +] + +[[package]] +name = "fs4" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "generator" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows", +] + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" + +[[package]] +name = "htmlescape" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" + +[[package]] +name = "include_dir" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" +dependencies = [ + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "jobserver" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "levenshtein_automata" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2cdeb66e45e9f36bfad5bbdb4d2384e70936afbee843c6f6543f0c551ebb25" + +[[package]] +name = "libc" +version = "0.2.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" + +[[package]] +name = "lingua" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d109aef84956f04b8b5866db17e59f964152411915ad27b6e291b262d63a442c" +dependencies = [ + "ahash", + "brotli", + "compact_str", + "fraction", + "include_dir", + "itertools 0.12.0", + "lingua-afrikaans-language-model", + "lingua-albanian-language-model", + "lingua-arabic-language-model", + "lingua-armenian-language-model", + "lingua-azerbaijani-language-model", + "lingua-basque-language-model", + "lingua-belarusian-language-model", + "lingua-bengali-language-model", + "lingua-bokmal-language-model", + "lingua-bosnian-language-model", + "lingua-bulgarian-language-model", + "lingua-catalan-language-model", + "lingua-chinese-language-model", + "lingua-croatian-language-model", + "lingua-czech-language-model", + "lingua-danish-language-model", + "lingua-dutch-language-model", + "lingua-english-language-model", + "lingua-esperanto-language-model", + "lingua-estonian-language-model", + "lingua-finnish-language-model", + "lingua-french-language-model", + "lingua-ganda-language-model", + "lingua-georgian-language-model", + "lingua-german-language-model", + "lingua-greek-language-model", + "lingua-gujarati-language-model", + "lingua-hebrew-language-model", + "lingua-hindi-language-model", + "lingua-hungarian-language-model", + "lingua-icelandic-language-model", + "lingua-indonesian-language-model", + "lingua-irish-language-model", + "lingua-italian-language-model", + "lingua-japanese-language-model", + "lingua-kazakh-language-model", + "lingua-korean-language-model", + "lingua-latin-language-model", + "lingua-latvian-language-model", + "lingua-lithuanian-language-model", + "lingua-macedonian-language-model", + "lingua-malay-language-model", + "lingua-maori-language-model", + "lingua-marathi-language-model", + "lingua-mongolian-language-model", + "lingua-nynorsk-language-model", + "lingua-persian-language-model", + "lingua-polish-language-model", + "lingua-portuguese-language-model", + "lingua-punjabi-language-model", + "lingua-romanian-language-model", + "lingua-russian-language-model", + "lingua-serbian-language-model", + "lingua-shona-language-model", + "lingua-slovak-language-model", + "lingua-slovene-language-model", + "lingua-somali-language-model", + "lingua-sotho-language-model", + "lingua-spanish-language-model", + "lingua-swahili-language-model", + "lingua-swedish-language-model", + "lingua-tagalog-language-model", + "lingua-tamil-language-model", + "lingua-telugu-language-model", + "lingua-thai-language-model", + "lingua-tsonga-language-model", + "lingua-tswana-language-model", + "lingua-turkish-language-model", + "lingua-ukrainian-language-model", + "lingua-urdu-language-model", + "lingua-vietnamese-language-model", + "lingua-welsh-language-model", + "lingua-xhosa-language-model", + "lingua-yoruba-language-model", + "lingua-zulu-language-model", + "maplit", + "once_cell", + "rayon", + "regex", + "serde", + "serde-wasm-bindgen", + "serde_json", + "strum", + "strum_macros", + "wasm-bindgen", +] + +[[package]] +name = "lingua-afrikaans-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97df3a7cd698a09753cb32c0f403cf9f698fa0ae1b081fc1b14fc4707301392" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-albanian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1f78f0468f3337d53bd1cdc481e0f1c445e33ce43650d654d8b56037daa1996" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-arabic-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ada75100728990b05bacaec7693efebf0c8b911599ac0c082cb4ed576bf494d" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-armenian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d126f4182866345c5df9cef2e0a3ca64891d7bf0325c31f99df360c00c72bc0f" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-azerbaijani-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "962742b8bed5483adb31cfd12b4ee79fc8dccfa602bb4c25a240579236394892" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-basque-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710aa0c4203d3c019b624601233b0035723087ba2cb9de8572632cb8c5ac97a4" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-belarusian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5b76ec320c7646f0c8849371530ba5332d64f640fc170c14d63102bd27580f5" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-bengali-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecf9f1c7b00c78984eee240f2188f1781a69a08b87bfb1aabd3e3cc50c0d279d" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-bokmal-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a9215ee6bbe6d37222dc5dbd9d1577389810011cb8afbef6155e71a11fa5cb9" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-bosnian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98f836f559334e2d9c0e1876c87e72431b25412b164efd194a840a13b49d8c3b" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-bulgarian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6639397b34419af35835a594178f93dd84edb3a146938f0f1d7013c1a48a5a1" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-catalan-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d9acd43a1320961fe4cb8571ebc0e87d9809a0e9d6d71e5cbab86fab923201" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-chinese-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a1e3a38a0920f6ddbd9b6a79a8c04cd927142713b595ba32be6b811603f7c6" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-croatian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66eaa997d1fa477c42d2497beeb546b63576e04cc6057a60718daabe061c2344" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-czech-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed98f50055cb5c9b06c20da82029c8cfe204332ab3360349545cbc3d465cd1d1" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-danish-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0adc4abde17e94cf023a1ae4f3bcda3b13dcfecfc1f6421f59f17f904d5b5ed2" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-dutch-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30f3db5635a5e964d85190b5d32ca391d9f7630137630458a605c7ab33583db9" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-english-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbd066693abb10083bb5b5fc1c494dda357170265021ad873ef582211817b8a8" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-esperanto-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7877160b3346161f2714236c9ab1c667097821c0dbb31e5bce42f23c82a157c2" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-estonian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a25c07d8a67c82a5c41d8cb2893a4032332d18abadd8d06d80a654f6a1b3c47" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-finnish-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07e0f34931973ec268916cb4c183e06df880e8e43ee99124522ea8c767c9940" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-french-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba406de05309b212790036e576aee4b1a71ce62b77fbd084df5bc8d7c624866f" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-ganda-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9890e6f6b48bf7f2240da770020c5045a1885598c6cb6bc25df73e0182f4792" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-georgian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7392be814065ff3ff71bae7dbb463a47039a68f90d45dd34f4ca7221c0c2f01" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-german-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd4041d542b6512d415c0ea6979333e5e88698b966dda7b9bf06029bf690a13" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-greek-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e1f5a17634410f527a6360979209504072ff9e71e29a0578b18a4f57dcb611b" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-gujarati-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee11b10ffdf8f4eb3d2078c9edec73fb51a36d061ddc6d6e847585a3b91909e" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-hebrew-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a13c9fa3f21bfb91ed3a9710add72c332d0e36234ea9b9d5ed3d6e2235051f6" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-hindi-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63659e514fa8c706d2ed0d7a04b98adb05b8c8d4bc37e3d12edb9d35ce24fd0" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-hungarian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "885525276c696b978c4a1aee8a2b3b9a822724e47348c260d05e9092ebd8c96e" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-icelandic-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b616e573df1aa0bc9881fcef4258d3445fc80f5efe3a71ab010c68eb97ab659d" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-indonesian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc06b8937f6adaad76b28fd009cbfaa6f876ebe5fa887d96dccd1dff2d21d9ad" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-irish-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6258beb6627274163aac7da4dda1e6bcbcf7ff404efa603d0e59e8054f77199" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-italian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c6e138047ac4d681e419e37ad9e383878652ac19e67056ff16085d4cc82e590" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-japanese-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b34b94aa96a1bc0838ddda2c7912d0ebd7256bb21e7a2974e4dd8b186df501a8" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-kazakh-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b64a848cc1a38dc3c4e7a5ad18b9f2ecbd6abf4c453a8898538d96e6a5c0da4" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-korean-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c47aa5e5dc8d029967375081aabda462faf10b070aefc1a175ea7f42f5267c" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-latin-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0922f27e68ae15397160ab1835aefb5a878bc14f0c0ce79b6d074ee828b4d7" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-latvian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6cc01bbfda64ccbfb00b5172d7ba9327053da8c38a85c0b71c969533cf8f08" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-lithuanian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b68e593c8f72e77b1fe823633baae744681bd8def2dce7d2830947b41c4b1e" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-macedonian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e288bc4ec1776131580ed80d842de39bce0355bcc3cc59c519008e60f9276fe" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-malay-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771c6b7ab2865e2563e1ce19bf06611aad674c3f0a180ec43c03a9883e49c8aa" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-maori-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d653a0c16c5cfaa088bdf75e362ba4f715cbd6dbca391f1637a6c49c1e8aff90" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-marathi-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a141c8d9670ff22e541c064ccab3cfbbc2db2625ec20236d73d76dd98e8ba0" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-mongolian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f53de502920af44b5d8ec7787895c0a81b0f5f43e3f3c2b80a240f2b605122c1" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-nynorsk-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db00b13561df244acb76927677200ff399b02d8c9b160d25a38320ef3361cfa9" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-persian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043ba9b4ac7df99acaa1cd9f5925d6fc9b0fe850d3891bbeb91b27ed94f266c4" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-polish-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f298b650531a5d85d3101ad7db7a5cbf3b671b71f01a775e97d4165eebc9ff75" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-portuguese-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9df0be307b3f5e24e10e76a7841302c0ff4a6ebf818a11d3a3c5c4cecfcfe58b" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-punjabi-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc529e58e6af7cca366af7fb964b4cad7a357d538d4b6a7eccde31ae4bd7604f" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-romanian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0428c13d8e05e65929ec170e807c8508c2201c63c7802c7786de0c3b78e390b" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-russian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea97d6643e90ee4fc0043c728f0c06cdd9e69d4970fd1983e5c59b3448a676e" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-serbian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7b181be3137969bf5a9e10d8773666d01223886a4d7454048fad99e7b0416db" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-shona-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "509772c502f2a47ec7cd5b50be1bc34b51dcb98cca1f5e30143c96de61a757bb" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-slovak-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44e1e99e6725e99659367ac80731efc24298a7a24190ff3d777209e86be3dc40" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-slovene-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49fc410d0acdf3068cc9c7ae493348d47a26be0d3d8c5c23603c807befd949c1" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-somali-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde8a66f8901e7e5eac9af985ace066bd5ed3643815beaecb2d7a7b86645d0b3" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-sotho-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58084eb81faf32f62c922e8b3f3dfdcadacf5de934edfb7d3b1acb3759d89f04" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-spanish-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d45be9bede9b9d6d53b6e06047822a18dbd83e5d515736afecd85c1e71cc6070" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-swahili-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f251246905cf56e519af87095fd31264417c19de83fb9e2e0ade5e8c27af4fe3" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-swedish-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0289dc7e5654aac497c829369b811ae1870eb9d5f76c6b82527bbe5470aa0d" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-tagalog-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc5cb889e86a8a62f56f06d0d9bd92d16f697151a9b3dcdefef0ba39624c5cb0" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-tamil-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630d10fabcd5a289b5cd4b651df0c448692a3e55cc7e28334313a2d76d2916e5" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-telugu-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0501f9b52fc247ef4e1f4020fd44a90cccddf9914724977cb3440eced01cbe07" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-thai-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194b09209fc63d986d8ef9505689756eff1935fa52fd91031b60e7d546ca3c76" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-tsonga-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa10493e6bb3bfd8591254a5657eb98bad6be33334c4ebd791edb354fc83b07" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-tswana-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db016128507f4eb48dbe96b05be134c9385f6752da7949c653a24e3c4661e37" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-turkish-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b517e12fe94ce80e7f8f380fdd2c0223bcfe351c0898c9a83f56f78b3afad81" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-ukrainian-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14ed035dd4b7ec5f76fe3b07e5f499d76c4cdb2a6d275459e4cdd3a3d21f131a" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-urdu-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9edb8e15e88004b5b89e80f1bf41237770c5536805494dcf627f7ec550eaf4" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-vietnamese-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07d08afaf263906aa3f2bfaffaf52eecd368992685e2468f1ba7f85f3e41fd49" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-welsh-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c47a533b66772fdd7ece069359900b18824851464a4dd4fd8e4b29928d19b1" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-xhosa-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55a48851d35933a57c6f87a4fdc25d7eeba8eff98f1852b00d7c8c15b2a818fb" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-yoruba-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf6365215ffb772d22c18fbf55b1503ad292aa9a5e93d1249d9307117f6b0ef" +dependencies = [ + "include_dir", +] + +[[package]] +name = "lingua-zulu-language-model" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63f8b5c7f412d078f37ffd2874297afce76719c4b1b7c4856af0fa4e8f89abe2" +dependencies = [ + "include_dir", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "loom" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" +dependencies = [ + "cfg-if", + "generator", + "pin-utils", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "lru" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "lz4_flex" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "912b45c753ff5f7f5208307e8ace7d2a2e30d024e26d3509f3dce546c044ce15" + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + +[[package]] +name = "markdown" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef3aab6a1d529b112695f72beec5ee80e729cb45af58663ec902c8fac764ecdd" +dependencies = [ + "lazy_static", + "pipeline", + "regex", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "measure_time" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56220900f1a0923789ecd6bf25fbae8af3b2f1ff3e9e297fc9b6b8674dd4d852" +dependencies = [ + "instant", + "log", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "memmap2" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" +dependencies = [ + "libc", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "murmurhash32" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9380db4c04d219ac5c51d14996bbf2c2e9a15229771b53f8671eb6c83cf44df" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "odict-rust" +version = "0.1.0" +dependencies = [ + "clap", + "console", + "flatbuffers", + "lingua", + "markdown", + "quick-xml", + "serde", + "serde_json", + "snap", + "tantivy", + "tokio", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "oneshot" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f6640c6bda7731b1fdbab747981a0f896dd1fedaf9f4a53fa237a04a84431f4" +dependencies = [ + "loom", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "ownedbytes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e8a72b918ae8198abb3a18c190288123e1d442b6b9a7d709305fd194688b4b7" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pipeline" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15b6607fa632996eb8a17c9041cb6071cb75ac057abd45dece578723ea8c7c0" + +[[package]] +name = "pkg-config" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-xml" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rayon" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.5", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "rust-stemmers" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +dependencies = [ + "bitflags 2.4.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "semver" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" + +[[package]] +name = "serde" +version = "1.0.196" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-wasm-bindgen" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b713f70513ae1f8d92665bbbbda5c295c2cf1da5542881ae5eefe20c9af132" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "serde_derive" +version = "1.0.196" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.112" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d1bd37ce2324cf3bf85e5a25f96eb4baf0d5aa6eba43e7ae8958870c4ec48ed" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "sketches-ddsketch" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" +dependencies = [ + "serde", +] + +[[package]] +name = "smallvec" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" + +[[package]] +name = "snap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tantivy" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6083cd777fa94271b8ce0fe4533772cb8110c3044bab048d20f70108329a1f2" +dependencies = [ + "aho-corasick", + "arc-swap", + "async-trait", + "base64", + "bitpacking", + "byteorder", + "census", + "crc32fast", + "crossbeam-channel", + "downcast-rs", + "fastdivide", + "fs4", + "htmlescape", + "itertools 0.11.0", + "levenshtein_automata", + "log", + "lru", + "lz4_flex", + "measure_time", + "memmap2", + "murmurhash32", + "num_cpus", + "once_cell", + "oneshot", + "rayon", + "regex", + "rust-stemmers", + "rustc-hash", + "serde", + "serde_json", + "sketches-ddsketch", + "smallvec", + "tantivy-bitpacker", + "tantivy-columnar", + "tantivy-common", + "tantivy-fst", + "tantivy-query-grammar", + "tantivy-stacker", + "tantivy-tokenizer-api", + "tempfile", + "thiserror", + "time", + "uuid", + "winapi", +] + +[[package]] +name = "tantivy-bitpacker" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecb164321482301f514dd582264fa67f70da2d7eb01872ccd71e35e0d96655a" +dependencies = [ + "bitpacking", +] + +[[package]] +name = "tantivy-columnar" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d85f8019af9a78b3118c11298b36ffd21c2314bd76bbcd9d12e00124cbb7e70" +dependencies = [ + "fastdivide", + "fnv", + "itertools 0.11.0", + "serde", + "tantivy-bitpacker", + "tantivy-common", + "tantivy-sstable", + "tantivy-stacker", +] + +[[package]] +name = "tantivy-common" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af4a3a975e604a2aba6b1106a04505e1e7a025e6def477fab6e410b4126471e1" +dependencies = [ + "async-trait", + "byteorder", + "ownedbytes", + "serde", + "time", +] + +[[package]] +name = "tantivy-fst" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc3c506b1a8443a3a65352df6382a1fb6a7afe1a02e871cee0d25e2c3d5f3944" +dependencies = [ + "byteorder", + "regex-syntax 0.6.29", + "utf8-ranges", +] + +[[package]] +name = "tantivy-query-grammar" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d39c5a03100ac10c96e0c8b07538e2ab8b17da56434ab348309b31f23fada77" +dependencies = [ + "nom", +] + +[[package]] +name = "tantivy-sstable" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0c1bb43e5e8b8e05eb8009610344dbf285f06066c844032fbb3e546b3c71df" +dependencies = [ + "tantivy-common", + "tantivy-fst", + "zstd", +] + +[[package]] +name = "tantivy-stacker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2c078595413f13f218cf6f97b23dcfd48936838f1d3d13a1016e05acd64ed6c" +dependencies = [ + "murmurhash32", + "tantivy-common", +] + +[[package]] +name = "tantivy-tokenizer-api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "347b6fb212b26d3505d224f438e3c4b827ab8bd847fe9953ad5ac6b8f9443b66" +dependencies = [ + "serde", +] + +[[package]] +name = "tempfile" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "thiserror" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +dependencies = [ + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tokio" +version = "1.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +dependencies = [ + "backtrace", + "pin-project-lite", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "utf8-ranges" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "uuid" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +dependencies = [ + "getrandom", + "serde", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" + +[[package]] +name = "web-sys" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zstd" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "6.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.9+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/cli/Cargo.toml b/cli/Cargo.toml new file mode 100644 index 00000000..3b2e77f1 --- /dev/null +++ b/cli/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "cli" +version = "2.0.0" +edition = "2021" + +[dependencies] +odict = { path = "../lib" } +clap = { version = "4.4.18", features = ["derive", "cargo"] } +console = "0.15.8" +serde = "1.0.196" +serde_json = "1.0.112" +clio = "0.3.5" +quick-xml = { version = "0.31.0", features = ["serde", "serialize"] } +regex = "1.10.3" diff --git a/cli/src/compile.rs b/cli/src/compile.rs new file mode 100644 index 00000000..18cc4f1b --- /dev/null +++ b/cli/src/compile.rs @@ -0,0 +1,44 @@ +use std::{error::Error, path::PathBuf}; + +use clap::{arg, command, Args}; +use odict::Dictionary; + +use crate::CLI; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct CompileArgs { + #[arg(required = true, help = "Path to ODXML file")] + input: PathBuf, + + #[arg(short, help = "Output path of compiled dictionary")] + output: Option, +} + +pub fn compile(args: &CompileArgs) -> Result<(), Box> { + let CompileArgs { input, output } = args; + + let mut out = output.clone(); + + if out.is_none() { + let name = input + .file_stem() + .and_then(|s| s.to_str()) + .unwrap_or_default(); + + let directory = input.parent().and_then(|s| s.to_str()).unwrap_or_default(); + + out = Some( + PathBuf::new() + .join(directory) + .join(format!("{}.odict", name)), + ); + } + + let dict = Dictionary::from(input); + + dict.write_to_path(&out.unwrap())?; + + Ok(()) +} diff --git a/cli/src/context.rs b/cli/src/context.rs new file mode 100644 index 00000000..22412d56 --- /dev/null +++ b/cli/src/context.rs @@ -0,0 +1,6 @@ +use odict::read::DictionaryReader; + +pub struct CLIContext { + pub reader: DictionaryReader, + // writer: DictionaryWriter, +} diff --git a/cli/src/enums.rs b/cli/src/enums.rs new file mode 100644 index 00000000..4828cd49 --- /dev/null +++ b/cli/src/enums.rs @@ -0,0 +1,8 @@ +use clap::ValueEnum; + +#[derive(Debug, Clone, ValueEnum)] +pub enum PrintFormat { + Print, + JSON, + XML, +} diff --git a/cli/src/lookup.rs b/cli/src/lookup.rs new file mode 100644 index 00000000..c97ff74c --- /dev/null +++ b/cli/src/lookup.rs @@ -0,0 +1,62 @@ +use std::error::Error; + +use crate::context::CLIContext; +use crate::enums::PrintFormat; +use clap::{arg, command, Args}; +use odict::LookupOptions; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct LookupArgs { + #[arg(required = true, help = "Path to a compiled dictionary")] + dictionary_path: String, + + #[arg(required = true, help = "Words to look up")] + queries: Vec, + + #[arg( + short, + long, + value_enum, + default_value_t = PrintFormat::Print, + help = "Output format of the entries" + )] + format: PrintFormat, + + #[arg( + short = 'F', + long, + default_value_t = false, + help = "Follows all \"see also\" attributes (\"see\") until it finds a root term." + )] + follow: bool, + + #[arg( + short, + long, + default_value_t = 0, + help = "If a definition cannot be found, attempt to split the query into words of at least length S and look up each word separately. Can be relatively slow." + )] + split: usize, +} + +pub fn lookup(ctx: &CLIContext, args: &LookupArgs) -> Result<(), Box> { + let LookupArgs { + dictionary_path: path, + queries, + format, + follow, + split, + } = args; + + let file = ctx.reader.read_from_path(&path)?; + + let entries = file.to_archive()?.lookup( + queries, + &LookupOptions::default().follow(*follow).split(*split), + ); + + println!("{:?}", entries); + Ok(()) +} diff --git a/cli/src/main.rs b/cli/src/main.rs new file mode 100644 index 00000000..9de954e7 --- /dev/null +++ b/cli/src/main.rs @@ -0,0 +1,55 @@ +use clap::{command, crate_version, Parser, Subcommand}; +use odict::DictionaryReader; + +mod compile; +mod context; +mod enums; +mod lookup; +mod utils; + +use compile::*; +use context::*; +use lookup::*; +use utils::*; + +#[derive(Debug, Parser)] +#[command(name = "odict", about = "the lighting-fast open-source dictionary compiler", version = crate_version!(), long_about = None)] +pub struct CLI { + #[command(subcommand)] + command: Commands, + + #[arg( + short, + long, + default_value_t = false, + help = "Silence any non-important output" + )] + quiet: bool, +} + +#[derive(Debug, Subcommand)] +enum Commands { + /// Compiles a dictionary from ODXML + #[command(arg_required_else_help = true)] + Compile(CompileArgs), + + /// Looks up an entry in a compiled dictionary without indexing + #[command(arg_required_else_help = true)] + Lookup(LookupArgs), +} + +fn main() { + let cli = CLI::parse(); + + let ctx = CLIContext { + reader: DictionaryReader::default(), + }; + + t( + || match cli.command { + Commands::Compile(ref args) => compile(&args), + Commands::Lookup(ref args) => lookup(&ctx, &args), + }, + cli.quiet, + ); +} diff --git a/cli/src/utils.rs b/cli/src/utils.rs new file mode 100644 index 00000000..c657a5b4 --- /dev/null +++ b/cli/src/utils.rs @@ -0,0 +1,33 @@ +// type closure func() error + +// // t times the amount of time it takes for a closure to +// // execute then prints the elapsed time +// func t(c *cli.Context, cb closure) error { +// start := time.Now() + +// err := cb() + +// if !c.Bool("quiet") && err == nil { +// fmt.Printf("\n✨ Completed in %s\n", time.Since(start).String()) +// } + +// return err +// } + +use std::error::Error; + +pub fn t(cb: F, quiet: bool) -> Result<(), Box> +where + F: FnOnce() -> Result<(), Box>, +{ + let start = std::time::Instant::now(); + let err = cb(); + + if let Err(msg) = err { + println!("{}", msg) + } else if !quiet { + println!("✨ Completed in {:?}", start.elapsed()); + } + + Ok(()) +} diff --git a/cli/alias.go b/go/cli/alias.go similarity index 100% rename from cli/alias.go rename to go/cli/alias.go diff --git a/cli/app.go b/go/cli/app.go similarity index 100% rename from cli/app.go rename to go/cli/app.go diff --git a/cli/compile.go b/go/cli/compile.go similarity index 100% rename from cli/compile.go rename to go/cli/compile.go diff --git a/cli/dump.go b/go/cli/dump.go similarity index 100% rename from cli/dump.go rename to go/cli/dump.go diff --git a/cli/enums_generated.go b/go/cli/enums_generated.go similarity index 100% rename from cli/enums_generated.go rename to go/cli/enums_generated.go diff --git a/cli/go.mod b/go/cli/go.mod similarity index 100% rename from cli/go.mod rename to go/cli/go.mod diff --git a/cli/go.sum b/go/cli/go.sum similarity index 100% rename from cli/go.sum rename to go/cli/go.sum diff --git a/cli/index.go b/go/cli/index.go similarity index 100% rename from cli/index.go rename to go/cli/index.go diff --git a/cli/ipc.go b/go/cli/ipc.go similarity index 100% rename from cli/ipc.go rename to go/cli/ipc.go diff --git a/cli/justfile b/go/cli/justfile similarity index 100% rename from cli/justfile rename to go/cli/justfile diff --git a/cli/lexicon.go b/go/cli/lexicon.go similarity index 100% rename from cli/lexicon.go rename to go/cli/lexicon.go diff --git a/cli/lookup.go b/go/cli/lookup.go similarity index 100% rename from cli/lookup.go rename to go/cli/lookup.go diff --git a/cli/merge.go b/go/cli/merge.go similarity index 100% rename from cli/merge.go rename to go/cli/merge.go diff --git a/cli/print.go b/go/cli/print.go similarity index 100% rename from cli/print.go rename to go/cli/print.go diff --git a/cli/search.go b/go/cli/search.go similarity index 100% rename from cli/search.go rename to go/cli/search.go diff --git a/cli/server.go b/go/cli/server.go similarity index 100% rename from cli/server.go rename to go/cli/server.go diff --git a/cli/service.go b/go/cli/service.go similarity index 100% rename from cli/service.go rename to go/cli/service.go diff --git a/cli/service_generated.go b/go/cli/service_generated.go similarity index 100% rename from cli/service_generated.go rename to go/cli/service_generated.go diff --git a/cli/split.go b/go/cli/split.go similarity index 100% rename from cli/split.go rename to go/cli/split.go diff --git a/cli/t.go b/go/cli/t.go similarity index 100% rename from cli/t.go rename to go/cli/t.go diff --git a/go.work b/go/go.work similarity index 100% rename from go.work rename to go/go.work diff --git a/go.work.sum b/go/go.work.sum similarity index 100% rename from go.work.sum rename to go/go.work.sum diff --git a/lib/config/aliases.go b/go/lib/config/aliases.go similarity index 100% rename from lib/config/aliases.go rename to go/lib/config/aliases.go diff --git a/lib/config/config.go b/go/lib/config/config.go similarity index 100% rename from lib/config/config.go rename to go/lib/config/config.go diff --git a/lib/config/config_test.go b/go/lib/config/config_test.go similarity index 100% rename from lib/config/config_test.go rename to go/lib/config/config_test.go diff --git a/lib/config/go.mod b/go/lib/config/go.mod similarity index 100% rename from lib/config/go.mod rename to go/lib/config/go.mod diff --git a/lib/config/go.sum b/go/lib/config/go.sum similarity index 100% rename from lib/config/go.sum rename to go/lib/config/go.sum diff --git a/lib/core/compile.go b/go/lib/core/compile.go similarity index 100% rename from lib/core/compile.go rename to go/lib/core/compile.go diff --git a/lib/core/go.mod b/go/lib/core/go.mod similarity index 100% rename from lib/core/go.mod rename to go/lib/core/go.mod diff --git a/lib/core/go.sum b/go/lib/core/go.sum similarity index 100% rename from lib/core/go.sum rename to go/lib/core/go.sum diff --git a/lib/core/lexicon.go b/go/lib/core/lexicon.go similarity index 100% rename from lib/core/lexicon.go rename to go/lib/core/lexicon.go diff --git a/lib/core/lexicon_test.go b/go/lib/core/lexicon_test.go similarity index 100% rename from lib/core/lexicon_test.go rename to go/lib/core/lexicon_test.go diff --git a/lib/core/lookup.go b/go/lib/core/lookup.go similarity index 100% rename from lib/core/lookup.go rename to go/lib/core/lookup.go diff --git a/lib/core/lookup_test.go b/go/lib/core/lookup_test.go similarity index 100% rename from lib/core/lookup_test.go rename to go/lib/core/lookup_test.go diff --git a/lib/core/merge.go b/go/lib/core/merge.go similarity index 100% rename from lib/core/merge.go rename to go/lib/core/merge.go diff --git a/lib/core/merge_test.go b/go/lib/core/merge_test.go similarity index 100% rename from lib/core/merge_test.go rename to go/lib/core/merge_test.go diff --git a/lib/core/read.go b/go/lib/core/read.go similarity index 100% rename from lib/core/read.go rename to go/lib/core/read.go diff --git a/lib/core/read_test.go b/go/lib/core/read_test.go similarity index 100% rename from lib/core/read_test.go rename to go/lib/core/read_test.go diff --git a/lib/core/split.go b/go/lib/core/split.go similarity index 100% rename from lib/core/split.go rename to go/lib/core/split.go diff --git a/lib/core/split_test.go b/go/lib/core/split_test.go similarity index 100% rename from lib/core/split_test.go rename to go/lib/core/split_test.go diff --git a/lib/core/version.go b/go/lib/core/version.go similarity index 100% rename from lib/core/version.go rename to go/lib/core/version.go diff --git a/lib/core/write.go b/go/lib/core/write.go similarity index 100% rename from lib/core/write.go rename to go/lib/core/write.go diff --git a/lib/core/write_test.go b/go/lib/core/write_test.go similarity index 100% rename from lib/core/write_test.go rename to go/lib/core/write_test.go diff --git a/lib/dump/dump.go b/go/lib/dump/dump.go similarity index 100% rename from lib/dump/dump.go rename to go/lib/dump/dump.go diff --git a/lib/dump/dump_test.go b/go/lib/dump/dump_test.go similarity index 100% rename from lib/dump/dump_test.go rename to go/lib/dump/dump_test.go diff --git a/lib/dump/go.mod b/go/lib/dump/go.mod similarity index 100% rename from lib/dump/go.mod rename to go/lib/dump/go.mod diff --git a/lib/dump/go.sum b/go/lib/dump/go.sum similarity index 100% rename from lib/dump/go.sum rename to go/lib/dump/go.sum diff --git a/lib/justfile b/go/lib/justfile similarity index 100% rename from lib/justfile rename to go/lib/justfile diff --git a/lib/search/go.mod b/go/lib/search/go.mod similarity index 100% rename from lib/search/go.mod rename to go/lib/search/go.mod diff --git a/lib/search/go.sum b/go/lib/search/go.sum similarity index 100% rename from lib/search/go.sum rename to go/lib/search/go.sum diff --git a/lib/search/index.go b/go/lib/search/index.go similarity index 100% rename from lib/search/index.go rename to go/lib/search/index.go diff --git a/lib/search/index_test.go b/go/lib/search/index_test.go similarity index 100% rename from lib/search/index_test.go rename to go/lib/search/index_test.go diff --git a/lib/search/search.go b/go/lib/search/search.go similarity index 100% rename from lib/search/search.go rename to go/lib/search/search.go diff --git a/lib/search/search_test.go b/go/lib/search/search_test.go similarity index 100% rename from lib/search/search_test.go rename to go/lib/search/search_test.go diff --git a/lib/server/cache.go b/go/lib/server/cache.go similarity index 100% rename from lib/server/cache.go rename to go/lib/server/cache.go diff --git a/lib/server/go.mod b/go/lib/server/go.mod similarity index 100% rename from lib/server/go.mod rename to go/lib/server/go.mod diff --git a/lib/server/go.sum b/go/lib/server/go.sum similarity index 100% rename from lib/server/go.sum rename to go/lib/server/go.sum diff --git a/lib/server/lookup.go b/go/lib/server/lookup.go similarity index 100% rename from lib/server/lookup.go rename to go/lib/server/lookup.go diff --git a/lib/server/lookup_test.go b/go/lib/server/lookup_test.go similarity index 100% rename from lib/server/lookup_test.go rename to go/lib/server/lookup_test.go diff --git a/lib/server/search.go b/go/lib/server/search.go similarity index 100% rename from lib/server/search.go rename to go/lib/server/search.go diff --git a/lib/server/search_test.go b/go/lib/server/search_test.go similarity index 100% rename from lib/server/search_test.go rename to go/lib/server/search_test.go diff --git a/lib/server/serve.go b/go/lib/server/serve.go similarity index 100% rename from lib/server/serve.go rename to go/lib/server/serve.go diff --git a/lib/sql/__snapshots__/sql_test.snap b/go/lib/sql/__snapshots__/sql_test.snap similarity index 100% rename from lib/sql/__snapshots__/sql_test.snap rename to go/lib/sql/__snapshots__/sql_test.snap diff --git a/lib/sql/definitions.go b/go/lib/sql/definitions.go similarity index 100% rename from lib/sql/definitions.go rename to go/lib/sql/definitions.go diff --git a/lib/sql/dictionaries.go b/go/lib/sql/dictionaries.go similarity index 100% rename from lib/sql/dictionaries.go rename to go/lib/sql/dictionaries.go diff --git a/lib/sql/entries.go b/go/lib/sql/entries.go similarity index 100% rename from lib/sql/entries.go rename to go/lib/sql/entries.go diff --git a/lib/sql/etymologies.go b/go/lib/sql/etymologies.go similarity index 100% rename from lib/sql/etymologies.go rename to go/lib/sql/etymologies.go diff --git a/lib/sql/examples.go b/go/lib/sql/examples.go similarity index 100% rename from lib/sql/examples.go rename to go/lib/sql/examples.go diff --git a/lib/sql/go.mod b/go/lib/sql/go.mod similarity index 100% rename from lib/sql/go.mod rename to go/lib/sql/go.mod diff --git a/lib/sql/go.sum b/go/lib/sql/go.sum similarity index 100% rename from lib/sql/go.sum rename to go/lib/sql/go.sum diff --git a/lib/sql/groups.go b/go/lib/sql/groups.go similarity index 100% rename from lib/sql/groups.go rename to go/lib/sql/groups.go diff --git a/lib/sql/notes.go b/go/lib/sql/notes.go similarity index 100% rename from lib/sql/notes.go rename to go/lib/sql/notes.go diff --git a/lib/sql/senses.go b/go/lib/sql/senses.go similarity index 100% rename from lib/sql/senses.go rename to go/lib/sql/senses.go diff --git a/lib/sql/sql.go b/go/lib/sql/sql.go similarity index 100% rename from lib/sql/sql.go rename to go/lib/sql/sql.go diff --git a/lib/sql/sql_test.go b/go/lib/sql/sql_test.go similarity index 100% rename from lib/sql/sql_test.go rename to go/lib/sql/sql_test.go diff --git a/lib/sql/types.go b/go/lib/sql/types.go similarity index 100% rename from lib/sql/types.go rename to go/lib/sql/types.go diff --git a/lib/sql/utils.go b/go/lib/sql/utils.go similarity index 100% rename from lib/sql/utils.go rename to go/lib/sql/utils.go diff --git a/lib/test/cleanup.go b/go/lib/test/cleanup.go similarity index 100% rename from lib/test/cleanup.go rename to go/lib/test/cleanup.go diff --git a/lib/test/go.mod b/go/lib/test/go.mod similarity index 100% rename from lib/test/go.mod rename to go/lib/test/go.mod diff --git a/lib/test/go.sum b/go/lib/test/go.sum similarity index 100% rename from lib/test/go.sum rename to go/lib/test/go.sum diff --git a/lib/types/definition.go b/go/lib/types/definition.go similarity index 100% rename from lib/types/definition.go rename to go/lib/types/definition.go diff --git a/lib/types/dictionary.go b/go/lib/types/dictionary.go similarity index 100% rename from lib/types/dictionary.go rename to go/lib/types/dictionary.go diff --git a/lib/types/entry.go b/go/lib/types/entry.go similarity index 100% rename from lib/types/entry.go rename to go/lib/types/entry.go diff --git a/lib/types/enums_generated.go b/go/lib/types/enums_generated.go similarity index 100% rename from lib/types/enums_generated.go rename to go/lib/types/enums_generated.go diff --git a/lib/types/etymology.go b/go/lib/types/etymology.go similarity index 100% rename from lib/types/etymology.go rename to go/lib/types/etymology.go diff --git a/lib/types/go.mod b/go/lib/types/go.mod similarity index 100% rename from lib/types/go.mod rename to go/lib/types/go.mod diff --git a/lib/types/go.sum b/go/lib/types/go.sum similarity index 100% rename from lib/types/go.sum rename to go/lib/types/go.sum diff --git a/lib/types/group.go b/go/lib/types/group.go similarity index 100% rename from lib/types/group.go rename to go/lib/types/group.go diff --git a/lib/types/mdstring.go b/go/lib/types/mdstring.go similarity index 100% rename from lib/types/mdstring.go rename to go/lib/types/mdstring.go diff --git a/lib/types/mdstring_test.go b/go/lib/types/mdstring_test.go similarity index 100% rename from lib/types/mdstring_test.go rename to go/lib/types/mdstring_test.go diff --git a/lib/types/note.go b/go/lib/types/note.go similarity index 100% rename from lib/types/note.go rename to go/lib/types/note.go diff --git a/lib/types/pos.go b/go/lib/types/pos.go similarity index 100% rename from lib/types/pos.go rename to go/lib/types/pos.go diff --git a/lib/types/schema_generated.go b/go/lib/types/schema_generated.go similarity index 100% rename from lib/types/schema_generated.go rename to go/lib/types/schema_generated.go diff --git a/lib/types/sense.go b/go/lib/types/sense.go similarity index 100% rename from lib/types/sense.go rename to go/lib/types/sense.go diff --git a/lib/types/types.go b/go/lib/types/types.go similarity index 100% rename from lib/types/types.go rename to go/lib/types/types.go diff --git a/lib/types/utils.go b/go/lib/types/utils.go similarity index 100% rename from lib/types/utils.go rename to go/lib/types/utils.go diff --git a/lib/utils/bytes.go b/go/lib/utils/bytes.go similarity index 100% rename from lib/utils/bytes.go rename to go/lib/utils/bytes.go diff --git a/lib/utils/fs.go b/go/lib/utils/fs.go similarity index 100% rename from lib/utils/fs.go rename to go/lib/utils/fs.go diff --git a/lib/utils/go.mod b/go/lib/utils/go.mod similarity index 100% rename from lib/utils/go.mod rename to go/lib/utils/go.mod diff --git a/lib/utils/go.sum b/go/lib/utils/go.sum similarity index 100% rename from lib/utils/go.sum rename to go/lib/utils/go.sum diff --git a/lib/utils/markdown.go b/go/lib/utils/markdown.go similarity index 100% rename from lib/utils/markdown.go rename to go/lib/utils/markdown.go diff --git a/lib/utils/markdown_test.go b/go/lib/utils/markdown_test.go similarity index 100% rename from lib/utils/markdown_test.go rename to go/lib/utils/markdown_test.go diff --git a/lib/utils/serialization.go b/go/lib/utils/serialization.go similarity index 100% rename from lib/utils/serialization.go rename to go/lib/utils/serialization.go diff --git a/lib/utils/uuid.go b/go/lib/utils/uuid.go similarity index 100% rename from lib/utils/uuid.go rename to go/lib/utils/uuid.go diff --git a/odict.go b/go/odict.go similarity index 100% rename from odict.go rename to go/odict.go diff --git a/wasm/.prettierrc.json b/go/wasm/.prettierrc.json similarity index 100% rename from wasm/.prettierrc.json rename to go/wasm/.prettierrc.json diff --git a/wasm/CHANGELOG.md b/go/wasm/CHANGELOG.md similarity index 100% rename from wasm/CHANGELOG.md rename to go/wasm/CHANGELOG.md diff --git a/wasm/demo.html b/go/wasm/demo.html similarity index 100% rename from wasm/demo.html rename to go/wasm/demo.html diff --git a/wasm/go.mod b/go/wasm/go.mod similarity index 100% rename from wasm/go.mod rename to go/wasm/go.mod diff --git a/wasm/jest.config.cjs b/go/wasm/jest.config.cjs similarity index 100% rename from wasm/jest.config.cjs rename to go/wasm/jest.config.cjs diff --git a/wasm/justfile b/go/wasm/justfile similarity index 100% rename from wasm/justfile rename to go/wasm/justfile diff --git a/wasm/package-lock.json b/go/wasm/package-lock.json similarity index 100% rename from wasm/package-lock.json rename to go/wasm/package-lock.json diff --git a/wasm/package.json b/go/wasm/package.json similarity index 100% rename from wasm/package.json rename to go/wasm/package.json diff --git a/wasm/src/__generated__/compile-payload.ts b/go/wasm/src/__generated__/compile-payload.ts similarity index 100% rename from wasm/src/__generated__/compile-payload.ts rename to go/wasm/src/__generated__/compile-payload.ts diff --git a/wasm/src/__generated__/enums.ts b/go/wasm/src/__generated__/enums.ts similarity index 100% rename from wasm/src/__generated__/enums.ts rename to go/wasm/src/__generated__/enums.ts diff --git a/wasm/src/__generated__/index.ts b/go/wasm/src/__generated__/index.ts similarity index 100% rename from wasm/src/__generated__/index.ts rename to go/wasm/src/__generated__/index.ts diff --git a/wasm/src/__generated__/lookup-payload.ts b/go/wasm/src/__generated__/lookup-payload.ts similarity index 100% rename from wasm/src/__generated__/lookup-payload.ts rename to go/wasm/src/__generated__/lookup-payload.ts diff --git a/wasm/src/__generated__/markdown-strategy.ts b/go/wasm/src/__generated__/markdown-strategy.ts similarity index 100% rename from wasm/src/__generated__/markdown-strategy.ts rename to go/wasm/src/__generated__/markdown-strategy.ts diff --git a/wasm/src/__generated__/method.ts b/go/wasm/src/__generated__/method.ts similarity index 100% rename from wasm/src/__generated__/method.ts rename to go/wasm/src/__generated__/method.ts diff --git a/wasm/src/__generated__/odict-method.ts b/go/wasm/src/__generated__/odict-method.ts similarity index 100% rename from wasm/src/__generated__/odict-method.ts rename to go/wasm/src/__generated__/odict-method.ts diff --git a/wasm/src/__generated__/pos.ts b/go/wasm/src/__generated__/pos.ts similarity index 100% rename from wasm/src/__generated__/pos.ts rename to go/wasm/src/__generated__/pos.ts diff --git a/wasm/src/__generated__/search-payload.ts b/go/wasm/src/__generated__/search-payload.ts similarity index 100% rename from wasm/src/__generated__/search-payload.ts rename to go/wasm/src/__generated__/search-payload.ts diff --git a/wasm/src/__generated__/service.ts b/go/wasm/src/__generated__/service.ts similarity index 100% rename from wasm/src/__generated__/service.ts rename to go/wasm/src/__generated__/service.ts diff --git a/wasm/src/__generated__/split-payload.ts b/go/wasm/src/__generated__/split-payload.ts similarity index 100% rename from wasm/src/__generated__/split-payload.ts rename to go/wasm/src/__generated__/split-payload.ts diff --git a/wasm/src/__generated__/write-payload.ts b/go/wasm/src/__generated__/write-payload.ts similarity index 100% rename from wasm/src/__generated__/write-payload.ts rename to go/wasm/src/__generated__/write-payload.ts diff --git a/wasm/src/dictionary.ts b/go/wasm/src/dictionary.ts similarity index 100% rename from wasm/src/dictionary.ts rename to go/wasm/src/dictionary.ts diff --git a/wasm/src/index.ts b/go/wasm/src/index.ts similarity index 100% rename from wasm/src/index.ts rename to go/wasm/src/index.ts diff --git a/wasm/src/odict.go b/go/wasm/src/odict.go similarity index 100% rename from wasm/src/odict.go rename to go/wasm/src/odict.go diff --git a/wasm/src/polyfill.ts b/go/wasm/src/polyfill.ts similarity index 100% rename from wasm/src/polyfill.ts rename to go/wasm/src/polyfill.ts diff --git a/wasm/src/service.ts b/go/wasm/src/service.ts similarity index 100% rename from wasm/src/service.ts rename to go/wasm/src/service.ts diff --git a/wasm/src/types.ts b/go/wasm/src/types.ts similarity index 100% rename from wasm/src/types.ts rename to go/wasm/src/types.ts diff --git a/wasm/src/wasm_exec.js b/go/wasm/src/wasm_exec.js similarity index 100% rename from wasm/src/wasm_exec.js rename to go/wasm/src/wasm_exec.js diff --git a/wasm/test/dictionary.spec.ts b/go/wasm/test/dictionary.spec.ts similarity index 100% rename from wasm/test/dictionary.spec.ts rename to go/wasm/test/dictionary.spec.ts diff --git a/wasm/tsconfig.json b/go/wasm/tsconfig.json similarity index 100% rename from wasm/tsconfig.json rename to go/wasm/tsconfig.json diff --git a/xsd/go.mod b/go/xsd/go.mod similarity index 100% rename from xsd/go.mod rename to go/xsd/go.mod diff --git a/xsd/go.sum b/go/xsd/go.sum similarity index 100% rename from xsd/go.sum rename to go/xsd/go.sum diff --git a/xsd/justfile b/go/xsd/justfile similarity index 100% rename from xsd/justfile rename to go/xsd/justfile diff --git a/xsd/xsd.go b/go/xsd/xsd.go similarity index 100% rename from xsd/xsd.go rename to go/xsd/xsd.go diff --git a/justfile b/justfile index 3b479b4a..23cdc2dd 100644 --- a/justfile +++ b/justfile @@ -4,15 +4,15 @@ GOLANG_CROSS_VERSION := "v1.21.3" # Global # # ---------------------------------------------------------------------------- # -@deps: xsd +@deps: asdf install > /dev/null go install golang.org/x/tools/cmd/goimports@latest -@build: deps (cli "schema") sync - go build -o bin/odict odict.go +@build +args="": deps + cargo build {{args}} -@build-all +args="": deps (cli "schema") sync - goreleaser build --id odict --clean {{args}} +# @build-all +args="": deps (cli "schema") sync +# goreleaser build --id odict --clean {{args}} @schema: (go "schema") (cli "schema") (js "schema") @@ -20,14 +20,14 @@ GOLANG_CROSS_VERSION := "v1.21.3" go run xsd/xsd.go @run +args="": - go run odict.go {{args}} + cargo run {{args}} @test: deps xsd (go "test") (jvm "test") (python "test") (js "test") (wasm "test") clean @clean: (python "clean") (jvm "clean") (js "clean") -@publish +args="--auto-snapshot --clean": - goreleaser release {{args}} +# @publish +args="--auto-snapshot --clean": +# goreleaser release {{args}} @snaps: UPDATE_SNAPS=true just go test @@ -40,7 +40,7 @@ GOLANG_CROSS_VERSION := "v1.21.3" # ------------------------------------------------------------------------------ # @go +command: - just lib/{{command}} + just go/lib/{{command}} @cli +command: just cli/{{command}} diff --git a/lib/Cargo.toml b/lib/Cargo.toml new file mode 100644 index 00000000..f78239f1 --- /dev/null +++ b/lib/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "odict" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +lz4_flex = { version = "0.11.2", default-features = false, features = [ + "frame", +] } +byteorder = "1.5.0" +markdown = "0.3.0" +quick-xml = { version = "0.31.0", features = ["serialize"] } +rayon = "1.8.1" +regex = "1.10.3" +rkyv = { version = "0.7.43", features = [ + "size_32", + "strict", + "alloc", + "archive_le", +] } +serde = "1.0.196" +serde_json = "1.0.113" +tantivy = "0.21.1" +validation = "0.0.1" diff --git a/lib/src/core/compile.rs b/lib/src/core/compile.rs new file mode 100644 index 00000000..64deb12e --- /dev/null +++ b/lib/src/core/compile.rs @@ -0,0 +1,52 @@ +use std::error::Error; + +use rkyv::to_bytes; + +use crate::{models::Dictionary, utils::compress}; + +use super::version::FILE_VERSION; + +const SIGNATURE: &[u8] = b"ODICT"; + +impl Dictionary { + pub fn serialize(&self) -> Result, Box> { + let bytes = to_bytes::<_, 4096>(self)?; + Ok(bytes.to_vec()) + } + + pub fn compile(&self) -> Result, Box> { + let version_bytes = FILE_VERSION.to_le_bytes(); + + let compressed = compress(&self.serialize()?)?; + let compressed_size = compressed.len() as u64; + let compressed_size_bytes = compressed_size.to_le_bytes(); + + let total_size = + SIGNATURE.len() + version_bytes.len() + compressed_size_bytes.len() + compressed.len(); + + let mut output = Vec::with_capacity(total_size); + + output.extend_from_slice(SIGNATURE); + output.extend_from_slice(&version_bytes); + output.extend_from_slice(&compressed_size_bytes); + output.extend_from_slice(&compressed); + + if SIGNATURE.len() != 5 { + return Err("Signature bytes do not equal 5".into()); + } + + if version_bytes.len() != 2 { + return Err("Version bytes do not equal 2".into()); + } + + if compressed_size_bytes.len() != 8 { + return Err("Content byte count does not equal 8".into()); + } + + if compressed.len() != compressed_size as usize { + return Err("Content does not equal the computed byte count".into()); + } + + Ok(output) + } +} diff --git a/lib/src/core/lookup.rs b/lib/src/core/lookup.rs new file mode 100644 index 00000000..732d7a85 --- /dev/null +++ b/lib/src/core/lookup.rs @@ -0,0 +1,138 @@ +use std::{error::Error, sync::OnceLock}; + +use crate::{ArchivedDictionary, Dictionary, Entry}; + +use rayon::prelude::*; + +use regex::Regex; +use rkyv::Archived; + +/* -------------------------------------------------------------------------- */ +/* Structs & Enums */ +/* -------------------------------------------------------------------------- */ + +/* ----------------------------- Lookup Options ----------------------------- */ + +pub enum LookupOption { + Follow(bool), + Split(u16), +} + +pub struct LookupOptions { + follow: bool, + split: usize, +} + +impl LookupOptions { + pub fn default() -> Self { + Self { + follow: false, + split: 0, + } + } + + pub fn follow(mut self, follow: bool) -> Self { + self.follow = follow; + self + } + + pub fn split(mut self, threshold: usize) -> Self { + self.split = threshold; + self + } +} + +/* --------------------------------- Queries -------------------------------- */ + +struct LookupQuery { + term: String, + fallback: String, +} + +fn parse_query(query: &str) -> LookupQuery { + let term: String; + + let fallback = match get_regex().captures(&query) { + Some(caps) => { + let fallback = &caps[1]; + term = query.replace(&caps[0], ""); + fallback.to_string() + } + None => { + term = query.to_string(); + "".to_string() + } + }; + + LookupQuery { term, fallback } +} + +fn get_regex() -> &'static Regex { + static R: OnceLock = OnceLock::new(); + return R.get_or_init(|| Regex::new(r"\((.+)\)$").unwrap()); +} + +/* -------------------------------------------------------------------------- */ +/* Methods */ +/* -------------------------------------------------------------------------- */ + +macro_rules! lookup { + ($tys:ty, $ret:ty) => { + impl $tys { + fn lookup_( + &self, + query: &LookupQuery, + options: &LookupOptions, + ) -> Result, Box> { + let mut entries: Vec<&$ret> = Vec::new(); + + let LookupQuery { term, fallback } = query; + let LookupOptions { follow, split } = options; + + let mut found = self.entries.get(term.as_str()); + + if found.is_none() && !fallback.is_empty() { + found = self.entries.get(fallback.as_str()); + } + + if let Some(entry) = found { + if *follow { + let also = &entry.see_also; + + if also.is_some() { + return self.lookup_( + &LookupQuery { + term: also.as_ref().unwrap().to_string(), + fallback: fallback.to_string(), + }, + options, + ); + } + } else if *split > 0 { + // TODO: revisit + // let split = dictionary.split(term, &SplitOptions::default().threshold(*split))?; + // entries.extend_from_slice(&split); + } else { + entries.push(entry); + } + } + + Ok(entries) + } + + pub fn lookup( + &self, + queries: &Vec, + options: &LookupOptions, + ) -> Result>, Box> { + queries + .par_iter() + .map(|query| self.lookup_(&parse_query(query), options)) + .collect() + } + } + }; +} + +lookup!(Dictionary, Entry); +lookup!(ArchivedDictionary, Archived); diff --git a/lib/src/core/mod.rs b/lib/src/core/mod.rs new file mode 100644 index 00000000..392f8674 --- /dev/null +++ b/lib/src/core/mod.rs @@ -0,0 +1,11 @@ +mod compile; +mod lookup; +pub mod read; +// mod split; +mod version; +mod write; + +pub use self::compile::*; +pub use self::lookup::*; +pub use self::read::*; +pub use self::write::*; diff --git a/lib/src/core/read.rs b/lib/src/core/read.rs new file mode 100644 index 00000000..c9fb4a10 --- /dev/null +++ b/lib/src/core/read.rs @@ -0,0 +1,90 @@ +use std::{ + error::Error, + fs::File, + io::{Cursor, Read, Seek}, +}; + +use byteorder::{LittleEndian, ReadBytesExt}; +use rkyv::{archived_root, Deserialize, Infallible}; + +use super::version::FILE_VERSION; +use crate::{utils::decompress, ArchivedDictionary, Dictionary}; + +pub struct DictionaryFile { + pub signature: String, + pub version: u16, + content: Vec, +} + +pub struct DictionaryReader {} + +impl DictionaryReader { + pub fn new() -> Self { + // TODO: maybe add a config? + Self {} + } + + pub fn default() -> Self { + Self::new() + } + + pub fn read_from_bytes(&self, data: &[u8]) -> Result> { + let mut reader = Cursor::new(data); + let mut sig_bytes = [0; 5]; + + reader.read_exact(&mut sig_bytes)?; + + reader.seek(std::io::SeekFrom::Start(5))?; + + let version = reader.read_u16::()?; + + if version != FILE_VERSION {} + + reader.seek(std::io::SeekFrom::Start(7))?; + + let content_size = reader.read_u64::()?; + + reader.seek(std::io::SeekFrom::Start(15))?; + + let signature = String::from_utf8(sig_bytes.to_vec())?; + + if signature != "ODICT" { + return Err("This is not an ODict file".into()); + } + + let mut content_bytes = vec![0; content_size as usize]; + + reader.read_exact(&mut content_bytes)?; + + let content = decompress(&content_bytes)?; + + Ok(DictionaryFile { + signature, + version, + content, + }) + } + + pub fn read_from_path(&self, path: &str) -> Result> { + let mut file = File::open(path)?; + let mut buffer = Vec::new(); + + file.read_to_end(&mut buffer)?; + + let result = self.read_from_bytes(&buffer)?; + + Ok(result) + } +} + +impl DictionaryFile { + pub fn to_archive(&self) -> Result<&ArchivedDictionary, Box> { + let archived = unsafe { archived_root::(&self.content[..]) }; + Ok(archived) + } + + pub fn to_dictionary(&self) -> Result> { + let dict: Dictionary = self.to_archive()?.deserialize(&mut Infallible)?; + Ok(dict) + } +} diff --git a/lib/src/core/split.rs b/lib/src/core/split.rs new file mode 100644 index 00000000..c14690ae --- /dev/null +++ b/lib/src/core/split.rs @@ -0,0 +1,56 @@ +/* -------------------------------------------------------------------------- */ +/* Split Options */ +/* -------------------------------------------------------------------------- */ + +use std::error::Error; + +use crate::{schema::EntryBuffer, DictionaryFile}; + +pub struct SplitOptions { + threshold: usize, +} + +impl SplitOptions { + pub fn default() -> Self { + Self { threshold: 0 } + } + + pub fn threshold(mut self, threshold: usize) -> Self { + self.threshold = threshold; + self + } +} + +impl DictionaryFile<'_> { + pub fn split( + &self, + query: &str, + options: &SplitOptions, + ) -> Result, Box> { + let buf = self.as_buffer(); + + let mut entries: Vec = Vec::new(); + let mut start = 0; + let mut end = query.len(); + + let SplitOptions { threshold } = options; + + while start < end { + let substr = &query[start..end]; + let entry_option = buf.entries_by_key(substr); + + if let Some(entry) = entry_option { + entries.push(entry.clone()); + } + + if entry_option != None || substr.len() <= *threshold { + start = end; + end = query.len(); + } else { + end -= 1; + } + } + + Ok(entries) + } +} diff --git a/lib/src/core/version.rs b/lib/src/core/version.rs new file mode 100644 index 00000000..634e1f4c --- /dev/null +++ b/lib/src/core/version.rs @@ -0,0 +1 @@ +pub static FILE_VERSION: u16 = 8; diff --git a/lib/src/core/write.rs b/lib/src/core/write.rs new file mode 100644 index 00000000..d6c7753c --- /dev/null +++ b/lib/src/core/write.rs @@ -0,0 +1,14 @@ +use std::{error::Error, fs::File, io::Write, path::PathBuf}; + +use crate::Dictionary; + +impl Dictionary { + pub fn write_to_path(&self, path: &PathBuf) -> Result<(), Box> { + let bytes = self.compile()?; + let mut file = File::create(path)?; + + file.write_all(&bytes)?; + + Ok(()) + } +} diff --git a/lib/src/lib.rs b/lib/src/lib.rs new file mode 100644 index 00000000..804f6111 --- /dev/null +++ b/lib/src/lib.rs @@ -0,0 +1,21 @@ +mod core; +mod models; +mod utils; + +pub use self::core::*; +pub use self::models::*; + +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/lib/src/models/definition.rs b/lib/src/models/definition.rs new file mode 100644 index 00000000..a9952a27 --- /dev/null +++ b/lib/src/models/definition.rs @@ -0,0 +1,19 @@ +use crate::serializable; + +use super::{example::Example, note::Note, MDString}; + +serializable! { + pub struct Definition { + #[serde(rename = "@id")] + id: Option, + + #[serde(rename = "@value")] + value: MDString, + + #[serde(default)] + examples: Vec, + + #[serde(default)] + notes: Vec, + } +} diff --git a/lib/src/models/dictionary.rs b/lib/src/models/dictionary.rs new file mode 100644 index 00000000..b3627b37 --- /dev/null +++ b/lib/src/models/dictionary.rs @@ -0,0 +1,63 @@ +use quick_xml::de::from_str; +use std::{collections::HashMap, fs::read_to_string, path::PathBuf}; + +use super::entry::Entry; +use crate::serializable; + +serializable! { + pub struct Dictionary { + #[serde(rename = "@id")] + pub id: Option, + + #[serde(rename = "@name")] + pub name: Option, + + #[serde(rename = "entry", with = "entries")] + pub entries: HashMap, + } +} + +mod entries { + + use std::collections::HashMap; + + use serde::de::Deserializer; + use serde::ser::Serializer; + use serde::Deserialize; + + use crate::models::Entry; + + pub fn serialize(map: &HashMap, serializer: S) -> Result + where + S: Serializer, + { + serializer.collect_seq(map.values()) + } + + pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> + where + D: Deserializer<'de>, + { + let mut map = HashMap::new(); + + for item in Vec::::deserialize(deserializer)? { + map.insert(item.term.to_owned(), item); + } + + Ok(map) + } +} + +impl From<&str> for Dictionary { + fn from(xml: &str) -> Self { + from_str(xml).unwrap() + } +} + +impl From<&PathBuf> for Dictionary { + fn from(path: &PathBuf) -> Self { + // TODO: add support for reading .odict files in addition to XML + let contents = read_to_string(path).unwrap(); + from_str(contents.as_str()).unwrap() + } +} diff --git a/lib/src/models/entry.rs b/lib/src/models/entry.rs new file mode 100644 index 00000000..65c26847 --- /dev/null +++ b/lib/src/models/entry.rs @@ -0,0 +1,16 @@ +use crate::serializable; + +use super::Etymology; + +serializable! { + pub struct Entry { + #[serde(rename = "@term")] + pub term: String, + + #[serde(rename = "@see")] + pub see_also: Option, + + #[serde(default, rename = "ety")] + pub etymologies: Vec, + } +} diff --git a/lib/src/models/etymology.rs b/lib/src/models/etymology.rs new file mode 100644 index 00000000..1736ab36 --- /dev/null +++ b/lib/src/models/etymology.rs @@ -0,0 +1,55 @@ +use std::collections::HashMap; + +use crate::serializable; + +use super::{pos::PartOfSpeech, sense::Sense, MDString}; + +serializable! { + pub struct Etymology { + #[serde(rename = "@id")] + id: Option, + + #[serde(rename = "@pronunciation")] + pronunciation: Option, + + #[serde(rename = "@description")] + description: Option, + + #[serde(rename = "sense", with = "senses")] + senses: HashMap, + } +} + +mod senses { + + use std::collections::HashMap; + + use serde::de::Deserializer; + use serde::ser::Serializer; + use serde::Deserialize; + + use crate::models::{PartOfSpeech, Sense}; + + pub fn serialize( + map: &HashMap, + serializer: S, + ) -> Result + where + S: Serializer, + { + serializer.collect_seq(map.values()) + } + + pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> + where + D: Deserializer<'de>, + { + let mut map = HashMap::new(); + + for item in Vec::::deserialize(deserializer)? { + map.insert(item.pos.clone(), item); + } + + Ok(map) + } +} diff --git a/lib/src/models/example.rs b/lib/src/models/example.rs new file mode 100644 index 00000000..e5098d88 --- /dev/null +++ b/lib/src/models/example.rs @@ -0,0 +1,8 @@ +use crate::serializable; + +serializable! { + pub struct Example { + #[serde(rename = "$text")] + value: String, + } +} diff --git a/lib/src/models/group.rs b/lib/src/models/group.rs new file mode 100644 index 00000000..89dbd0a5 --- /dev/null +++ b/lib/src/models/group.rs @@ -0,0 +1,16 @@ +use crate::serializable; + +use super::{definition::Definition, mdstring::MDString}; + +serializable! { + pub struct Group { + #[serde(rename = "@id")] + id: Option, + + #[serde(rename = "@description")] + description: Option, + + #[serde(default, rename = "definition")] + definitions: Vec, + } +} diff --git a/lib/src/models/mdstring.rs b/lib/src/models/mdstring.rs new file mode 100644 index 00000000..a22a0fcb --- /dev/null +++ b/lib/src/models/mdstring.rs @@ -0,0 +1,59 @@ +use serde::{Deserialize, Serialize, Serializer}; + +use crate::{serializable, serializable_custom}; + +pub enum MarkdownStrategy { + HTML, + Text, + Disabled, +} + +serializable_custom! { + pub struct MDString { + value: String, + } +} + +impl<'de> Deserialize<'de> for MDString { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let value = String::deserialize(deserializer)?; + Ok(MDString { value }) + } +} + +impl Serialize for MDString { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(&self.value) + } +} + +impl From<&str> for MDString { + fn from(value: &str) -> MDString { + MDString { + value: value.to_string(), + } + } +} + +impl MDString { + pub fn parse(&self, strategy: MarkdownStrategy) -> String { + // output := []byte(mds) + + // switch markdownStrategy { + // case MarkdownStrategyHTML: + // output = utils.MarkdownToHTML(output) + // case MarkdownStrategyText: + // output = utils.MarkdownToText(output) + // } + + // TODO:implement + + self.value.clone() + } +} diff --git a/lib/src/models/mod.rs b/lib/src/models/mod.rs new file mode 100644 index 00000000..12a27ee2 --- /dev/null +++ b/lib/src/models/mod.rs @@ -0,0 +1,23 @@ +mod definition; +mod dictionary; +mod entry; +mod etymology; +mod example; +mod group; +mod mdstring; +mod note; +mod pos; +mod sense; + +#[macro_use] +mod serializable; + +pub use self::definition::*; +pub use self::dictionary::*; +pub use self::entry::*; +pub use self::etymology::*; +pub use self::group::*; +pub use self::mdstring::*; +pub use self::note::*; +pub use self::pos::*; +pub use self::sense::*; diff --git a/lib/src/models/note.rs b/lib/src/models/note.rs new file mode 100644 index 00000000..a7b11591 --- /dev/null +++ b/lib/src/models/note.rs @@ -0,0 +1,15 @@ +use crate::serializable; + +use super::example::Example; + +serializable! { + pub struct Note { + #[serde(rename = "@id")] + id: Option, + + // #[serde(rename = "@value")] + // value: MDString, + #[serde(default, rename = "example")] + examples: Vec, + } +} diff --git a/lib/src/models/pos.rs b/lib/src/models/pos.rs new file mode 100644 index 00000000..9bbcd533 --- /dev/null +++ b/lib/src/models/pos.rs @@ -0,0 +1,269 @@ +use crate::serializable; + +serializable! { + #[derive(Hash)] + #[archive_attr(derive(PartialEq, Eq, Hash))] + #[repr(u8)] + #[allow(non_camel_case_types)] + pub enum PartOfSpeech { + /* -------------------------------------------------------------------------- */ + /* Japanese-specific POS */ + /* -------------------------------------------------------------------------- */ + adj_pn, + adj_kari, + art, + adj_ku, + adj_nari, + adj_na, + adj_shiku, + adj_t, + adj_ix, + n_adv, + adv_to, + adj_no, + n_pref, + n_suf, + n_t, + adj_f, + v5b, + v5g, + v5k, + v5m, + v5n, + v5r, + v5r_i, + v5aru, + v5k_s, + v5s, + v5t, + v5u, + v5uru, + v5u_s, + v1, + v1_s, + vz, + vk, + v2b_s, + v2b_k, + v2d_s, + v2d_k, + v2g_s, + v2g_k, + v2h_s, + v2h_k, + v2k_s, + v2k_k, + v2m_s, + v2m_k, + v2n_s, + v2r_s, + v2r_k, + v2s_s, + v2t_s, + v2t_k, + v2a_s, + v2w_s, + v2y_s, + v2y_k, + v2z_s, + vn, + vr, + vs_c, + vs, + vs_i, + vs_s, + v_unspec, + v4b, + v4g, + v4h, + v4k, + v4m, + v4n, + v4r, + v4s, + v4t, + + /* -------------------------------------------------------------------------- */ + /* Universal POS */ + /* -------------------------------------------------------------------------- */ + abv, + adf, + adj, + phr_adj, + adv, + phr_adv, + aff, + aux, + aux_adj, + aux_v, + chr, + cf, + cls, + conj, + conj_c, + cop, + ctr, + det, + expr, + inf, + intf, + intj, + vi, + name, + n, + num, + part, + phr, + postp, + pref, + prep, + phr_prep, + pron, + propn, + prov, + punc, + conj_s, + suff, + sym, + vt, + un, + v, + } +} + +impl Default for PartOfSpeech { + fn default() -> Self { + PartOfSpeech::un + } +} + +impl PartOfSpeech { + pub fn to_string(&self) -> &str { + match *self { + /* -------------------------------------------------------------------------- */ + /* Japanese-specific POS */ + /* -------------------------------------------------------------------------- */ + PartOfSpeech::adj_pn => "pre-noun adjectival (rentaishi)", + PartOfSpeech::adj_kari => "'kari' adjective (archaic)", + PartOfSpeech::adj_ku => "'ku' adjective (archaic)", + PartOfSpeech::adj_nari => "archaic/formal form of na-adjective", + PartOfSpeech::adj_na => "adjectival nouns or quasi-adjectives (keiyodoshi)", + PartOfSpeech::adj_shiku => "'shiku' adjective (archaic)", + PartOfSpeech::adj_t => "'taru' adjective", + PartOfSpeech::adj_ix => "adjective (keiyoushi) - yoi/ii class", + PartOfSpeech::n_adv => "adverbial noun (fukushitekimeishi)", + PartOfSpeech::adv_to => "adverb taking the 'to' particle", + PartOfSpeech::adj_no => "nouns which may take the genitive case particle 'no'", + PartOfSpeech::n_pref => "noun, used as a prefix", + PartOfSpeech::n_suf => "noun, used as a suffix", + PartOfSpeech::n_t => "noun (temporal) (jisoumeishi)", + PartOfSpeech::adj_f => "noun or verb acting prenominally", + PartOfSpeech::v5b => "Godan verb with 'bu' ending", + PartOfSpeech::v5g => "Godan verb with 'gu' ending", + PartOfSpeech::v5k => "Godan verb with 'ku' ending", + PartOfSpeech::v5m => "Godan verb with 'mu' ending", + PartOfSpeech::v5n => "Godan verb with 'nu' ending", + PartOfSpeech::v5r => "Godan verb with 'ru' ending", + PartOfSpeech::v5r_i => "Godan verb with 'ru' ending (irregular verb)", + PartOfSpeech::v5aru => "Godan verb - -aru special class", + PartOfSpeech::v5k_s => "Godan verb - Iku/Yuku special class", + PartOfSpeech::v5s => "Godan verb with 'su' ending", + PartOfSpeech::v5t => "Godan verb with 'tsu' ending", + PartOfSpeech::v5u => "Godan verb with 'u' ending", + PartOfSpeech::v5uru => "Godan verb - Uru old class verb (old form of Eru)", + PartOfSpeech::v5u_s => "Godan verb with 'u' ending (special class)", + PartOfSpeech::v1 => "Ichidan verb", + PartOfSpeech::v1_s => "Ichidan verb - kureru special class", + PartOfSpeech::vz => "Ichidan verb - zuru verb (alternative form of -jiru verbs)", + PartOfSpeech::vk => "Kuru verb - special class", + PartOfSpeech::v2b_s => "Nidan verb (lower class) with 'bu' ending (archaic)", + PartOfSpeech::v2b_k => "Nidan verb (upper class) with 'bu' ending (archaic)", + PartOfSpeech::v2d_s => "Nidan verb (lower class) with 'dzu' ending (archaic)", + PartOfSpeech::v2d_k => "Nidan verb (upper class) with 'dzu' ending (archaic)", + PartOfSpeech::v2g_s => "Nidan verb (lower class) with 'gu' ending (archaic)", + PartOfSpeech::v2g_k => "Nidan verb (upper class) with 'gu' ending (archaic)", + PartOfSpeech::v2h_s => "Nidan verb (lower class) with 'hu/fu' ending (archaic)", + PartOfSpeech::v2h_k => "Nidan verb (upper class) with 'hu/fu' ending (archaic)", + PartOfSpeech::v2k_s => "Nidan verb (lower class) with 'ku' ending (archaic)", + PartOfSpeech::v2k_k => "Nidan verb (upper class) with 'ku' ending (archaic)", + PartOfSpeech::v2m_s => "Nidan verb (lower class) with 'mu' ending (archaic)", + PartOfSpeech::v2m_k => "Nidan verb (upper class) with 'mu' ending (archaic)", + PartOfSpeech::v2n_s => "Nidan verb (lower class) with 'nu' ending (archaic)", + PartOfSpeech::v2r_s => "Nidan verb (lower class) with 'ru' ending (archaic)", + PartOfSpeech::v2r_k => "Nidan verb (upper class) with 'ru' ending (archaic)", + PartOfSpeech::v2s_s => "Nidan verb (lower class) with 'su' ending (archaic)", + PartOfSpeech::v2t_s => "Nidan verb (lower class) with 'tsu' ending (archaic)", + PartOfSpeech::v2t_k => "Nidan verb (upper class) with 'tsu' ending (archaic)", + PartOfSpeech::v2a_s => "Nidan verb with 'u' ending (archaic)", + PartOfSpeech::v2w_s => { + "Nidan verb (lower class) with 'u' ending and 'we' conjugation (archaic)" + } + PartOfSpeech::v2y_s => "Nidan verb (lower class) with 'yu' ending (archaic)", + PartOfSpeech::v2y_k => "Nidan verb (upper class) with 'yu' ending (archaic)", + PartOfSpeech::v2z_s => "Nidan verb (lower class) with 'zu' ending (archaic)", + PartOfSpeech::vn => "irregular nu verb", + PartOfSpeech::vr => "irregular ru verb, plain form ends with -ri", + PartOfSpeech::vs_c => "su verb - precursor to the modern suru", + PartOfSpeech::vs => "noun or participle which takes the aux. verb suru", + PartOfSpeech::vs_i => "suru verb - included", + PartOfSpeech::vs_s => "suru verb - special class", + PartOfSpeech::v_unspec => "verb unspecified", + PartOfSpeech::v4b => "Yodan verb with 'bu' ending (archaic)", + PartOfSpeech::v4g => "Yodan verb with 'gu' ending (archaic)", + PartOfSpeech::v4h => "Yodan verb with 'hu/fu' ending (archaic)", + PartOfSpeech::v4k => "Yodan verb with 'ku' ending (archaic)", + PartOfSpeech::v4m => "Yodan verb with 'mu' ending (archaic)", + PartOfSpeech::v4n => "Yodan verb with 'nu' ending (archaic)", + PartOfSpeech::v4r => "Yodan verb with 'ru' ending (archaic)", + PartOfSpeech::v4s => "Yodan verb with 'su' ending (archaic)", + PartOfSpeech::v4t => "Yodan verb with 'tsu' ending (archaic)", + + /* -------------------------------------------------------------------------- */ + /* Universal POS */ + /* -------------------------------------------------------------------------- */ + PartOfSpeech::abv => "abbreviation", + PartOfSpeech::adf => "adfix", + PartOfSpeech::art => "article", + PartOfSpeech::adj => "adjective", + PartOfSpeech::phr_adj => "adjective phrase", + PartOfSpeech::adv => "adverb", + PartOfSpeech::phr_adv => "adverbial phrase", + PartOfSpeech::aff => "affix", + PartOfSpeech::aux => "auxiliary", + PartOfSpeech::aux_adj => "auxiliary adjective", + PartOfSpeech::aux_v => "auxiliary verb", + PartOfSpeech::chr => "character", + PartOfSpeech::cf => "circumfix", + PartOfSpeech::cls => "classifier", + PartOfSpeech::conj => "conjunction", + PartOfSpeech::conj_c => "coordinating conjunction", + PartOfSpeech::cop => "copula", + PartOfSpeech::ctr => "counter", + PartOfSpeech::det => "determiner", + PartOfSpeech::expr => "expression", + PartOfSpeech::inf => "infix", + PartOfSpeech::intf => "interfix", + PartOfSpeech::intj => "interjection", + PartOfSpeech::vi => "intransitive verb", + PartOfSpeech::name => "name", + PartOfSpeech::n => "noun", + PartOfSpeech::num => "numeric", + PartOfSpeech::part => "particle", + PartOfSpeech::phr => "phrase", + PartOfSpeech::postp => "postposition", + PartOfSpeech::pref => "prefix", + PartOfSpeech::prep => "preposition", + PartOfSpeech::phr_prep => "prepositional phrase", + PartOfSpeech::pron => "pronoun", + PartOfSpeech::propn => "proper noun", + PartOfSpeech::prov => "proverb", + PartOfSpeech::punc => "punctuation", + PartOfSpeech::conj_s => "subordinating conjunction", + PartOfSpeech::suff => "suffix", + PartOfSpeech::sym => "symbol", + PartOfSpeech::vt => "transitive verb", + PartOfSpeech::un => "unknown", + PartOfSpeech::v => "verb", + } + } +} diff --git a/lib/src/models/sense.rs b/lib/src/models/sense.rs new file mode 100644 index 00000000..aaa320a2 --- /dev/null +++ b/lib/src/models/sense.rs @@ -0,0 +1,16 @@ +use crate::serializable; + +use super::{pos::PartOfSpeech, Definition, Group}; + +serializable! { + pub struct Sense { + #[serde(rename = "@pos", default)] + pub pos: PartOfSpeech, + + #[serde(rename = "group", default)] + pub groups: Vec, + + #[serde(rename = "definition", default)] + pub definitions: Vec, + } +} diff --git a/lib/src/models/serializable.rs b/lib/src/models/serializable.rs new file mode 100644 index 00000000..411c613e --- /dev/null +++ b/lib/src/models/serializable.rs @@ -0,0 +1,29 @@ +#[macro_export] +macro_rules! serializable { + ($i:item) => { + #[derive( + PartialEq, + Eq, + Debug, + Clone, + serde::Serialize, + serde::Deserialize, + rkyv::Archive, + rkyv::Serialize, + rkyv::Deserialize, + )] + #[archive_attr(derive(Debug))] + $i + }; +} + +#[macro_export] +macro_rules! serializable_custom { + ($i:item) => { + #[derive( + PartialEq, Eq, Debug, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, + )] + #[archive_attr(derive(Debug))] + $i + }; +} diff --git a/lib/src/utils.rs b/lib/src/utils.rs new file mode 100644 index 00000000..9cec27c0 --- /dev/null +++ b/lib/src/utils.rs @@ -0,0 +1,26 @@ +use std::{ + error::Error, + io::{Read, Write}, +}; + +use lz4_flex::frame::{FrameDecoder, FrameEncoder}; + +pub fn compress(bytes: &[u8]) -> Result, Box> { + let buf = Vec::new(); + let mut enc = FrameEncoder::new(buf); + + enc.write_all(&bytes)?; + + let compressed = enc.finish()?; + + Ok(compressed) +} + +pub fn decompress(bytes: &[u8]) -> Result, Box> { + let mut buf = Vec::new(); + let mut dec = FrameDecoder::new(bytes); + + dec.read_to_end(&mut buf)?; + + Ok(buf) +} From 83ae9422353217fb5fe2c8ddf75bd875842372fd Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Tue, 6 Feb 2024 22:54:18 +0800 Subject: [PATCH 002/393] add DictionaryWriter --- cli/src/compile.rs | 6 ++-- cli/src/context.rs | 13 ++++++-- cli/src/lookup.rs | 2 +- cli/src/main.rs | 14 ++++----- lib/src/core/compile.rs | 52 ------------------------------- lib/src/core/constants.rs | 2 ++ lib/src/core/mod.rs | 4 +-- lib/src/core/read.rs | 34 +++++++++++++-------- lib/src/core/version.rs | 1 - lib/src/core/write.rs | 59 ++++++++++++++++++++++++++++++++++-- lib/src/models/dictionary.rs | 10 +++++- lib/src/models/mdstring.rs | 2 +- 12 files changed, 112 insertions(+), 87 deletions(-) delete mode 100644 lib/src/core/compile.rs create mode 100644 lib/src/core/constants.rs delete mode 100644 lib/src/core/version.rs diff --git a/cli/src/compile.rs b/cli/src/compile.rs index 18cc4f1b..d0f481d9 100644 --- a/cli/src/compile.rs +++ b/cli/src/compile.rs @@ -3,7 +3,7 @@ use std::{error::Error, path::PathBuf}; use clap::{arg, command, Args}; use odict::Dictionary; -use crate::CLI; +use crate::CLIContext; #[derive(Debug, Args)] #[command(args_conflicts_with_subcommands = true)] @@ -16,7 +16,7 @@ pub struct CompileArgs { output: Option, } -pub fn compile(args: &CompileArgs) -> Result<(), Box> { +pub fn compile(ctx: &CLIContext, args: &CompileArgs) -> Result<(), Box> { let CompileArgs { input, output } = args; let mut out = output.clone(); @@ -38,7 +38,7 @@ pub fn compile(args: &CompileArgs) -> Result<(), Box> { let dict = Dictionary::from(input); - dict.write_to_path(&out.unwrap())?; + ctx.writer.write_to_path(&dict, &out.unwrap())?; Ok(()) } diff --git a/cli/src/context.rs b/cli/src/context.rs index 22412d56..86197942 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -1,6 +1,15 @@ -use odict::read::DictionaryReader; +use odict::{read::DictionaryReader, DictionaryWriter}; pub struct CLIContext { pub reader: DictionaryReader, - // writer: DictionaryWriter, + pub writer: DictionaryWriter, +} + +impl CLIContext { + pub fn default() -> Self { + Self { + reader: DictionaryReader::default(), + writer: DictionaryWriter::default(), + } + } } diff --git a/cli/src/lookup.rs b/cli/src/lookup.rs index c97ff74c..85462e2f 100644 --- a/cli/src/lookup.rs +++ b/cli/src/lookup.rs @@ -45,7 +45,7 @@ pub fn lookup(ctx: &CLIContext, args: &LookupArgs) -> Result<(), Box> let LookupArgs { dictionary_path: path, queries, - format, + format: _, follow, split, } = args; diff --git a/cli/src/main.rs b/cli/src/main.rs index 9de954e7..b3c22e56 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,5 +1,4 @@ use clap::{command, crate_version, Parser, Subcommand}; -use odict::DictionaryReader; mod compile; mod context; @@ -40,16 +39,17 @@ enum Commands { fn main() { let cli = CLI::parse(); + let ctx = CLIContext::default(); - let ctx = CLIContext { - reader: DictionaryReader::default(), - }; - - t( + let result = t( || match cli.command { - Commands::Compile(ref args) => compile(&args), + Commands::Compile(ref args) => compile(&ctx, &args), Commands::Lookup(ref args) => lookup(&ctx, &args), }, cli.quiet, ); + + if let Err(e) = result { + eprintln!("Error: {}", e); + } } diff --git a/lib/src/core/compile.rs b/lib/src/core/compile.rs deleted file mode 100644 index 64deb12e..00000000 --- a/lib/src/core/compile.rs +++ /dev/null @@ -1,52 +0,0 @@ -use std::error::Error; - -use rkyv::to_bytes; - -use crate::{models::Dictionary, utils::compress}; - -use super::version::FILE_VERSION; - -const SIGNATURE: &[u8] = b"ODICT"; - -impl Dictionary { - pub fn serialize(&self) -> Result, Box> { - let bytes = to_bytes::<_, 4096>(self)?; - Ok(bytes.to_vec()) - } - - pub fn compile(&self) -> Result, Box> { - let version_bytes = FILE_VERSION.to_le_bytes(); - - let compressed = compress(&self.serialize()?)?; - let compressed_size = compressed.len() as u64; - let compressed_size_bytes = compressed_size.to_le_bytes(); - - let total_size = - SIGNATURE.len() + version_bytes.len() + compressed_size_bytes.len() + compressed.len(); - - let mut output = Vec::with_capacity(total_size); - - output.extend_from_slice(SIGNATURE); - output.extend_from_slice(&version_bytes); - output.extend_from_slice(&compressed_size_bytes); - output.extend_from_slice(&compressed); - - if SIGNATURE.len() != 5 { - return Err("Signature bytes do not equal 5".into()); - } - - if version_bytes.len() != 2 { - return Err("Version bytes do not equal 2".into()); - } - - if compressed_size_bytes.len() != 8 { - return Err("Content byte count does not equal 8".into()); - } - - if compressed.len() != compressed_size as usize { - return Err("Content does not equal the computed byte count".into()); - } - - Ok(output) - } -} diff --git a/lib/src/core/constants.rs b/lib/src/core/constants.rs new file mode 100644 index 00000000..8c09e26f --- /dev/null +++ b/lib/src/core/constants.rs @@ -0,0 +1,2 @@ +pub const FILE_VERSION: u16 = 8; +pub const SIGNATURE: &[u8] = b"ODICT"; diff --git a/lib/src/core/mod.rs b/lib/src/core/mod.rs index 392f8674..81ba5c42 100644 --- a/lib/src/core/mod.rs +++ b/lib/src/core/mod.rs @@ -1,11 +1,9 @@ -mod compile; mod lookup; pub mod read; // mod split; -mod version; +mod constants; mod write; -pub use self::compile::*; pub use self::lookup::*; pub use self::read::*; pub use self::write::*; diff --git a/lib/src/core/read.rs b/lib/src/core/read.rs index c9fb4a10..550498bf 100644 --- a/lib/src/core/read.rs +++ b/lib/src/core/read.rs @@ -7,15 +7,35 @@ use std::{ use byteorder::{LittleEndian, ReadBytesExt}; use rkyv::{archived_root, Deserialize, Infallible}; -use super::version::FILE_VERSION; +use super::constants::FILE_VERSION; use crate::{utils::decompress, ArchivedDictionary, Dictionary}; +/* -------------------------------------------------------------------------- */ +/* DictionaryFile */ +/* -------------------------------------------------------------------------- */ + pub struct DictionaryFile { pub signature: String, pub version: u16, content: Vec, } +impl DictionaryFile { + pub fn to_archive(&self) -> Result<&ArchivedDictionary, Box> { + let archived = unsafe { archived_root::(&self.content[..]) }; + Ok(archived) + } + + pub fn to_dictionary(&self) -> Result> { + let dict: Dictionary = self.to_archive()?.deserialize(&mut Infallible)?; + Ok(dict) + } +} + +/* -------------------------------------------------------------------------- */ +/* DictionaryReader */ +/* -------------------------------------------------------------------------- */ + pub struct DictionaryReader {} impl DictionaryReader { @@ -76,15 +96,3 @@ impl DictionaryReader { Ok(result) } } - -impl DictionaryFile { - pub fn to_archive(&self) -> Result<&ArchivedDictionary, Box> { - let archived = unsafe { archived_root::(&self.content[..]) }; - Ok(archived) - } - - pub fn to_dictionary(&self) -> Result> { - let dict: Dictionary = self.to_archive()?.deserialize(&mut Infallible)?; - Ok(dict) - } -} diff --git a/lib/src/core/version.rs b/lib/src/core/version.rs deleted file mode 100644 index 634e1f4c..00000000 --- a/lib/src/core/version.rs +++ /dev/null @@ -1 +0,0 @@ -pub static FILE_VERSION: u16 = 8; diff --git a/lib/src/core/write.rs b/lib/src/core/write.rs index d6c7753c..8bc49b56 100644 --- a/lib/src/core/write.rs +++ b/lib/src/core/write.rs @@ -1,10 +1,63 @@ use std::{error::Error, fs::File, io::Write, path::PathBuf}; +use crate::utils::compress; use crate::Dictionary; -impl Dictionary { - pub fn write_to_path(&self, path: &PathBuf) -> Result<(), Box> { - let bytes = self.compile()?; +use super::constants::*; + +pub struct DictionaryWriter {} + +impl DictionaryWriter { + pub fn new() -> Self { + Self {} + } + + pub fn default() -> Self { + Self {} + } + + pub fn write_to_bytes(&self, dictionary: &Dictionary) -> Result, Box> { + let version_bytes = FILE_VERSION.to_le_bytes(); + + let compressed = compress(&dictionary.serialize()?)?; + let compressed_size = compressed.len() as u64; + let compressed_size_bytes = compressed_size.to_le_bytes(); + + let total_size = + SIGNATURE.len() + version_bytes.len() + compressed_size_bytes.len() + compressed.len(); + + let mut output = Vec::with_capacity(total_size); + + output.extend_from_slice(SIGNATURE); + output.extend_from_slice(&version_bytes); + output.extend_from_slice(&compressed_size_bytes); + output.extend_from_slice(&compressed); + + if SIGNATURE.len() != 5 { + return Err("Signature bytes do not equal 5".into()); + } + + if version_bytes.len() != 2 { + return Err("Version bytes do not equal 2".into()); + } + + if compressed_size_bytes.len() != 8 { + return Err("Content byte count does not equal 8".into()); + } + + if compressed.len() != compressed_size as usize { + return Err("Content does not equal the computed byte count".into()); + } + + Ok(output) + } + + pub fn write_to_path( + &self, + dictionary: &Dictionary, + path: &PathBuf, + ) -> Result<(), Box> { + let bytes = self.write_to_bytes(dictionary)?; let mut file = File::create(path)?; file.write_all(&bytes)?; diff --git a/lib/src/models/dictionary.rs b/lib/src/models/dictionary.rs index b3627b37..384c348c 100644 --- a/lib/src/models/dictionary.rs +++ b/lib/src/models/dictionary.rs @@ -1,5 +1,6 @@ use quick_xml::de::from_str; -use std::{collections::HashMap, fs::read_to_string, path::PathBuf}; +use rkyv::to_bytes; +use std::{collections::HashMap, error::Error, fs::read_to_string, path::PathBuf}; use super::entry::Entry; use crate::serializable; @@ -48,6 +49,13 @@ mod entries { } } +impl Dictionary { + pub fn serialize(&self) -> Result, Box> { + let bytes = to_bytes::<_, 4096>(self)?; + Ok(bytes.to_vec()) + } +} + impl From<&str> for Dictionary { fn from(xml: &str) -> Self { from_str(xml).unwrap() diff --git a/lib/src/models/mdstring.rs b/lib/src/models/mdstring.rs index a22a0fcb..166df023 100644 --- a/lib/src/models/mdstring.rs +++ b/lib/src/models/mdstring.rs @@ -42,7 +42,7 @@ impl From<&str> for MDString { } impl MDString { - pub fn parse(&self, strategy: MarkdownStrategy) -> String { + pub fn parse(&self, _strategy: MarkdownStrategy) -> String { // output := []byte(mds) // switch markdownStrategy { From 4dfae40802e2c96ddf5f65a275adf0d45ad77568 Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Tue, 6 Feb 2024 23:48:24 +0800 Subject: [PATCH 003/393] write tests --- Cargo.lock | 1 + cli/src/compile.rs | 6 ++++-- lib/Cargo.toml | 1 + lib/src/core/write.rs | 38 ++++++++++++++++++++++++++++++++---- lib/src/models/dictionary.rs | 22 +++++++++++---------- lib/src/models/id.rs | 23 ++++++++++++++++++++++ lib/src/models/mod.rs | 2 ++ lib/tests/io.rs | 33 +++++++++++++++++++++++++++++++ 8 files changed, 110 insertions(+), 16 deletions(-) create mode 100644 lib/src/models/id.rs create mode 100644 lib/tests/io.rs diff --git a/Cargo.lock b/Cargo.lock index ccdbfbac..0684d1a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -694,6 +694,7 @@ dependencies = [ "serde", "serde_json", "tantivy", + "uuid", "validation", ] diff --git a/cli/src/compile.rs b/cli/src/compile.rs index d0f481d9..bf15840c 100644 --- a/cli/src/compile.rs +++ b/cli/src/compile.rs @@ -1,4 +1,4 @@ -use std::{error::Error, path::PathBuf}; +use std::{error::Error, fs::read_to_string, path::PathBuf}; use clap::{arg, command, Args}; use odict::Dictionary; @@ -36,7 +36,9 @@ pub fn compile(ctx: &CLIContext, args: &CompileArgs) -> Result<(), Box>( &self, dictionary: &Dictionary, - path: &PathBuf, + path: P, ) -> Result<(), Box> { let bytes = self.write_to_bytes(dictionary)?; let mut file = File::create(path)?; @@ -64,4 +66,32 @@ impl DictionaryWriter { Ok(()) } + + /// Compiles an XML file to an ODict dictionary file + /// + /// # Arguments + /// + /// * `input_path` - The path to the XML file + /// * `output_path` - The path to the output dictionary file + /// + /// # Example + /// + /// ``` + /// use odict::DictionaryWriter; + /// use std::path::PathBuf; + /// + /// let writer = DictionaryWriter::new(); + /// + /// writer.compile_xml("path/to/input.xml", "path/to/output.odict"); + /// ``` + /// + pub fn compile_xml>( + &self, + input_path: P, + output_path: P, + ) -> Result<(), Box> { + let dict = read_to_string(input_path)?.to_dictionary()?; + self.write_to_path(&dict, output_path)?; + Ok(()) + } } diff --git a/lib/src/models/dictionary.rs b/lib/src/models/dictionary.rs index 384c348c..1caa4932 100644 --- a/lib/src/models/dictionary.rs +++ b/lib/src/models/dictionary.rs @@ -1,19 +1,19 @@ use quick_xml::de::from_str; use rkyv::to_bytes; -use std::{collections::HashMap, error::Error, fs::read_to_string, path::PathBuf}; +use std::{collections::HashMap, error::Error}; -use super::entry::Entry; +use super::{entry::Entry, id::ID}; use crate::serializable; serializable! { pub struct Dictionary { - #[serde(rename = "@id")] - pub id: Option, + #[serde(default, rename = "@id", )] + pub id: ID, #[serde(rename = "@name")] pub name: Option, - #[serde(rename = "entry", with = "entries")] + #[serde(default, rename = "entry", with = "entries")] pub entries: HashMap, } } @@ -62,10 +62,12 @@ impl From<&str> for Dictionary { } } -impl From<&PathBuf> for Dictionary { - fn from(path: &PathBuf) -> Self { - // TODO: add support for reading .odict files in addition to XML - let contents = read_to_string(path).unwrap(); - from_str(contents.as_str()).unwrap() +pub trait ToDictionary { + fn to_dictionary(&self) -> Result>; +} + +impl ToDictionary for String { + fn to_dictionary(&self) -> Result> { + Ok(Dictionary::from(self.as_str())) } } diff --git a/lib/src/models/id.rs b/lib/src/models/id.rs new file mode 100644 index 00000000..b71610bc --- /dev/null +++ b/lib/src/models/id.rs @@ -0,0 +1,23 @@ +use std::ops::Deref; + +use uuid::Uuid; + +use crate::serializable; + +serializable! { + pub struct ID(String); +} + +impl Default for ID { + fn default() -> Self { + ID(Uuid::new_v4().to_string()) + } +} + +impl Deref for ID { + type Target = String; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/lib/src/models/mod.rs b/lib/src/models/mod.rs index 12a27ee2..bd8977d1 100644 --- a/lib/src/models/mod.rs +++ b/lib/src/models/mod.rs @@ -4,6 +4,7 @@ mod entry; mod etymology; mod example; mod group; +mod id; mod mdstring; mod note; mod pos; @@ -17,6 +18,7 @@ pub use self::dictionary::*; pub use self::entry::*; pub use self::etymology::*; pub use self::group::*; +pub use self::id::*; pub use self::mdstring::*; pub use self::note::*; pub use self::pos::*; diff --git a/lib/tests/io.rs b/lib/tests/io.rs new file mode 100644 index 00000000..a46d9c63 --- /dev/null +++ b/lib/tests/io.rs @@ -0,0 +1,33 @@ +#[cfg(test)] +mod tests { + + use odict::{DictionaryReader, DictionaryWriter, ID}; + use regex::Regex; + use rkyv::{Deserialize, Infallible}; + + #[test] + fn test_empty() { + let reader = DictionaryReader::default(); + let writer = DictionaryWriter::default(); + + let write = writer.compile_xml("../examples/empty.xml", "../examples/empty.odict"); + + assert_eq!(write.is_ok(), true); + + let read = reader.read_from_path("../examples/empty.odict"); + + assert_eq!(read.is_err(), false); + + let archive = read.as_ref().unwrap().to_archive().unwrap(); + + let id: ID = archive.id.deserialize(&mut Infallible).unwrap(); + + // Ensure a UUID ID is generated for the dictionary + let id_regex = Regex::new( + r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", + ) + .unwrap(); + + assert!(id_regex.is_match(&id)); + } +} From 20546dab7ff9a6d008006183b13577275c1ce944 Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Thu, 8 Feb 2024 22:56:59 +0800 Subject: [PATCH 004/393] added lexicon and merge (without tests) --- .tool-versions | 2 +- Cargo.lock | 1 + cli/src/context.rs | 2 +- justfile | 7 +++- lib/Cargo.toml | 3 ++ lib/src/core/lexicon.rs | 20 +++++++++++ lib/src/core/lookup.rs | 7 ++-- lib/src/core/merge.rs | 13 +++++++ lib/src/core/mod.rs | 11 ++++-- lib/src/core/split.rs | 67 ++++++++++++++++++++---------------- lib/src/ext.rs | 13 +++++++ lib/src/lib.rs | 2 ++ lib/src/models/dictionary.rs | 10 ------ lib/src/models/mdstring.rs | 2 +- lib/src/models/mod.rs | 1 + lib/src/models/pos.rs | 1 - lib/tests/helpers.rs | 17 +++++++++ lib/tests/io.rs | 2 +- lib/tests/lexicon.rs | 13 +++++++ lib/tests/merge.rs | 0 lib/tests/split.rs | 30 ++++++++++++++++ 21 files changed, 172 insertions(+), 52 deletions(-) create mode 100644 lib/src/core/lexicon.rs create mode 100644 lib/src/core/merge.rs create mode 100644 lib/src/ext.rs create mode 100644 lib/tests/helpers.rs create mode 100644 lib/tests/lexicon.rs create mode 100644 lib/tests/merge.rs create mode 100644 lib/tests/split.rs diff --git a/.tool-versions b/.tool-versions index 45821ccb..8f1cffe4 100644 --- a/.tool-versions +++ b/.tool-versions @@ -8,4 +8,4 @@ nodejs 20.11.0 just 1.23.0 goreleaser 1.21.1 make 4.4.1 -rust 1.75.0 +rust 1.76.0 diff --git a/Cargo.lock b/Cargo.lock index 0684d1a9..93c48877 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -687,6 +687,7 @@ dependencies = [ "byteorder", "lz4_flex", "markdown", + "once_cell", "quick-xml", "rayon", "regex", diff --git a/cli/src/context.rs b/cli/src/context.rs index 86197942..8bb66a71 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -1,4 +1,4 @@ -use odict::{read::DictionaryReader, DictionaryWriter}; +use odict::{DictionaryReader, DictionaryWriter}; pub struct CLIContext { pub reader: DictionaryReader, diff --git a/justfile b/justfile index 23cdc2dd..927115db 100644 --- a/justfile +++ b/justfile @@ -22,7 +22,9 @@ GOLANG_CROSS_VERSION := "v1.21.3" @run +args="": cargo run {{args}} -@test: deps xsd (go "test") (jvm "test") (python "test") (js "test") (wasm "test") clean +@test: + cargo test +# deps xsd (go "test") (jvm "test") (python "test") (js "test") (wasm "test") clean @clean: (python "clean") (jvm "clean") (js "clean") @@ -42,6 +44,9 @@ GOLANG_CROSS_VERSION := "v1.21.3" @go +command: just go/lib/{{command}} +@rust +command: + just lib/{{command}} + @cli +command: just cli/{{command}} diff --git a/lib/Cargo.toml b/lib/Cargo.toml index df1cccac..7d5007c9 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -25,3 +25,6 @@ serde_json = "1.0.113" tantivy = "0.21.1" validation = "0.0.1" uuid = "1.7.0" + +[dev-dependencies] +once_cell = "1.19.0" diff --git a/lib/src/core/lexicon.rs b/lib/src/core/lexicon.rs new file mode 100644 index 00000000..c1793de4 --- /dev/null +++ b/lib/src/core/lexicon.rs @@ -0,0 +1,20 @@ +use crate::{ArchivedDictionary, Dictionary}; + +macro_rules! lexicon { + ($type:ty) => { + impl $type { + pub fn lexicon(&self) -> Vec<&str> { + let mut vec: Vec<&str> = self + .entries + .iter() + .map(|(_, entry)| entry.term.as_str()) + .collect(); + vec.sort(); + vec + } + } + }; +} + +lexicon!(Dictionary); +lexicon!(ArchivedDictionary); diff --git a/lib/src/core/lookup.rs b/lib/src/core/lookup.rs index 732d7a85..f97e6b37 100644 --- a/lib/src/core/lookup.rs +++ b/lib/src/core/lookup.rs @@ -1,6 +1,6 @@ use std::{error::Error, sync::OnceLock}; -use crate::{ArchivedDictionary, Dictionary, Entry}; +use crate::{ArchivedDictionary, Dictionary, Entry, SplitOptions}; use rayon::prelude::*; @@ -109,9 +109,8 @@ macro_rules! lookup { ); } } else if *split > 0 { - // TODO: revisit - // let split = dictionary.split(term, &SplitOptions::default().threshold(*split))?; - // entries.extend_from_slice(&split); + let split = self.split(term, &SplitOptions::default().threshold(*split))?; + entries.extend_from_slice(&split); } else { entries.push(entry); } diff --git a/lib/src/core/merge.rs b/lib/src/core/merge.rs new file mode 100644 index 00000000..5986f006 --- /dev/null +++ b/lib/src/core/merge.rs @@ -0,0 +1,13 @@ +use crate::Dictionary; + +impl Dictionary { + pub fn merge_in(&mut self, dictionaries: &[&Dictionary]) { + for src in dictionaries { + for (term, entry) in src.entries.iter() { + if !self.entries.contains_key(term.as_str()) { + self.entries.insert(term.clone(), entry.clone()); + } + } + } + } +} diff --git a/lib/src/core/mod.rs b/lib/src/core/mod.rs index 81ba5c42..e5ed2e24 100644 --- a/lib/src/core/mod.rs +++ b/lib/src/core/mod.rs @@ -1,9 +1,14 @@ -mod lookup; -pub mod read; -// mod split; mod constants; +mod lexicon; +mod lookup; +mod merge; +mod read; +mod split; mod write; +pub use self::lexicon::*; pub use self::lookup::*; +pub use self::merge::*; pub use self::read::*; +pub use self::split::*; pub use self::write::*; diff --git a/lib/src/core/split.rs b/lib/src/core/split.rs index c14690ae..26da86a6 100644 --- a/lib/src/core/split.rs +++ b/lib/src/core/split.rs @@ -1,11 +1,11 @@ +use std::error::Error; + +use crate::{ArchivedDictionary, ArchivedEntry, Dictionary, Entry}; + /* -------------------------------------------------------------------------- */ /* Split Options */ /* -------------------------------------------------------------------------- */ -use std::error::Error; - -use crate::{schema::EntryBuffer, DictionaryFile}; - pub struct SplitOptions { threshold: usize, } @@ -21,36 +21,45 @@ impl SplitOptions { } } -impl DictionaryFile<'_> { - pub fn split( - &self, - query: &str, - options: &SplitOptions, - ) -> Result, Box> { - let buf = self.as_buffer(); +/* -------------------------------------------------------------------------- */ +/* Implementation */ +/* -------------------------------------------------------------------------- */ - let mut entries: Vec = Vec::new(); - let mut start = 0; - let mut end = query.len(); +macro_rules! split { + ($t:ty, $r:ty) => { + impl $t { + pub fn split( + &self, + query: &str, + options: &SplitOptions, + ) -> Result, Box> { + let mut entries: Vec<&$r> = Vec::new(); + let mut start = 0; + let mut end = query.len(); - let SplitOptions { threshold } = options; + let SplitOptions { threshold } = options; - while start < end { - let substr = &query[start..end]; - let entry_option = buf.entries_by_key(substr); + while start < end { + let substr = &query[start..end]; + let entry = self.entries.get(substr); - if let Some(entry) = entry_option { - entries.push(entry.clone()); - } + if entry.is_some() { + entries.push(entry.unwrap()); + } + + if entry.is_some() || substr.len() <= *threshold { + start = end; + end = query.len(); + } else { + end -= 1; + } + } - if entry_option != None || substr.len() <= *threshold { - start = end; - end = query.len(); - } else { - end -= 1; + Ok(entries) } } - - Ok(entries) - } + }; } + +split!(Dictionary, Entry); +split!(ArchivedDictionary, ArchivedEntry); diff --git a/lib/src/ext.rs b/lib/src/ext.rs new file mode 100644 index 00000000..d1773674 --- /dev/null +++ b/lib/src/ext.rs @@ -0,0 +1,13 @@ +use std::error::Error; + +use crate::Dictionary; + +pub trait ToDictionary { + fn to_dictionary(&self) -> Result>; +} + +impl ToDictionary for String { + fn to_dictionary(&self) -> Result> { + Ok(Dictionary::from(self.as_str())) + } +} diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 804f6111..e9333ea4 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -1,8 +1,10 @@ mod core; +mod ext; mod models; mod utils; pub use self::core::*; +pub use self::ext::*; pub use self::models::*; pub fn add(left: usize, right: usize) -> usize { diff --git a/lib/src/models/dictionary.rs b/lib/src/models/dictionary.rs index 1caa4932..b4443c32 100644 --- a/lib/src/models/dictionary.rs +++ b/lib/src/models/dictionary.rs @@ -61,13 +61,3 @@ impl From<&str> for Dictionary { from_str(xml).unwrap() } } - -pub trait ToDictionary { - fn to_dictionary(&self) -> Result>; -} - -impl ToDictionary for String { - fn to_dictionary(&self) -> Result> { - Ok(Dictionary::from(self.as_str())) - } -} diff --git a/lib/src/models/mdstring.rs b/lib/src/models/mdstring.rs index 166df023..8e7d4f05 100644 --- a/lib/src/models/mdstring.rs +++ b/lib/src/models/mdstring.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize, Serializer}; -use crate::{serializable, serializable_custom}; +use crate::serializable_custom; pub enum MarkdownStrategy { HTML, diff --git a/lib/src/models/mod.rs b/lib/src/models/mod.rs index bd8977d1..eaefcdd7 100644 --- a/lib/src/models/mod.rs +++ b/lib/src/models/mod.rs @@ -7,6 +7,7 @@ mod group; mod id; mod mdstring; mod note; +#[allow(non_camel_case_types)] mod pos; mod sense; diff --git a/lib/src/models/pos.rs b/lib/src/models/pos.rs index 9bbcd533..f7767e71 100644 --- a/lib/src/models/pos.rs +++ b/lib/src/models/pos.rs @@ -4,7 +4,6 @@ serializable! { #[derive(Hash)] #[archive_attr(derive(PartialEq, Eq, Hash))] #[repr(u8)] - #[allow(non_camel_case_types)] pub enum PartOfSpeech { /* -------------------------------------------------------------------------- */ /* Japanese-specific POS */ diff --git a/lib/tests/helpers.rs b/lib/tests/helpers.rs new file mode 100644 index 00000000..ff877c2e --- /dev/null +++ b/lib/tests/helpers.rs @@ -0,0 +1,17 @@ +use once_cell::sync::Lazy; +use std::error::Error; + +use odict::{DictionaryFile, DictionaryReader, DictionaryWriter}; + +pub fn create_archive_dict(name: &str) -> Result> { + let reader = DictionaryReader::default(); + let writer = DictionaryWriter::default(); + let input = format!("../examples/{}.xml", name); + let output = format!("../examples/{}.odict", name); + + writer.compile_xml(&input, &output)?; + reader.read_from_path(&output) +} + +pub static EXAMPLE_DICTIONARY_1: Lazy = + Lazy::new(|| create_archive_dict("example1").unwrap()); diff --git a/lib/tests/io.rs b/lib/tests/io.rs index a46d9c63..0a534e58 100644 --- a/lib/tests/io.rs +++ b/lib/tests/io.rs @@ -1,5 +1,5 @@ #[cfg(test)] -mod tests { +mod io_tests { use odict::{DictionaryReader, DictionaryWriter, ID}; use regex::Regex; diff --git a/lib/tests/lexicon.rs b/lib/tests/lexicon.rs new file mode 100644 index 00000000..741a0aa5 --- /dev/null +++ b/lib/tests/lexicon.rs @@ -0,0 +1,13 @@ +mod helpers; + +#[cfg(test)] +mod lexicon_tests { + use crate::helpers::EXAMPLE_DICTIONARY_1; + + #[test] + fn test_lexicon() { + let dict = EXAMPLE_DICTIONARY_1.to_archive().unwrap(); + let result = dict.lexicon(); + assert_eq!(result, vec!["cat", "dog", "poo", "ran", "run"]); + } +} diff --git a/lib/tests/merge.rs b/lib/tests/merge.rs new file mode 100644 index 00000000..e69de29b diff --git a/lib/tests/split.rs b/lib/tests/split.rs new file mode 100644 index 00000000..13a120f4 --- /dev/null +++ b/lib/tests/split.rs @@ -0,0 +1,30 @@ +mod helpers; + +#[cfg(test)] +mod split_tests { + use odict::SplitOptions; + + use crate::helpers::EXAMPLE_DICTIONARY_1; + + #[test] + fn test_split() { + let dict = EXAMPLE_DICTIONARY_1.to_archive().unwrap(); + let result = dict.split("catdog", &SplitOptions::default().threshold(1)); + + assert_eq!(result.is_ok(), true); + assert_eq!(result.as_ref().unwrap().len(), 2); + assert_eq!(result.as_ref().unwrap()[0].term, "cat"); + assert_eq!(result.as_ref().unwrap()[1].term, "dog"); + } + + #[test] + fn test_split_with_numbers() { + let dict = EXAMPLE_DICTIONARY_1.to_archive().unwrap(); + let result = dict.split("2cat8dog", &SplitOptions::default().threshold(1)); + + assert_eq!(result.is_ok(), true); + assert_eq!(result.as_ref().unwrap().len(), 2); + assert_eq!(result.as_ref().unwrap()[0].term, "cat"); + assert_eq!(result.as_ref().unwrap()[1].term, "dog"); + } +} From d9e710f82375d96383e97e09466d2ff19388c5f9 Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Fri, 9 Feb 2024 22:20:17 +0800 Subject: [PATCH 005/393] add tests for merge and mdstring --- Cargo.lock | 55 +++++++++++---- lib/Cargo.toml | 3 +- lib/src/core/mod.rs | 2 - lib/src/core/read.rs | 2 +- lib/src/core/write.rs | 2 +- lib/src/lib.rs | 18 +---- lib/src/{utils.rs => lz4.rs} | 0 lib/src/md.rs | 121 +++++++++++++++++++++++++++++++++ lib/src/models/definition.rs | 8 +-- lib/src/models/etymology.rs | 8 +-- lib/src/models/id.rs | 8 ++- lib/src/models/mdstring.rs | 40 ++++++++--- lib/tests/merge.rs | 126 +++++++++++++++++++++++++++++++++++ 13 files changed, 338 insertions(+), 55 deletions(-) rename lib/src/{utils.rs => lz4.rs} (100%) create mode 100644 lib/src/md.rs diff --git a/Cargo.lock b/Cargo.lock index 93c48877..f92247a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -427,6 +427,15 @@ dependencies = [ "windows", ] +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + [[package]] name = "getrandom" version = "0.2.12" @@ -594,15 +603,10 @@ dependencies = [ ] [[package]] -name = "markdown" +name = "map-macro" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef3aab6a1d529b112695f72beec5ee80e729cb45af58663ec902c8fac764ecdd" -dependencies = [ - "lazy_static", - "pipeline", - "regex", -] +checksum = "fb950a42259642e5a3483115aca87eebed2a64886993463af9c9739c205b8d3a" [[package]] name = "matchers" @@ -686,8 +690,9 @@ version = "0.1.0" dependencies = [ "byteorder", "lz4_flex", - "markdown", + "map-macro", "once_cell", + "pulldown-cmark", "quick-xml", "rayon", "regex", @@ -741,12 +746,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pipeline" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d15b6607fa632996eb8a17c9041cb6071cb75ac057abd45dece578723ea8c7c0" - [[package]] name = "pkg-config" version = "0.3.29" @@ -788,6 +787,25 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "pulldown-cmark" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce76ce678ffc8e5675b22aa1405de0b7037e2fdf8913fea40d1926c6fe1e6e7" +dependencies = [ + "bitflags 2.4.2", + "getopts", + "memchr", + "pulldown-cmark-escape", + "unicase", +] + +[[package]] +name = "pulldown-cmark-escape" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5d8f9aa0e3cbcfaf8bf00300004ee3b72f74770f9cbac93f6928771f613276b" + [[package]] name = "quick-xml" version = "0.31.0" @@ -1391,6 +1409,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-ident" version = "1.0.12" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 7d5007c9..6413851a 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -10,7 +10,6 @@ lz4_flex = { version = "0.11.2", default-features = false, features = [ "frame", ] } byteorder = "1.5.0" -markdown = "0.3.0" quick-xml = { version = "0.31.0", features = ["serialize"] } rayon = "1.8.1" regex = "1.10.3" @@ -25,6 +24,8 @@ serde_json = "1.0.113" tantivy = "0.21.1" validation = "0.0.1" uuid = "1.7.0" +pulldown-cmark = "0.10.0" [dev-dependencies] +map-macro = "0.3.0" once_cell = "1.19.0" diff --git a/lib/src/core/mod.rs b/lib/src/core/mod.rs index e5ed2e24..3321be0c 100644 --- a/lib/src/core/mod.rs +++ b/lib/src/core/mod.rs @@ -6,9 +6,7 @@ mod read; mod split; mod write; -pub use self::lexicon::*; pub use self::lookup::*; -pub use self::merge::*; pub use self::read::*; pub use self::split::*; pub use self::write::*; diff --git a/lib/src/core/read.rs b/lib/src/core/read.rs index 550498bf..6fdb59d8 100644 --- a/lib/src/core/read.rs +++ b/lib/src/core/read.rs @@ -8,7 +8,7 @@ use byteorder::{LittleEndian, ReadBytesExt}; use rkyv::{archived_root, Deserialize, Infallible}; use super::constants::FILE_VERSION; -use crate::{utils::decompress, ArchivedDictionary, Dictionary}; +use crate::{lz4::decompress, ArchivedDictionary, Dictionary}; /* -------------------------------------------------------------------------- */ /* DictionaryFile */ diff --git a/lib/src/core/write.rs b/lib/src/core/write.rs index cf1166f4..6ff488a3 100644 --- a/lib/src/core/write.rs +++ b/lib/src/core/write.rs @@ -2,7 +2,7 @@ use std::fs::read_to_string; use std::path::Path; use std::{error::Error, fs::File, io::Write}; -use crate::utils::compress; +use crate::lz4::compress; use crate::{Dictionary, ToDictionary}; use super::constants::*; diff --git a/lib/src/lib.rs b/lib/src/lib.rs index e9333ea4..7fe99734 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -1,23 +1,9 @@ mod core; mod ext; +mod lz4; +mod md; mod models; -mod utils; pub use self::core::*; pub use self::ext::*; pub use self::models::*; - -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/lib/src/utils.rs b/lib/src/lz4.rs similarity index 100% rename from lib/src/utils.rs rename to lib/src/lz4.rs diff --git a/lib/src/md.rs b/lib/src/md.rs new file mode 100644 index 00000000..d75bfaf3 --- /dev/null +++ b/lib/src/md.rs @@ -0,0 +1,121 @@ +use pulldown_cmark::{html, Event, Parser, Tag, TagEnd}; + +fn pt_start_tag(tag: &Tag, buffer: &mut String, tags_stack: &mut Vec) { + match tag { + Tag::Link { title, .. } | Tag::Image { title, .. } => buffer.push_str(&title), + Tag::Item => { + buffer.push('\n'); + let mut lists_stack = tags_stack + .iter_mut() + .filter_map(|tag| match tag { + Tag::List(nb) => Some(nb), + _ => None, + }) + .collect::>(); + let prefix_tabs_count = lists_stack.len() - 1; + for _ in 0..prefix_tabs_count { + buffer.push('\t') + } + if let Some(Some(nb)) = lists_stack.last_mut() { + buffer.push_str(&nb.to_string()); + buffer.push_str(". "); + *nb += 1; + } else { + buffer.push_str("• "); + } + } + Tag::Paragraph | Tag::CodeBlock(_) | Tag::Heading { .. } => buffer.push('\n'), + _ => (), + } +} + +fn pt_end_tag(tag: &TagEnd, buffer: &mut String, tags_stack: &[Tag]) { + match tag { + TagEnd::Paragraph | TagEnd::Heading { .. } => buffer.push('\n'), + TagEnd::CodeBlock { .. } => { + if buffer.chars().last() != Some('\n') { + buffer.push('\n'); + } + } + TagEnd::List(_) => { + let is_sublist = tags_stack.iter().any(|tag| match tag { + Tag::List(_) => true, + _ => false, + }); + if !is_sublist { + buffer.push('\n') + } + } + _ => (), + } +} + +pub fn to_html(md: &str) -> String { + let parser = Parser::new(&md).filter(|event| { + !matches!( + event, + Event::Start(Tag::Paragraph) | Event::End(TagEnd::Paragraph) + ) + }); + + let mut html_output = String::new(); + + html::push_html(&mut html_output, parser); + + html_output +} + +pub fn to_text(md: &str) -> String { + // Implementation adapted from + // https://github.com/fbecart/markdown_to_text/blob/master/src/lib.rs + + let parser = Parser::new(&md); + let mut tags_stack = Vec::new(); + let mut buffer = String::new(); + + // For each event we push into the buffer to produce the plain text version. + for event in parser { + match event { + // The start and end events don't contain the text inside the tag. + // That's handled by the `Event::Text` arm. + Event::Start(tag) => { + pt_start_tag(&tag, &mut buffer, &mut tags_stack); + tags_stack.push(tag); + } + Event::End(tag) => { + tags_stack.pop(); + pt_end_tag(&tag, &mut buffer, &tags_stack); + } + Event::Text(content) => buffer.push_str(&content), + Event::Code(content) => buffer.push_str(&content), + Event::SoftBreak => buffer.push(' '), + _ => (), + } + } + + buffer.trim().to_string() +} + +#[cfg(test)] +mod tests { + use super::{to_html, to_text}; + + #[test] + fn test_html() { + let md = "**This** is a test of the _parser_"; + let expected = + "This is a test of the parser"; + let actual = to_html(md); + + assert_eq!(expected, actual); + } + + #[test] + fn test_text() { + let md = "**This** is a test of the _parser_"; + let expected = "This is a test of the parser"; + let actual = to_text(md); + + assert_eq!(expected, actual); + } +} diff --git a/lib/src/models/definition.rs b/lib/src/models/definition.rs index a9952a27..4ded2eb1 100644 --- a/lib/src/models/definition.rs +++ b/lib/src/models/definition.rs @@ -5,15 +5,15 @@ use super::{example::Example, note::Note, MDString}; serializable! { pub struct Definition { #[serde(rename = "@id")] - id: Option, + pub id: Option, #[serde(rename = "@value")] - value: MDString, + pub value: MDString, #[serde(default)] - examples: Vec, + pub examples: Vec, #[serde(default)] - notes: Vec, + pub notes: Vec, } } diff --git a/lib/src/models/etymology.rs b/lib/src/models/etymology.rs index 1736ab36..27de585e 100644 --- a/lib/src/models/etymology.rs +++ b/lib/src/models/etymology.rs @@ -7,16 +7,16 @@ use super::{pos::PartOfSpeech, sense::Sense, MDString}; serializable! { pub struct Etymology { #[serde(rename = "@id")] - id: Option, + pub id: Option, #[serde(rename = "@pronunciation")] - pronunciation: Option, + pub pronunciation: Option, #[serde(rename = "@description")] - description: Option, + pub description: Option, #[serde(rename = "sense", with = "senses")] - senses: HashMap, + pub senses: HashMap, } } diff --git a/lib/src/models/id.rs b/lib/src/models/id.rs index b71610bc..49fae9db 100644 --- a/lib/src/models/id.rs +++ b/lib/src/models/id.rs @@ -8,9 +8,15 @@ serializable! { pub struct ID(String); } +impl ID { + pub fn new() -> Self { + ID(Uuid::new_v4().to_string()) + } +} + impl Default for ID { fn default() -> Self { - ID(Uuid::new_v4().to_string()) + ID::new() } } diff --git a/lib/src/models/mdstring.rs b/lib/src/models/mdstring.rs index 8e7d4f05..af97df99 100644 --- a/lib/src/models/mdstring.rs +++ b/lib/src/models/mdstring.rs @@ -1,6 +1,9 @@ use serde::{Deserialize, Serialize, Serializer}; -use crate::serializable_custom; +use crate::{ + md::{to_html, to_text}, + serializable_custom, +}; pub enum MarkdownStrategy { HTML, @@ -42,18 +45,33 @@ impl From<&str> for MDString { } impl MDString { - pub fn parse(&self, _strategy: MarkdownStrategy) -> String { - // output := []byte(mds) + pub fn parse(&self, strategy: MarkdownStrategy) -> String { + match strategy { + MarkdownStrategy::HTML => to_html(&self.value), + MarkdownStrategy::Text => to_text(&self.value), + MarkdownStrategy::Disabled => self.value.to_owned(), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse() { + let md = MDString::from("**This** is a test of the _parser_!"); - // switch markdownStrategy { - // case MarkdownStrategyHTML: - // output = utils.MarkdownToHTML(output) - // case MarkdownStrategyText: - // output = utils.MarkdownToText(output) - // } + assert_eq!( + md.parse(MarkdownStrategy::HTML), + "This is a test of the parser!" + ); - // TODO:implement + assert_eq!( + md.parse(MarkdownStrategy::Text), + "This is a test of the parser!" + ); - self.value.clone() + assert_eq!(md.parse(MarkdownStrategy::Disabled), md.value); } } diff --git a/lib/tests/merge.rs b/lib/tests/merge.rs index e69de29b..bfb85c22 100644 --- a/lib/tests/merge.rs +++ b/lib/tests/merge.rs @@ -0,0 +1,126 @@ +use map_macro::hash_map; + +use odict::{Definition, Dictionary, Entry, Etymology, PartOfSpeech, Sense, ID}; + +#[test] +fn test_merge() { + let dict1 = Dictionary { + id: ID::new(), + name: None, + entries: hash_map! { + String::from("dog") => Entry { + term: "dog".to_string(), + see_also: None, + etymologies: vec![ + Etymology { + id:None, + description:None, + pronunciation:None, + senses: hash_map! { + PartOfSpeech::n => Sense { + pos: PartOfSpeech::n, + definitions: vec![ + Definition { + id: None, + value: "some definition".into(), + examples: vec![], + notes: vec![], + } + ], + groups: vec![], + } + } + } + ] + } + }, + }; + + let dict2 = Dictionary { + id: ID::new(), + name: None, + entries: hash_map! { + "cat".to_string()=> + Entry { + see_also: None, + term: "cat".to_string(), + etymologies: vec![Etymology { + id: None, + pronunciation: None, + description: None, + senses:hash_map! { + PartOfSpeech::n=> + Sense { + pos: PartOfSpeech::n, + definitions: vec![Definition { + id: None, + value: "some other definition".into(), + examples: vec![], + notes: vec![], + }], + groups: vec![], + }, + } + }], + }, + }, + }; + + let expected = Dictionary { + id: ID::new(), + name: None, + entries: hash_map! { + "dog".to_string() => Entry { + see_also: None, + term: "dog".to_string(), + etymologies: vec![Etymology { + id: None, + pronunciation: None, + description: None, + senses:hash_map! { + PartOfSpeech::n=> + Sense { + pos: PartOfSpeech::n, + definitions: vec![Definition { + id: None, + value: "some definition".into(), + examples: vec![], + notes: vec![], + }], + groups: vec![], + }, + } + }], + }, + "cat".to_string() => Entry { + see_also: None, + term: "cat".to_string(), + etymologies: vec![Etymology { + id: None, + pronunciation: None, + description: None, + senses:hash_map! { + PartOfSpeech::n=> + Sense { + pos: PartOfSpeech::n, + definitions: vec![Definition { + id: None, + value: "some other definition".into(), + examples: vec![], + notes: vec![], + }], + groups: vec![], + }, + } + }], + }, + }, + }; + + let mut result = dict1; + + result.merge_in(&vec![&dict2]); + result.id = expected.id.clone(); // Prevent failures based solely on UUIDs + + assert_eq!(expected, result); +} From d0a01e83cab64e407b6bf341387d3d5c2b25ac5e Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Fri, 9 Feb 2024 23:58:22 +0800 Subject: [PATCH 006/393] refactor --- Cargo.toml | 10 +- cli/Cargo.lock | 2602 ----------------------------------------- cli/src/cli.rs | 33 + cli/src/context.rs | 19 +- cli/src/lib.rs | 14 + cli/src/lookup.rs | 2 +- cli/src/main.rs | 55 +- cli/src/merge.rs | 42 + cli/src/utils.rs | 30 +- lib/src/core/merge.rs | 14 +- lib/tests/merge.rs | 2 +- 11 files changed, 141 insertions(+), 2682 deletions(-) delete mode 100644 cli/Cargo.lock create mode 100644 cli/src/cli.rs create mode 100644 cli/src/lib.rs create mode 100644 cli/src/merge.rs diff --git a/Cargo.toml b/Cargo.toml index 3c86303b..638fc317 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,9 @@ resolver = "2" -members = [ - "cli", - "lib" -] +members = ["cli", "lib"] + +[profile.release] +strip = true +codegen-units = 1 +lto = true diff --git a/cli/Cargo.lock b/cli/Cargo.lock deleted file mode 100644 index a4cf3b21..00000000 --- a/cli/Cargo.lock +++ /dev/null @@ -1,2602 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ahash" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" -dependencies = [ - "cfg-if", - "const-random", - "getrandom", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "allocator-api2" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" - -[[package]] -name = "anstream" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" - -[[package]] -name = "anstyle-parse" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - -[[package]] -name = "arc-swap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" - -[[package]] -name = "async-trait" -version = "0.1.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" - -[[package]] -name = "bitpacking" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c7d2ac73c167c06af4a5f37e6e59d84148d57ccbe4480b76f0273eefea82d7" -dependencies = [ - "crunchy", -] - -[[package]] -name = "brotli" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "castaway" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc" -dependencies = [ - "rustversion", -] - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "jobserver", - "libc", -] - -[[package]] -name = "census" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4c707c6a209cbe82d10abd08e1ea8995e9ea937d2550646e02798948992be0" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "compact_str" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" -dependencies = [ - "castaway", - "cfg-if", - "itoa", - "ryu", - "static_assertions", -] - -[[package]] -name = "console" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys 0.52.0", -] - -[[package]] -name = "const-random" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" -dependencies = [ - "const-random-macro", -] - -[[package]] -name = "const-random-macro" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" -dependencies = [ - "getrandom", - "once_cell", - "tiny-keccak", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", - "serde", -] - -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fastdivide" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25c7df09945d65ea8d70b3321547ed414bbc540aad5bac6883d021b970f35b04" - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "flatbuffers" -version = "23.5.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" -dependencies = [ - "bitflags 1.3.2", - "rustc_version", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fraction" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a78dd758a47a7305478e0e054f9fde4e983b9f9eccda162bf7ca03b79e9d40" -dependencies = [ - "lazy_static", - "num", -] - -[[package]] -name = "fs4" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" -dependencies = [ - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "generator" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows", -] - -[[package]] -name = "getrandom" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -dependencies = [ - "ahash", - "allocator-api2", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" - -[[package]] -name = "htmlescape" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" - -[[package]] -name = "include_dir" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" -dependencies = [ - "include_dir_macros", -] - -[[package]] -name = "include_dir_macros" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" -dependencies = [ - "proc-macro2", - "quote", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" - -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "levenshtein_automata" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2cdeb66e45e9f36bfad5bbdb4d2384e70936afbee843c6f6543f0c551ebb25" - -[[package]] -name = "libc" -version = "0.2.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" - -[[package]] -name = "lingua" -version = "1.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d109aef84956f04b8b5866db17e59f964152411915ad27b6e291b262d63a442c" -dependencies = [ - "ahash", - "brotli", - "compact_str", - "fraction", - "include_dir", - "itertools 0.12.0", - "lingua-afrikaans-language-model", - "lingua-albanian-language-model", - "lingua-arabic-language-model", - "lingua-armenian-language-model", - "lingua-azerbaijani-language-model", - "lingua-basque-language-model", - "lingua-belarusian-language-model", - "lingua-bengali-language-model", - "lingua-bokmal-language-model", - "lingua-bosnian-language-model", - "lingua-bulgarian-language-model", - "lingua-catalan-language-model", - "lingua-chinese-language-model", - "lingua-croatian-language-model", - "lingua-czech-language-model", - "lingua-danish-language-model", - "lingua-dutch-language-model", - "lingua-english-language-model", - "lingua-esperanto-language-model", - "lingua-estonian-language-model", - "lingua-finnish-language-model", - "lingua-french-language-model", - "lingua-ganda-language-model", - "lingua-georgian-language-model", - "lingua-german-language-model", - "lingua-greek-language-model", - "lingua-gujarati-language-model", - "lingua-hebrew-language-model", - "lingua-hindi-language-model", - "lingua-hungarian-language-model", - "lingua-icelandic-language-model", - "lingua-indonesian-language-model", - "lingua-irish-language-model", - "lingua-italian-language-model", - "lingua-japanese-language-model", - "lingua-kazakh-language-model", - "lingua-korean-language-model", - "lingua-latin-language-model", - "lingua-latvian-language-model", - "lingua-lithuanian-language-model", - "lingua-macedonian-language-model", - "lingua-malay-language-model", - "lingua-maori-language-model", - "lingua-marathi-language-model", - "lingua-mongolian-language-model", - "lingua-nynorsk-language-model", - "lingua-persian-language-model", - "lingua-polish-language-model", - "lingua-portuguese-language-model", - "lingua-punjabi-language-model", - "lingua-romanian-language-model", - "lingua-russian-language-model", - "lingua-serbian-language-model", - "lingua-shona-language-model", - "lingua-slovak-language-model", - "lingua-slovene-language-model", - "lingua-somali-language-model", - "lingua-sotho-language-model", - "lingua-spanish-language-model", - "lingua-swahili-language-model", - "lingua-swedish-language-model", - "lingua-tagalog-language-model", - "lingua-tamil-language-model", - "lingua-telugu-language-model", - "lingua-thai-language-model", - "lingua-tsonga-language-model", - "lingua-tswana-language-model", - "lingua-turkish-language-model", - "lingua-ukrainian-language-model", - "lingua-urdu-language-model", - "lingua-vietnamese-language-model", - "lingua-welsh-language-model", - "lingua-xhosa-language-model", - "lingua-yoruba-language-model", - "lingua-zulu-language-model", - "maplit", - "once_cell", - "rayon", - "regex", - "serde", - "serde-wasm-bindgen", - "serde_json", - "strum", - "strum_macros", - "wasm-bindgen", -] - -[[package]] -name = "lingua-afrikaans-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97df3a7cd698a09753cb32c0f403cf9f698fa0ae1b081fc1b14fc4707301392" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-albanian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1f78f0468f3337d53bd1cdc481e0f1c445e33ce43650d654d8b56037daa1996" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-arabic-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ada75100728990b05bacaec7693efebf0c8b911599ac0c082cb4ed576bf494d" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-armenian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d126f4182866345c5df9cef2e0a3ca64891d7bf0325c31f99df360c00c72bc0f" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-azerbaijani-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962742b8bed5483adb31cfd12b4ee79fc8dccfa602bb4c25a240579236394892" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-basque-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710aa0c4203d3c019b624601233b0035723087ba2cb9de8572632cb8c5ac97a4" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-belarusian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b76ec320c7646f0c8849371530ba5332d64f640fc170c14d63102bd27580f5" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-bengali-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecf9f1c7b00c78984eee240f2188f1781a69a08b87bfb1aabd3e3cc50c0d279d" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-bokmal-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a9215ee6bbe6d37222dc5dbd9d1577389810011cb8afbef6155e71a11fa5cb9" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-bosnian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98f836f559334e2d9c0e1876c87e72431b25412b164efd194a840a13b49d8c3b" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-bulgarian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6639397b34419af35835a594178f93dd84edb3a146938f0f1d7013c1a48a5a1" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-catalan-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d9acd43a1320961fe4cb8571ebc0e87d9809a0e9d6d71e5cbab86fab923201" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-chinese-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a1e3a38a0920f6ddbd9b6a79a8c04cd927142713b595ba32be6b811603f7c6" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-croatian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66eaa997d1fa477c42d2497beeb546b63576e04cc6057a60718daabe061c2344" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-czech-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed98f50055cb5c9b06c20da82029c8cfe204332ab3360349545cbc3d465cd1d1" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-danish-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0adc4abde17e94cf023a1ae4f3bcda3b13dcfecfc1f6421f59f17f904d5b5ed2" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-dutch-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30f3db5635a5e964d85190b5d32ca391d9f7630137630458a605c7ab33583db9" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-english-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbd066693abb10083bb5b5fc1c494dda357170265021ad873ef582211817b8a8" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-esperanto-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7877160b3346161f2714236c9ab1c667097821c0dbb31e5bce42f23c82a157c2" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-estonian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a25c07d8a67c82a5c41d8cb2893a4032332d18abadd8d06d80a654f6a1b3c47" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-finnish-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07e0f34931973ec268916cb4c183e06df880e8e43ee99124522ea8c767c9940" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-french-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba406de05309b212790036e576aee4b1a71ce62b77fbd084df5bc8d7c624866f" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-ganda-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9890e6f6b48bf7f2240da770020c5045a1885598c6cb6bc25df73e0182f4792" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-georgian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7392be814065ff3ff71bae7dbb463a47039a68f90d45dd34f4ca7221c0c2f01" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-german-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd4041d542b6512d415c0ea6979333e5e88698b966dda7b9bf06029bf690a13" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-greek-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e1f5a17634410f527a6360979209504072ff9e71e29a0578b18a4f57dcb611b" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-gujarati-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee11b10ffdf8f4eb3d2078c9edec73fb51a36d061ddc6d6e847585a3b91909e" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-hebrew-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a13c9fa3f21bfb91ed3a9710add72c332d0e36234ea9b9d5ed3d6e2235051f6" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-hindi-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63659e514fa8c706d2ed0d7a04b98adb05b8c8d4bc37e3d12edb9d35ce24fd0" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-hungarian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "885525276c696b978c4a1aee8a2b3b9a822724e47348c260d05e9092ebd8c96e" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-icelandic-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b616e573df1aa0bc9881fcef4258d3445fc80f5efe3a71ab010c68eb97ab659d" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-indonesian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc06b8937f6adaad76b28fd009cbfaa6f876ebe5fa887d96dccd1dff2d21d9ad" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-irish-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6258beb6627274163aac7da4dda1e6bcbcf7ff404efa603d0e59e8054f77199" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-italian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6e138047ac4d681e419e37ad9e383878652ac19e67056ff16085d4cc82e590" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-japanese-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b34b94aa96a1bc0838ddda2c7912d0ebd7256bb21e7a2974e4dd8b186df501a8" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-kazakh-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b64a848cc1a38dc3c4e7a5ad18b9f2ecbd6abf4c453a8898538d96e6a5c0da4" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-korean-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c47aa5e5dc8d029967375081aabda462faf10b070aefc1a175ea7f42f5267c" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-latin-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0922f27e68ae15397160ab1835aefb5a878bc14f0c0ce79b6d074ee828b4d7" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-latvian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6cc01bbfda64ccbfb00b5172d7ba9327053da8c38a85c0b71c969533cf8f08" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-lithuanian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b68e593c8f72e77b1fe823633baae744681bd8def2dce7d2830947b41c4b1e" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-macedonian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e288bc4ec1776131580ed80d842de39bce0355bcc3cc59c519008e60f9276fe" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-malay-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771c6b7ab2865e2563e1ce19bf06611aad674c3f0a180ec43c03a9883e49c8aa" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-maori-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d653a0c16c5cfaa088bdf75e362ba4f715cbd6dbca391f1637a6c49c1e8aff90" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-marathi-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a141c8d9670ff22e541c064ccab3cfbbc2db2625ec20236d73d76dd98e8ba0" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-mongolian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f53de502920af44b5d8ec7787895c0a81b0f5f43e3f3c2b80a240f2b605122c1" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-nynorsk-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db00b13561df244acb76927677200ff399b02d8c9b160d25a38320ef3361cfa9" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-persian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043ba9b4ac7df99acaa1cd9f5925d6fc9b0fe850d3891bbeb91b27ed94f266c4" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-polish-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f298b650531a5d85d3101ad7db7a5cbf3b671b71f01a775e97d4165eebc9ff75" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-portuguese-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9df0be307b3f5e24e10e76a7841302c0ff4a6ebf818a11d3a3c5c4cecfcfe58b" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-punjabi-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc529e58e6af7cca366af7fb964b4cad7a357d538d4b6a7eccde31ae4bd7604f" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-romanian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0428c13d8e05e65929ec170e807c8508c2201c63c7802c7786de0c3b78e390b" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-russian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea97d6643e90ee4fc0043c728f0c06cdd9e69d4970fd1983e5c59b3448a676e" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-serbian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b181be3137969bf5a9e10d8773666d01223886a4d7454048fad99e7b0416db" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-shona-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509772c502f2a47ec7cd5b50be1bc34b51dcb98cca1f5e30143c96de61a757bb" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-slovak-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44e1e99e6725e99659367ac80731efc24298a7a24190ff3d777209e86be3dc40" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-slovene-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49fc410d0acdf3068cc9c7ae493348d47a26be0d3d8c5c23603c807befd949c1" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-somali-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde8a66f8901e7e5eac9af985ace066bd5ed3643815beaecb2d7a7b86645d0b3" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-sotho-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58084eb81faf32f62c922e8b3f3dfdcadacf5de934edfb7d3b1acb3759d89f04" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-spanish-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d45be9bede9b9d6d53b6e06047822a18dbd83e5d515736afecd85c1e71cc6070" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-swahili-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f251246905cf56e519af87095fd31264417c19de83fb9e2e0ade5e8c27af4fe3" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-swedish-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0289dc7e5654aac497c829369b811ae1870eb9d5f76c6b82527bbe5470aa0d" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-tagalog-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5cb889e86a8a62f56f06d0d9bd92d16f697151a9b3dcdefef0ba39624c5cb0" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-tamil-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630d10fabcd5a289b5cd4b651df0c448692a3e55cc7e28334313a2d76d2916e5" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-telugu-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0501f9b52fc247ef4e1f4020fd44a90cccddf9914724977cb3440eced01cbe07" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-thai-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194b09209fc63d986d8ef9505689756eff1935fa52fd91031b60e7d546ca3c76" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-tsonga-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa10493e6bb3bfd8591254a5657eb98bad6be33334c4ebd791edb354fc83b07" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-tswana-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db016128507f4eb48dbe96b05be134c9385f6752da7949c653a24e3c4661e37" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-turkish-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b517e12fe94ce80e7f8f380fdd2c0223bcfe351c0898c9a83f56f78b3afad81" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-ukrainian-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ed035dd4b7ec5f76fe3b07e5f499d76c4cdb2a6d275459e4cdd3a3d21f131a" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-urdu-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9edb8e15e88004b5b89e80f1bf41237770c5536805494dcf627f7ec550eaf4" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-vietnamese-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d08afaf263906aa3f2bfaffaf52eecd368992685e2468f1ba7f85f3e41fd49" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-welsh-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c47a533b66772fdd7ece069359900b18824851464a4dd4fd8e4b29928d19b1" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-xhosa-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55a48851d35933a57c6f87a4fdc25d7eeba8eff98f1852b00d7c8c15b2a818fb" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-yoruba-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf6365215ffb772d22c18fbf55b1503ad292aa9a5e93d1249d9307117f6b0ef" -dependencies = [ - "include_dir", -] - -[[package]] -name = "lingua-zulu-language-model" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63f8b5c7f412d078f37ffd2874297afce76719c4b1b7c4856af0fa4e8f89abe2" -dependencies = [ - "include_dir", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "loom" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" -dependencies = [ - "cfg-if", - "generator", - "pin-utils", - "scoped-tls", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "lru" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" -dependencies = [ - "hashbrown", -] - -[[package]] -name = "lz4_flex" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912b45c753ff5f7f5208307e8ace7d2a2e30d024e26d3509f3dce546c044ce15" - -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "markdown" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef3aab6a1d529b112695f72beec5ee80e729cb45af58663ec902c8fac764ecdd" -dependencies = [ - "lazy_static", - "pipeline", - "regex", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - -[[package]] -name = "measure_time" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56220900f1a0923789ecd6bf25fbae8af3b2f1ff3e9e297fc9b6b8674dd4d852" -dependencies = [ - "instant", - "log", -] - -[[package]] -name = "memchr" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - -[[package]] -name = "memmap2" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" -dependencies = [ - "libc", -] - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "murmurhash32" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9380db4c04d219ac5c51d14996bbf2c2e9a15229771b53f8671eb6c83cf44df" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - -[[package]] -name = "odict-rust" -version = "0.1.0" -dependencies = [ - "clap", - "console", - "flatbuffers", - "lingua", - "markdown", - "quick-xml", - "serde", - "serde_json", - "snap", - "tantivy", - "tokio", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "oneshot" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6640c6bda7731b1fdbab747981a0f896dd1fedaf9f4a53fa237a04a84431f4" -dependencies = [ - "loom", -] - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "ownedbytes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8a72b918ae8198abb3a18c190288123e1d442b6b9a7d709305fd194688b4b7" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pipeline" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d15b6607fa632996eb8a17c9041cb6071cb75ac057abd45dece578723ea8c7c0" - -[[package]] -name = "pkg-config" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "proc-macro2" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quick-xml" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" -dependencies = [ - "memchr", -] - -[[package]] -name = "quote" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rayon" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "regex" -version = "1.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.5", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "rust-stemmers" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" -dependencies = [ - "bitflags 2.4.2", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - -[[package]] -name = "ryu" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "semver" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" - -[[package]] -name = "serde" -version = "1.0.196" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-wasm-bindgen" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9b713f70513ae1f8d92665bbbbda5c295c2cf1da5542881ae5eefe20c9af132" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - -[[package]] -name = "serde_derive" -version = "1.0.196" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.112" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1bd37ce2324cf3bf85e5a25f96eb4baf0d5aa6eba43e7ae8958870c4ec48ed" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "sketches-ddsketch" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" -dependencies = [ - "serde", -] - -[[package]] -name = "smallvec" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" - -[[package]] -name = "snap" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strum" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" - -[[package]] -name = "strum_macros" -version = "0.25.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "syn" -version = "2.0.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tantivy" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6083cd777fa94271b8ce0fe4533772cb8110c3044bab048d20f70108329a1f2" -dependencies = [ - "aho-corasick", - "arc-swap", - "async-trait", - "base64", - "bitpacking", - "byteorder", - "census", - "crc32fast", - "crossbeam-channel", - "downcast-rs", - "fastdivide", - "fs4", - "htmlescape", - "itertools 0.11.0", - "levenshtein_automata", - "log", - "lru", - "lz4_flex", - "measure_time", - "memmap2", - "murmurhash32", - "num_cpus", - "once_cell", - "oneshot", - "rayon", - "regex", - "rust-stemmers", - "rustc-hash", - "serde", - "serde_json", - "sketches-ddsketch", - "smallvec", - "tantivy-bitpacker", - "tantivy-columnar", - "tantivy-common", - "tantivy-fst", - "tantivy-query-grammar", - "tantivy-stacker", - "tantivy-tokenizer-api", - "tempfile", - "thiserror", - "time", - "uuid", - "winapi", -] - -[[package]] -name = "tantivy-bitpacker" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecb164321482301f514dd582264fa67f70da2d7eb01872ccd71e35e0d96655a" -dependencies = [ - "bitpacking", -] - -[[package]] -name = "tantivy-columnar" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d85f8019af9a78b3118c11298b36ffd21c2314bd76bbcd9d12e00124cbb7e70" -dependencies = [ - "fastdivide", - "fnv", - "itertools 0.11.0", - "serde", - "tantivy-bitpacker", - "tantivy-common", - "tantivy-sstable", - "tantivy-stacker", -] - -[[package]] -name = "tantivy-common" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4a3a975e604a2aba6b1106a04505e1e7a025e6def477fab6e410b4126471e1" -dependencies = [ - "async-trait", - "byteorder", - "ownedbytes", - "serde", - "time", -] - -[[package]] -name = "tantivy-fst" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc3c506b1a8443a3a65352df6382a1fb6a7afe1a02e871cee0d25e2c3d5f3944" -dependencies = [ - "byteorder", - "regex-syntax 0.6.29", - "utf8-ranges", -] - -[[package]] -name = "tantivy-query-grammar" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d39c5a03100ac10c96e0c8b07538e2ab8b17da56434ab348309b31f23fada77" -dependencies = [ - "nom", -] - -[[package]] -name = "tantivy-sstable" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0c1bb43e5e8b8e05eb8009610344dbf285f06066c844032fbb3e546b3c71df" -dependencies = [ - "tantivy-common", - "tantivy-fst", - "zstd", -] - -[[package]] -name = "tantivy-stacker" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2c078595413f13f218cf6f97b23dcfd48936838f1d3d13a1016e05acd64ed6c" -dependencies = [ - "murmurhash32", - "tantivy-common", -] - -[[package]] -name = "tantivy-tokenizer-api" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "347b6fb212b26d3505d224f438e3c4b827ab8bd847fe9953ad5ac6b8f9443b66" -dependencies = [ - "serde", -] - -[[package]] -name = "tempfile" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.52.0", -] - -[[package]] -name = "thiserror" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" -dependencies = [ - "deranged", - "itoa", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" -dependencies = [ - "time-core", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tokio" -version = "1.35.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" -dependencies = [ - "backtrace", - "pin-project-lite", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - -[[package]] -name = "utf8-ranges" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba" - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "uuid" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" -dependencies = [ - "getrandom", - "serde", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" - -[[package]] -name = "web-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" - -[[package]] -name = "zerocopy" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zstd" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "6.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/cli/src/cli.rs b/cli/src/cli.rs new file mode 100644 index 00000000..1ac47b45 --- /dev/null +++ b/cli/src/cli.rs @@ -0,0 +1,33 @@ +use clap::{command, crate_version, Parser, Subcommand}; + +use crate::{CompileArgs, LookupArgs, MergeArgs}; + +#[derive(Debug, Parser)] +#[command(name = "odict", about = "the lighting-fast open-source dictionary compiler", version = crate_version!(), long_about = None)] +pub struct CLI { + #[command(subcommand)] + pub command: Commands, + + #[arg( + short, + long, + default_value_t = false, + help = "Silence any non-important output" + )] + pub quiet: bool, +} + +#[derive(Debug, Subcommand)] +pub enum Commands { + /// Compiles a dictionary from ODXML + #[command(arg_required_else_help = true)] + Compile(CompileArgs), + + /// Looks up an entry in a compiled dictionary without indexing + #[command(arg_required_else_help = true)] + Lookup(LookupArgs), + + /// Merge entries from multiple dictionaries into a destination dictionary + #[command(arg_required_else_help = true)] + Merge(MergeArgs), +} diff --git a/cli/src/context.rs b/cli/src/context.rs index 8bb66a71..fbe852f6 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -1,15 +1,28 @@ +use std::io::Write; + +use crate::CLI; use odict::{DictionaryReader, DictionaryWriter}; -pub struct CLIContext { +pub struct CLIContext<'a> { + pub cli: &'a CLI, pub reader: DictionaryReader, pub writer: DictionaryWriter, + pub stdout: Box, + pub stderr: Box, } -impl CLIContext { - pub fn default() -> Self { +impl<'a> CLIContext<'a> { + pub fn default(cli: &'a CLI) -> Self { Self { + cli, reader: DictionaryReader::default(), writer: DictionaryWriter::default(), + stdout: Box::new(std::io::stdout()), + stderr: Box::new(std::io::stderr()), } } + + pub fn print(&mut self, msg: String) { + self.stdout.write_all(msg.as_bytes()).unwrap(); + } } diff --git a/cli/src/lib.rs b/cli/src/lib.rs new file mode 100644 index 00000000..5ef97f63 --- /dev/null +++ b/cli/src/lib.rs @@ -0,0 +1,14 @@ +mod cli; +mod compile; +mod context; +mod enums; +mod lookup; +mod merge; +mod utils; + +pub use cli::*; +pub use compile::*; +pub use context::*; +pub use lookup::*; +pub use merge::*; +pub use utils::*; diff --git a/cli/src/lookup.rs b/cli/src/lookup.rs index 85462e2f..d53596a8 100644 --- a/cli/src/lookup.rs +++ b/cli/src/lookup.rs @@ -41,7 +41,7 @@ pub struct LookupArgs { split: usize, } -pub fn lookup(ctx: &CLIContext, args: &LookupArgs) -> Result<(), Box> { +pub fn lookup(ctx: &mut CLIContext, args: &LookupArgs) -> Result<(), Box> { let LookupArgs { dictionary_path: path, queries, diff --git a/cli/src/main.rs b/cli/src/main.rs index b3c22e56..ca7fc67f 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,55 +1,22 @@ -use clap::{command, crate_version, Parser, Subcommand}; - -mod compile; -mod context; -mod enums; -mod lookup; -mod utils; - -use compile::*; -use context::*; -use lookup::*; -use utils::*; - -#[derive(Debug, Parser)] -#[command(name = "odict", about = "the lighting-fast open-source dictionary compiler", version = crate_version!(), long_about = None)] -pub struct CLI { - #[command(subcommand)] - command: Commands, - - #[arg( - short, - long, - default_value_t = false, - help = "Silence any non-important output" - )] - quiet: bool, -} - -#[derive(Debug, Subcommand)] -enum Commands { - /// Compiles a dictionary from ODXML - #[command(arg_required_else_help = true)] - Compile(CompileArgs), - - /// Looks up an entry in a compiled dictionary without indexing - #[command(arg_required_else_help = true)] - Lookup(LookupArgs), -} +use clap::Parser; +use cli::{compile, lookup, merge, t, CLIContext, Commands, CLI}; fn main() { let cli = CLI::parse(); - let ctx = CLIContext::default(); + let mut ctx = CLIContext::default(&cli); let result = t( - || match cli.command { - Commands::Compile(ref args) => compile(&ctx, &args), - Commands::Lookup(ref args) => lookup(&ctx, &args), + |c| match cli.command { + Commands::Compile(ref args) => compile(c, &args), + Commands::Lookup(ref args) => lookup(c, &args), + Commands::Merge(ref args) => merge(c, &args), }, - cli.quiet, + &mut ctx, ); if let Err(e) = result { - eprintln!("Error: {}", e); + ctx.stderr + .write_all(format!("Error: {}", e).as_bytes()) + .unwrap(); } } diff --git a/cli/src/merge.rs b/cli/src/merge.rs new file mode 100644 index 00000000..db3a6e14 --- /dev/null +++ b/cli/src/merge.rs @@ -0,0 +1,42 @@ +use std::error::Error; + +use clap::{arg, command, Args}; + +use crate::CLIContext; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct MergeArgs { + #[arg( + required = true, + help = "Path of the dictionary to merge into (unless --output is specified)" + )] + destination: String, + + #[arg(required = true, help = "Paths of dictionaries to merge")] + sources: Vec, + + #[arg(short, long, help = "Separate output path for the compiled dictionary")] + output: Option, +} + +pub fn merge(ctx: &CLIContext, args: &MergeArgs) -> Result<(), Box> { + let mut dict = ctx + .reader + .read_from_path(&args.destination)? + .to_dictionary()?; + + for source in &args.sources { + let source_dict = ctx.reader.read_from_path(source)?.to_dictionary()?; + dict.merge(&source_dict); + } + + if let Some(output) = &args.output { + ctx.writer.write_to_path(&dict, &output)?; + } else { + ctx.writer.write_to_path(&dict, &args.destination)?; + } + + Ok(()) +} diff --git a/cli/src/utils.rs b/cli/src/utils.rs index c657a5b4..276e4c87 100644 --- a/cli/src/utils.rs +++ b/cli/src/utils.rs @@ -1,32 +1,18 @@ -// type closure func() error - -// // t times the amount of time it takes for a closure to -// // execute then prints the elapsed time -// func t(c *cli.Context, cb closure) error { -// start := time.Now() - -// err := cb() - -// if !c.Bool("quiet") && err == nil { -// fmt.Printf("\n✨ Completed in %s\n", time.Since(start).String()) -// } - -// return err -// } - use std::error::Error; -pub fn t(cb: F, quiet: bool) -> Result<(), Box> +use crate::CLIContext; + +pub fn t(cb: F, ctx: &mut CLIContext) -> Result<(), Box> where - F: FnOnce() -> Result<(), Box>, + F: FnOnce(&mut CLIContext) -> Result<(), Box>, { let start = std::time::Instant::now(); - let err = cb(); + let err = cb(ctx); if let Err(msg) = err { - println!("{}", msg) - } else if !quiet { - println!("✨ Completed in {:?}", start.elapsed()); + ctx.print(format!("{}", msg)); + } else if !ctx.cli.quiet { + ctx.print(format!("✨ Completed in {:?}", start.elapsed())); } Ok(()) diff --git a/lib/src/core/merge.rs b/lib/src/core/merge.rs index 5986f006..33cd9d3d 100644 --- a/lib/src/core/merge.rs +++ b/lib/src/core/merge.rs @@ -1,12 +1,16 @@ use crate::Dictionary; impl Dictionary { - pub fn merge_in(&mut self, dictionaries: &[&Dictionary]) { + pub fn merge_multi(&mut self, dictionaries: &[&Dictionary]) { for src in dictionaries { - for (term, entry) in src.entries.iter() { - if !self.entries.contains_key(term.as_str()) { - self.entries.insert(term.clone(), entry.clone()); - } + self.merge(src); + } + } + + pub fn merge(&mut self, dictionary: &Dictionary) { + for (term, entry) in dictionary.entries.iter() { + if !self.entries.contains_key(term.as_str()) { + self.entries.insert(term.clone(), entry.clone()); } } } diff --git a/lib/tests/merge.rs b/lib/tests/merge.rs index bfb85c22..30da37c1 100644 --- a/lib/tests/merge.rs +++ b/lib/tests/merge.rs @@ -119,7 +119,7 @@ fn test_merge() { let mut result = dict1; - result.merge_in(&vec![&dict2]); + result.merge(&dict2); result.id = expected.id.clone(); // Prevent failures based solely on UUIDs assert_eq!(expected, result); From d44f583ed01cf0e65a818429b4564c5c5c5caa6c Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Sun, 11 Feb 2024 19:34:48 +0800 Subject: [PATCH 007/393] works --- cli/src/cli.rs | 6 +++- cli/src/context.rs | 6 ++-- cli/src/lexicon.rs | 28 ++++++++++++++++++ cli/src/lib.rs | 2 ++ cli/src/main.rs | 3 +- cli/src/utils.rs | 4 +-- lib/src/models/sense.rs | 17 +++++++---- lib/tests/merge.rs | 64 +++++++++++++++++++++++------------------ 8 files changed, 91 insertions(+), 39 deletions(-) create mode 100644 cli/src/lexicon.rs diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 1ac47b45..c295f443 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -1,6 +1,6 @@ use clap::{command, crate_version, Parser, Subcommand}; -use crate::{CompileArgs, LookupArgs, MergeArgs}; +use crate::{CompileArgs, LexiconArgs, LookupArgs, MergeArgs}; #[derive(Debug, Parser)] #[command(name = "odict", about = "the lighting-fast open-source dictionary compiler", version = crate_version!(), long_about = None)] @@ -30,4 +30,8 @@ pub enum Commands { /// Merge entries from multiple dictionaries into a destination dictionary #[command(arg_required_else_help = true)] Merge(MergeArgs), + + /// Lists all words defined in a dictionary + #[command(arg_required_else_help = true)] + Lexicon(LexiconArgs), } diff --git a/cli/src/context.rs b/cli/src/context.rs index fbe852f6..538f8cbf 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -22,7 +22,9 @@ impl<'a> CLIContext<'a> { } } - pub fn print(&mut self, msg: String) { - self.stdout.write_all(msg.as_bytes()).unwrap(); + pub fn println(&mut self, msg: String) { + self.stdout + .write_all(format!("{}\n", msg).as_bytes()) + .unwrap(); } } diff --git a/cli/src/lexicon.rs b/cli/src/lexicon.rs new file mode 100644 index 00000000..daf758d5 --- /dev/null +++ b/cli/src/lexicon.rs @@ -0,0 +1,28 @@ +use std::error::Error; + +use clap::{arg, command, Args}; + +use crate::CLIContext; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct LexiconArgs { + #[arg(required = true, help = "Path to a compiled dictionary")] + dictionary: String, +} + +pub fn lexicon(ctx: &mut CLIContext, args: &LexiconArgs) -> Result<(), Box> { + let dict = ctx + .reader + .read_from_path(&args.dictionary)? + .to_dictionary()?; + + let lexicon = dict.lexicon(); + + for word in lexicon { + ctx.println(word.to_string()); + } + + Ok(()) +} diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 5ef97f63..45789be2 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -2,6 +2,7 @@ mod cli; mod compile; mod context; mod enums; +mod lexicon; mod lookup; mod merge; mod utils; @@ -9,6 +10,7 @@ mod utils; pub use cli::*; pub use compile::*; pub use context::*; +pub use lexicon::*; pub use lookup::*; pub use merge::*; pub use utils::*; diff --git a/cli/src/main.rs b/cli/src/main.rs index ca7fc67f..03055cb7 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,5 +1,5 @@ use clap::Parser; -use cli::{compile, lookup, merge, t, CLIContext, Commands, CLI}; +use cli::{compile, lexicon, lookup, merge, t, CLIContext, Commands, CLI}; fn main() { let cli = CLI::parse(); @@ -10,6 +10,7 @@ fn main() { Commands::Compile(ref args) => compile(c, &args), Commands::Lookup(ref args) => lookup(c, &args), Commands::Merge(ref args) => merge(c, &args), + Commands::Lexicon(ref args) => lexicon(c, &args), }, &mut ctx, ); diff --git a/cli/src/utils.rs b/cli/src/utils.rs index 276e4c87..69b4a72f 100644 --- a/cli/src/utils.rs +++ b/cli/src/utils.rs @@ -10,9 +10,9 @@ where let err = cb(ctx); if let Err(msg) = err { - ctx.print(format!("{}", msg)); + ctx.println(format!("{}", msg)); } else if !ctx.cli.quiet { - ctx.print(format!("✨ Completed in {:?}", start.elapsed())); + ctx.println(format!("\n✨ Completed in {:?}", start.elapsed())); } Ok(()) diff --git a/lib/src/models/sense.rs b/lib/src/models/sense.rs index aaa320a2..327e3e86 100644 --- a/lib/src/models/sense.rs +++ b/lib/src/models/sense.rs @@ -2,15 +2,22 @@ use crate::serializable; use super::{pos::PartOfSpeech, Definition, Group}; +serializable! { + pub enum DefinitionType { + #[serde(rename = "group")] + Group(Group), + + #[serde(rename = "definition")] + Definition(Definition), + } +} + serializable! { pub struct Sense { #[serde(rename = "@pos", default)] pub pos: PartOfSpeech, - #[serde(rename = "group", default)] - pub groups: Vec, - - #[serde(rename = "definition", default)] - pub definitions: Vec, + #[serde(default, rename = "$value")] + pub definitions: Vec, } } diff --git a/lib/tests/merge.rs b/lib/tests/merge.rs index 30da37c1..a9359916 100644 --- a/lib/tests/merge.rs +++ b/lib/tests/merge.rs @@ -1,6 +1,6 @@ use map_macro::hash_map; -use odict::{Definition, Dictionary, Entry, Etymology, PartOfSpeech, Sense, ID}; +use odict::{Definition, DefinitionType, Dictionary, Entry, Etymology, PartOfSpeech, Sense, ID}; #[test] fn test_merge() { @@ -20,14 +20,15 @@ fn test_merge() { PartOfSpeech::n => Sense { pos: PartOfSpeech::n, definitions: vec![ - Definition { - id: None, - value: "some definition".into(), - examples: vec![], - notes: vec![], - } + DefinitionType::Definition( + Definition { + id: None, + value: "some definition".into(), + examples: vec![], + notes: vec![], + } + ) ], - groups: vec![], } } } @@ -52,13 +53,16 @@ fn test_merge() { PartOfSpeech::n=> Sense { pos: PartOfSpeech::n, - definitions: vec![Definition { - id: None, - value: "some other definition".into(), - examples: vec![], - notes: vec![], - }], - groups: vec![], + definitions: vec![ + DefinitionType::Definition( + Definition { + id: None, + value: "some other definition".into(), + examples: vec![], + notes: vec![], + } + ) + ], }, } }], @@ -70,7 +74,7 @@ fn test_merge() { id: ID::new(), name: None, entries: hash_map! { - "dog".to_string() => Entry { + "dog".to_string() => Entry { see_also: None, term: "dog".to_string(), etymologies: vec![Etymology { @@ -78,21 +82,24 @@ fn test_merge() { pronunciation: None, description: None, senses:hash_map! { - PartOfSpeech::n=> - Sense { - pos: PartOfSpeech::n, - definitions: vec![Definition { + PartOfSpeech::n=> + Sense { + pos: PartOfSpeech::n, + definitions: vec![ + DefinitionType::Definition( + Definition { id: None, value: "some definition".into(), examples: vec![], notes: vec![], - }], - groups: vec![], - }, - } + } + ) + ], + }, + } }], }, - "cat".to_string() => Entry { + "cat".to_string() => Entry { see_also: None, term: "cat".to_string(), etymologies: vec![Etymology { @@ -103,13 +110,14 @@ fn test_merge() { PartOfSpeech::n=> Sense { pos: PartOfSpeech::n, - definitions: vec![Definition { + definitions: vec![DefinitionType::Definition( + Definition{ id: None, value: "some other definition".into(), examples: vec![], notes: vec![], - }], - groups: vec![], + } + )], }, } }], From 556adc3a55b12e15c2c7ecaba13d06accea107cc Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Mon, 12 Feb 2024 11:32:24 +0800 Subject: [PATCH 008/393] wip --- .github/workflows/test.yml | 5 +++-- cli/src/lib.rs | 2 ++ cli/src/lookup.rs | 18 +++++++++++++----- cli/src/print.rs | 26 ++++++++++++++++++++++++++ cli/src/utils.rs | 14 ++++++++++++++ lib/src/ext.rs | 6 ++++++ lib/src/models/entry.rs | 11 +++++++++++ 7 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 cli/src/print.rs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f92b7789..0f80005a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,10 @@ name: Build & Test on: push: - branches: [main] + # TODO: update this so it runs on main again + branches: [main_] pull_request: - branches: [main] + branches: [main_] jobs: test: diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 45789be2..557f2d46 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -5,6 +5,7 @@ mod enums; mod lexicon; mod lookup; mod merge; +mod print; mod utils; pub use cli::*; @@ -13,4 +14,5 @@ pub use context::*; pub use lexicon::*; pub use lookup::*; pub use merge::*; +pub use print::*; pub use utils::*; diff --git a/cli/src/lookup.rs b/cli/src/lookup.rs index d53596a8..aae302c8 100644 --- a/cli/src/lookup.rs +++ b/cli/src/lookup.rs @@ -1,7 +1,8 @@ use std::error::Error; -use crate::context::CLIContext; +use crate::deserialize_nested_entries; use crate::enums::PrintFormat; +use crate::{context::CLIContext, print_entries}; use clap::{arg, command, Args}; use odict::LookupOptions; @@ -45,18 +46,25 @@ pub fn lookup(ctx: &mut CLIContext, args: &LookupArgs) -> Result<(), Box { + print_entries(ctx, &deserialize_nested_entries(entries), format)?; + Ok(()) + } + Err(err) => { + return Err(err); + } + } } diff --git a/cli/src/print.rs b/cli/src/print.rs new file mode 100644 index 00000000..e1c1a665 --- /dev/null +++ b/cli/src/print.rs @@ -0,0 +1,26 @@ +use std::error::Error; + +use odict::Entry; +use serde_json::to_string_pretty; + +use crate::{enums::PrintFormat, CLIContext}; + +fn print_as_json(ctx: &mut CLIContext, entries: &Vec>) -> Result<(), Box> { + ctx.println(to_string_pretty(entries)?); + Ok(()) +} + +pub fn print_entries( + ctx: &mut CLIContext, + entries: &Vec>, + format: &PrintFormat, +) -> Result<(), Box> { + match format { + PrintFormat::Print => {} + PrintFormat::JSON => { + print_as_json(ctx, entries)?; + } + PrintFormat::XML => todo!(), + } + Ok(()) +} diff --git a/cli/src/utils.rs b/cli/src/utils.rs index 69b4a72f..00440646 100644 --- a/cli/src/utils.rs +++ b/cli/src/utils.rs @@ -1,5 +1,7 @@ use std::error::Error; +use odict::{ArchivedEntry, Entry}; + use crate::CLIContext; pub fn t(cb: F, ctx: &mut CLIContext) -> Result<(), Box> @@ -17,3 +19,15 @@ where Ok(()) } + +pub fn deserialize_nested_entries(entries: Vec>) -> Vec> { + entries + .iter() + .map(|entries_inner| -> Vec { + entries_inner + .iter() + .map(|entry| entry.to_entry().unwrap()) + .collect() + }) + .collect() +} diff --git a/lib/src/ext.rs b/lib/src/ext.rs index d1773674..a079d06f 100644 --- a/lib/src/ext.rs +++ b/lib/src/ext.rs @@ -11,3 +11,9 @@ impl ToDictionary for String { Ok(Dictionary::from(self.as_str())) } } + +impl ToDictionary for str { + fn to_dictionary(&self) -> Result> { + Ok(Dictionary::from(self)) + } +} diff --git a/lib/src/models/entry.rs b/lib/src/models/entry.rs index 65c26847..6619f41d 100644 --- a/lib/src/models/entry.rs +++ b/lib/src/models/entry.rs @@ -1,3 +1,7 @@ +use std::error::Error; + +use rkyv::{Deserialize, Infallible}; + use crate::serializable; use super::Etymology; @@ -14,3 +18,10 @@ serializable! { pub etymologies: Vec, } } + +impl ArchivedEntry { + pub fn to_entry(&self) -> Result> { + let entry: Entry = self.deserialize(&mut Infallible)?; + Ok(entry) + } +} From 853bf435ecf6808a8f7d0daa724802de9dac43f1 Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Mon, 12 Feb 2024 17:17:18 +0800 Subject: [PATCH 009/393] feat(config): port `alias` logic and CLI command to Rust (#641) --- .github/workflows/test2.yml | 35 ++ Cargo.lock | 882 ++++-------------------------------- cli/Cargo.toml | 3 +- cli/src/alias/alias.rs | 33 ++ cli/src/alias/delete.rs | 17 + cli/src/alias/mod.rs | 5 + cli/src/alias/set.rs | 26 ++ cli/src/cli.rs | 5 + cli/src/context.rs | 13 +- cli/src/lexicon.rs | 2 +- cli/src/lib.rs | 2 + cli/src/lookup.rs | 4 +- cli/src/main.rs | 11 +- cli/src/merge.rs | 6 +- lib/Cargo.toml | 9 +- lib/src/config/aliases.rs | 75 +++ lib/src/config/config.rs | 87 ++++ lib/src/config/mod.rs | 28 ++ lib/src/core/read.rs | 7 +- lib/src/lib.rs | 3 + 20 files changed, 441 insertions(+), 812 deletions(-) create mode 100644 .github/workflows/test2.yml create mode 100644 cli/src/alias/alias.rs create mode 100644 cli/src/alias/delete.rs create mode 100644 cli/src/alias/mod.rs create mode 100644 cli/src/alias/set.rs create mode 100644 lib/src/config/aliases.rs create mode 100644 lib/src/config/config.rs create mode 100644 lib/src/config/mod.rs diff --git a/.github/workflows/test2.yml b/.github/workflows/test2.yml new file mode 100644 index 00000000..d02278fa --- /dev/null +++ b/.github/workflows/test2.yml @@ -0,0 +1,35 @@ +name: Run Tests + +on: + push: + branches: [v2] + pull_request: + branches: [v2] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Setup asdf + uses: asdf-vm/actions/setup@v2 + - name: Cache asdf + id: cache-asdf + uses: actions/cache@v3 + with: + path: | + /home/runner/.asdf + key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }} + restore-keys: | + ${{ runner.os }}-asdf- + - name: Install dependencies in .tool-versions + uses: asdf-vm/actions/install@v2 + - name: Run tests + run: just test + - uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: code + path: /home/runner/work/odict diff --git a/Cargo.lock b/Cargo.lock index f92247a2..547e1e64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,18 +13,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "ahash" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.2" @@ -34,12 +22,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "allocator-api2" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" - [[package]] name = "anstream" version = "0.6.11" @@ -88,29 +70,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "arc-swap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" - -[[package]] -name = "async-trait" -version = "0.1.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "bitflags" version = "1.3.2" @@ -123,15 +82,6 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" -[[package]] -name = "bitpacking" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c7d2ac73c167c06af4a5f37e6e59d84148d57ccbe4480b76f0273eefea82d7" -dependencies = [ - "crunchy", -] - [[package]] name = "bitvec" version = "1.0.1" @@ -144,12 +94,6 @@ dependencies = [ "wyz", ] -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - [[package]] name = "bytecheck" version = "0.6.11" @@ -184,22 +128,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "jobserver", - "libc", -] - -[[package]] -name = "census" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4c707c6a209cbe82d10abd08e1ea8995e9ea937d2550646e02798948992be0" - [[package]] name = "cfg-if" version = "1.0.0" @@ -254,6 +182,7 @@ dependencies = [ "clio", "console", "odict", + "once_cell", "quick-xml", "regex", "serde", @@ -293,24 +222,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -337,26 +248,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] -name = "crunchy" -version = "0.2.2" +name = "dirs" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ - "powerfmt", - "serde", + "dirs-sys", ] [[package]] -name = "downcast-rs" -version = "1.2.0" +name = "dirs-sys" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] [[package]] name = "either" @@ -380,53 +290,18 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "fastdivide" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25c7df09945d65ea8d70b3321547ed414bbc540aad5bac6883d021b970f35b04" - [[package]] name = "fastrand" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fs4" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" -dependencies = [ - "rustix", - "windows-sys 0.48.0", -] - [[package]] name = "funty" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" -[[package]] -name = "generator" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows", -] - [[package]] name = "getopts" version = "0.2.21" @@ -453,17 +328,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", -] - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -dependencies = [ - "ahash 0.8.7", - "allocator-api2", + "ahash", ] [[package]] @@ -478,24 +343,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" -[[package]] -name = "htmlescape" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "is-terminal" version = "0.4.10" @@ -507,51 +354,18 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "levenshtein_automata" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2cdeb66e45e9f36bfad5bbdb4d2384e70936afbee843c6f6543f0c551ebb25" - [[package]] name = "libc" version = "0.2.152" @@ -559,39 +373,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] -name = "linux-raw-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "loom" -version = "0.5.6" +name = "libredox" +version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "cfg-if", - "generator", - "pin-utils", - "scoped-tls", - "tracing", - "tracing-subscriber", + "bitflags 2.4.2", + "libc", + "redox_syscall", ] [[package]] -name = "lru" -version = "0.11.1" +name = "linux-raw-sys" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" -dependencies = [ - "hashbrown 0.14.3", -] +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lz4_flex" @@ -608,87 +404,18 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb950a42259642e5a3483115aca87eebed2a64886993463af9c9739c205b8d3a" -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - -[[package]] -name = "measure_time" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56220900f1a0923789ecd6bf25fbae8af3b2f1ff3e9e297fc9b6b8674dd4d852" -dependencies = [ - "instant", - "log", -] - [[package]] name = "memchr" version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" -[[package]] -name = "memmap2" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" -dependencies = [ - "libc", -] - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "murmurhash32" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9380db4c04d219ac5c51d14996bbf2c2e9a15229771b53f8671eb6c83cf44df" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "odict" version = "0.1.0" dependencies = [ "byteorder", + "dirs", "lz4_flex", "map-macro", "once_cell", @@ -699,7 +426,6 @@ dependencies = [ "rkyv", "serde", "serde_json", - "tantivy", "uuid", "validation", ] @@ -711,52 +437,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "oneshot" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6640c6bda7731b1fdbab747981a0f896dd1fedaf9f4a53fa237a04a84431f4" -dependencies = [ - "loom", -] - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "ownedbytes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8a72b918ae8198abb3a18c190288123e1d442b6b9a7d709305fd194688b4b7" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" +name = "option-ext" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] -name = "pkg-config" -version = "0.3.29" +name = "ppv-lite86" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" @@ -831,6 +521,36 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "rayon" version = "1.8.1" @@ -861,24 +581,26 @@ dependencies = [ ] [[package]] -name = "regex" -version = "1.10.3" +name = "redox_users" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.5", - "regex-syntax 0.8.2", + "getrandom", + "libredox", + "thiserror", ] [[package]] -name = "regex-automata" -version = "0.1.10" +name = "regex" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ - "regex-syntax 0.6.29", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] [[package]] @@ -889,15 +611,9 @@ checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.2" @@ -922,7 +638,7 @@ dependencies = [ "bitvec", "bytecheck", "bytes", - "hashbrown 0.12.3", + "hashbrown", "ptr_meta", "rend", "rkyv_derive", @@ -942,22 +658,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "rust-stemmers" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustix" version = "0.38.30" @@ -971,12 +671,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - [[package]] name = "ryu" version = "1.0.16" @@ -992,12 +686,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "seahash" version = "4.1.0" @@ -1035,42 +723,12 @@ dependencies = [ "serde", ] -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - [[package]] name = "simdutf8" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" -[[package]] -name = "sketches-ddsketch" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" -dependencies = [ - "serde", -] - -[[package]] -name = "smallvec" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "static_assertions" version = "1.1.0" @@ -1105,146 +763,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "tantivy" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6083cd777fa94271b8ce0fe4533772cb8110c3044bab048d20f70108329a1f2" -dependencies = [ - "aho-corasick", - "arc-swap", - "async-trait", - "base64", - "bitpacking", - "byteorder", - "census", - "crc32fast", - "crossbeam-channel", - "downcast-rs", - "fastdivide", - "fs4", - "htmlescape", - "itertools", - "levenshtein_automata", - "log", - "lru", - "lz4_flex", - "measure_time", - "memmap2", - "murmurhash32", - "num_cpus", - "once_cell", - "oneshot", - "rayon", - "regex", - "rust-stemmers", - "rustc-hash", - "serde", - "serde_json", - "sketches-ddsketch", - "smallvec", - "tantivy-bitpacker", - "tantivy-columnar", - "tantivy-common", - "tantivy-fst", - "tantivy-query-grammar", - "tantivy-stacker", - "tantivy-tokenizer-api", - "tempfile", - "thiserror", - "time", - "uuid", - "winapi", -] - -[[package]] -name = "tantivy-bitpacker" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecb164321482301f514dd582264fa67f70da2d7eb01872ccd71e35e0d96655a" -dependencies = [ - "bitpacking", -] - -[[package]] -name = "tantivy-columnar" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d85f8019af9a78b3118c11298b36ffd21c2314bd76bbcd9d12e00124cbb7e70" -dependencies = [ - "fastdivide", - "fnv", - "itertools", - "serde", - "tantivy-bitpacker", - "tantivy-common", - "tantivy-sstable", - "tantivy-stacker", -] - -[[package]] -name = "tantivy-common" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4a3a975e604a2aba6b1106a04505e1e7a025e6def477fab6e410b4126471e1" -dependencies = [ - "async-trait", - "byteorder", - "ownedbytes", - "serde", - "time", -] - -[[package]] -name = "tantivy-fst" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc3c506b1a8443a3a65352df6382a1fb6a7afe1a02e871cee0d25e2c3d5f3944" -dependencies = [ - "byteorder", - "regex-syntax 0.6.29", - "utf8-ranges", -] - -[[package]] -name = "tantivy-query-grammar" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d39c5a03100ac10c96e0c8b07538e2ab8b17da56434ab348309b31f23fada77" -dependencies = [ - "nom", -] - -[[package]] -name = "tantivy-sstable" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0c1bb43e5e8b8e05eb8009610344dbf285f06066c844032fbb3e546b3c71df" -dependencies = [ - "tantivy-common", - "tantivy-fst", - "zstd", -] - -[[package]] -name = "tantivy-stacker" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2c078595413f13f218cf6f97b23dcfd48936838f1d3d13a1016e05acd64ed6c" -dependencies = [ - "murmurhash32", - "tantivy-common", -] - -[[package]] -name = "tantivy-tokenizer-api" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "347b6fb212b26d3505d224f438e3c4b827ab8bd847fe9953ad5ac6b8f9443b66" -dependencies = [ - "serde", -] - [[package]] name = "tap" version = "1.0.1" @@ -1284,45 +802,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" -dependencies = [ - "deranged", - "itoa", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" -dependencies = [ - "time-core", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -1338,67 +817,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - [[package]] name = "twox-hash" version = "1.6.3" @@ -1430,12 +848,6 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" -[[package]] -name = "utf8-ranges" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba" - [[package]] name = "utf8parse" version = "0.2.1" @@ -1449,20 +861,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom", - "serde", + "rand", + "uuid-macro-internal", ] [[package]] -name = "validation" -version = "0.0.1" +name = "uuid-macro-internal" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb8044f0b8a3e94bc8cd089c6a2e42e435553093800b76762418d4bbc3289cc" +checksum = "7abb14ae1a50dad63eaa768a458ef43d298cd1bd44951677bd10b732a9ba2a2d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] [[package]] -name = "valuable" -version = "0.1.0" +name = "validation" +version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "3fb8044f0b8a3e94bc8cd089c6a2e42e435553093800b76762418d4bbc3289cc" [[package]] name = "version_check" @@ -1486,70 +904,6 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.48", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" - -[[package]] -name = "web-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "winapi" version = "0.3.9" @@ -1581,15 +935,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -1787,52 +1132,3 @@ checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] - -[[package]] -name = "zerocopy" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "zstd" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "6.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 3b2e77f1..8b9a5da4 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -4,7 +4,7 @@ version = "2.0.0" edition = "2021" [dependencies] -odict = { path = "../lib" } +odict = { path = "../lib", features = ["config"] } clap = { version = "4.4.18", features = ["derive", "cargo"] } console = "0.15.8" serde = "1.0.196" @@ -12,3 +12,4 @@ serde_json = "1.0.112" clio = "0.3.5" quick-xml = { version = "0.31.0", features = ["serde", "serialize"] } regex = "1.10.3" +once_cell = "1.19.0" diff --git a/cli/src/alias/alias.rs b/cli/src/alias/alias.rs new file mode 100644 index 00000000..78f4b1b6 --- /dev/null +++ b/cli/src/alias/alias.rs @@ -0,0 +1,33 @@ +use std::error::Error; + +use crate::CLIContext; + +use super::{ + delete::{delete, DeleteArgs}, + set::{set, SetArgs}, +}; + +use clap::{command, Subcommand}; + +#[derive(Debug, Subcommand)] +pub enum AliasCommands { + /// Attempts to create a new dictionary alias, failing if one already exists with the given name + #[command(arg_required_else_help = true)] + Add(SetArgs), + + /// Creates or updates an existing dictionary alias + #[command(arg_required_else_help = true)] + Set(SetArgs), + + /// Deletes an alias with the given name if it exists + #[command(arg_required_else_help = true)] + Delete(DeleteArgs), +} + +pub fn alias(ctx: &mut CLIContext, command: &AliasCommands) -> Result<(), Box> { + match command { + AliasCommands::Add(ref args) => set(ctx, args, false), + AliasCommands::Set(ref args) => set(ctx, args, true), + AliasCommands::Delete(ref args) => delete(ctx, args), + } +} diff --git a/cli/src/alias/delete.rs b/cli/src/alias/delete.rs new file mode 100644 index 00000000..e415d192 --- /dev/null +++ b/cli/src/alias/delete.rs @@ -0,0 +1,17 @@ +use std::error::Error; + +use clap::{arg, Args}; + +use crate::CLIContext; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct DeleteArgs { + #[arg(required = true, help = "Name of the alias")] + name: String, +} + +pub fn delete(ctx: &mut CLIContext, args: &DeleteArgs) -> Result<(), Box> { + ctx.alias_manager.delete(args.name.as_str()) +} diff --git a/cli/src/alias/mod.rs b/cli/src/alias/mod.rs new file mode 100644 index 00000000..8861efad --- /dev/null +++ b/cli/src/alias/mod.rs @@ -0,0 +1,5 @@ +mod alias; +mod delete; +mod set; + +pub use self::alias::*; diff --git a/cli/src/alias/set.rs b/cli/src/alias/set.rs new file mode 100644 index 00000000..b23f24af --- /dev/null +++ b/cli/src/alias/set.rs @@ -0,0 +1,26 @@ +use std::error::Error; + +use clap::{arg, Args}; + +use crate::CLIContext; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct SetArgs { + #[arg(required = true, help = "Name of the alias")] + name: String, + + #[arg(required = true, help = "Dictionary path")] + path: String, +} + +pub fn set(ctx: &mut CLIContext, args: &SetArgs, overwrite: bool) -> Result<(), Box> { + let dict = ctx.reader.read_from_path(args.path.as_str())?; + + if overwrite { + ctx.alias_manager.set(args.name.as_str(), &dict) + } else { + ctx.alias_manager.add(args.name.as_str(), &dict) + } +} diff --git a/cli/src/cli.rs b/cli/src/cli.rs index c295f443..dca8baad 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -1,5 +1,6 @@ use clap::{command, crate_version, Parser, Subcommand}; +use crate::alias::AliasCommands; use crate::{CompileArgs, LexiconArgs, LookupArgs, MergeArgs}; #[derive(Debug, Parser)] @@ -19,6 +20,10 @@ pub struct CLI { #[derive(Debug, Subcommand)] pub enum Commands { + /// Manage dictionary aliases + #[command(subcommand, arg_required_else_help = true)] + Alias(AliasCommands), + /// Compiles a dictionary from ODXML #[command(arg_required_else_help = true)] Compile(CompileArgs), diff --git a/cli/src/context.rs b/cli/src/context.rs index 538f8cbf..bdebc511 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -1,12 +1,14 @@ +use once_cell::sync::Lazy; use std::io::Write; use crate::CLI; -use odict::{DictionaryReader, DictionaryWriter}; +use odict::{config::AliasManager, DictionaryReader, DictionaryWriter}; pub struct CLIContext<'a> { pub cli: &'a CLI, - pub reader: DictionaryReader, - pub writer: DictionaryWriter, + pub alias_manager: Lazy, + pub reader: Lazy, + pub writer: Lazy, pub stdout: Box, pub stderr: Box, } @@ -15,8 +17,9 @@ impl<'a> CLIContext<'a> { pub fn default(cli: &'a CLI) -> Self { Self { cli, - reader: DictionaryReader::default(), - writer: DictionaryWriter::default(), + alias_manager: Lazy::new(|| AliasManager::default()), + reader: Lazy::new(|| DictionaryReader::default()), + writer: Lazy::new(|| DictionaryWriter::default()), stdout: Box::new(std::io::stdout()), stderr: Box::new(std::io::stderr()), } diff --git a/cli/src/lexicon.rs b/cli/src/lexicon.rs index daf758d5..da695e83 100644 --- a/cli/src/lexicon.rs +++ b/cli/src/lexicon.rs @@ -15,7 +15,7 @@ pub struct LexiconArgs { pub fn lexicon(ctx: &mut CLIContext, args: &LexiconArgs) -> Result<(), Box> { let dict = ctx .reader - .read_from_path(&args.dictionary)? + .read_from_path_or_alias_with_manager(&args.dictionary, &ctx.alias_manager)? .to_dictionary()?; let lexicon = dict.lexicon(); diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 557f2d46..e8d530e2 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -1,3 +1,4 @@ +mod alias; mod cli; mod compile; mod context; @@ -8,6 +9,7 @@ mod merge; mod print; mod utils; +pub use alias::*; pub use cli::*; pub use compile::*; pub use context::*; diff --git a/cli/src/lookup.rs b/cli/src/lookup.rs index aae302c8..48854667 100644 --- a/cli/src/lookup.rs +++ b/cli/src/lookup.rs @@ -51,7 +51,9 @@ pub fn lookup(ctx: &mut CLIContext, args: &LookupArgs) -> Result<(), Box compile(c, &args), - Commands::Lookup(ref args) => lookup(c, &args), - Commands::Merge(ref args) => merge(c, &args), - Commands::Lexicon(ref args) => lexicon(c, &args), + Commands::Compile(ref args) => compile(c, args), + Commands::Lookup(ref args) => lookup(c, args), + Commands::Merge(ref args) => merge(c, args), + Commands::Lexicon(ref args) => lexicon(c, args), + Commands::Alias(ref args) => alias(c, args), }, &mut ctx, ); diff --git a/cli/src/merge.rs b/cli/src/merge.rs index db3a6e14..ba72ff7e 100644 --- a/cli/src/merge.rs +++ b/cli/src/merge.rs @@ -28,7 +28,11 @@ pub fn merge(ctx: &CLIContext, args: &MergeArgs) -> Result<(), Box> { .to_dictionary()?; for source in &args.sources { - let source_dict = ctx.reader.read_from_path(source)?.to_dictionary()?; + let source_dict = ctx + .reader + .read_from_path_or_alias_with_manager(source, &ctx.alias_manager)? + .to_dictionary()?; + dict.merge(&source_dict); } diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 6413851a..018a9500 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -3,7 +3,8 @@ name = "odict" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +config = ["dep:dirs"] [dependencies] lz4_flex = { version = "0.11.2", default-features = false, features = [ @@ -19,12 +20,12 @@ rkyv = { version = "0.7.43", features = [ "alloc", "archive_le", ] } -serde = "1.0.196" +serde = { version = "1.0.196", features = ["serde_derive"] } serde_json = "1.0.113" -tantivy = "0.21.1" validation = "0.0.1" -uuid = "1.7.0" +uuid = { version = "1.7.0", features = ["v4", "fast-rng", "macro-diagnostics"] } pulldown-cmark = "0.10.0" +dirs = { version = "5.0.1", optional = true } [dev-dependencies] map-macro = "0.3.0" diff --git a/lib/src/config/aliases.rs b/lib/src/config/aliases.rs new file mode 100644 index 00000000..e2276c12 --- /dev/null +++ b/lib/src/config/aliases.rs @@ -0,0 +1,75 @@ +use std::{error::Error, ffi::OsStr}; + +use serde_json::to_vec; + +use crate::DictionaryFile; + +use super::config::{get_config, ODictConfig}; + +use std::fs; + +pub struct AliasManager { + config: ODictConfig, +} + +impl AliasManager { + // May be used in the future? + pub fn new + ?Sized>(config_path: &S) -> Result> { + Ok(Self { + config: get_config(Some(config_path))?, + }) + } +} + +impl Default for AliasManager { + fn default() -> Self { + Self { + config: get_config::(None).unwrap(), + } + } +} + +impl AliasManager { + fn save_to_disk(&self) -> Result<(), Box> { + let config_bytes = to_vec(&self.config.aliases)?; + fs::write(&self.config.path, config_bytes)?; + Ok(()) + } + + pub fn add(&mut self, alias: &str, file: &DictionaryFile) -> Result<(), Box> { + if self.get(alias).is_none() { + self.set(alias, file) + } else { + Err("An alias with this name already exists!".into()) + } + } + + pub fn set(&mut self, alias: &str, file: &DictionaryFile) -> Result<(), Box> { + match &file.path { + Some(path) => { + self.config + .aliases + .insert(alias.to_string(), path.to_string_lossy().to_string()); + self.save_to_disk() + } + None => Err("This dictionary has no path!".into()), + } + } + + pub fn delete(&mut self, alias: &str) -> Result<(), Box> { + self.config.aliases.remove(alias); + self.save_to_disk()?; + Ok(()) + } + + pub fn get(&self, alias: &str) -> Option<&String> { + self.config.aliases.get(alias) + } +} + +impl DictionaryFile { + pub fn alias_to(&self, name: &str) -> Result<(), Box> { + let mut manager = AliasManager::default(); + manager.add(name, self) + } +} diff --git a/lib/src/config/config.rs b/lib/src/config/config.rs new file mode 100644 index 00000000..c9dac86f --- /dev/null +++ b/lib/src/config/config.rs @@ -0,0 +1,87 @@ +use dirs::home_dir; +use std::collections::HashMap; +use std::env::var; +use std::error::Error; +use std::ffi::OsStr; +use std::fs::{self, create_dir, read_to_string}; +use std::path::{Path, PathBuf}; + +pub(super) struct ODictConfig { + pub(super) path: PathBuf, + pub(super) aliases: HashMap, +} + +pub(super) fn get_config_dir(custom: Option<&str>) -> Result> { + let config_dir = custom.map(|c| c.to_string()).unwrap_or_else(|| { + let home_dir = home_dir().expect("Failed to get home directory"); + let mut config_dir = PathBuf::from(home_dir); + + config_dir.push(".odict"); + + return config_dir.to_string_lossy().to_string(); + }); + + let path = PathBuf::from(&config_dir); + + if !path.exists() { + create_dir(&path)?; + } + + Ok(path) +} + +pub(super) fn get_default_config_path(custom_dir: Option<&str>) -> Result> { + Ok(Path::new(&get_config_dir(custom_dir)?).join("aliases.json")) +} + +pub(super) fn get_config + ?Sized>( + config_path: Option<&S>, +) -> Result> { + let config_path = config_path + .map(PathBuf::from) + .unwrap_or(get_default_config_path( + var("ODICT_CONFIG_DIR").ok().as_deref(), + )?); + + if !config_path.exists() { + fs::write(&config_path, "{}")?; + } + + let config = read_to_string(&config_path)?; + let config: HashMap = serde_json::from_str(&config)?; + + Ok(ODictConfig { + path: config_path, + aliases: config, + }) +} + +#[cfg(test)] +mod test { + use dirs::home_dir; + use std::path::PathBuf; + + use super::get_config_dir; + + #[test] + fn test_get_config_dir_custom() { + let config_dir = get_config_dir(Some(".odict")).unwrap(); + let actual = config_dir.to_str().unwrap(); + + assert_eq!(actual, ".odict"); + } + + #[test] + fn test_get_config_dir() { + let home_dir = home_dir().expect("Failed to get home directory"); + let mut config_dir = PathBuf::from(home_dir); + + config_dir.push(".odict"); + + let expected = config_dir.to_string_lossy().to_string(); + let config_dir = get_config_dir(None).unwrap(); + let actual = config_dir.to_str().unwrap(); + + assert_eq!(actual, expected); + } +} diff --git a/lib/src/config/mod.rs b/lib/src/config/mod.rs new file mode 100644 index 00000000..0e0ef402 --- /dev/null +++ b/lib/src/config/mod.rs @@ -0,0 +1,28 @@ +mod aliases; +mod config; + +use std::error::Error; + +pub use aliases::*; + +use crate::{DictionaryFile, DictionaryReader}; + +impl DictionaryReader { + pub fn read_from_path_or_alias( + &self, + path_or_alias: &str, + ) -> Result> { + self.read_from_path_or_alias_with_manager(path_or_alias, &AliasManager::default()) + } + + pub fn read_from_path_or_alias_with_manager( + &self, + path_or_alias: &str, + manager: &AliasManager, + ) -> Result> { + match manager.get(path_or_alias) { + Some(path) => self.read_from_path(path), + None => self.read_from_path(path_or_alias), + } + } +} diff --git a/lib/src/core/read.rs b/lib/src/core/read.rs index 6fdb59d8..f2274faf 100644 --- a/lib/src/core/read.rs +++ b/lib/src/core/read.rs @@ -2,6 +2,7 @@ use std::{ error::Error, fs::File, io::{Cursor, Read, Seek}, + path::PathBuf, }; use byteorder::{LittleEndian, ReadBytesExt}; @@ -17,6 +18,7 @@ use crate::{lz4::decompress, ArchivedDictionary, Dictionary}; pub struct DictionaryFile { pub signature: String, pub version: u16, + pub path: Option, content: Vec, } @@ -82,6 +84,7 @@ impl DictionaryReader { signature, version, content, + path: None, }) } @@ -91,7 +94,9 @@ impl DictionaryReader { file.read_to_end(&mut buffer)?; - let result = self.read_from_bytes(&buffer)?; + let mut result = self.read_from_bytes(&buffer)?; + + result.path = Some(PathBuf::from(path)); Ok(result) } diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 7fe99734..5b242534 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -1,3 +1,6 @@ +#[cfg(feature = "config")] +pub mod config; + mod core; mod ext; mod lz4; From 3f6d00ed6e1130e96a500cc91dc281d48a04ac4f Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Sun, 18 Feb 2024 00:36:58 +0900 Subject: [PATCH 010/393] wip --- .zed/settings.json | 5 + Cargo.lock | 2920 ++++++++++++++++++++++++++++++---- Cargo.toml | 2 +- cli/Cargo.toml | 8 +- cli/src/print.rs | 5 +- justfile | 11 +- lib/Cargo.toml | 19 +- lib/src/core/lookup.rs | 2 +- lib/src/core/merge.rs | 2 +- lib/src/dump/json.rs | 198 +++ lib/src/dump/mod.rs | 3 + lib/src/lib.rs | 3 + lib/src/models/dictionary.rs | 11 +- macros/Cargo.toml | 14 + macros/src/lib.rs | 23 + 15 files changed, 2876 insertions(+), 350 deletions(-) create mode 100644 .zed/settings.json create mode 100644 lib/src/dump/json.rs create mode 100644 lib/src/dump/mod.rs create mode 100644 macros/Cargo.toml create mode 100644 macros/src/lib.rs diff --git a/.zed/settings.json b/.zed/settings.json new file mode 100644 index 00000000..82ddf880 --- /dev/null +++ b/.zed/settings.json @@ -0,0 +1,5 @@ +// Folder-specific settings +// +// For a full list of overridable settings, and general information on folder-specific settings, +// see the documentation: https://docs.zed.dev/configuration/configuring-zed#folder-specific-settings +{} diff --git a/Cargo.lock b/Cargo.lock index 547e1e64..4f3c1a52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,211 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "actix-codec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" +dependencies = [ + "bitflags 2.4.2", + "bytes", + "futures-core", + "futures-sink", + "memchr", + "pin-project-lite", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "actix-http" +version = "3.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d223b13fd481fc0d1f83bb12659ae774d9e3601814c68a0bc539731698cca743" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "actix-utils", + "ahash 0.8.8", + "base64", + "bitflags 2.4.2", + "brotli", + "bytes", + "bytestring", + "derive_more", + "encoding_rs", + "flate2", + "futures-core", + "h2", + "http", + "httparse", + "httpdate", + "itoa", + "language-tags", + "local-channel", + "mime", + "percent-encoding", + "pin-project-lite", + "rand", + "sha1", + "smallvec", + "tokio", + "tokio-util", + "tracing", + "zstd 0.13.0", +] + +[[package]] +name = "actix-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" +dependencies = [ + "quote", + "syn 2.0.48", +] + +[[package]] +name = "actix-router" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" +dependencies = [ + "bytestring", + "http", + "regex", + "serde", + "tracing", +] + +[[package]] +name = "actix-rt" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" +dependencies = [ + "futures-core", + "tokio", +] + +[[package]] +name = "actix-server" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eb13e7eef0423ea6eab0e59f6c72e7cb46d33691ad56a726b3cd07ddec2c2d4" +dependencies = [ + "actix-rt", + "actix-service", + "actix-utils", + "futures-core", + "futures-util", + "mio", + "socket2", + "tokio", + "tracing", +] + +[[package]] +name = "actix-service" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a" +dependencies = [ + "futures-core", + "paste", + "pin-project-lite", +] + +[[package]] +name = "actix-utils" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" +dependencies = [ + "local-waker", + "pin-project-lite", +] + +[[package]] +name = "actix-web" +version = "4.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a6556ddebb638c2358714d853257ed226ece6023ef9364f23f0c70737ea984" +dependencies = [ + "actix-codec", + "actix-http", + "actix-macros", + "actix-router", + "actix-rt", + "actix-server", + "actix-service", + "actix-utils", + "actix-web-codegen", + "ahash 0.8.8", + "bytes", + "bytestring", + "cfg-if", + "cookie", + "derive_more", + "encoding_rs", + "futures-core", + "futures-util", + "itoa", + "language-tags", + "log", + "mime", + "once_cell", + "pin-project-lite", + "regex", + "serde", + "serde_json", + "serde_urlencoded", + "smallvec", + "socket2", + "time", + "url", +] + +[[package]] +name = "actix-web-codegen" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1f50ebbb30eca122b188319a4398b3f7bb4a8cdf50ecfb73bfc6a3c3ce54f5" +dependencies = [ + "actix-router", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.7.7" @@ -13,6 +218,19 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -22,6 +240,27 @@ dependencies = [ "memchr", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "anstream" version = "0.6.11" @@ -70,6 +309,71 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "anyhow" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" + +[[package]] +name = "arc-swap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" + +[[package]] +name = "async-trait" +version = "0.1.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -82,6 +386,15 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +[[package]] +name = "bitpacking" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c7d2ac73c167c06af4a5f37e6e59d84148d57ccbe4480b76f0273eefea82d7" +dependencies = [ + "crunchy", +] + [[package]] name = "bitvec" version = "1.0.1" @@ -94,6 +407,42 @@ dependencies = [ "wyz", ] +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "brotli" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bumpalo" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" + [[package]] name = "bytecheck" version = "0.6.11" @@ -128,12 +477,105 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +[[package]] +name = "bytestring" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d80203ea6b29df88012294f62733de21cfeab47f17b41af3a38bc30a03ee72" +dependencies = [ + "bytes", +] + +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "cedarwood" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d910bedd62c24733263d0bed247460853c9d22e8956bd4cd964302095e04e90" +dependencies = [ + "smallvec", +] + +[[package]] +name = "census" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4c707c6a209cbe82d10abd08e1ea8995e9ea937d2550646e02798948992be0" + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "charabia" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9071b1586dd067b5fdfd2069fab932c047ca5bbce4bd2bdee8af0f4b155053" +dependencies = [ + "aho-corasick", + "cow-utils", + "csv", + "deunicode", + "either", + "finl_unicode", + "fst", + "irg-kvariants", + "jieba-rs", + "lindera-core", + "lindera-dictionary", + "lindera-tokenizer", + "litemap", + "once_cell", + "pinyin", + "serde", + "slice-group-by", + "unicode-normalization", + "whatlang", + "zerovec", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "4.4.18" @@ -179,28 +621,9 @@ name = "cli" version = "2.0.0" dependencies = [ "clap", - "clio", "console", "odict", "once_cell", - "quick-xml", - "regex", - "serde", - "serde_json", -] - -[[package]] -name = "clio" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7fc6734af48458f72f5a3fa7b840903606427d98a710256e808f76a965047d9" -dependencies = [ - "cfg-if", - "is-terminal", - "libc", - "tempfile", - "walkdir", - "windows-sys 0.42.0", ] [[package]] @@ -223,361 +646,1464 @@ dependencies = [ ] [[package]] -name = "crossbeam-deque" -version = "0.8.5" +name = "constant_time_eq" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] -name = "crossbeam-epoch" -version = "0.9.18" +name = "convert_case" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cookie" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ - "crossbeam-utils", + "percent-encoding", + "time", + "version_check", ] [[package]] -name = "crossbeam-utils" -version = "0.8.19" +name = "cow-utils" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79" [[package]] -name = "dirs" -version = "5.0.1" +name = "cpufeatures" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ - "dirs-sys", + "libc", ] [[package]] -name = "dirs-sys" -version = "0.4.1" +name = "crc32fast" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", + "cfg-if", ] [[package]] -name = "either" -version = "1.9.0" +name = "crossbeam-channel" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +dependencies = [ + "crossbeam-utils", +] [[package]] -name = "encode_unicode" -version = "0.3.6" +name = "crossbeam-deque" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] [[package]] -name = "errno" -version = "0.3.8" +name = "crossbeam-epoch" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "libc", - "windows-sys 0.52.0", + "crossbeam-utils", ] [[package]] -name = "fastrand" -version = "2.0.1" +name = "crossbeam-utils" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] -name = "funty" -version = "2.0.0" +name = "crunchy" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "getopts" -version = "0.2.21" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "unicode-width", + "generic-array", + "typenum", ] [[package]] -name = "getrandom" -version = "0.2.12" +name = "csv" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ - "cfg-if", - "libc", - "wasi", + "csv-core", + "itoa", + "ryu", + "serde", ] [[package]] -name = "hashbrown" -version = "0.12.3" +name = "csv-core" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" dependencies = [ - "ahash", + "memchr", ] [[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.4" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] [[package]] -name = "is-terminal" -version = "0.4.10" +name = "derive_more" +version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.52.0", + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", ] [[package]] -name = "itoa" -version = "1.0.10" +name = "deunicode" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "b6e854126756c496b8c81dec88f9a706b15b875c5849d4097a3854476b9fdf94" [[package]] -name = "lazy_static" -version = "1.4.0" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] [[package]] -name = "libc" -version = "0.2.152" +name = "dirs" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] [[package]] -name = "libredox" -version = "0.0.1" +name = "dirs-sys" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ - "bitflags 2.4.2", "libc", - "redox_syscall", + "option-ext", + "redox_users", + "windows-sys 0.48.0", ] [[package]] -name = "linux-raw-sys" -version = "0.4.13" +name = "downcast-rs" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] -name = "lz4_flex" -version = "0.11.2" +name = "either" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912b45c753ff5f7f5208307e8ace7d2a2e30d024e26d3509f3dce546c044ce15" -dependencies = [ - "twox-hash", -] +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] -name = "map-macro" -version = "0.3.0" +name = "encode_unicode" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb950a42259642e5a3483115aca87eebed2a64886993463af9c9739c205b8d3a" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] -name = "memchr" -version = "2.7.1" +name = "encoding" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" +dependencies = [ + "encoding-index-japanese", + "encoding-index-korean", + "encoding-index-simpchinese", + "encoding-index-singlebyte", + "encoding-index-tradchinese", +] [[package]] -name = "odict" -version = "0.1.0" +name = "encoding-index-japanese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" dependencies = [ - "byteorder", - "dirs", - "lz4_flex", - "map-macro", - "once_cell", - "pulldown-cmark", - "quick-xml", - "rayon", - "regex", - "rkyv", - "serde", - "serde_json", - "uuid", - "validation", + "encoding_index_tests", ] [[package]] -name = "once_cell" -version = "1.19.0" +name = "encoding-index-korean" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" +dependencies = [ + "encoding_index_tests", +] [[package]] -name = "option-ext" -version = "0.2.0" +name = "encoding-index-simpchinese" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" +dependencies = [ + "encoding_index_tests", +] [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "encoding-index-singlebyte" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +dependencies = [ + "encoding_index_tests", +] [[package]] -name = "proc-macro2" -version = "1.0.78" +name = "encoding-index-tradchinese" +version = "1.20141219.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" dependencies = [ - "unicode-ident", + "encoding_index_tests", ] [[package]] -name = "ptr_meta" +name = "encoding_index_tests" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "ptr_meta_derive", + "cfg-if", ] [[package]] -name = "ptr_meta_derive" -version = "0.1.4" +name = "encoding_rs_io" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +checksum = "1cc3c5651fb62ab8aa3103998dade57efdd028544bd300516baa31840c252a83" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "encoding_rs", ] [[package]] -name = "pulldown-cmark" -version = "0.10.0" +name = "env_logger" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce76ce678ffc8e5675b22aa1405de0b7037e2fdf8913fea40d1926c6fe1e6e7" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ - "bitflags 2.4.2", - "getopts", - "memchr", - "pulldown-cmark-escape", - "unicase", + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", ] [[package]] -name = "pulldown-cmark-escape" -version = "0.10.0" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d8f9aa0e3cbcfaf8bf00300004ee3b72f74770f9cbac93f6928771f613276b" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "quick-xml" -version = "0.31.0" +name = "errno" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "memchr", - "serde", + "libc", + "windows-sys 0.52.0", ] [[package]] -name = "quote" -version = "1.0.35" +name = "fastdivide" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] +checksum = "25c7df09945d65ea8d70b3321547ed414bbc540aad5bac6883d021b970f35b04" [[package]] -name = "radium" -version = "0.7.0" +name = "fastrand" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] -name = "rand" -version = "0.8.5" +name = "filetime" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ + "cfg-if", "libc", - "rand_chacha", - "rand_core", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "finl_unicode" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" [[package]] -name = "rand_core" -version = "0.6.4" +name = "flate2" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ - "getrandom", + "crc32fast", + "miniz_oxide", ] [[package]] -name = "rayon" -version = "1.8.1" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" -dependencies = [ - "either", - "rayon-core", -] +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "rayon-core" -version = "1.12.1" +name = "form_urlencoded" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "crossbeam-deque", - "crossbeam-utils", + "percent-encoding", ] [[package]] -name = "redox_syscall" -version = "0.4.1" +name = "fs4" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" dependencies = [ - "bitflags 1.3.2", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "fst" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generator" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "h2" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.7", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.8", + "allocator-api2", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "htmlescape" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" + +[[package]] +name = "http" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "irg-kvariants" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c73214298363629cf9dbfc93b426808865ee3c121029778cb31b1284104fdf78" +dependencies = [ + "csv", + "once_cell", + "serde", +] + +[[package]] +name = "is-terminal" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "jieba-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f0c1347cd3ac8d7c6e3a2dc33ac496d365cf09fc0831aa61111e1a6738983e" +dependencies = [ + "cedarwood", + "fxhash", + "hashbrown 0.14.3", + "lazy_static", + "phf", + "phf_codegen", + "regex", +] + +[[package]] +name = "jobserver" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "language-tags" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "levenshtein_automata" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2cdeb66e45e9f36bfad5bbdb4d2384e70936afbee843c6f6543f0c551ebb25" + +[[package]] +name = "libc" +version = "0.2.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" + +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.2", + "libc", + "redox_syscall", +] + +[[package]] +name = "lindera-cc-cedict-builder" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a90d23f7cef31c6ab7ac0d4f3b23940754207f7b5a80b080c39193caffe99ac2" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "csv", + "encoding", + "env_logger", + "glob", + "lindera-core", + "lindera-decompress", + "log", + "yada", +] + +[[package]] +name = "lindera-compress" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1927b7d2bd4ffc19e07691bf8609722663c341f80260a1c636cee8f1ec420dce" +dependencies = [ + "anyhow", + "flate2", + "lindera-decompress", +] + +[[package]] +name = "lindera-core" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3299caa2b81c9a076535a4651a83bf7d624c15f2349f243187fffc64b5a78251" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "encoding_rs", + "log", + "once_cell", + "serde", + "thiserror", + "yada", +] + +[[package]] +name = "lindera-decompress" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b82b8d2323a67dc8ff0c40751d199b7ba94cd5e3c13a5b31622d318acc79e5b" +dependencies = [ + "anyhow", + "flate2", + "serde", +] + +[[package]] +name = "lindera-dictionary" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cddf783b459d54b130d956889bec052c25fcb478a304e03fa9b2289387572bc5" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "lindera-cc-cedict-builder", + "lindera-core", + "lindera-ipadic-builder", + "lindera-ipadic-neologd-builder", + "lindera-ko-dic", + "lindera-ko-dic-builder", + "lindera-unidic", + "lindera-unidic-builder", + "serde", +] + +[[package]] +name = "lindera-ipadic-builder" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27c708f08f14b0806f6c4cce5324b4bcba27209463026b78c31f399f8be9d30d" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "csv", + "encoding_rs", + "encoding_rs_io", + "env_logger", + "glob", + "lindera-core", + "lindera-decompress", + "log", + "serde", + "yada", +] + +[[package]] +name = "lindera-ipadic-neologd-builder" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e67eb91652203d202f7d27ead220d1d8c9099552709b8429eae9c70f2312fb" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "csv", + "encoding_rs", + "encoding_rs_io", + "env_logger", + "glob", + "lindera-core", + "lindera-decompress", + "log", + "serde", + "yada", +] + +[[package]] +name = "lindera-ko-dic" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d45da8d9a5888f4d4e78bb29fc82ff9ae519962efb0d2d92343b6cf8e373952f" +dependencies = [ + "bincode", + "byteorder", + "encoding", + "flate2", + "lindera-core", + "lindera-decompress", + "lindera-ko-dic-builder", + "once_cell", + "tar", +] + +[[package]] +name = "lindera-ko-dic-builder" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41c0933295dc945178bbc08f34111dc3ef22bfee38820f78453c8f8d4f3463d1" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "csv", + "encoding", + "env_logger", + "glob", + "lindera-compress", + "lindera-core", + "lindera-decompress", + "log", + "yada", +] + +[[package]] +name = "lindera-tokenizer" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "348ce9bb3f2e5edc577420b98cca05b2177f3af50ef5ae278a1d8a1351d56197" +dependencies = [ + "bincode", + "byteorder", + "lindera-core", + "lindera-dictionary", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "lindera-unidic" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74022a57c395ed7e213a9cd5833207e3c583145078ee9a164aeaec68b30c9d8e" +dependencies = [ + "bincode", + "byteorder", + "encoding", + "lindera-core", + "lindera-decompress", + "lindera-unidic-builder", + "once_cell", + "ureq", + "zip", +] + +[[package]] +name = "lindera-unidic-builder" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34e5564ee81af82603cd6a03c3abe6e17cc0ae598bfa5078809f06e59e96e08" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "csv", + "encoding", + "env_logger", + "glob", + "lindera-compress", + "lindera-core", + "lindera-decompress", + "log", + "yada", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + +[[package]] +name = "litemap" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d642685b028806386b2b6e75685faadd3eb65a85fff7df711ce18446a422da" + +[[package]] +name = "local-channel" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" +dependencies = [ + "futures-core", + "futures-sink", + "local-waker", +] + +[[package]] +name = "local-waker" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "loom" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" +dependencies = [ + "cfg-if", + "generator", + "pin-utils", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "lru" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" +dependencies = [ + "hashbrown 0.14.3", +] + +[[package]] +name = "lz4_flex" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "912b45c753ff5f7f5208307e8ace7d2a2e30d024e26d3509f3dce546c044ce15" +dependencies = [ + "twox-hash", +] + +[[package]] +name = "macros" +version = "0.1.0" +dependencies = [ + "quote", + "syn 2.0.48", +] + +[[package]] +name = "map-macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb950a42259642e5a3483115aca87eebed2a64886993463af9c9739c205b8d3a" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "measure_time" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56220900f1a0923789ecd6bf25fbae8af3b2f1ff3e9e297fc9b6b8674dd4d852" +dependencies = [ + "instant", + "log", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "memmap2" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" +dependencies = [ + "libc", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "murmurhash32" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9380db4c04d219ac5c51d14996bbf2c2e9a15229771b53f8671eb6c83cf44df" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "odict" +version = "0.1.0" +dependencies = [ + "actix-web", + "byteorder", + "charabia", + "dirs", + "lz4_flex", + "macros", + "map-macro", + "once_cell", + "pulldown-cmark", + "quick-xml", + "rayon", + "regex", + "rkyv", + "serde", + "serde_json", + "tantivy", + "uuid", + "validation", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "oneshot" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f6640c6bda7731b1fdbab747981a0f896dd1fedaf9f4a53fa237a04a84431f4" +dependencies = [ + "loom", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "ownedbytes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e8a72b918ae8198abb3a18c190288123e1d442b6b9a7d709305fd194688b4b7" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", + "hmac", + "password-hash", + "sha2", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pinyin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f2611cd06a1ac239a0cea4521de9eb068a6ca110324ee00631aa68daa74fc0" + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "pulldown-cmark" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce76ce678ffc8e5675b22aa1405de0b7037e2fdf8913fea40d1926c6fe1e6e7" +dependencies = [ + "bitflags 2.4.2", + "getopts", + "memchr", + "pulldown-cmark-escape", + "unicase", +] + +[[package]] +name = "pulldown-cmark-escape" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5d8f9aa0e3cbcfaf8bf00300004ee3b72f74770f9cbac93f6928771f613276b" + +[[package]] +name = "quick-xml" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rayon" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", ] [[package]] @@ -599,8 +2125,17 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.5", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", ] [[package]] @@ -611,9 +2146,15 @@ checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.2", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.8.2" @@ -629,6 +2170,20 @@ dependencies = [ "bytecheck", ] +[[package]] +name = "ring" +version = "0.17.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.48.0", +] + [[package]] name = "rkyv" version = "0.7.43" @@ -638,7 +2193,7 @@ dependencies = [ "bitvec", "bytecheck", "bytes", - "hashbrown", + "hashbrown 0.12.3", "ptr_meta", "rend", "rkyv_derive", @@ -648,14 +2203,45 @@ dependencies = [ ] [[package]] -name = "rkyv_derive" -version = "0.7.43" +name = "rkyv_derive" +version = "0.7.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rust-stemmers" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "semver", ] [[package]] @@ -671,6 +2257,43 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048a63e5b3ac996d78d402940b5fa47973d2d080c6c6fffa1d0f19c4445310b7" + +[[package]] +name = "rustls-webpki" +version = "0.102.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.16" @@ -678,13 +2301,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] -name = "same-file" -version = "1.0.6" +name = "scoped-tls" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "seahash" @@ -692,6 +2318,12 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" +[[package]] +name = "semver" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" + [[package]] name = "serde" version = "1.0.196" @@ -723,12 +2355,122 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + [[package]] name = "simdutf8" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "sketches-ddsketch" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85636c14b73d81f541e525f585c0a2109e6744e1565b5c1668e31c70c10ed65c" +dependencies = [ + "serde", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -741,6 +2483,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "1.0.109" @@ -753,49 +2501,319 @@ dependencies = [ ] [[package]] -name = "syn" -version = "2.0.48" +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tantivy" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6083cd777fa94271b8ce0fe4533772cb8110c3044bab048d20f70108329a1f2" +dependencies = [ + "aho-corasick", + "arc-swap", + "async-trait", + "base64", + "bitpacking", + "byteorder", + "census", + "crc32fast", + "crossbeam-channel", + "downcast-rs", + "fastdivide", + "fs4", + "htmlescape", + "itertools", + "levenshtein_automata", + "log", + "lru", + "lz4_flex", + "measure_time", + "memmap2", + "murmurhash32", + "num_cpus", + "once_cell", + "oneshot", + "rayon", + "regex", + "rust-stemmers", + "rustc-hash", + "serde", + "serde_json", + "sketches-ddsketch", + "smallvec", + "tantivy-bitpacker", + "tantivy-columnar", + "tantivy-common", + "tantivy-fst", + "tantivy-query-grammar", + "tantivy-stacker", + "tantivy-tokenizer-api", + "tempfile", + "thiserror", + "time", + "uuid", + "winapi", +] + +[[package]] +name = "tantivy-bitpacker" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecb164321482301f514dd582264fa67f70da2d7eb01872ccd71e35e0d96655a" +dependencies = [ + "bitpacking", +] + +[[package]] +name = "tantivy-columnar" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d85f8019af9a78b3118c11298b36ffd21c2314bd76bbcd9d12e00124cbb7e70" +dependencies = [ + "fastdivide", + "fnv", + "itertools", + "serde", + "tantivy-bitpacker", + "tantivy-common", + "tantivy-sstable", + "tantivy-stacker", +] + +[[package]] +name = "tantivy-common" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af4a3a975e604a2aba6b1106a04505e1e7a025e6def477fab6e410b4126471e1" +dependencies = [ + "async-trait", + "byteorder", + "ownedbytes", + "serde", + "time", +] + +[[package]] +name = "tantivy-fst" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc3c506b1a8443a3a65352df6382a1fb6a7afe1a02e871cee0d25e2c3d5f3944" +dependencies = [ + "byteorder", + "regex-syntax 0.6.29", + "utf8-ranges", +] + +[[package]] +name = "tantivy-query-grammar" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d39c5a03100ac10c96e0c8b07538e2ab8b17da56434ab348309b31f23fada77" +dependencies = [ + "nom", +] + +[[package]] +name = "tantivy-sstable" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0c1bb43e5e8b8e05eb8009610344dbf285f06066c844032fbb3e546b3c71df" +dependencies = [ + "tantivy-common", + "tantivy-fst", + "zstd 0.12.4", +] + +[[package]] +name = "tantivy-stacker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2c078595413f13f218cf6f97b23dcfd48936838f1d3d13a1016e05acd64ed6c" +dependencies = [ + "murmurhash32", + "tantivy-common", +] + +[[package]] +name = "tantivy-tokenizer-api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "347b6fb212b26d3505d224f438e3c4b827ab8bd847fe9953ad5ac6b8f9443b66" +dependencies = [ + "serde", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tar" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "tempfile" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "tinyvec_macros", ] [[package]] -name = "tap" -version = "1.0.1" +name = "tinyvec_macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] -name = "tempfile" -version = "3.9.0" +name = "tokio" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.52.0", + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "windows-sys 0.48.0", ] [[package]] -name = "thiserror" -version = "1.0.56" +name = "tokio-util" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "thiserror-impl", + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] -name = "thiserror-impl" -version = "1.0.56" +name = "tracing" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -803,19 +2821,43 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.6.0" +name = "tracing-core" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ - "tinyvec_macros", + "once_cell", + "valuable", ] [[package]] -name = "tinyvec_macros" -version = "0.1.1" +name = "tracing-log" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] [[package]] name = "twox-hash" @@ -827,6 +2869,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + [[package]] name = "unicase" version = "2.7.0" @@ -836,18 +2884,72 @@ dependencies = [ "version_check", ] +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-width" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "2.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11f214ce18d8b2cbe84ed3aa6486ed3f5b285cf8d8fbdbce9f3f767a724adc35" +dependencies = [ + "base64", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "rustls-webpki", + "url", + "webpki-roots", +] + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8-ranges" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba" + [[package]] name = "utf8parse" version = "0.2.1" @@ -862,6 +2964,7 @@ checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom", "rand", + "serde", "uuid-macro-internal", ] @@ -882,6 +2985,12 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fb8044f0b8a3e94bc8cd089c6a2e42e435553093800b76762418d4bbc3289cc" +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "version_check" version = "0.9.4" @@ -889,20 +2998,93 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "walkdir" -version = "2.4.0" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ - "same-file", - "winapi-util", + "cfg-if", + "wasm-bindgen-macro", ] [[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +name = "wasm-bindgen-backend" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" + +[[package]] +name = "web-sys" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "whatlang" +version = "0.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "471d1c1645d361eb782a1650b1786a8fb58dd625e681a04c09f5ff7c8764a7b0" +dependencies = [ + "hashbrown 0.14.3", + "once_cell", +] [[package]] name = "winapi" @@ -936,18 +3118,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-sys" -version = "0.42.0" +name = "windows" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets 0.48.5", ] [[package]] @@ -998,12 +3174,6 @@ dependencies = [ "windows_x86_64_msvc 0.52.0", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -1016,12 +3186,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -1034,12 +3198,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -1052,12 +3210,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -1070,12 +3222,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -1088,12 +3234,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -1106,12 +3246,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -1132,3 +3266,147 @@ checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] + +[[package]] +name = "xattr" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +dependencies = [ + "libc", + "linux-raw-sys", + "rustix", +] + +[[package]] +name = "yada" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d12cb7a57bbf2ab670ed9545bae3648048547f9039279a89ce000208e585c1" + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "zerofrom" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655b0814c5c0b19ade497851070c640773304939a6c0fd5f5fb43da0696d05b7" + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" + +[[package]] +name = "zerovec" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff4439ae91fb5c72b8abc12f3f2dbf51bd27e6eadb9f8a5bc8898dddb0e27ea" +dependencies = [ + "zerofrom", +] + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "aes", + "byteorder", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac", + "pbkdf2", + "sha1", + "time", + "zstd 0.11.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe 5.0.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +dependencies = [ + "zstd-safe 6.0.6", +] + +[[package]] +name = "zstd" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" +dependencies = [ + "zstd-safe 7.0.0", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-safe" +version = "6.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-safe" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.9+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index 638fc317..bb2867ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ resolver = "2" -members = ["cli", "lib"] +members = ["cli", "lib", "macros"] [profile.release] strip = true diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 8b9a5da4..6321f982 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -2,14 +2,10 @@ name = "cli" version = "2.0.0" edition = "2021" +publish = false [dependencies] -odict = { path = "../lib", features = ["config"] } +odict = { path = "../lib", features = ["config", "search", "serve", "dump"] } clap = { version = "4.4.18", features = ["derive", "cargo"] } console = "0.15.8" -serde = "1.0.196" -serde_json = "1.0.112" -clio = "0.3.5" -quick-xml = { version = "0.31.0", features = ["serde", "serialize"] } -regex = "1.10.3" once_cell = "1.19.0" diff --git a/cli/src/print.rs b/cli/src/print.rs index e1c1a665..31f84c84 100644 --- a/cli/src/print.rs +++ b/cli/src/print.rs @@ -1,12 +1,11 @@ use std::error::Error; -use odict::Entry; -use serde_json::to_string_pretty; +use odict::{dump::to_json, Entry}; use crate::{enums::PrintFormat, CLIContext}; fn print_as_json(ctx: &mut CLIContext, entries: &Vec>) -> Result<(), Box> { - ctx.println(to_string_pretty(entries)?); + ctx.println(to_json(entries)?); Ok(()) } diff --git a/justfile b/justfile index 927115db..8e4c56b0 100644 --- a/justfile +++ b/justfile @@ -6,7 +6,6 @@ GOLANG_CROSS_VERSION := "v1.21.3" @deps: asdf install > /dev/null - go install golang.org/x/tools/cmd/goimports@latest @build +args="": deps cargo build {{args}} @@ -21,8 +20,8 @@ GOLANG_CROSS_VERSION := "v1.21.3" @run +args="": cargo run {{args}} - -@test: + +@test: cargo test # deps xsd (go "test") (jvm "test") (python "test") (js "test") (wasm "test") clean @@ -31,11 +30,11 @@ GOLANG_CROSS_VERSION := "v1.21.3" # @publish +args="--auto-snapshot --clean": # goreleaser release {{args}} -@snaps: +@snaps: UPDATE_SNAPS=true just go test - + @sync: - go work sync + go work sync # ------------------------------------------------------------------------------ # # Platforms # diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 018a9500..504c9d14 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -4,28 +4,35 @@ version = "0.1.0" edition = "2021" [features] +dump = ["dep:serde_json"] config = ["dep:dirs"] +search = ["dep:tantivy", "dep:charabia"] +serve = ["dep:actix-web"] [dependencies] +macros = { path = "../macros" } lz4_flex = { version = "0.11.2", default-features = false, features = [ - "frame", + "frame", ] } byteorder = "1.5.0" quick-xml = { version = "0.31.0", features = ["serialize"] } rayon = "1.8.1" regex = "1.10.3" rkyv = { version = "0.7.43", features = [ - "size_32", - "strict", - "alloc", - "archive_le", + "size_32", + "strict", + "alloc", + "archive_le", ] } serde = { version = "1.0.196", features = ["serde_derive"] } -serde_json = "1.0.113" +serde_json = { version = "1.0.113", optional = true } validation = "0.0.1" uuid = { version = "1.7.0", features = ["v4", "fast-rng", "macro-diagnostics"] } pulldown-cmark = "0.10.0" dirs = { version = "5.0.1", optional = true } +actix-web = { version = "4.5.1", optional = true } +tantivy = { version = "0.21.1", optional = true } +charabia = { version = "0.8.7", optional = true } [dev-dependencies] map-macro = "0.3.0" diff --git a/lib/src/core/lookup.rs b/lib/src/core/lookup.rs index f97e6b37..06dffd3b 100644 --- a/lib/src/core/lookup.rs +++ b/lib/src/core/lookup.rs @@ -69,7 +69,7 @@ fn parse_query(query: &str) -> LookupQuery { fn get_regex() -> &'static Regex { static R: OnceLock = OnceLock::new(); - return R.get_or_init(|| Regex::new(r"\((.+)\)$").unwrap()); + R.get_or_init(|| Regex::new(r"\((.+)\)$").unwrap()) } /* -------------------------------------------------------------------------- */ diff --git a/lib/src/core/merge.rs b/lib/src/core/merge.rs index 33cd9d3d..5770e11b 100644 --- a/lib/src/core/merge.rs +++ b/lib/src/core/merge.rs @@ -1,7 +1,7 @@ use crate::Dictionary; impl Dictionary { - pub fn merge_multi(&mut self, dictionaries: &[&Dictionary]) { + pub fn merge_multi(&mut self, dictionaries: Vec<&Dictionary>) { for src in dictionaries { self.merge(src); } diff --git a/lib/src/dump/json.rs b/lib/src/dump/json.rs new file mode 100644 index 00000000..78219c06 --- /dev/null +++ b/lib/src/dump/json.rs @@ -0,0 +1,198 @@ +use std::{error::Error, io::Write}; + +use serde::{Serialize, Serializer}; +use serde_json::{ + ser::{CompactFormatter, Formatter, PrettyFormatter}, + to_string_pretty, +}; + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] +struct JSONSerializer(T); + +impl JSONSerializer +where + S: Serializer, +{ + pub fn new(serializer: S) -> Self { + JSONSerializer(serializer) + } +} + +macro_rules! forward_method { + ($name: ident (self $(, $arg: ident : $arg_type: ty)* ) -> $return_type: ty) => { + fn $name (self $(, $arg : $arg_type)* ) -> $return_type { + (self.0).$name( $($arg),* ) + } + }; +} + +macro_rules! forward_serialize_methods { + ( $( $name: ident $arg_type: ty),* ) => { + $( + forward_method!($name(self, v: $arg_type) -> Result); + )* + }; +} + +impl Serializer for JSONSerializer +where + S: Serializer, +{ + type Ok = S::Ok; + type Error = S::Error; + type SerializeSeq = S::SerializeSeq; + type SerializeTuple = S::SerializeTuple; + type SerializeTupleStruct = S::SerializeTupleStruct; + type SerializeTupleVariant = S::SerializeTupleVariant; + type SerializeMap = S::SerializeMap; + type SerializeStruct = S::SerializeStruct; + type SerializeStructVariant = S::SerializeStructVariant; + + forward_serialize_methods! { + serialize_bool bool, + serialize_i8 i8, + serialize_i16 i16, + serialize_i32 i32, + serialize_i64 i64, + serialize_u8 u8, + serialize_u16 u16, + serialize_u32 u32, + serialize_u64 u64, + serialize_f32 f32, + serialize_f64 f64, + serialize_char char, + serialize_str &str, + serialize_bytes &[u8], + serialize_unit_struct &'static str + } + + fn serialize_none(self) -> Result { + todo!() + } + + fn serialize_some(self, value: &T) -> Result + where + T: serde::Serialize, + { + todo!() + } + + fn serialize_unit(self) -> Result { + self.0.serialize_unit() + } + + fn serialize_unit_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + ) -> Result { + self.0.serialize_unit_variant(name, variant_index, variant) + } + + fn serialize_newtype_struct( + self, + name: &'static str, + value: &T, + ) -> Result + where + T: serde::Serialize, + { + self.0.serialize_newtype_struct(name, value) + } + + fn serialize_newtype_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + value: &T, + ) -> Result + where + T: serde::Serialize, + { + self.0 + .serialize_newtype_variant(name, variant_index, variant, value) + } + + fn serialize_tuple_struct( + self, + name: &'static str, + len: usize, + ) -> Result { + self.0.serialize_tuple_struct(name, len) + } + + fn serialize_tuple_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + len: usize, + ) -> Result { + self.0 + .serialize_tuple_variant(name, variant_index, variant, len) + } + + fn serialize_struct( + self, + name: &'static str, + len: usize, + ) -> Result { + self.0.serialize_struct(name, len) + } + + fn serialize_struct_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + len: usize, + ) -> Result { + self.0 + .serialize_struct_variant(name, variant_index, variant, len) + } + + fn serialize_seq(self, len: Option) -> Result { + self.0.serialize_seq(len) + } + + fn serialize_tuple(self, len: usize) -> Result { + self.0.serialize_tuple(len) + } + + fn serialize_map(self, len: Option) -> Result { + self.0.serialize_map(len) + } +} + +fn stringify(value: &V, pretty: bool) -> Result> +where + V: ?Sized + Serialize, +{ + let mut writer = Vec::with_capacity(128); + + if pretty { + // value.serialize(JSONSerializer::pretty(writer))?; + } else { + let mut ser = serde_json::Serializer::new(&mut writer); + value.serialize(JSONSerializer::new(&mut ser))?; + } + + let string = unsafe { String::from_utf8_unchecked(writer) }; + + Ok(string) +} + +pub fn to_json(value: S) -> Result> +where + S: Serialize, +{ + stringify(&value, false) +} + +// pub fn to_json_pretty(value: S) -> Result> { +// let mut writer = Vec::with_capacity(128); +// let string = stringify(value, &JSONSerializer::pretty(writer))?; +// Ok(string) +// } diff --git a/lib/src/dump/mod.rs b/lib/src/dump/mod.rs new file mode 100644 index 00000000..041b31ae --- /dev/null +++ b/lib/src/dump/mod.rs @@ -0,0 +1,3 @@ +mod json; + +pub use self::json::*; diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 5b242534..04788041 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -1,6 +1,9 @@ #[cfg(feature = "config")] pub mod config; +#[cfg(feature = "dump")] +pub mod dump; + mod core; mod ext; mod lz4; diff --git a/lib/src/models/dictionary.rs b/lib/src/models/dictionary.rs index b4443c32..62e7687f 100644 --- a/lib/src/models/dictionary.rs +++ b/lib/src/models/dictionary.rs @@ -2,19 +2,20 @@ use quick_xml::de::from_str; use rkyv::to_bytes; use std::{collections::HashMap, error::Error}; +use crate::{serializable, serializable_custom}; + use super::{entry::Entry, id::ID}; -use crate::serializable; serializable! { pub struct Dictionary { - #[serde(default, rename = "@id", )] - pub id: ID, + #[serde(default, rename = "@id")] + pub id: ID, #[serde(rename = "@name")] - pub name: Option, + pub name: Option, #[serde(default, rename = "entry", with = "entries")] - pub entries: HashMap, + pub entries: HashMap, } } diff --git a/macros/Cargo.toml b/macros/Cargo.toml new file mode 100644 index 00000000..cc555cdc --- /dev/null +++ b/macros/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "macros" +version = "0.1.0" +edition = "2021" +publish = false + +[lib] +proc-macro = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +quote = "1.0.35" +syn = { version = "2.0.48", features = ["full", "extra-traits"] } diff --git a/macros/src/lib.rs b/macros/src/lib.rs new file mode 100644 index 00000000..a24a9b4d --- /dev/null +++ b/macros/src/lib.rs @@ -0,0 +1,23 @@ +use std::fmt::Debug; + +use proc_macro::TokenStream; +use quote::quote; +use syn::{parse_macro_input, DeriveInput}; + +#[proc_macro_derive(Serialize, attributes(serde))] +pub fn impl_serialize(tokens: TokenStream) -> TokenStream { + // let DeriveInput { ident, .. } = parse_macro_input!(tokens); + let output = format!("{} #[derive(Debug)]", tokens); + // let output = quote! { + // impl serde::Serialize for #ident { + // fn serialize(&self, serializer: S) -> Result + // where + // S: serde::Serializer, + // { + // todo!() + // } + // } + // }; + + output.parse().unwrap() +} From ada87faa6b40989e4e765b64fd12f498b035e392 Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Sun, 18 Feb 2024 00:37:34 +0900 Subject: [PATCH 011/393] wip --- lib/src/models/dictionary.rs | 2 +- macros/Cargo.toml | 14 -------------- macros/src/lib.rs | 23 ----------------------- 3 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 macros/Cargo.toml delete mode 100644 macros/src/lib.rs diff --git a/lib/src/models/dictionary.rs b/lib/src/models/dictionary.rs index 62e7687f..1f7895b5 100644 --- a/lib/src/models/dictionary.rs +++ b/lib/src/models/dictionary.rs @@ -2,7 +2,7 @@ use quick_xml::de::from_str; use rkyv::to_bytes; use std::{collections::HashMap, error::Error}; -use crate::{serializable, serializable_custom}; +use crate::{serializable}; use super::{entry::Entry, id::ID}; diff --git a/macros/Cargo.toml b/macros/Cargo.toml deleted file mode 100644 index cc555cdc..00000000 --- a/macros/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "macros" -version = "0.1.0" -edition = "2021" -publish = false - -[lib] -proc-macro = true - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -quote = "1.0.35" -syn = { version = "2.0.48", features = ["full", "extra-traits"] } diff --git a/macros/src/lib.rs b/macros/src/lib.rs deleted file mode 100644 index a24a9b4d..00000000 --- a/macros/src/lib.rs +++ /dev/null @@ -1,23 +0,0 @@ -use std::fmt::Debug; - -use proc_macro::TokenStream; -use quote::quote; -use syn::{parse_macro_input, DeriveInput}; - -#[proc_macro_derive(Serialize, attributes(serde))] -pub fn impl_serialize(tokens: TokenStream) -> TokenStream { - // let DeriveInput { ident, .. } = parse_macro_input!(tokens); - let output = format!("{} #[derive(Debug)]", tokens); - // let output = quote! { - // impl serde::Serialize for #ident { - // fn serialize(&self, serializer: S) -> Result - // where - // S: serde::Serializer, - // { - // todo!() - // } - // } - // }; - - output.parse().unwrap() -} From 5e29764048767752c56178df5e1ac1e9160894d0 Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Sat, 24 Feb 2024 18:10:32 -0800 Subject: [PATCH 012/393] feat(v2): implement basic dumping (#654) --- Cargo.lock | 44 +++- Cargo.toml | 7 +- cli/src/cli.rs | 14 +- cli/src/compile.rs | 2 +- cli/src/dump.rs | 47 ++++ cli/src/enums.rs | 21 ++ cli/src/lib.rs | 2 + cli/src/lookup.rs | 2 +- cli/src/main.rs | 1 + cli/src/print.rs | 29 ++- justfile | 9 +- lib/Cargo.toml | 12 +- lib/src/dump/json.rs | 215 +++------------- lib/src/dump/mod.rs | 2 + lib/src/dump/xml.rs | 34 +++ lib/src/json/definition.rs | 37 +++ lib/src/json/dictionary.rs | 36 +++ lib/src/json/entry.rs | 35 +++ lib/src/json/etymology.rs | 46 ++++ lib/src/json/group.rs | 36 +++ lib/src/json/mod.rs | 17 ++ lib/src/json/note.rs | 30 +++ lib/src/json/sense.rs | 48 ++++ lib/src/json/utils.rs | 14 + lib/src/lib.rs | 3 + lib/src/models/definition.rs | 1 + lib/src/models/dictionary.rs | 4 +- lib/src/models/entry.rs | 5 +- lib/src/models/etymology.rs | 3 + lib/src/models/example.rs | 2 +- lib/src/models/group.rs | 8 +- lib/src/models/id.rs | 6 +- lib/src/models/note.rs | 12 +- lib/src/models/pos.rs | 2 +- lib/src/models/serializable.rs | 18 ++ lib/src/search/index.rs | 21 ++ lib/src/search/mod.rs | 5 + lib/tests/dump.rs | 37 +++ lib/tests/merge.rs | 241 +++++++++--------- .../snapshots/dump__dump_tests__json.snap | 145 +++++++++++ 40 files changed, 909 insertions(+), 344 deletions(-) create mode 100644 cli/src/dump.rs create mode 100644 lib/src/dump/xml.rs create mode 100644 lib/src/json/definition.rs create mode 100644 lib/src/json/dictionary.rs create mode 100644 lib/src/json/entry.rs create mode 100644 lib/src/json/etymology.rs create mode 100644 lib/src/json/group.rs create mode 100644 lib/src/json/mod.rs create mode 100644 lib/src/json/note.rs create mode 100644 lib/src/json/sense.rs create mode 100644 lib/src/json/utils.rs create mode 100644 lib/src/search/index.rs create mode 100644 lib/src/search/mod.rs create mode 100644 lib/tests/dump.rs create mode 100644 lib/tests/snapshots/dump__dump_tests__json.snap diff --git a/Cargo.lock b/Cargo.lock index 4f3c1a52..8350b2aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1247,6 +1247,19 @@ dependencies = [ "generic-array", ] +[[package]] +name = "insta" +version = "1.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c985c1bef99cf13c58fade470483d81a2bfe846ebde60ed28cc2dddec2df9e2" +dependencies = [ + "console", + "lazy_static", + "linked-hash-map", + "similar", + "yaml-rust", +] + [[package]] name = "instant" version = "0.1.12" @@ -1573,6 +1586,12 @@ dependencies = [ "yada", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -1650,14 +1669,6 @@ dependencies = [ "twox-hash", ] -[[package]] -name = "macros" -version = "0.1.0" -dependencies = [ - "quote", - "syn 2.0.48", -] - [[package]] name = "map-macro" version = "0.3.0" @@ -1790,8 +1801,8 @@ dependencies = [ "byteorder", "charabia", "dirs", + "insta", "lz4_flex", - "macros", "map-macro", "once_cell", "pulldown-cmark", @@ -2413,6 +2424,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +[[package]] +name = "similar" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21" + [[package]] name = "siphasher" version = "0.3.11" @@ -3284,6 +3301,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d12cb7a57bbf2ab670ed9545bae3648048547f9039279a89ce000208e585c1" +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "zerocopy" version = "0.7.32" diff --git a/Cargo.toml b/Cargo.toml index bb2867ae..81529498 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,9 +2,14 @@ resolver = "2" -members = ["cli", "lib", "macros"] +members = ["cli", "lib"] [profile.release] strip = true codegen-units = 1 lto = true +panic = "abort" + +[profile.dev.package] +insta.opt-level = 3 +similar.opt-level = 3 diff --git a/cli/src/cli.rs b/cli/src/cli.rs index dca8baad..9ddccdf0 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -1,7 +1,7 @@ use clap::{command, crate_version, Parser, Subcommand}; use crate::alias::AliasCommands; -use crate::{CompileArgs, LexiconArgs, LookupArgs, MergeArgs}; +use crate::{CompileArgs, DumpArgs, LexiconArgs, LookupArgs, MergeArgs}; #[derive(Debug, Parser)] #[command(name = "odict", about = "the lighting-fast open-source dictionary compiler", version = crate_version!(), long_about = None)] @@ -28,6 +28,14 @@ pub enum Commands { #[command(arg_required_else_help = true)] Compile(CompileArgs), + /// Outputs a dictionary in a human-readable format + #[command(arg_required_else_help = true)] + Dump(DumpArgs), + + /// Lists all words defined in a dictionary + #[command(arg_required_else_help = true)] + Lexicon(LexiconArgs), + /// Looks up an entry in a compiled dictionary without indexing #[command(arg_required_else_help = true)] Lookup(LookupArgs), @@ -35,8 +43,4 @@ pub enum Commands { /// Merge entries from multiple dictionaries into a destination dictionary #[command(arg_required_else_help = true)] Merge(MergeArgs), - - /// Lists all words defined in a dictionary - #[command(arg_required_else_help = true)] - Lexicon(LexiconArgs), } diff --git a/cli/src/compile.rs b/cli/src/compile.rs index bf15840c..75f7ae42 100644 --- a/cli/src/compile.rs +++ b/cli/src/compile.rs @@ -19,7 +19,7 @@ pub struct CompileArgs { pub fn compile(ctx: &CLIContext, args: &CompileArgs) -> Result<(), Box> { let CompileArgs { input, output } = args; - let mut out = output.clone(); + let mut out = output.to_owned(); if out.is_none() { let name = input diff --git a/cli/src/dump.rs b/cli/src/dump.rs new file mode 100644 index 00000000..062f8865 --- /dev/null +++ b/cli/src/dump.rs @@ -0,0 +1,47 @@ +use std::{error::Error, fs}; + +use clap::{arg, command, Args}; +use odict::dump::ToXML; + +use crate::{enums::DumpFormat, CLIContext}; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct DumpArgs { + #[arg(required = true, help = "Path to a compile dictionary")] + input: String, + + #[arg(default_value_t = DumpFormat::XML, short, help = "Format in which to dump the dictionary.")] + format: DumpFormat, + + #[arg(short, help = "Output path of the dump. Defaults to stdout.")] + output: Option, +} + +pub fn dump(ctx: &mut CLIContext, args: &DumpArgs) -> Result<(), Box> { + let DumpArgs { + input, + format, + output, + } = args; + + let dict = ctx + .reader + .read_from_path_or_alias_with_manager(input, &ctx.alias_manager)? + .to_dictionary()?; + + let contents = match format { + DumpFormat::XML => dict.to_xml(true)?, + DumpFormat::SQLite => todo!(), + DumpFormat::Postgres => todo!(), + DumpFormat::MySQL => todo!(), + }; + + match output { + Some(out) => fs::write(&out, &contents)?, + None => ctx.println(contents), + }; + + Ok(()) +} diff --git a/cli/src/enums.rs b/cli/src/enums.rs index 4828cd49..ad55e879 100644 --- a/cli/src/enums.rs +++ b/cli/src/enums.rs @@ -1,3 +1,5 @@ +use std::fmt::Display; + use clap::ValueEnum; #[derive(Debug, Clone, ValueEnum)] @@ -6,3 +8,22 @@ pub enum PrintFormat { JSON, XML, } + +#[derive(Debug, Clone, ValueEnum)] +pub enum DumpFormat { + XML, + SQLite, + Postgres, + MySQL, +} + +impl Display for DumpFormat { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + DumpFormat::XML => write!(f, "xml"), + DumpFormat::SQLite => write!(f, "sqlite"), + DumpFormat::Postgres => write!(f, "postgres"), + DumpFormat::MySQL => write!(f, "mysql"), + } + } +} diff --git a/cli/src/lib.rs b/cli/src/lib.rs index e8d530e2..2b30c825 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -2,6 +2,7 @@ mod alias; mod cli; mod compile; mod context; +mod dump; mod enums; mod lexicon; mod lookup; @@ -13,6 +14,7 @@ pub use alias::*; pub use cli::*; pub use compile::*; pub use context::*; +pub use dump::*; pub use lexicon::*; pub use lookup::*; pub use merge::*; diff --git a/cli/src/lookup.rs b/cli/src/lookup.rs index 48854667..726a6119 100644 --- a/cli/src/lookup.rs +++ b/cli/src/lookup.rs @@ -62,7 +62,7 @@ pub fn lookup(ctx: &mut CLIContext, args: &LookupArgs) -> Result<(), Box { - print_entries(ctx, &deserialize_nested_entries(entries), format)?; + print_entries(ctx, deserialize_nested_entries(entries), format)?; Ok(()) } Err(err) => { diff --git a/cli/src/main.rs b/cli/src/main.rs index c301f6f1..5dfe9666 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -12,6 +12,7 @@ fn main() { Commands::Merge(ref args) => merge(c, args), Commands::Lexicon(ref args) => lexicon(c, args), Commands::Alias(ref args) => alias(c, args), + Commands::Dump(ref args) => cli::dump(c, args), }, &mut ctx, ); diff --git a/cli/src/print.rs b/cli/src/print.rs index 31f84c84..010fa8c7 100644 --- a/cli/src/print.rs +++ b/cli/src/print.rs @@ -1,25 +1,38 @@ use std::error::Error; -use odict::{dump::to_json, Entry}; +use odict::{ + dump::{ToJSON, ToXML}, + Entry, +}; use crate::{enums::PrintFormat, CLIContext}; -fn print_as_json(ctx: &mut CLIContext, entries: &Vec>) -> Result<(), Box> { - ctx.println(to_json(entries)?); +fn print_json(ctx: &mut CLIContext, entries: Vec>) -> Result<(), Box> { + ctx.println(entries.to_json(true)?); + Ok(()) +} + +fn print_xml(ctx: &mut CLIContext, entries: Vec>) -> Result<(), Box> { + let xml: Vec = entries + .iter() + .flatten() + .map(|v| v.to_xml(true).unwrap()) + .collect(); + + ctx.println(xml.join("\n")); + Ok(()) } pub fn print_entries( ctx: &mut CLIContext, - entries: &Vec>, + entries: Vec>, format: &PrintFormat, ) -> Result<(), Box> { match format { PrintFormat::Print => {} - PrintFormat::JSON => { - print_as_json(ctx, entries)?; - } - PrintFormat::XML => todo!(), + PrintFormat::JSON => print_json(ctx, entries)?, + PrintFormat::XML => print_xml(ctx, entries)?, } Ok(()) } diff --git a/justfile b/justfile index 8e4c56b0..f3441bb6 100644 --- a/justfile +++ b/justfile @@ -15,6 +15,12 @@ GOLANG_CROSS_VERSION := "v1.21.3" @schema: (go "schema") (cli "schema") (js "schema") +@insta +args="": + cargo insta {{args}} + +@update-snaps: + cargo insta accept + @xsd: go run xsd/xsd.go @@ -30,9 +36,6 @@ GOLANG_CROSS_VERSION := "v1.21.3" # @publish +args="--auto-snapshot --clean": # goreleaser release {{args}} -@snaps: - UPDATE_SNAPS=true just go test - @sync: go work sync diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 504c9d14..3ab2c391 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -10,19 +10,18 @@ search = ["dep:tantivy", "dep:charabia"] serve = ["dep:actix-web"] [dependencies] -macros = { path = "../macros" } lz4_flex = { version = "0.11.2", default-features = false, features = [ - "frame", + "frame", ] } byteorder = "1.5.0" quick-xml = { version = "0.31.0", features = ["serialize"] } rayon = "1.8.1" regex = "1.10.3" rkyv = { version = "0.7.43", features = [ - "size_32", - "strict", - "alloc", - "archive_le", + "size_32", + "strict", + "alloc", + "archive_le", ] } serde = { version = "1.0.196", features = ["serde_derive"] } serde_json = { version = "1.0.113", optional = true } @@ -35,5 +34,6 @@ tantivy = { version = "0.21.1", optional = true } charabia = { version = "0.8.7", optional = true } [dev-dependencies] +insta = "1.35.1" map-macro = "0.3.0" once_cell = "1.19.0" diff --git a/lib/src/dump/json.rs b/lib/src/dump/json.rs index 78219c06..9c86a462 100644 --- a/lib/src/dump/json.rs +++ b/lib/src/dump/json.rs @@ -1,198 +1,59 @@ -use std::{error::Error, io::Write}; +use std::error::Error; -use serde::{Serialize, Serializer}; -use serde_json::{ - ser::{CompactFormatter, Formatter, PrettyFormatter}, - to_string_pretty, -}; +use serde::Serialize; +use serde_json::{to_string, to_string_pretty}; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] -struct JSONSerializer(T); +use crate::json::{DictionaryJSON, EntryJSON}; +use crate::{Dictionary, Entry}; -impl JSONSerializer +pub struct JSONSerializer {} + +pub fn stringify(value: &T, pretty: bool) -> Result> where - S: Serializer, + T: ?Sized + Serialize, { - pub fn new(serializer: S) -> Self { - JSONSerializer(serializer) + match pretty { + true => Ok(to_string_pretty(value)?), + false => Ok(to_string(value)?), } } -macro_rules! forward_method { - ($name: ident (self $(, $arg: ident : $arg_type: ty)* ) -> $return_type: ty) => { - fn $name (self $(, $arg : $arg_type)* ) -> $return_type { - (self.0).$name( $($arg),* ) - } - }; -} - -macro_rules! forward_serialize_methods { - ( $( $name: ident $arg_type: ty),* ) => { - $( - forward_method!($name(self, v: $arg_type) -> Result); - )* - }; +pub trait ToJSON { + fn to_json(self, pretty: bool) -> Result>; } -impl Serializer for JSONSerializer -where - S: Serializer, -{ - type Ok = S::Ok; - type Error = S::Error; - type SerializeSeq = S::SerializeSeq; - type SerializeTuple = S::SerializeTuple; - type SerializeTupleStruct = S::SerializeTupleStruct; - type SerializeTupleVariant = S::SerializeTupleVariant; - type SerializeMap = S::SerializeMap; - type SerializeStruct = S::SerializeStruct; - type SerializeStructVariant = S::SerializeStructVariant; - - forward_serialize_methods! { - serialize_bool bool, - serialize_i8 i8, - serialize_i16 i16, - serialize_i32 i32, - serialize_i64 i64, - serialize_u8 u8, - serialize_u16 u16, - serialize_u32 u32, - serialize_u64 u64, - serialize_f32 f32, - serialize_f64 f64, - serialize_char char, - serialize_str &str, - serialize_bytes &[u8], - serialize_unit_struct &'static str - } - - fn serialize_none(self) -> Result { - todo!() - } - - fn serialize_some(self, value: &T) -> Result - where - T: serde::Serialize, - { - todo!() - } - - fn serialize_unit(self) -> Result { - self.0.serialize_unit() - } - - fn serialize_unit_variant( - self, - name: &'static str, - variant_index: u32, - variant: &'static str, - ) -> Result { - self.0.serialize_unit_variant(name, variant_index, variant) - } - - fn serialize_newtype_struct( - self, - name: &'static str, - value: &T, - ) -> Result - where - T: serde::Serialize, - { - self.0.serialize_newtype_struct(name, value) - } - - fn serialize_newtype_variant( - self, - name: &'static str, - variant_index: u32, - variant: &'static str, - value: &T, - ) -> Result - where - T: serde::Serialize, - { - self.0 - .serialize_newtype_variant(name, variant_index, variant, value) - } - - fn serialize_tuple_struct( - self, - name: &'static str, - len: usize, - ) -> Result { - self.0.serialize_tuple_struct(name, len) - } - - fn serialize_tuple_variant( - self, - name: &'static str, - variant_index: u32, - variant: &'static str, - len: usize, - ) -> Result { - self.0 - .serialize_tuple_variant(name, variant_index, variant, len) - } - - fn serialize_struct( - self, - name: &'static str, - len: usize, - ) -> Result { - self.0.serialize_struct(name, len) - } - - fn serialize_struct_variant( - self, - name: &'static str, - variant_index: u32, - variant: &'static str, - len: usize, - ) -> Result { - self.0 - .serialize_struct_variant(name, variant_index, variant, len) +impl ToJSON for Dictionary { + fn to_json(self, pretty: bool) -> Result> { + let json = DictionaryJSON::from(self); + stringify(&json, pretty) } +} - fn serialize_seq(self, len: Option) -> Result { - self.0.serialize_seq(len) +impl ToJSON for Entry { + fn to_json(self, pretty: bool) -> Result> { + let json = EntryJSON::from(self); + stringify(&json, pretty) } +} - fn serialize_tuple(self, len: usize) -> Result { - self.0.serialize_tuple(len) - } +impl ToJSON for Vec { + fn to_json(self, pretty: bool) -> Result> { + let json = self + .into_iter() + .map(|v| EntryJSON::from(v)) + .collect::>(); - fn serialize_map(self, len: Option) -> Result { - self.0.serialize_map(len) + stringify(&json, pretty) } } -fn stringify(value: &V, pretty: bool) -> Result> -where - V: ?Sized + Serialize, -{ - let mut writer = Vec::with_capacity(128); +impl ToJSON for Vec> { + fn to_json(self, pretty: bool) -> Result> { + let json = self + .into_iter() + .map(|v| v.into_iter().map(|v| EntryJSON::from(v)).collect()) + .collect::>>(); - if pretty { - // value.serialize(JSONSerializer::pretty(writer))?; - } else { - let mut ser = serde_json::Serializer::new(&mut writer); - value.serialize(JSONSerializer::new(&mut ser))?; + stringify(&json, pretty) } - - let string = unsafe { String::from_utf8_unchecked(writer) }; - - Ok(string) } - -pub fn to_json(value: S) -> Result> -where - S: Serialize, -{ - stringify(&value, false) -} - -// pub fn to_json_pretty(value: S) -> Result> { -// let mut writer = Vec::with_capacity(128); -// let string = stringify(value, &JSONSerializer::pretty(writer))?; -// Ok(string) -// } diff --git a/lib/src/dump/mod.rs b/lib/src/dump/mod.rs index 041b31ae..5c37637c 100644 --- a/lib/src/dump/mod.rs +++ b/lib/src/dump/mod.rs @@ -1,3 +1,5 @@ mod json; +mod xml; pub use self::json::*; +pub use self::xml::*; diff --git a/lib/src/dump/xml.rs b/lib/src/dump/xml.rs new file mode 100644 index 00000000..47071f24 --- /dev/null +++ b/lib/src/dump/xml.rs @@ -0,0 +1,34 @@ +use std::error::Error; + +use quick_xml::se::{to_string, Serializer}; +use serde::Serialize; + +use crate::{Dictionary, Entry}; + +pub trait ToXML { + fn to_xml(self, pretty: bool) -> Result> + where + Self: Sized + Serialize, + { + match pretty { + true => { + // See https://github.com/tafia/quick-xml/issues/361#issuecomment-1509724435 + let mut buffer = String::new(); + let mut ser = Serializer::new(&mut buffer); + + ser.indent(' ', 2); + + self.serialize(ser)?; + + Ok(format!("{}", buffer)) + } + false => Ok(to_string(&self)?), + } + } +} + +impl ToXML for Dictionary {} + +impl ToXML for Entry {} + +impl ToXML for &Entry {} diff --git a/lib/src/json/definition.rs b/lib/src/json/definition.rs new file mode 100644 index 00000000..848125e8 --- /dev/null +++ b/lib/src/json/definition.rs @@ -0,0 +1,37 @@ +use serde::Serialize; + +use crate::{Definition, MDString}; + +use super::NoteJSON; + +#[derive(Serialize)] +pub struct DefinitionJSON { + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + pub value: MDString, + + #[serde(skip_serializing_if = "Vec::is_empty")] + pub examples: Vec, + + #[serde(skip_serializing_if = "Vec::is_empty")] + pub notes: Vec, +} + +impl From for DefinitionJSON { + fn from(definition: Definition) -> Self { + let Definition { + id, + value, + examples, + notes, + } = definition; + + Self { + id, + value, + examples: examples.into_iter().map(|e| e.value).collect(), + notes: notes.into_iter().map(|n| NoteJSON::from(n)).collect(), + } + } +} diff --git a/lib/src/json/dictionary.rs b/lib/src/json/dictionary.rs new file mode 100644 index 00000000..126c6c68 --- /dev/null +++ b/lib/src/json/dictionary.rs @@ -0,0 +1,36 @@ +use std::collections::HashMap; + +use serde::Serialize; + +use crate::{Dictionary, ID}; + +use super::{ordered_map, EntryJSON}; + +#[derive(Serialize)] +pub struct DictionaryJSON { + pub id: ID, + + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + + #[serde( + serialize_with = "ordered_map", + skip_serializing_if = "HashMap::is_empty" + )] + pub entries: HashMap, +} + +impl From for DictionaryJSON { + fn from(dictionary: Dictionary) -> Self { + let Dictionary { id, name, entries } = dictionary; + + Self { + id, + name, + entries: entries + .into_iter() + .map(|(k, v)| (k, EntryJSON::from(v))) + .collect(), + } + } +} diff --git a/lib/src/json/entry.rs b/lib/src/json/entry.rs new file mode 100644 index 00000000..19396a6d --- /dev/null +++ b/lib/src/json/entry.rs @@ -0,0 +1,35 @@ +use crate::Entry; + +use serde::Serialize; + +use super::EtymologyJSON; + +#[derive(Serialize)] +pub struct EntryJSON { + pub term: String, + + #[serde(skip_serializing_if = "Option::is_none")] + pub see_also: Option, + + #[serde(skip_serializing_if = "Vec::is_empty")] + pub etymologies: Vec, +} + +impl From for EntryJSON { + fn from(entry: Entry) -> Self { + let Entry { + term, + see_also, + etymologies, + } = entry; + + Self { + term, + see_also, + etymologies: etymologies + .into_iter() + .map(|e| EtymologyJSON::from(e)) + .collect(), + } + } +} diff --git a/lib/src/json/etymology.rs b/lib/src/json/etymology.rs new file mode 100644 index 00000000..41df599e --- /dev/null +++ b/lib/src/json/etymology.rs @@ -0,0 +1,46 @@ +use std::collections::HashMap; + +use serde::Serialize; + +use crate::{Etymology, MDString, PartOfSpeech}; + +use super::{ordered_map, SenseJSON}; + +#[derive(Serialize)] +pub struct EtymologyJSON { + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub pronunciation: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + + #[serde( + serialize_with = "ordered_map", + skip_serializing_if = "HashMap::is_empty" + )] + pub senses: HashMap, +} + +impl From for EtymologyJSON { + fn from(entry: Etymology) -> Self { + let Etymology { + id, + pronunciation, + description, + senses, + } = entry; + + Self { + id, + pronunciation, + description, + senses: senses + .into_iter() + .map(|(k, v)| (k, SenseJSON::from(v))) + .collect(), + } + } +} diff --git a/lib/src/json/group.rs b/lib/src/json/group.rs new file mode 100644 index 00000000..73918ae6 --- /dev/null +++ b/lib/src/json/group.rs @@ -0,0 +1,36 @@ +use serde::Serialize; + +use crate::{Group, MDString}; + +use super::DefinitionJSON; + +#[derive(Serialize)] +pub struct GroupJSON { + #[serde(skip_serializing_if = "Option::is_none")] + id: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + description: Option, + + #[serde(skip_serializing_if = "Vec::is_empty")] + definitions: Vec, +} + +impl From for GroupJSON { + fn from(group: Group) -> Self { + let Group { + id, + description, + definitions, + } = group; + + Self { + id, + description, + definitions: definitions + .into_iter() + .map(|d| DefinitionJSON::from(d)) + .collect(), + } + } +} diff --git a/lib/src/json/mod.rs b/lib/src/json/mod.rs new file mode 100644 index 00000000..d14b1652 --- /dev/null +++ b/lib/src/json/mod.rs @@ -0,0 +1,17 @@ +mod definition; +mod dictionary; +mod entry; +mod etymology; +mod group; +mod note; +mod sense; +mod utils; + +pub(super) use self::definition::*; +pub(super) use self::dictionary::*; +pub(super) use self::entry::*; +pub(super) use self::etymology::*; +pub(super) use self::group::*; +pub(super) use self::note::*; +pub(super) use self::sense::*; +pub(super) use self::utils::*; diff --git a/lib/src/json/note.rs b/lib/src/json/note.rs new file mode 100644 index 00000000..d68f1d4e --- /dev/null +++ b/lib/src/json/note.rs @@ -0,0 +1,30 @@ +use serde::Serialize; + +use crate::{MDString, Note}; + +#[derive(Serialize)] +pub struct NoteJSON { + #[serde(skip_serializing_if = "Option::is_none")] + id: Option, + + value: MDString, + + #[serde(skip_serializing_if = "Vec::is_empty")] + examples: Vec, +} + +impl From for NoteJSON { + fn from(note: Note) -> Self { + let Note { + id, + value, + examples, + } = note; + + Self { + id, + value, + examples: examples.into_iter().map(|e| e.value).collect(), + } + } +} diff --git a/lib/src/json/sense.rs b/lib/src/json/sense.rs new file mode 100644 index 00000000..9894c281 --- /dev/null +++ b/lib/src/json/sense.rs @@ -0,0 +1,48 @@ +use serde::Serialize; + +use crate::{DefinitionType, PartOfSpeech, Sense}; + +use super::{DefinitionJSON, GroupJSON}; + +#[derive(Serialize)] +#[serde(tag = "type")] +pub enum DefinitionTypeJSON { + #[serde(rename = "group")] + Group(GroupJSON), + + #[serde(rename = "definition")] + Definition(DefinitionJSON), +} + +impl From for DefinitionTypeJSON { + fn from(definition: DefinitionType) -> Self { + match definition { + DefinitionType::Group(g) => DefinitionTypeJSON::Group(GroupJSON::from(g)), + DefinitionType::Definition(d) => { + DefinitionTypeJSON::Definition(DefinitionJSON::from(d)) + } + } + } +} + +#[derive(Serialize)] +pub struct SenseJSON { + pub pos: PartOfSpeech, + + #[serde(skip_serializing_if = "Vec::is_empty")] + pub definitions: Vec, +} + +impl From for SenseJSON { + fn from(sense: Sense) -> Self { + let Sense { pos, definitions } = sense; + + Self { + pos, + definitions: definitions + .into_iter() + .map(|d| DefinitionTypeJSON::from(d)) + .collect(), + } + } +} diff --git a/lib/src/json/utils.rs b/lib/src/json/utils.rs new file mode 100644 index 00000000..c91b2568 --- /dev/null +++ b/lib/src/json/utils.rs @@ -0,0 +1,14 @@ +use std::collections::{BTreeMap, HashMap}; + +use serde::{Serialize, Serializer}; + +pub fn ordered_map( + value: &HashMap, + serializer: S, +) -> Result +where + S: Serializer, +{ + let ordered: BTreeMap<_, _> = value.iter().collect(); + ordered.serialize(serializer) +} diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 04788041..69dd943e 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -4,6 +4,9 @@ pub mod config; #[cfg(feature = "dump")] pub mod dump; +#[cfg(feature = "dump")] +pub(self) mod json; + mod core; mod ext; mod lz4; diff --git a/lib/src/models/definition.rs b/lib/src/models/definition.rs index 4ded2eb1..85e7c92a 100644 --- a/lib/src/models/definition.rs +++ b/lib/src/models/definition.rs @@ -5,6 +5,7 @@ use super::{example::Example, note::Note, MDString}; serializable! { pub struct Definition { #[serde(rename = "@id")] + #[serde(skip_serializing_if = "Option::is_none")] pub id: Option, #[serde(rename = "@value")] diff --git a/lib/src/models/dictionary.rs b/lib/src/models/dictionary.rs index 1f7895b5..1dbe122f 100644 --- a/lib/src/models/dictionary.rs +++ b/lib/src/models/dictionary.rs @@ -2,16 +2,18 @@ use quick_xml::de::from_str; use rkyv::to_bytes; use std::{collections::HashMap, error::Error}; -use crate::{serializable}; +use crate::serializable; use super::{entry::Entry, id::ID}; serializable! { + #[serde(rename = "dictionary")] pub struct Dictionary { #[serde(default, rename = "@id")] pub id: ID, #[serde(rename = "@name")] + #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, #[serde(default, rename = "entry", with = "entries")] diff --git a/lib/src/models/entry.rs b/lib/src/models/entry.rs index 6619f41d..4c1f98c3 100644 --- a/lib/src/models/entry.rs +++ b/lib/src/models/entry.rs @@ -2,9 +2,7 @@ use std::error::Error; use rkyv::{Deserialize, Infallible}; -use crate::serializable; - -use super::Etymology; +use crate::{serializable, Etymology}; serializable! { pub struct Entry { @@ -12,6 +10,7 @@ serializable! { pub term: String, #[serde(rename = "@see")] + #[serde(skip_serializing_if = "Option::is_none")] pub see_also: Option, #[serde(default, rename = "ety")] diff --git a/lib/src/models/etymology.rs b/lib/src/models/etymology.rs index 27de585e..2f65c8d9 100644 --- a/lib/src/models/etymology.rs +++ b/lib/src/models/etymology.rs @@ -7,12 +7,15 @@ use super::{pos::PartOfSpeech, sense::Sense, MDString}; serializable! { pub struct Etymology { #[serde(rename = "@id")] + #[serde(skip_serializing_if = "Option::is_none")] pub id: Option, #[serde(rename = "@pronunciation")] + #[serde(skip_serializing_if = "Option::is_none")] pub pronunciation: Option, #[serde(rename = "@description")] + #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "sense", with = "senses")] diff --git a/lib/src/models/example.rs b/lib/src/models/example.rs index e5098d88..9516b9ac 100644 --- a/lib/src/models/example.rs +++ b/lib/src/models/example.rs @@ -3,6 +3,6 @@ use crate::serializable; serializable! { pub struct Example { #[serde(rename = "$text")] - value: String, + pub value: String, } } diff --git a/lib/src/models/group.rs b/lib/src/models/group.rs index 89dbd0a5..9107de9f 100644 --- a/lib/src/models/group.rs +++ b/lib/src/models/group.rs @@ -5,12 +5,14 @@ use super::{definition::Definition, mdstring::MDString}; serializable! { pub struct Group { #[serde(rename = "@id")] - id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, #[serde(rename = "@description")] - description: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, #[serde(default, rename = "definition")] - definitions: Vec, + pub definitions: Vec, } } diff --git a/lib/src/models/id.rs b/lib/src/models/id.rs index 49fae9db..942b77e3 100644 --- a/lib/src/models/id.rs +++ b/lib/src/models/id.rs @@ -1,4 +1,4 @@ -use std::ops::Deref; +use std::{error::Error, ops::Deref}; use uuid::Uuid; @@ -12,6 +12,10 @@ impl ID { pub fn new() -> Self { ID(Uuid::new_v4().to_string()) } + + pub fn parse(value: &str) -> Result> { + Ok(ID(Uuid::parse_str(value)?.to_string())) + } } impl Default for ID { diff --git a/lib/src/models/note.rs b/lib/src/models/note.rs index a7b11591..0afa9656 100644 --- a/lib/src/models/note.rs +++ b/lib/src/models/note.rs @@ -1,15 +1,17 @@ -use crate::serializable; +use crate::{serializable, MDString}; use super::example::Example; serializable! { pub struct Note { #[serde(rename = "@id")] - id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + #[serde(rename = "@value")] + pub value: MDString, - // #[serde(rename = "@value")] - // value: MDString, #[serde(default, rename = "example")] - examples: Vec, + pub examples: Vec, } } diff --git a/lib/src/models/pos.rs b/lib/src/models/pos.rs index f7767e71..b3aa0296 100644 --- a/lib/src/models/pos.rs +++ b/lib/src/models/pos.rs @@ -1,7 +1,7 @@ use crate::serializable; serializable! { - #[derive(Hash)] + #[derive(Hash, Ord, PartialOrd)] #[archive_attr(derive(PartialEq, Eq, Hash))] #[repr(u8)] pub enum PartOfSpeech { diff --git a/lib/src/models/serializable.rs b/lib/src/models/serializable.rs index 411c613e..3c9db60c 100644 --- a/lib/src/models/serializable.rs +++ b/lib/src/models/serializable.rs @@ -17,6 +17,24 @@ macro_rules! serializable { }; } +#[macro_export] +macro_rules! serializable_test { + ($i:item) => { + #[derive( + PartialEq, + Eq, + Debug, + Clone, + serde::Deserialize, + rkyv::Archive, + rkyv::Serialize, + rkyv::Deserialize, + )] + #[archive_attr(derive(Debug))] + $i + }; +} + #[macro_export] macro_rules! serializable_custom { ($i:item) => { diff --git a/lib/src/search/index.rs b/lib/src/search/index.rs new file mode 100644 index 00000000..119468f1 --- /dev/null +++ b/lib/src/search/index.rs @@ -0,0 +1,21 @@ +use once_cell::sync::Lazy; +use tantivy::schema::{Schema, STORED, TEXT}; + +const SCHEMA: Lazy = Lazy::new(|| { + let mut schema_builder = Schema::builder(); + + schema_builder.add_text_field("title", TEXT | STORED); + + schema_builder.build() +}); + +impl Dictionary { + pub fn index() { + // let index_path = TempDir::new()?; + let mut schema_builder = Schema::builder(); + let index = Index::create_in_dir(&index_path, schema.clone())?; + schema_builder.add_text_field("title", TEXT | STORED); + // schema_builder. + let schema = schema_builder.build(); + } +} diff --git a/lib/src/search/mod.rs b/lib/src/search/mod.rs new file mode 100644 index 00000000..ecc75a28 --- /dev/null +++ b/lib/src/search/mod.rs @@ -0,0 +1,5 @@ +mod index; +mod search; + +pub use self::index::*; +pub use self::search::*; diff --git a/lib/tests/dump.rs b/lib/tests/dump.rs new file mode 100644 index 00000000..d116ea5e --- /dev/null +++ b/lib/tests/dump.rs @@ -0,0 +1,37 @@ +mod helpers; + +mod dump_tests { + + use insta::assert_snapshot; + + use odict::{ + dump::{ToJSON, ToXML}, + Dictionary, ID, + }; + + use crate::helpers::EXAMPLE_DICTIONARY_1; + + #[test] + fn test_xml() { + let dictionary1 = EXAMPLE_DICTIONARY_1.to_dictionary().unwrap(); + let dumped = dictionary1.clone().to_xml(true).unwrap(); + let mut dictionary2 = Dictionary::from(dumped.as_str()); + + dictionary2.id = dictionary1.id.clone(); + + assert_eq!(dictionary1, dictionary2); + } + + #[test] + fn test_json() { + let dictionary1 = EXAMPLE_DICTIONARY_1.to_dictionary().unwrap(); + let mut mutable = dictionary1.clone(); + + // Keep it consistent + mutable.id = ID::parse("2ee2a1ae-f7ff-4590-ba2d-de857ba7857f").unwrap(); + + let dumped = mutable.to_json(true).unwrap(); + + assert_snapshot!(dumped); + } +} diff --git a/lib/tests/merge.rs b/lib/tests/merge.rs index a9359916..9f3f948a 100644 --- a/lib/tests/merge.rs +++ b/lib/tests/merge.rs @@ -1,134 +1,139 @@ -use map_macro::hash_map; +#[cfg(test)] +mod merge_tests { + use map_macro::hash_map; -use odict::{Definition, DefinitionType, Dictionary, Entry, Etymology, PartOfSpeech, Sense, ID}; - -#[test] -fn test_merge() { - let dict1 = Dictionary { - id: ID::new(), - name: None, - entries: hash_map! { - String::from("dog") => Entry { - term: "dog".to_string(), - see_also: None, - etymologies: vec![ - Etymology { - id:None, - description:None, - pronunciation:None, - senses: hash_map! { - PartOfSpeech::n => Sense { - pos: PartOfSpeech::n, - definitions: vec![ - DefinitionType::Definition( - Definition { - id: None, - value: "some definition".into(), - examples: vec![], - notes: vec![], - } - ) - ], - } - } - } - ] - } - }, - }; - - let dict2 = Dictionary { - id: ID::new(), - name: None, - entries: hash_map! { - "cat".to_string()=> - Entry { - see_also: None, - term: "cat".to_string(), - etymologies: vec![Etymology { - id: None, - pronunciation: None, - description: None, - senses:hash_map! { - PartOfSpeech::n=> - Sense { - pos: PartOfSpeech::n, - definitions: vec![ - DefinitionType::Definition( - Definition { - id: None, - value: "some other definition".into(), - examples: vec![], - notes: vec![], - } - ) - ], - }, - } - }], - }, - }, + use odict::{ + Definition, DefinitionType, Dictionary, Entry, Etymology, PartOfSpeech, Sense, ID, }; - let expected = Dictionary { - id: ID::new(), - name: None, - entries: hash_map! { - "dog".to_string() => Entry { - see_also: None, - term: "dog".to_string(), - etymologies: vec![Etymology { - id: None, - pronunciation: None, - description: None, - senses:hash_map! { - PartOfSpeech::n=> - Sense { + #[test] + fn test_merge() { + let dict1 = Dictionary { + id: ID::new(), + name: None, + entries: hash_map! { + String::from("dog") => Entry { + term: "dog".to_string(), + see_also: None, + etymologies: vec![ + Etymology { + id:None, + description:None, + pronunciation:None, + senses: hash_map! { + PartOfSpeech::n => Sense { pos: PartOfSpeech::n, definitions: vec![ - DefinitionType::Definition( + DefinitionType::Definition( Definition { id: None, value: "some definition".into(), examples: vec![], notes: vec![], - } - ) - ], - }, - } - }], - }, - "cat".to_string() => Entry { - see_also: None, - term: "cat".to_string(), - etymologies: vec![Etymology { - id: None, - pronunciation: None, - description: None, - senses:hash_map! { - PartOfSpeech::n=> - Sense { - pos: PartOfSpeech::n, - definitions: vec![DefinitionType::Definition( - Definition{ - id: None, - value: "some other definition".into(), - examples: vec![], - notes: vec![], } - )], - }, + ) + ], + } } - }], - }, - }, - }; + } + ] + } + }, + }; + + let dict2 = Dictionary { + id: ID::new(), + name: None, + entries: hash_map! { + "cat".to_string()=> + Entry { + see_also: None, + term: "cat".to_string(), + etymologies: vec![Etymology { + id: None, + pronunciation: None, + description: None, + senses:hash_map! { + PartOfSpeech::n=> + Sense { + pos: PartOfSpeech::n, + definitions: vec![ + DefinitionType::Definition( + Definition { + id: None, + value: "some other definition".into(), + examples: vec![], + notes: vec![], + } + ) + ], + }, + } + }], + }, + }, + }; + + let expected = Dictionary { + id: ID::new(), + name: None, + entries: hash_map! { + "dog".to_string() => Entry { + see_also: None, + term: "dog".to_string(), + etymologies: vec![Etymology { + id: None, + pronunciation: None, + description: None, + senses:hash_map! { + PartOfSpeech::n=> + Sense { + pos: PartOfSpeech::n, + definitions: vec![ + DefinitionType::Definition( + Definition { + id: None, + value: "some definition".into(), + examples: vec![], + notes: vec![], + } + ) + ], + }, + } + }], + }, + "cat".to_string() => Entry { + see_also: None, + term: "cat".to_string(), + etymologies: vec![Etymology { + id: None, + pronunciation: None, + description: None, + senses:hash_map! { + PartOfSpeech::n=> + Sense { + pos: PartOfSpeech::n, + definitions: vec![DefinitionType::Definition( + Definition{ + id: None, + value: "some other definition".into(), + examples: vec![], + notes: vec![], + } + )], + }, + } + }], + }, + }, + }; - let mut result = dict1; + let mut result = dict1; - result.merge(&dict2); - result.id = expected.id.clone(); // Prevent failures based solely on UUIDs + result.merge(&dict2); + result.id = expected.id.clone(); // Prevent failures based solely on UUIDs - assert_eq!(expected, result); + assert_eq!(expected, result); + } } diff --git a/lib/tests/snapshots/dump__dump_tests__json.snap b/lib/tests/snapshots/dump__dump_tests__json.snap new file mode 100644 index 00000000..ca5a9d0e --- /dev/null +++ b/lib/tests/snapshots/dump__dump_tests__json.snap @@ -0,0 +1,145 @@ +--- +source: lib/tests/dump.rs +expression: dumped +--- +{ + "id": "2ee2a1ae-f7ff-4590-ba2d-de857ba7857f", + "name": "Example Dictionary 1", + "entries": { + "cat": { + "term": "cat", + "etymologies": [ + { + "description": "Latin root", + "senses": { + "n": { + "pos": "n", + "definitions": [ + { + "type": "definition", + "value": "a cat" + } + ] + } + } + } + ] + }, + "dog": { + "term": "dog", + "etymologies": [ + { + "pronunciation": "dooooog", + "description": "Latin root", + "senses": { + "un": { + "pos": "un", + "definitions": [ + { + "type": "definition", + "value": "a dog" + } + ] + } + } + } + ] + }, + "poo": { + "term": "poo", + "etymologies": [ + { + "description": "Latin root", + "senses": { + "un": { + "pos": "un", + "definitions": [ + { + "type": "group", + "description": "A number of verb senses", + "definitions": [ + { + "value": "crap, shit" + } + ] + } + ] + } + } + } + ] + }, + "ran": { + "term": "ran", + "see_also": "run" + }, + "run": { + "term": "run", + "etymologies": [ + { + "description": "Latin root", + "senses": { + "n": { + "pos": "n", + "definitions": [ + { + "type": "definition", + "value": "(vertebrates) To move swiftly" + }, + { + "type": "definition", + "value": "Act or instance of hurrying (to or from a place) (not necessarily by foot); dash or errand, trip." + }, + { + "type": "definition", + "value": "A pleasure trip." + }, + { + "type": "definition", + "value": "Flight, instance or period of fleeing." + }, + { + "type": "definition", + "value": "Migration (of fish)." + }, + { + "type": "definition", + "value": "A group of fish that migrate, or ascend a river for the purpose of spawning." + } + ] + }, + "v": { + "pos": "v", + "definitions": [ + { + "type": "group", + "description": "A number of verb senses", + "definitions": [ + { + "value": "(vertebrates) To move swiftly (figuratively)" + }, + { + "value": "(fluids) To flow." + }, + { + "value": "(nautical, of a vessel) To sail before the wind, in distinction from reaching or sailing close-hauled." + }, + { + "value": "(social) To carry out an activity." + }, + { + "value": "To extend or persist, statically or dynamically, through space or time." + }, + { + "value": "(transitive) To execute or carry out a plan, procedure or program." + } + ] + } + ] + } + } + } + ] + } + } +} From a94db9953c34df96bedff5c3ebde989a64d27ace Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Sat, 16 Mar 2024 17:31:59 -0700 Subject: [PATCH 013/393] feat(*): add indexing (#656) --- .tool-versions | 7 +- Cargo.lock | 270 +++++++++++++++++++---------------- cli/Cargo.toml | 1 + cli/src/cli.rs | 6 +- cli/src/compile.rs | 10 +- cli/src/context.rs | 9 +- cli/src/index.rs | 65 +++++++++ cli/src/lib.rs | 2 + cli/src/main.rs | 9 +- cli/src/utils.rs | 3 - go/lib/search/go.mod | 8 +- go/lib/search/go.sum | 8 ++ go/lib/sql/go.mod | 4 +- go/lib/sql/go.sum | 4 + go/wasm/package-lock.json | 113 +++++++-------- js/package-lock.json | 120 ++++++++-------- justfile | 5 +- lib/Cargo.toml | 7 +- lib/src/config/aliases.rs | 44 +++--- lib/src/config/config.rs | 76 ++-------- lib/src/config/mod.rs | 1 + lib/src/core/lexicon.rs | 4 +- lib/src/core/lookup.rs | 24 ++-- lib/src/core/mod.rs | 2 + lib/src/core/preview.rs | 69 +++++++++ lib/src/core/split.rs | 2 +- lib/src/ext.rs | 4 +- lib/src/lib.rs | 4 + lib/src/models/dictionary.rs | 5 + lib/src/models/id.rs | 9 ++ lib/src/models/mdstring.rs | 33 ++++- lib/src/search/index.rs | 111 ++++++++++++-- lib/src/search/mod.rs | 1 + lib/src/search/schema.rs | 14 ++ lib/src/search/search.rs | 0 lib/tests/dump.rs | 2 +- lib/tests/index.rs | 22 +++ lib/tests/preview.rs | 13 ++ python/poetry.lock | 52 +++---- 39 files changed, 720 insertions(+), 423 deletions(-) create mode 100644 cli/src/index.rs create mode 100644 lib/src/core/preview.rs create mode 100644 lib/src/search/schema.rs create mode 100644 lib/src/search/search.rs create mode 100644 lib/tests/index.rs create mode 100644 lib/tests/preview.rs diff --git a/.tool-versions b/.tool-versions index 8f1cffe4..120c51f3 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,11 +1,12 @@ -golang 1.21.6 +golang 1.22.0 python 3.12.1 poetry 1.7.1 gradle 7.5.1 kotlin 1.9.22 java adoptopenjdk-17.0.10+7 -nodejs 20.11.0 -just 1.23.0 +nodejs 20.11.1 +just 1.24.0 +flatc 23.3.3 goreleaser 1.21.1 make 4.4.1 rust 1.76.0 diff --git a/Cargo.lock b/Cargo.lock index 8350b2aa..59add617 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,7 +29,7 @@ dependencies = [ "actix-rt", "actix-service", "actix-utils", - "ahash 0.8.8", + "ahash 0.8.9", "base64", "bitflags 2.4.2", "brotli", @@ -65,7 +65,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -144,7 +144,7 @@ dependencies = [ "actix-service", "actix-utils", "actix-web-codegen", - "ahash 0.8.8", + "ahash 0.8.9", "bytes", "bytestring", "cfg-if", @@ -178,7 +178,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -209,9 +209,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", @@ -220,9 +220,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" dependencies = [ "cfg-if", "getrandom", @@ -263,9 +263,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" dependencies = [ "anstyle", "anstyle-parse", @@ -277,9 +277,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -311,9 +311,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "arc-swap" @@ -329,7 +329,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -439,15 +439,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.0" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" [[package]] name = "bytecheck" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -456,9 +456,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" dependencies = [ "proc-macro2", "quote", @@ -509,11 +509,10 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" dependencies = [ - "jobserver", "libc", ] @@ -578,9 +577,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -588,9 +587,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", @@ -600,21 +599,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "cli" @@ -622,6 +621,7 @@ version = "2.0.0" dependencies = [ "clap", "console", + "indicatif", "odict", "once_cell", ] @@ -832,9 +832,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "encode_unicode" @@ -1149,7 +1149,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] @@ -1158,7 +1158,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.9", "allocator-api2", ] @@ -1170,9 +1170,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "379dada1584ad501b383485dd706b8afb7a70fcbc7f4da7d780638a5a6124a60" [[package]] name = "hmac" @@ -1238,6 +1238,19 @@ dependencies = [ "hashbrown 0.14.3", ] +[[package]] +name = "indicatif" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +dependencies = [ + "console", + "instant", + "number_prefix", + "portable-atomic", + "unicode-width", +] + [[package]] name = "inout" version = "0.1.3" @@ -1285,12 +1298,12 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", + "libc", "windows-sys 0.52.0", ] @@ -1324,15 +1337,6 @@ dependencies = [ "regex", ] -[[package]] -name = "jobserver" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.68" @@ -1362,9 +1366,9 @@ checksum = "0c2cdeb66e45e9f36bfad5bbdb4d2384e70936afbee843c6f6543f0c551ebb25" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libredox" @@ -1744,9 +1748,9 @@ dependencies = [ [[package]] name = "murmurhash32" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9380db4c04d219ac5c51d14996bbf2c2e9a15229771b53f8671eb6c83cf44df" +checksum = "2195bf6aa996a481483b29d62a7663eed3fe39600c460e323f8ff41e90bdd89b" [[package]] name = "nom" @@ -1784,6 +1788,12 @@ dependencies = [ "libc", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "object" version = "0.32.2" @@ -1973,6 +1983,12 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "powerfmt" version = "0.2.0" @@ -2174,32 +2190,33 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rend" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" dependencies = [ "bytecheck", ] [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", "spin", "untrusted", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "rkyv" -version = "0.7.43" +version = "0.7.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" +checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" dependencies = [ "bitvec", "bytecheck", @@ -2215,9 +2232,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.43" +version = "0.7.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" dependencies = [ "proc-macro2", "quote", @@ -2257,9 +2274,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ "bitflags 2.4.2", "errno", @@ -2307,9 +2324,9 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "scoped-tls" @@ -2331,35 +2348,35 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -2468,12 +2485,12 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2496,9 +2513,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "subtle" @@ -2519,9 +2536,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" dependencies = [ "proc-macro2", "quote", @@ -2687,13 +2704,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", "windows-sys 0.52.0", ] @@ -2709,29 +2725,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -2834,7 +2850,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -2915,9 +2931,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -2993,7 +3009,7 @@ checksum = "7abb14ae1a50dad63eaa768a458ef43d298cd1bd44951677bd10b732a9ba2a2d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -3041,7 +3057,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", "wasm-bindgen-shared", ] @@ -3063,7 +3079,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3158,7 +3174,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -3178,17 +3194,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.3", + "windows_aarch64_msvc 0.52.3", + "windows_i686_gnu 0.52.3", + "windows_i686_msvc 0.52.3", + "windows_x86_64_gnu 0.52.3", + "windows_x86_64_gnullvm 0.52.3", + "windows_x86_64_msvc 0.52.3", ] [[package]] @@ -3199,9 +3215,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" [[package]] name = "windows_aarch64_msvc" @@ -3211,9 +3227,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" [[package]] name = "windows_i686_gnu" @@ -3223,9 +3239,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" [[package]] name = "windows_i686_msvc" @@ -3235,9 +3251,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" [[package]] name = "windows_x86_64_gnu" @@ -3247,9 +3263,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" [[package]] name = "windows_x86_64_gnullvm" @@ -3259,9 +3275,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" [[package]] name = "windows_x86_64_msvc" @@ -3271,9 +3287,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" [[package]] name = "wyz" @@ -3297,9 +3313,9 @@ dependencies = [ [[package]] name = "yada" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d12cb7a57bbf2ab670ed9545bae3648048547f9039279a89ce000208e585c1" +checksum = "aed111bd9e48a802518765906cbdadf0b45afb72b9c81ab049a3b86252adffdd" [[package]] name = "yaml-rust" @@ -3327,7 +3343,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 6321f982..60ef3b7f 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -9,3 +9,4 @@ odict = { path = "../lib", features = ["config", "search", "serve", "dump"] } clap = { version = "4.4.18", features = ["derive", "cargo"] } console = "0.15.8" once_cell = "1.19.0" +indicatif = "0.17.8" diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 9ddccdf0..317864e4 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -1,7 +1,7 @@ use clap::{command, crate_version, Parser, Subcommand}; use crate::alias::AliasCommands; -use crate::{CompileArgs, DumpArgs, LexiconArgs, LookupArgs, MergeArgs}; +use crate::{CompileArgs, DumpArgs, IndexArgs, LexiconArgs, LookupArgs, MergeArgs}; #[derive(Debug, Parser)] #[command(name = "odict", about = "the lighting-fast open-source dictionary compiler", version = crate_version!(), long_about = None)] @@ -32,6 +32,10 @@ pub enum Commands { #[command(arg_required_else_help = true)] Dump(DumpArgs), + /// Creates a full-text index of a compiled dictionary + #[command(arg_required_else_help = true)] + Index(IndexArgs), + /// Lists all words defined in a dictionary #[command(arg_required_else_help = true)] Lexicon(LexiconArgs), diff --git a/cli/src/compile.rs b/cli/src/compile.rs index 75f7ae42..089b323c 100644 --- a/cli/src/compile.rs +++ b/cli/src/compile.rs @@ -38,9 +38,15 @@ pub fn compile(ctx: &CLIContext, args: &CompileArgs) -> Result<(), Box { + ctx.writer.write_to_path(&dict, &out.unwrap())?; + } + Err(e) => { + return Err(format!("\nAn error occurred parsing your XML: \n\n{}", e).into()); + } + } Ok(()) } diff --git a/cli/src/context.rs b/cli/src/context.rs index bdebc511..312ae42c 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -1,3 +1,4 @@ +use console::Term; use once_cell::sync::Lazy; use std::io::Write; @@ -9,8 +10,8 @@ pub struct CLIContext<'a> { pub alias_manager: Lazy, pub reader: Lazy, pub writer: Lazy, - pub stdout: Box, - pub stderr: Box, + pub stdout: Term, + pub stderr: Term, } impl<'a> CLIContext<'a> { @@ -20,8 +21,8 @@ impl<'a> CLIContext<'a> { alias_manager: Lazy::new(|| AliasManager::default()), reader: Lazy::new(|| DictionaryReader::default()), writer: Lazy::new(|| DictionaryWriter::default()), - stdout: Box::new(std::io::stdout()), - stderr: Box::new(std::io::stderr()), + stdout: Term::stdout(), + stderr: Term::stderr(), } } diff --git a/cli/src/index.rs b/cli/src/index.rs new file mode 100644 index 00000000..30f3f7e3 --- /dev/null +++ b/cli/src/index.rs @@ -0,0 +1,65 @@ +use std::{error::Error, path::PathBuf}; + +use clap::{arg, command, Args}; +use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle}; +use odict::search::{get_default_index_dir, IndexOptions}; + +use crate::CLIContext; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct IndexArgs { + /// Path to a compiled dictionary + #[arg(required = true)] + dictionary: String, + + /// Custom directory to store the index + #[arg(short)] + directory: Option, + + /// Whether to overwrite the index if it already exists + #[arg(short = 'f', default_value_t = false)] + overwrite: bool, + + /// Memory arena per thread in bytes. Must be above 15MB. + #[arg(short, default_value_t = 15000000)] + memory: usize, +} + +pub fn index(ctx: &mut CLIContext, args: &IndexArgs) -> Result<(), Box> { + let file = ctx + .reader + .read_from_path_or_alias_with_manager(&args.dictionary, &ctx.alias_manager)?; + + ctx.println("".to_string()); + + let archive = file.to_archive()?; + + let progress1 = ProgressBar::new(archive.entries.len() as u64).with_style( + ProgressStyle::with_template("[{eta_precise}] {bar} {pos}/{len} entries indexed").unwrap(), + ); + + progress1.set_draw_target(ProgressDrawTarget::term(ctx.stdout.clone(), 20)); + + let progress2 = progress1.clone(); + + let options = IndexOptions::default() + .overwrite(args.overwrite) + .memory(args.memory) + .dir(args.directory.as_ref().unwrap_or(&get_default_index_dir())) + .on_item(move |_, _| { + progress2.inc(1); + }); + + archive.index(&options)?; + + progress1.finish(); + + ctx.println(format!( + "\n\nSuccessfully wrote index to {}", + options.dir.as_path().to_str().unwrap() + )); + + Ok(()) +} diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 2b30c825..3a1fd7f6 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -4,6 +4,7 @@ mod compile; mod context; mod dump; mod enums; +mod index; mod lexicon; mod lookup; mod merge; @@ -15,6 +16,7 @@ pub use cli::*; pub use compile::*; pub use context::*; pub use dump::*; +pub use index::*; pub use lexicon::*; pub use lookup::*; pub use merge::*; diff --git a/cli/src/main.rs b/cli/src/main.rs index 5dfe9666..e9c4bd75 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,3 +1,5 @@ +use std::io::Write; + use clap::Parser; use cli::{alias, compile, lexicon, lookup, merge, t, CLIContext, Commands, CLI}; @@ -7,12 +9,13 @@ fn main() { let result = t( |c| match cli.command { + Commands::Alias(ref args) => alias(c, args), Commands::Compile(ref args) => compile(c, args), + Commands::Dump(ref args) => cli::dump(c, args), + Commands::Index(ref args) => cli::index(c, args), + Commands::Lexicon(ref args) => lexicon(c, args), Commands::Lookup(ref args) => lookup(c, args), Commands::Merge(ref args) => merge(c, args), - Commands::Lexicon(ref args) => lexicon(c, args), - Commands::Alias(ref args) => alias(c, args), - Commands::Dump(ref args) => cli::dump(c, args), }, &mut ctx, ); diff --git a/cli/src/utils.rs b/cli/src/utils.rs index 00440646..5bb22496 100644 --- a/cli/src/utils.rs +++ b/cli/src/utils.rs @@ -8,13 +8,10 @@ pub fn t(cb: F, ctx: &mut CLIContext) -> Result<(), Box> where F: FnOnce(&mut CLIContext) -> Result<(), Box>, { - let start = std::time::Instant::now(); let err = cb(ctx); if let Err(msg) = err { ctx.println(format!("{}", msg)); - } else if !ctx.cli.quiet { - ctx.println(format!("\n✨ Completed in {:?}", start.elapsed())); } Ok(()) diff --git a/go/lib/search/go.mod b/go/lib/search/go.mod index fef44691..716c01d8 100644 --- a/go/lib/search/go.mod +++ b/go/lib/search/go.mod @@ -9,7 +9,7 @@ require ( github.com/TheOpenDictionary/odict/lib/types v0.0.0-20231031041149-dd406d841689 github.com/blevesearch/bleve/v2 v2.3.10 github.com/blevesearch/bleve_index_api v1.1.6 - github.com/schollz/progressbar/v3 v3.14.1 + github.com/schollz/progressbar/v3 v3.14.2 github.com/stretchr/testify v1.8.4 ) @@ -44,12 +44,12 @@ require ( github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/mschoch/smat v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rivo/uniseg v0.4.4 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/samber/lo v1.39.0 // indirect go.etcd.io/bbolt v1.3.7 // indirect golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect - golang.org/x/sys v0.14.0 // indirect - golang.org/x/term v0.14.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/term v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go/lib/search/go.sum b/go/lib/search/go.sum index 2d705ba4..912551a3 100644 --- a/go/lib/search/go.sum +++ b/go/lib/search/go.sum @@ -82,6 +82,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= @@ -89,6 +91,8 @@ github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/schollz/progressbar/v3 v3.14.1 h1:VD+MJPCr4s3wdhTc7OEJ/Z3dAeBzJ7yKH/P4lC5yRTI= github.com/schollz/progressbar/v3 v3.14.1/go.mod h1:Zc9xXneTzWXF81TGoqL71u0sBPjULtEHYtj/WVgVy8E= +github.com/schollz/progressbar/v3 v3.14.2 h1:EducH6uNLIWsr560zSV1KrTeUb/wZGAHqyMFIEa99ks= +github.com/schollz/progressbar/v3 v3.14.2/go.mod h1:aQAZQnhF4JGFtRJiw/eobaXpsqpVQAftEQ+hLGXaRc4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -102,8 +106,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= +golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go/lib/sql/go.mod b/go/lib/sql/go.mod index 4599a92e..6900bbac 100644 --- a/go/lib/sql/go.mod +++ b/go/lib/sql/go.mod @@ -8,8 +8,8 @@ require ( github.com/TheOpenDictionary/odict/lib/types v0.0.0-20240121002644-e3f52802057f github.com/TheOpenDictionary/odict/lib/utils v0.0.0-20240121002644-e3f52802057f github.com/bokwoon95/sq v0.4.5 - github.com/bokwoon95/sqddl v0.4.9 - github.com/gkampitakis/go-snaps v0.5.1 + github.com/bokwoon95/sqddl v0.4.10 + github.com/gkampitakis/go-snaps v0.5.2 github.com/google/uuid v1.6.0 github.com/stretchr/testify v1.8.4 ) diff --git a/go/lib/sql/go.sum b/go/lib/sql/go.sum index 3c608da5..bbc3c2dd 100644 --- a/go/lib/sql/go.sum +++ b/go/lib/sql/go.sum @@ -14,6 +14,8 @@ github.com/bokwoon95/sq v0.4.5 h1:1uAaYFJs897zrAJWPedJG0FWuJP7KRKOKT1GnU4ne+w= github.com/bokwoon95/sq v0.4.5/go.mod h1:E3X8ARaXQ77XGMvjS0sQrcA1F5BZvq4Ck/91dPsMKR4= github.com/bokwoon95/sqddl v0.4.9 h1:ELZB4osci3LrjPZZyhKgnFvX7HtOk2stq+eBpzD+SME= github.com/bokwoon95/sqddl v0.4.9/go.mod h1:OKDpMxJCGMMtn52HdgltLH7M7zHrLo/lxGbnIkG6nQo= +github.com/bokwoon95/sqddl v0.4.10 h1:kPyRnWw8N2G0bla9wq+Gy08QFOs1vxhuhEmSghHd8mM= +github.com/bokwoon95/sqddl v0.4.10/go.mod h1:OKDpMxJCGMMtn52HdgltLH7M7zHrLo/lxGbnIkG6nQo= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -29,6 +31,8 @@ github.com/gkampitakis/go-snaps v0.5.0 h1:Qpk1+V1WJszsDvYMgrI15XbUvWqpsFvFxgaXKV github.com/gkampitakis/go-snaps v0.5.0/go.mod h1:gX47VYsnvqHsjBrTrpaXfm1Dm1Xg+nREZPKRT8xifV8= github.com/gkampitakis/go-snaps v0.5.1 h1:lLf6BhcUu8VqRgy4mMq5YKa+eQp/0MBhkKd5ZYMMNpE= github.com/gkampitakis/go-snaps v0.5.1/go.mod h1:gX47VYsnvqHsjBrTrpaXfm1Dm1Xg+nREZPKRT8xifV8= +github.com/gkampitakis/go-snaps v0.5.2 h1:ay/6f7WHwRkOgpBec9DjMLRBAApziJommZ21NkOOCwY= +github.com/gkampitakis/go-snaps v0.5.2/go.mod h1:ZABkO14uCuVxBHAXAfKG+bqNz+aa1bGPAg8jkI0Nk8Y= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= diff --git a/go/wasm/package-lock.json b/go/wasm/package-lock.json index 18fad79b..0e10fee7 100644 --- a/go/wasm/package-lock.json +++ b/go/wasm/package-lock.json @@ -3776,13 +3776,13 @@ } }, "node_modules/@swc/core": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.107.tgz", - "integrity": "sha512-zKhqDyFcTsyLIYK1iEmavljZnf4CCor5pF52UzLAz4B6Nu/4GLU+2LQVAf+oRHjusG39PTPjd2AlRT3f3QWfsQ==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.2.tgz", + "integrity": "sha512-vWgY07R/eqj1/a0vsRKLI9o9klGZfpLNOVEnrv4nrccxBgYPjcf22IWwAoaBJ+wpA7Q4fVjCUM8lP0m01dpxcg==", "dev": true, "hasInstallScript": true, "dependencies": { - "@swc/counter": "^0.1.1", + "@swc/counter": "^0.1.2", "@swc/types": "^0.1.5" }, "engines": { @@ -3793,16 +3793,16 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.3.107", - "@swc/core-darwin-x64": "1.3.107", - "@swc/core-linux-arm-gnueabihf": "1.3.107", - "@swc/core-linux-arm64-gnu": "1.3.107", - "@swc/core-linux-arm64-musl": "1.3.107", - "@swc/core-linux-x64-gnu": "1.3.107", - "@swc/core-linux-x64-musl": "1.3.107", - "@swc/core-win32-arm64-msvc": "1.3.107", - "@swc/core-win32-ia32-msvc": "1.3.107", - "@swc/core-win32-x64-msvc": "1.3.107" + "@swc/core-darwin-arm64": "1.4.2", + "@swc/core-darwin-x64": "1.4.2", + "@swc/core-linux-arm-gnueabihf": "1.4.2", + "@swc/core-linux-arm64-gnu": "1.4.2", + "@swc/core-linux-arm64-musl": "1.4.2", + "@swc/core-linux-x64-gnu": "1.4.2", + "@swc/core-linux-x64-musl": "1.4.2", + "@swc/core-win32-arm64-msvc": "1.4.2", + "@swc/core-win32-ia32-msvc": "1.4.2", + "@swc/core-win32-x64-msvc": "1.4.2" }, "peerDependencies": { "@swc/helpers": "^0.5.0" @@ -3814,9 +3814,9 @@ } }, "node_modules/@swc/core-darwin-arm64": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.107.tgz", - "integrity": "sha512-47tD/5vSXWxPd0j/ZllyQUg4bqalbQTsmqSw0J4dDdS82MWqCAwUErUrAZPRjBkjNQ6Kmrf5rpCWaGTtPw+ngw==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.2.tgz", + "integrity": "sha512-1uSdAn1MRK5C1m/TvLZ2RDvr0zLvochgrZ2xL+lRzugLlCTlSA+Q4TWtrZaOz+vnnFVliCpw7c7qu0JouhgQIw==", "cpu": [ "arm64" ], @@ -3830,9 +3830,9 @@ } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.107.tgz", - "integrity": "sha512-hwiLJ2ulNkBGAh1m1eTfeY1417OAYbRGcb/iGsJ+LuVLvKAhU/itzsl535CvcwAlt2LayeCFfcI8gdeOLeZa9A==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.2.tgz", + "integrity": "sha512-TYD28+dCQKeuxxcy7gLJUCFLqrwDZnHtC2z7cdeGfZpbI2mbfppfTf2wUPzqZk3gEC96zHd4Yr37V3Tvzar+lQ==", "cpu": [ "x64" ], @@ -3846,9 +3846,9 @@ } }, "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.107.tgz", - "integrity": "sha512-I2wzcC0KXqh0OwymCmYwNRgZ9nxX7DWnOOStJXV3pS0uB83TXAkmqd7wvMBuIl9qu4Hfomi9aDM7IlEEn9tumQ==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.2.tgz", + "integrity": "sha512-Eyqipf7ZPGj0vplKHo8JUOoU1un2sg5PjJMpEesX0k+6HKE2T8pdyeyXODN0YTFqzndSa/J43EEPXm+rHAsLFQ==", "cpu": [ "arm" ], @@ -3862,9 +3862,9 @@ } }, "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.107.tgz", - "integrity": "sha512-HWgnn7JORYlOYnGsdunpSF8A+BCZKPLzLtEUA27/M/ZuANcMZabKL9Zurt7XQXq888uJFAt98Gy+59PU90aHKg==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.2.tgz", + "integrity": "sha512-wZn02DH8VYPv3FC0ub4my52Rttsus/rFw+UUfzdb3tHMHXB66LqN+rR0ssIOZrH6K+VLN6qpTw9VizjyoH0BxA==", "cpu": [ "arm64" ], @@ -3878,9 +3878,9 @@ } }, "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.107.tgz", - "integrity": "sha512-vfPF74cWfAm8hyhS8yvYI94ucMHIo8xIYU+oFOW9uvDlGQRgnUf/6DEVbLyt/3yfX5723Ln57U8uiMALbX5Pyw==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.2.tgz", + "integrity": "sha512-3G0D5z9hUj9bXNcwmA1eGiFTwe5rWkuL3DsoviTj73TKLpk7u64ND0XjEfO0huVv4vVu9H1jodrKb7nvln/dlw==", "cpu": [ "arm64" ], @@ -3894,9 +3894,9 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.107.tgz", - "integrity": "sha512-uBVNhIg0ip8rH9OnOsCARUFZ3Mq3tbPHxtmWk9uAa5u8jQwGWeBx5+nTHpDOVd3YxKb6+5xDEI/edeeLpha/9g==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.2.tgz", + "integrity": "sha512-LFxn9U8cjmYHw3jrdPNqPAkBGglKE3tCZ8rA7hYyp0BFxuo7L2ZcEnPm4RFpmSCCsExFH+LEJWuMGgWERoktvg==", "cpu": [ "x64" ], @@ -3910,9 +3910,9 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.107.tgz", - "integrity": "sha512-mvACkUvzSIB12q1H5JtabWATbk3AG+pQgXEN95AmEX2ZA5gbP9+B+mijsg7Sd/3tboHr7ZHLz/q3SHTvdFJrEw==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.2.tgz", + "integrity": "sha512-dp0fAmreeVVYTUcb4u9njTPrYzKnbIH0EhH2qvC9GOYNNREUu2GezSIDgonjOXkHiTCvopG4xU7y56XtXj4VrQ==", "cpu": [ "x64" ], @@ -3926,9 +3926,9 @@ } }, "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.107.tgz", - "integrity": "sha512-J3P14Ngy/1qtapzbguEH41kY109t6DFxfbK4Ntz9dOWNuVY3o9/RTB841ctnJk0ZHEG+BjfCJjsD2n8H5HcaOA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.2.tgz", + "integrity": "sha512-HlVIiLMQkzthAdqMslQhDkoXJ5+AOLUSTV6fm6shFKZKqc/9cJvr4S8UveNERL9zUficA36yM3bbfo36McwnvQ==", "cpu": [ "arm64" ], @@ -3942,9 +3942,9 @@ } }, "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.107.tgz", - "integrity": "sha512-ZBUtgyjTHlz8TPJh7kfwwwFma+ktr6OccB1oXC8fMSopD0AxVnQasgun3l3099wIsAB9eEsJDQ/3lDkOLs1gBA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.2.tgz", + "integrity": "sha512-WCF8faPGjCl4oIgugkp+kL9nl3nUATlzKXCEGFowMEmVVCFM0GsqlmGdPp1pjZoWc9tpYanoXQDnp5IvlDSLhA==", "cpu": [ "ia32" ], @@ -3958,9 +3958,9 @@ } }, "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.107.tgz", - "integrity": "sha512-Eyzo2XRqWOxqhE1gk9h7LWmUf4Bp4Xn2Ttb0ayAXFp6YSTxQIThXcT9kipXZqcpxcmDwoq8iWbbf2P8XL743EA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.2.tgz", + "integrity": "sha512-oV71rwiSpA5xre2C5570BhCsg1HF97SNLsZ/12xv7zayGzqr3yvFALFJN8tHKpqUdCB4FGPjoP3JFdV3i+1wUw==", "cpu": [ "x64" ], @@ -3974,9 +3974,9 @@ } }, "node_modules/@swc/counter": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.2.tgz", - "integrity": "sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw==", + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", "dev": true }, "node_modules/@swc/helpers": { @@ -3989,12 +3989,13 @@ } }, "node_modules/@swc/jest": { - "version": "0.2.34", - "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.34.tgz", - "integrity": "sha512-MrS4m3yHFfnkYjxr3eqxshWi6fVhPViHQsb6XfiTO81niwEqYXeR58YhGJee6R0bfQHC69cv5OJ9+dYTYaYKRg==", + "version": "0.2.36", + "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.36.tgz", + "integrity": "sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==", "dev": true, "dependencies": { "@jest/create-cache-key-function": "^29.7.0", + "@swc/counter": "^0.1.3", "jsonc-parser": "^3.2.0" }, "engines": { @@ -8388,9 +8389,9 @@ } }, "node_modules/prettier": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", - "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -9412,9 +9413,9 @@ "dev": true }, "node_modules/tsup": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.0.1.tgz", - "integrity": "sha512-hvW7gUSG96j53ZTSlT4j/KL0q1Q2l6TqGBFc6/mu/L46IoNWqLLUzLRLP1R8Q7xrJTmkDxxDoojV5uCVs1sVOg==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.0.2.tgz", + "integrity": "sha512-NY8xtQXdH7hDUAZwcQdY/Vzlw9johQsaqf7iwZ6g1DOUlFYQ5/AtVAjTvihhEyeRlGo4dLRVHtrRaL35M1daqQ==", "dev": true, "dependencies": { "bundle-require": "^4.0.0", diff --git a/js/package-lock.json b/js/package-lock.json index 1712b521..22ff8f9f 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -1426,12 +1426,13 @@ } }, "node_modules/@swc/cli": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.3.6.tgz", - "integrity": "sha512-ZoQbsJXjiWIlbCgr1m+m7TGNk7pILb3uWm4t423jM8vot8clseclXFU4QCMqJUVcYCSwKStzP3+yYMZvme/lsQ==", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.3.9.tgz", + "integrity": "sha512-e5grxGEyNT0fYZEFmhSrRYL1kFAZAXlv+WjfQ35J6J9Hl0EtrMVymAEbGabetg2Q/2FX6HiRcjgc9LrdUCBk4A==", "dev": true, "dependencies": { "@mole-inc/bin-wrapper": "^8.0.1", + "@swc/counter": "^0.1.3", "commander": "^7.1.0", "fast-glob": "^3.2.5", "minimatch": "^9.0.3", @@ -1483,13 +1484,13 @@ } }, "node_modules/@swc/core": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.107.tgz", - "integrity": "sha512-zKhqDyFcTsyLIYK1iEmavljZnf4CCor5pF52UzLAz4B6Nu/4GLU+2LQVAf+oRHjusG39PTPjd2AlRT3f3QWfsQ==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.2.tgz", + "integrity": "sha512-vWgY07R/eqj1/a0vsRKLI9o9klGZfpLNOVEnrv4nrccxBgYPjcf22IWwAoaBJ+wpA7Q4fVjCUM8lP0m01dpxcg==", "dev": true, "hasInstallScript": true, "dependencies": { - "@swc/counter": "^0.1.1", + "@swc/counter": "^0.1.2", "@swc/types": "^0.1.5" }, "engines": { @@ -1500,16 +1501,16 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.3.107", - "@swc/core-darwin-x64": "1.3.107", - "@swc/core-linux-arm-gnueabihf": "1.3.107", - "@swc/core-linux-arm64-gnu": "1.3.107", - "@swc/core-linux-arm64-musl": "1.3.107", - "@swc/core-linux-x64-gnu": "1.3.107", - "@swc/core-linux-x64-musl": "1.3.107", - "@swc/core-win32-arm64-msvc": "1.3.107", - "@swc/core-win32-ia32-msvc": "1.3.107", - "@swc/core-win32-x64-msvc": "1.3.107" + "@swc/core-darwin-arm64": "1.4.2", + "@swc/core-darwin-x64": "1.4.2", + "@swc/core-linux-arm-gnueabihf": "1.4.2", + "@swc/core-linux-arm64-gnu": "1.4.2", + "@swc/core-linux-arm64-musl": "1.4.2", + "@swc/core-linux-x64-gnu": "1.4.2", + "@swc/core-linux-x64-musl": "1.4.2", + "@swc/core-win32-arm64-msvc": "1.4.2", + "@swc/core-win32-ia32-msvc": "1.4.2", + "@swc/core-win32-x64-msvc": "1.4.2" }, "peerDependencies": { "@swc/helpers": "^0.5.0" @@ -1521,9 +1522,9 @@ } }, "node_modules/@swc/core-darwin-arm64": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.107.tgz", - "integrity": "sha512-47tD/5vSXWxPd0j/ZllyQUg4bqalbQTsmqSw0J4dDdS82MWqCAwUErUrAZPRjBkjNQ6Kmrf5rpCWaGTtPw+ngw==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.2.tgz", + "integrity": "sha512-1uSdAn1MRK5C1m/TvLZ2RDvr0zLvochgrZ2xL+lRzugLlCTlSA+Q4TWtrZaOz+vnnFVliCpw7c7qu0JouhgQIw==", "cpu": [ "arm64" ], @@ -1537,9 +1538,9 @@ } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.107.tgz", - "integrity": "sha512-hwiLJ2ulNkBGAh1m1eTfeY1417OAYbRGcb/iGsJ+LuVLvKAhU/itzsl535CvcwAlt2LayeCFfcI8gdeOLeZa9A==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.2.tgz", + "integrity": "sha512-TYD28+dCQKeuxxcy7gLJUCFLqrwDZnHtC2z7cdeGfZpbI2mbfppfTf2wUPzqZk3gEC96zHd4Yr37V3Tvzar+lQ==", "cpu": [ "x64" ], @@ -1553,9 +1554,9 @@ } }, "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.107.tgz", - "integrity": "sha512-I2wzcC0KXqh0OwymCmYwNRgZ9nxX7DWnOOStJXV3pS0uB83TXAkmqd7wvMBuIl9qu4Hfomi9aDM7IlEEn9tumQ==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.2.tgz", + "integrity": "sha512-Eyqipf7ZPGj0vplKHo8JUOoU1un2sg5PjJMpEesX0k+6HKE2T8pdyeyXODN0YTFqzndSa/J43EEPXm+rHAsLFQ==", "cpu": [ "arm" ], @@ -1569,9 +1570,9 @@ } }, "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.107.tgz", - "integrity": "sha512-HWgnn7JORYlOYnGsdunpSF8A+BCZKPLzLtEUA27/M/ZuANcMZabKL9Zurt7XQXq888uJFAt98Gy+59PU90aHKg==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.2.tgz", + "integrity": "sha512-wZn02DH8VYPv3FC0ub4my52Rttsus/rFw+UUfzdb3tHMHXB66LqN+rR0ssIOZrH6K+VLN6qpTw9VizjyoH0BxA==", "cpu": [ "arm64" ], @@ -1585,9 +1586,9 @@ } }, "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.107.tgz", - "integrity": "sha512-vfPF74cWfAm8hyhS8yvYI94ucMHIo8xIYU+oFOW9uvDlGQRgnUf/6DEVbLyt/3yfX5723Ln57U8uiMALbX5Pyw==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.2.tgz", + "integrity": "sha512-3G0D5z9hUj9bXNcwmA1eGiFTwe5rWkuL3DsoviTj73TKLpk7u64ND0XjEfO0huVv4vVu9H1jodrKb7nvln/dlw==", "cpu": [ "arm64" ], @@ -1601,9 +1602,9 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.107.tgz", - "integrity": "sha512-uBVNhIg0ip8rH9OnOsCARUFZ3Mq3tbPHxtmWk9uAa5u8jQwGWeBx5+nTHpDOVd3YxKb6+5xDEI/edeeLpha/9g==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.2.tgz", + "integrity": "sha512-LFxn9U8cjmYHw3jrdPNqPAkBGglKE3tCZ8rA7hYyp0BFxuo7L2ZcEnPm4RFpmSCCsExFH+LEJWuMGgWERoktvg==", "cpu": [ "x64" ], @@ -1617,9 +1618,9 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.107.tgz", - "integrity": "sha512-mvACkUvzSIB12q1H5JtabWATbk3AG+pQgXEN95AmEX2ZA5gbP9+B+mijsg7Sd/3tboHr7ZHLz/q3SHTvdFJrEw==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.2.tgz", + "integrity": "sha512-dp0fAmreeVVYTUcb4u9njTPrYzKnbIH0EhH2qvC9GOYNNREUu2GezSIDgonjOXkHiTCvopG4xU7y56XtXj4VrQ==", "cpu": [ "x64" ], @@ -1633,9 +1634,9 @@ } }, "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.107.tgz", - "integrity": "sha512-J3P14Ngy/1qtapzbguEH41kY109t6DFxfbK4Ntz9dOWNuVY3o9/RTB841ctnJk0ZHEG+BjfCJjsD2n8H5HcaOA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.2.tgz", + "integrity": "sha512-HlVIiLMQkzthAdqMslQhDkoXJ5+AOLUSTV6fm6shFKZKqc/9cJvr4S8UveNERL9zUficA36yM3bbfo36McwnvQ==", "cpu": [ "arm64" ], @@ -1649,9 +1650,9 @@ } }, "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.107.tgz", - "integrity": "sha512-ZBUtgyjTHlz8TPJh7kfwwwFma+ktr6OccB1oXC8fMSopD0AxVnQasgun3l3099wIsAB9eEsJDQ/3lDkOLs1gBA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.2.tgz", + "integrity": "sha512-WCF8faPGjCl4oIgugkp+kL9nl3nUATlzKXCEGFowMEmVVCFM0GsqlmGdPp1pjZoWc9tpYanoXQDnp5IvlDSLhA==", "cpu": [ "ia32" ], @@ -1665,9 +1666,9 @@ } }, "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.3.107", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.107.tgz", - "integrity": "sha512-Eyzo2XRqWOxqhE1gk9h7LWmUf4Bp4Xn2Ttb0ayAXFp6YSTxQIThXcT9kipXZqcpxcmDwoq8iWbbf2P8XL743EA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.2.tgz", + "integrity": "sha512-oV71rwiSpA5xre2C5570BhCsg1HF97SNLsZ/12xv7zayGzqr3yvFALFJN8tHKpqUdCB4FGPjoP3JFdV3i+1wUw==", "cpu": [ "x64" ], @@ -1681,18 +1682,19 @@ } }, "node_modules/@swc/counter": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.2.tgz", - "integrity": "sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw==", + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", "dev": true }, "node_modules/@swc/jest": { - "version": "0.2.34", - "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.34.tgz", - "integrity": "sha512-MrS4m3yHFfnkYjxr3eqxshWi6fVhPViHQsb6XfiTO81niwEqYXeR58YhGJee6R0bfQHC69cv5OJ9+dYTYaYKRg==", + "version": "0.2.36", + "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.36.tgz", + "integrity": "sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==", "dev": true, "dependencies": { "@jest/create-cache-key-function": "^29.7.0", + "@swc/counter": "^0.1.3", "jsonc-parser": "^3.2.0" }, "engines": { @@ -1838,9 +1840,9 @@ } }, "node_modules/@types/node": { - "version": "20.11.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz", - "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", + "version": "20.11.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", + "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -4807,9 +4809,9 @@ } }, "node_modules/prettier": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", - "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/justfile b/justfile index f3441bb6..049bb0a8 100644 --- a/justfile +++ b/justfile @@ -15,10 +15,10 @@ GOLANG_CROSS_VERSION := "v1.21.3" @schema: (go "schema") (cli "schema") (js "schema") -@insta +args="": +@insta +args="": cargo insta {{args}} -@update-snaps: +@update-snaps: cargo insta accept @xsd: @@ -29,6 +29,7 @@ GOLANG_CROSS_VERSION := "v1.21.3" @test: cargo test + rm -rf **/.odict # deps xsd (go "test") (jvm "test") (python "test") (js "test") (wasm "test") clean @clean: (python "clean") (jvm "clean") (js "clean") diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 3ab2c391..5bc56589 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -9,6 +9,7 @@ config = ["dep:dirs"] search = ["dep:tantivy", "dep:charabia"] serve = ["dep:actix-web"] + [dependencies] lz4_flex = { version = "0.11.2", default-features = false, features = [ "frame", @@ -24,11 +25,12 @@ rkyv = { version = "0.7.43", features = [ "archive_le", ] } serde = { version = "1.0.196", features = ["serde_derive"] } -serde_json = { version = "1.0.113", optional = true } -validation = "0.0.1" uuid = { version = "1.7.0", features = ["v4", "fast-rng", "macro-diagnostics"] } pulldown-cmark = "0.10.0" dirs = { version = "5.0.1", optional = true } +once_cell = "1.19.0" +serde_json = { version = "1.0.113", optional = true } +validation = "0.0.1" actix-web = { version = "4.5.1", optional = true } tantivy = { version = "0.21.1", optional = true } charabia = { version = "0.8.7", optional = true } @@ -36,4 +38,3 @@ charabia = { version = "0.8.7", optional = true } [dev-dependencies] insta = "1.35.1" map-macro = "0.3.0" -once_cell = "1.19.0" diff --git a/lib/src/config/aliases.rs b/lib/src/config/aliases.rs index e2276c12..61a4008f 100644 --- a/lib/src/config/aliases.rs +++ b/lib/src/config/aliases.rs @@ -1,38 +1,43 @@ -use std::{error::Error, ffi::OsStr}; - use serde_json::to_vec; +use std::{collections::HashMap, error::Error, ffi::OsStr, fs, fs::read_to_string, path::PathBuf}; use crate::DictionaryFile; -use super::config::{get_config, ODictConfig}; - -use std::fs; +use super::config::get_config_dir; pub struct AliasManager { - config: ODictConfig, + path: PathBuf, + aliases: HashMap, } impl AliasManager { - // May be used in the future? - pub fn new + ?Sized>(config_path: &S) -> Result> { - Ok(Self { - config: get_config(Some(config_path))?, - }) + pub fn new + ?Sized>( + config_path: &S, // May be used in the future? + ) -> Result> { + let path = PathBuf::from(config_path); + + if !path.exists() { + fs::write(&path, "{}")?; + } + + let config = read_to_string(&path)?; + let aliases: HashMap = serde_json::from_str(&config)?; + + Ok(Self { path, aliases }) } } impl Default for AliasManager { fn default() -> Self { - Self { - config: get_config::(None).unwrap(), - } + let config_path = get_config_dir().unwrap().join("aliases.json"); + Self::new(&config_path).unwrap() } } impl AliasManager { fn save_to_disk(&self) -> Result<(), Box> { - let config_bytes = to_vec(&self.config.aliases)?; - fs::write(&self.config.path, config_bytes)?; + let config_bytes = to_vec(&self.aliases)?; + fs::write(&self.path, config_bytes)?; Ok(()) } @@ -47,8 +52,7 @@ impl AliasManager { pub fn set(&mut self, alias: &str, file: &DictionaryFile) -> Result<(), Box> { match &file.path { Some(path) => { - self.config - .aliases + self.aliases .insert(alias.to_string(), path.to_string_lossy().to_string()); self.save_to_disk() } @@ -57,13 +61,13 @@ impl AliasManager { } pub fn delete(&mut self, alias: &str) -> Result<(), Box> { - self.config.aliases.remove(alias); + self.aliases.remove(alias); self.save_to_disk()?; Ok(()) } pub fn get(&self, alias: &str) -> Option<&String> { - self.config.aliases.get(alias) + self.aliases.get(alias) } } diff --git a/lib/src/config/config.rs b/lib/src/config/config.rs index c9dac86f..e15a61c1 100644 --- a/lib/src/config/config.rs +++ b/lib/src/config/config.rs @@ -1,27 +1,15 @@ use dirs::home_dir; -use std::collections::HashMap; -use std::env::var; -use std::error::Error; -use std::ffi::OsStr; -use std::fs::{self, create_dir, read_to_string}; -use std::path::{Path, PathBuf}; - -pub(super) struct ODictConfig { - pub(super) path: PathBuf, - pub(super) aliases: HashMap, -} - -pub(super) fn get_config_dir(custom: Option<&str>) -> Result> { - let config_dir = custom.map(|c| c.to_string()).unwrap_or_else(|| { - let home_dir = home_dir().expect("Failed to get home directory"); - let mut config_dir = PathBuf::from(home_dir); - - config_dir.push(".odict"); - - return config_dir.to_string_lossy().to_string(); +use std::{env::var, error::Error, fs::create_dir, path::PathBuf}; + +pub fn get_config_dir() -> Result> { + let dir_name = var("ODICT_CONFIG_DIR").ok().unwrap_or_else(|| { + PathBuf::from(home_dir().expect("Failed to get home directory")) + .join(".odict") + .to_string_lossy() + .to_string() }); - let path = PathBuf::from(&config_dir); + let path = PathBuf::from(&dir_name.as_str()); if !path.exists() { create_dir(&path)?; @@ -30,58 +18,18 @@ pub(super) fn get_config_dir(custom: Option<&str>) -> Result) -> Result> { - Ok(Path::new(&get_config_dir(custom_dir)?).join("aliases.json")) -} - -pub(super) fn get_config + ?Sized>( - config_path: Option<&S>, -) -> Result> { - let config_path = config_path - .map(PathBuf::from) - .unwrap_or(get_default_config_path( - var("ODICT_CONFIG_DIR").ok().as_deref(), - )?); - - if !config_path.exists() { - fs::write(&config_path, "{}")?; - } - - let config = read_to_string(&config_path)?; - let config: HashMap = serde_json::from_str(&config)?; - - Ok(ODictConfig { - path: config_path, - aliases: config, - }) -} - #[cfg(test)] mod test { use dirs::home_dir; - use std::path::PathBuf; use super::get_config_dir; - #[test] - fn test_get_config_dir_custom() { - let config_dir = get_config_dir(Some(".odict")).unwrap(); - let actual = config_dir.to_str().unwrap(); - - assert_eq!(actual, ".odict"); - } - #[test] fn test_get_config_dir() { let home_dir = home_dir().expect("Failed to get home directory"); - let mut config_dir = PathBuf::from(home_dir); - - config_dir.push(".odict"); - - let expected = config_dir.to_string_lossy().to_string(); - let config_dir = get_config_dir(None).unwrap(); - let actual = config_dir.to_str().unwrap(); + let actual = get_config_dir().unwrap(); + let expected = home_dir.join(".odict"); - assert_eq!(actual, expected); + assert_eq!(actual.to_str().unwrap(), expected.to_str().unwrap()); } } diff --git a/lib/src/config/mod.rs b/lib/src/config/mod.rs index 0e0ef402..fb3bc018 100644 --- a/lib/src/config/mod.rs +++ b/lib/src/config/mod.rs @@ -4,6 +4,7 @@ mod config; use std::error::Error; pub use aliases::*; +pub use config::*; use crate::{DictionaryFile, DictionaryReader}; diff --git a/lib/src/core/lexicon.rs b/lib/src/core/lexicon.rs index c1793de4..bd5177cb 100644 --- a/lib/src/core/lexicon.rs +++ b/lib/src/core/lexicon.rs @@ -1,8 +1,8 @@ use crate::{ArchivedDictionary, Dictionary}; macro_rules! lexicon { - ($type:ty) => { - impl $type { + ($t:ident) => { + impl $t { pub fn lexicon(&self) -> Vec<&str> { let mut vec: Vec<&str> = self .entries diff --git a/lib/src/core/lookup.rs b/lib/src/core/lookup.rs index 06dffd3b..23d13261 100644 --- a/lib/src/core/lookup.rs +++ b/lib/src/core/lookup.rs @@ -1,11 +1,11 @@ -use std::{error::Error, sync::OnceLock}; +use std::error::Error; -use crate::{ArchivedDictionary, Dictionary, Entry, SplitOptions}; +use crate::{ArchivedDictionary, ArchivedEntry, Dictionary, Entry, SplitOptions}; +use once_cell::sync::Lazy; use rayon::prelude::*; use regex::Regex; -use rkyv::Archived; /* -------------------------------------------------------------------------- */ /* Structs & Enums */ @@ -13,11 +13,6 @@ use rkyv::Archived; /* ----------------------------- Lookup Options ----------------------------- */ -pub enum LookupOption { - Follow(bool), - Split(u16), -} - pub struct LookupOptions { follow: bool, split: usize, @@ -49,10 +44,12 @@ struct LookupQuery { fallback: String, } +const PARENTHETICAL_REGEX: Lazy = Lazy::new(|| Regex::new(r"\((.+)\)$").unwrap()); + fn parse_query(query: &str) -> LookupQuery { let term: String; - let fallback = match get_regex().captures(&query) { + let fallback = match PARENTHETICAL_REGEX.captures(&query) { Some(caps) => { let fallback = &caps[1]; term = query.replace(&caps[0], ""); @@ -67,17 +64,12 @@ fn parse_query(query: &str) -> LookupQuery { LookupQuery { term, fallback } } -fn get_regex() -> &'static Regex { - static R: OnceLock = OnceLock::new(); - R.get_or_init(|| Regex::new(r"\((.+)\)$").unwrap()) -} - /* -------------------------------------------------------------------------- */ /* Methods */ /* -------------------------------------------------------------------------- */ macro_rules! lookup { - ($tys:ty, $ret:ty) => { + ($tys:ident, $ret:ident) => { impl $tys { fn lookup_( &self, @@ -134,4 +126,4 @@ macro_rules! lookup { } lookup!(Dictionary, Entry); -lookup!(ArchivedDictionary, Archived); +lookup!(ArchivedDictionary, ArchivedEntry); diff --git a/lib/src/core/mod.rs b/lib/src/core/mod.rs index 3321be0c..af0108e4 100644 --- a/lib/src/core/mod.rs +++ b/lib/src/core/mod.rs @@ -2,11 +2,13 @@ mod constants; mod lexicon; mod lookup; mod merge; +mod preview; mod read; mod split; mod write; pub use self::lookup::*; +pub use self::preview::*; pub use self::read::*; pub use self::split::*; pub use self::write::*; diff --git a/lib/src/core/preview.rs b/lib/src/core/preview.rs new file mode 100644 index 00000000..aca330b6 --- /dev/null +++ b/lib/src/core/preview.rs @@ -0,0 +1,69 @@ +use crate::{ArchivedDefinitionType, ArchivedEntry, DefinitionType, Entry, MarkdownStrategy}; + +pub struct PreviewOptions { + strategy: MarkdownStrategy, + delimiter: String, +} + +impl Default for PreviewOptions { + fn default() -> Self { + Self { + strategy: MarkdownStrategy::default(), + delimiter: "; ".to_string(), + } + } +} + +impl PreviewOptions { + pub fn strategy(mut self, strategy: MarkdownStrategy) -> Self { + self.strategy = strategy; + self + } + + pub fn delimiter(mut self, delimiter: String) -> Self { + self.delimiter = delimiter; + self + } +} + +macro_rules! preview { + ($t:ident, $d:ident) => { + impl $t { + pub fn preview(&self, options: PreviewOptions) -> String { + let strategy = &options.strategy; + + let definitions: Vec = self + .etymologies + .iter() + .flat_map(|e| -> Vec { + e.senses + .values() + .flat_map(|s| -> Vec { + s.definitions + .iter() + .flat_map(|value| -> Vec { + match value { + $d::Definition(d) => { + vec![d.value.parse(strategy)] + } + $d::Group(g) => g + .definitions + .iter() + .map(|d| d.value.parse(strategy)) + .collect(), + } + }) + .collect() + }) + .collect() + }) + .collect(); + + definitions.join(&options.delimiter) + } + } + }; +} + +preview!(Entry, DefinitionType); +preview!(ArchivedEntry, ArchivedDefinitionType); diff --git a/lib/src/core/split.rs b/lib/src/core/split.rs index 26da86a6..8f52523b 100644 --- a/lib/src/core/split.rs +++ b/lib/src/core/split.rs @@ -26,7 +26,7 @@ impl SplitOptions { /* -------------------------------------------------------------------------- */ macro_rules! split { - ($t:ty, $r:ty) => { + ($t:ident, $r:ident) => { impl $t { pub fn split( &self, diff --git a/lib/src/ext.rs b/lib/src/ext.rs index a079d06f..427fff97 100644 --- a/lib/src/ext.rs +++ b/lib/src/ext.rs @@ -8,12 +8,12 @@ pub trait ToDictionary { impl ToDictionary for String { fn to_dictionary(&self) -> Result> { - Ok(Dictionary::from(self.as_str())) + Dictionary::from(self.as_str()) } } impl ToDictionary for str { fn to_dictionary(&self) -> Result> { - Ok(Dictionary::from(self)) + Dictionary::from(self) } } diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 69dd943e..1cdaa2d0 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -1,6 +1,10 @@ #[cfg(feature = "config")] +#[cfg(feature = "search")] pub mod config; +#[cfg(feature = "search")] +pub mod search; + #[cfg(feature = "dump")] pub mod dump; diff --git a/lib/src/models/dictionary.rs b/lib/src/models/dictionary.rs index 1dbe122f..dd756308 100644 --- a/lib/src/models/dictionary.rs +++ b/lib/src/models/dictionary.rs @@ -57,6 +57,11 @@ impl Dictionary { let bytes = to_bytes::<_, 4096>(self)?; Ok(bytes.to_vec()) } + + pub fn from(xml: &str) -> Result> { + let dict = from_str(xml)?; + Ok(dict) + } } impl From<&str> for Dictionary { diff --git a/lib/src/models/id.rs b/lib/src/models/id.rs index 942b77e3..ea639fde 100644 --- a/lib/src/models/id.rs +++ b/lib/src/models/id.rs @@ -1,5 +1,6 @@ use std::{error::Error, ops::Deref}; +use rkyv::string::ArchivedString; use uuid::Uuid; use crate::serializable; @@ -31,3 +32,11 @@ impl Deref for ID { &self.0 } } + +impl Deref for ArchivedID { + type Target = ArchivedString; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/lib/src/models/mdstring.rs b/lib/src/models/mdstring.rs index af97df99..6724ec72 100644 --- a/lib/src/models/mdstring.rs +++ b/lib/src/models/mdstring.rs @@ -11,6 +11,18 @@ pub enum MarkdownStrategy { Disabled, } +impl Default for MarkdownStrategy { + fn default() -> Self { + MarkdownStrategy::HTML + } +} + +impl AsRef for MarkdownStrategy { + fn as_ref(&self) -> &MarkdownStrategy { + self + } +} + serializable_custom! { pub struct MDString { value: String, @@ -44,16 +56,23 @@ impl From<&str> for MDString { } } -impl MDString { - pub fn parse(&self, strategy: MarkdownStrategy) -> String { - match strategy { - MarkdownStrategy::HTML => to_html(&self.value), - MarkdownStrategy::Text => to_text(&self.value), - MarkdownStrategy::Disabled => self.value.to_owned(), +macro_rules! parse { + ($t:ident) => { + impl $t { + pub fn parse>(&self, strategy: S) -> String { + match strategy.as_ref() { + MarkdownStrategy::HTML => to_html(&self.value), + MarkdownStrategy::Text => to_text(&self.value), + MarkdownStrategy::Disabled => self.value.to_owned(), + } + } } - } + }; } +parse!(MDString); +parse!(ArchivedMDString); + #[cfg(test)] mod tests { use super::*; diff --git a/lib/src/search/index.rs b/lib/src/search/index.rs index 119468f1..6c7a5c11 100644 --- a/lib/src/search/index.rs +++ b/lib/src/search/index.rs @@ -1,21 +1,102 @@ -use once_cell::sync::Lazy; -use tantivy::schema::{Schema, STORED, TEXT}; +use std::{error::Error, ffi::OsStr, fs::create_dir_all, fs::remove_dir_all, path::PathBuf}; -const SCHEMA: Lazy = Lazy::new(|| { - let mut schema_builder = Schema::builder(); +use tantivy::{doc, Index}; - schema_builder.add_text_field("title", TEXT | STORED); +use crate::config::get_config_dir; +use crate::{ArchivedDictionary, Dictionary, PreviewOptions}; - schema_builder.build() -}); +use super::schema::{FIELD_DEFINITIONS, FIELD_TERM, SCHEMA}; -impl Dictionary { - pub fn index() { - // let index_path = TempDir::new()?; - let mut schema_builder = Schema::builder(); - let index = Index::create_in_dir(&index_path, schema.clone())?; - schema_builder.add_text_field("title", TEXT | STORED); - // schema_builder. - let schema = schema_builder.build(); +pub struct IndexOptions { + pub memory: usize, + pub dir: PathBuf, + pub overwrite: bool, + pub cb_on_item: Box, +} + +pub fn get_default_index_dir() -> PathBuf { + get_config_dir().unwrap().join(".idx") +} + +impl IndexOptions { + pub fn default() -> Self { + Self { + memory: 50_000_000, + overwrite: false, + dir: get_default_index_dir(), + cb_on_item: Box::new(|_, _| {}), + } + } + + pub fn overwrite(mut self, overwrite: bool) -> Self { + self.overwrite = overwrite; + self + } + + pub fn memory(mut self, memory: usize) -> Self { + self.memory = memory; + self + } + + pub fn dir + ?Sized>(mut self, dir: &P) -> Self { + self.dir = PathBuf::from(dir); + self + } + + pub fn on_item(mut self, callback: F) -> Self + where + F: Fn(usize, &str) + Send + Sync + 'static, + { + self.cb_on_item = Box::new(callback); + self + } +} + +impl AsRef for IndexOptions { + fn as_ref(&self) -> &IndexOptions { + self } } + +macro_rules! index { + ($t:ident) => { + impl $t { + pub fn index>(&self, options: Options) -> Result<(), Box> { + let opts = options.as_ref(); + let index_path = opts.dir.join(self.id.as_str()); + + if opts.overwrite && index_path.exists() { + remove_dir_all(&index_path)?; + } + + if !index_path.exists() { + create_dir_all(&index_path)?; + } + + let index = Index::create_in_dir(&index_path, SCHEMA.to_owned())?; + + let mut index_writer = index.writer(opts.memory)?; + + self.entries.values().enumerate().for_each(|(i, entry)| { + let document = doc!( + *FIELD_TERM => entry.term.as_str(), + *FIELD_DEFINITIONS => entry.preview(PreviewOptions::default()) + ); + + if index_writer.add_document(document).is_ok() { + let cb = opts.cb_on_item.as_ref(); + cb(i, entry.term.as_str()); + } + }); + + index_writer.commit()?; + index_writer.wait_merging_threads()?; + + Ok(()) + } + } + }; +} + +index!(Dictionary); +index!(ArchivedDictionary); diff --git a/lib/src/search/mod.rs b/lib/src/search/mod.rs index ecc75a28..18511a4e 100644 --- a/lib/src/search/mod.rs +++ b/lib/src/search/mod.rs @@ -1,4 +1,5 @@ mod index; +mod schema; mod search; pub use self::index::*; diff --git a/lib/src/search/schema.rs b/lib/src/search/schema.rs new file mode 100644 index 00000000..6d3d4c74 --- /dev/null +++ b/lib/src/search/schema.rs @@ -0,0 +1,14 @@ +use once_cell::sync::Lazy; +use tantivy::schema::{Field, Schema, STORED, TEXT}; + +pub(super) const SCHEMA: Lazy = Lazy::new(|| { + let mut schema_builder = Schema::builder(); + schema_builder.add_text_field("term", TEXT | STORED); + schema_builder.add_text_field("definitions", TEXT); + schema_builder.build() +}); + +pub(super) const FIELD_TERM: Lazy = Lazy::new(|| SCHEMA.get_field("term").unwrap()); + +pub(super) const FIELD_DEFINITIONS: Lazy = + Lazy::new(|| SCHEMA.get_field("definitions").unwrap()); diff --git a/lib/src/search/search.rs b/lib/src/search/search.rs new file mode 100644 index 00000000..e69de29b diff --git a/lib/tests/dump.rs b/lib/tests/dump.rs index d116ea5e..c4d2700b 100644 --- a/lib/tests/dump.rs +++ b/lib/tests/dump.rs @@ -15,7 +15,7 @@ mod dump_tests { fn test_xml() { let dictionary1 = EXAMPLE_DICTIONARY_1.to_dictionary().unwrap(); let dumped = dictionary1.clone().to_xml(true).unwrap(); - let mut dictionary2 = Dictionary::from(dumped.as_str()); + let mut dictionary2 = Dictionary::from(dumped.as_str()).unwrap(); dictionary2.id = dictionary1.id.clone(); diff --git a/lib/tests/index.rs b/lib/tests/index.rs new file mode 100644 index 00000000..d38d0931 --- /dev/null +++ b/lib/tests/index.rs @@ -0,0 +1,22 @@ +mod helpers; + +#[cfg(test)] +mod index_tests { + + use super::helpers::EXAMPLE_DICTIONARY_1; + use odict::search::IndexOptions; + + #[test] + fn test_index() { + let archive = EXAMPLE_DICTIONARY_1.to_archive().unwrap(); + let opts = IndexOptions::default().dir(".odict/.idx"); + let result1 = archive.index(&opts); + + assert_eq!(result1.is_err(), false); + + let result2 = archive.index(&opts); + + assert_eq!(result2.is_err(), true); + assert_eq!(result2.unwrap_err().to_string(), "Index already exists"); + } +} diff --git a/lib/tests/preview.rs b/lib/tests/preview.rs new file mode 100644 index 00000000..741a0aa5 --- /dev/null +++ b/lib/tests/preview.rs @@ -0,0 +1,13 @@ +mod helpers; + +#[cfg(test)] +mod lexicon_tests { + use crate::helpers::EXAMPLE_DICTIONARY_1; + + #[test] + fn test_lexicon() { + let dict = EXAMPLE_DICTIONARY_1.to_archive().unwrap(); + let result = dict.lexicon(); + assert_eq!(result, vec!["cat", "dog", "poo", "ran", "run"]); + } +} diff --git a/python/poetry.lock b/python/poetry.lock index 2d016558..151316d4 100644 --- a/python/poetry.lock +++ b/python/poetry.lock @@ -2,33 +2,33 @@ [[package]] name = "black" -version = "24.1.1" +version = "24.2.0" description = "The uncompromising code formatter." optional = false python-versions = ">=3.8" files = [ - {file = "black-24.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2588021038bd5ada078de606f2a804cadd0a3cc6a79cb3e9bb3a8bf581325a4c"}, - {file = "black-24.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1a95915c98d6e32ca43809d46d932e2abc5f1f7d582ffbe65a5b4d1588af7445"}, - {file = "black-24.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fa6a0e965779c8f2afb286f9ef798df770ba2b6cee063c650b96adec22c056a"}, - {file = "black-24.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:5242ecd9e990aeb995b6d03dc3b2d112d4a78f2083e5a8e86d566340ae80fec4"}, - {file = "black-24.1.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fc1ec9aa6f4d98d022101e015261c056ddebe3da6a8ccfc2c792cbe0349d48b7"}, - {file = "black-24.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0269dfdea12442022e88043d2910429bed717b2d04523867a85dacce535916b8"}, - {file = "black-24.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3d64db762eae4a5ce04b6e3dd745dcca0fb9560eb931a5be97472e38652a161"}, - {file = "black-24.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:5d7b06ea8816cbd4becfe5f70accae953c53c0e53aa98730ceccb0395520ee5d"}, - {file = "black-24.1.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e2c8dfa14677f90d976f68e0c923947ae68fa3961d61ee30976c388adc0b02c8"}, - {file = "black-24.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a21725862d0e855ae05da1dd25e3825ed712eaaccef6b03017fe0853a01aa45e"}, - {file = "black-24.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07204d078e25327aad9ed2c64790d681238686bce254c910de640c7cc4fc3aa6"}, - {file = "black-24.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:a83fe522d9698d8f9a101b860b1ee154c1d25f8a82ceb807d319f085b2627c5b"}, - {file = "black-24.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:08b34e85170d368c37ca7bf81cf67ac863c9d1963b2c1780c39102187ec8dd62"}, - {file = "black-24.1.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7258c27115c1e3b5de9ac6c4f9957e3ee2c02c0b39222a24dc7aa03ba0e986f5"}, - {file = "black-24.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40657e1b78212d582a0edecafef133cf1dd02e6677f539b669db4746150d38f6"}, - {file = "black-24.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e298d588744efda02379521a19639ebcd314fba7a49be22136204d7ed1782717"}, - {file = "black-24.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:34afe9da5056aa123b8bfda1664bfe6fb4e9c6f311d8e4a6eb089da9a9173bf9"}, - {file = "black-24.1.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:854c06fb86fd854140f37fb24dbf10621f5dab9e3b0c29a690ba595e3d543024"}, - {file = "black-24.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3897ae5a21ca132efa219c029cce5e6bfc9c3d34ed7e892113d199c0b1b444a2"}, - {file = "black-24.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:ecba2a15dfb2d97105be74bbfe5128bc5e9fa8477d8c46766505c1dda5883aac"}, - {file = "black-24.1.1-py3-none-any.whl", hash = "sha256:5cdc2e2195212208fbcae579b931407c1fa9997584f0a415421748aeafff1168"}, - {file = "black-24.1.1.tar.gz", hash = "sha256:48b5760dcbfe5cf97fd4fba23946681f3a81514c6ab8a45b50da67ac8fbc6c7b"}, + {file = "black-24.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6981eae48b3b33399c8757036c7f5d48a535b962a7c2310d19361edeef64ce29"}, + {file = "black-24.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d533d5e3259720fdbc1b37444491b024003e012c5173f7d06825a77508085430"}, + {file = "black-24.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61a0391772490ddfb8a693c067df1ef5227257e72b0e4108482b8d41b5aee13f"}, + {file = "black-24.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:992e451b04667116680cb88f63449267c13e1ad134f30087dec8527242e9862a"}, + {file = "black-24.2.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:163baf4ef40e6897a2a9b83890e59141cc8c2a98f2dda5080dc15c00ee1e62cd"}, + {file = "black-24.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e37c99f89929af50ffaf912454b3e3b47fd64109659026b678c091a4cd450fb2"}, + {file = "black-24.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f9de21bafcba9683853f6c96c2d515e364aee631b178eaa5145fc1c61a3cc92"}, + {file = "black-24.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:9db528bccb9e8e20c08e716b3b09c6bdd64da0dd129b11e160bf082d4642ac23"}, + {file = "black-24.2.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d84f29eb3ee44859052073b7636533ec995bd0f64e2fb43aeceefc70090e752b"}, + {file = "black-24.2.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1e08fb9a15c914b81dd734ddd7fb10513016e5ce7e6704bdd5e1251ceee51ac9"}, + {file = "black-24.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:810d445ae6069ce64030c78ff6127cd9cd178a9ac3361435708b907d8a04c693"}, + {file = "black-24.2.0-cp312-cp312-win_amd64.whl", hash = "sha256:ba15742a13de85e9b8f3239c8f807723991fbfae24bad92d34a2b12e81904982"}, + {file = "black-24.2.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:7e53a8c630f71db01b28cd9602a1ada68c937cbf2c333e6ed041390d6968faf4"}, + {file = "black-24.2.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:93601c2deb321b4bad8f95df408e3fb3943d85012dddb6121336b8e24a0d1218"}, + {file = "black-24.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a0057f800de6acc4407fe75bb147b0c2b5cbb7c3ed110d3e5999cd01184d53b0"}, + {file = "black-24.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:faf2ee02e6612577ba0181f4347bcbcf591eb122f7841ae5ba233d12c39dcb4d"}, + {file = "black-24.2.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:057c3dc602eaa6fdc451069bd027a1b2635028b575a6c3acfd63193ced20d9c8"}, + {file = "black-24.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:08654d0797e65f2423f850fc8e16a0ce50925f9337fb4a4a176a7aa4026e63f8"}, + {file = "black-24.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca610d29415ee1a30a3f30fab7a8f4144e9d34c89a235d81292a1edb2b55f540"}, + {file = "black-24.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:4dd76e9468d5536abd40ffbc7a247f83b2324f0c050556d9c371c2b9a9a95e31"}, + {file = "black-24.2.0-py3-none-any.whl", hash = "sha256:e8a6ae970537e67830776488bca52000eaa37fa63b9988e8c487458d9cd5ace6"}, + {file = "black-24.2.0.tar.gz", hash = "sha256:bce4f25c27c3435e4dace4815bcb2008b87e167e3bf4ee47ccdc5ce906eb4894"}, ] [package.dependencies] @@ -161,13 +161,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pytest" -version = "8.0.0" +version = "8.0.2" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.0.0-py3-none-any.whl", hash = "sha256:50fb9cbe836c3f20f0dfa99c565201fb75dc54c8d76373cd1bde06b06657bdb6"}, - {file = "pytest-8.0.0.tar.gz", hash = "sha256:249b1b0864530ba251b7438274c4d251c58d868edaaec8762893ad4a0d71c36c"}, + {file = "pytest-8.0.2-py3-none-any.whl", hash = "sha256:edfaaef32ce5172d5466b5127b42e0d6d35ebbe4453f0e3505d96afd93f6b096"}, + {file = "pytest-8.0.2.tar.gz", hash = "sha256:d4051d623a2e0b7e51960ba963193b09ce6daeb9759a451844a21e4ddedfc1bd"}, ] [package.dependencies] From 0e17c88142befd6c221a0008f30688a05151b865 Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Sun, 17 Mar 2024 18:53:03 -0700 Subject: [PATCH 014/393] feat(*): finalize search (#693) --- Cargo.lock | 1 + cli/src/cli.rs | 6 +- cli/src/enums.rs | 10 + cli/src/index.rs | 20 +- cli/src/lib.rs | 2 + cli/src/main.rs | 3 +- cli/src/search.rs | 57 +++++ go/go.work.sum | 204 +++++++++++++++--- lib/Cargo.toml | 13 +- lib/src/models/entry.rs | 9 +- lib/src/search/constants.rs | 1 + lib/src/search/index.rs | 73 ++++--- lib/src/search/mod.rs | 2 + lib/src/search/schema.rs | 18 +- lib/src/search/search.rs | 97 +++++++++ lib/src/search/tokenizer.rs | 118 ++++++++++ lib/tests/index.rs | 6 +- lib/tests/search.rs | 23 ++ .../search__index_tests__search.snap | 26 +++ 19 files changed, 601 insertions(+), 88 deletions(-) create mode 100644 cli/src/search.rs create mode 100644 lib/src/search/constants.rs create mode 100644 lib/src/search/tokenizer.rs create mode 100644 lib/tests/search.rs create mode 100644 lib/tests/snapshots/search__index_tests__search.snap diff --git a/Cargo.lock b/Cargo.lock index 59add617..2127d78d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1823,6 +1823,7 @@ dependencies = [ "serde", "serde_json", "tantivy", + "tantivy-tokenizer-api", "uuid", "validation", ] diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 317864e4..8f7c7d01 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -1,7 +1,7 @@ use clap::{command, crate_version, Parser, Subcommand}; use crate::alias::AliasCommands; -use crate::{CompileArgs, DumpArgs, IndexArgs, LexiconArgs, LookupArgs, MergeArgs}; +use crate::{CompileArgs, DumpArgs, IndexArgs, LexiconArgs, LookupArgs, MergeArgs, SearchArgs}; #[derive(Debug, Parser)] #[command(name = "odict", about = "the lighting-fast open-source dictionary compiler", version = crate_version!(), long_about = None)] @@ -47,4 +47,8 @@ pub enum Commands { /// Merge entries from multiple dictionaries into a destination dictionary #[command(arg_required_else_help = true)] Merge(MergeArgs), + + /// Run a full-text query on a compiled dictionary + #[command(arg_required_else_help = true)] + Search(SearchArgs), } diff --git a/cli/src/enums.rs b/cli/src/enums.rs index ad55e879..bb927988 100644 --- a/cli/src/enums.rs +++ b/cli/src/enums.rs @@ -17,6 +17,16 @@ pub enum DumpFormat { MySQL, } +impl Display for PrintFormat { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + PrintFormat::Print => write!(f, "print"), + PrintFormat::JSON => write!(f, "json"), + PrintFormat::XML => write!(f, "xml"), + } + } +} + impl Display for DumpFormat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { diff --git a/cli/src/index.rs b/cli/src/index.rs index 30f3f7e3..93436e1c 100644 --- a/cli/src/index.rs +++ b/cli/src/index.rs @@ -6,25 +6,27 @@ use odict::search::{get_default_index_dir, IndexOptions}; use crate::CLIContext; +pub(super) static DEFAULT_INDEX_MEMORY: usize = 15000000; + #[derive(Debug, Args)] #[command(args_conflicts_with_subcommands = true)] #[command(flatten_help = true)] pub struct IndexArgs { - /// Path to a compiled dictionary + /// Path to a compiled dictionary or an alias #[arg(required = true)] - dictionary: String, + pub(super) dictionary: String, /// Custom directory to store the index #[arg(short)] - directory: Option, + pub(super) directory: Option, /// Whether to overwrite the index if it already exists #[arg(short = 'f', default_value_t = false)] - overwrite: bool, + pub(super) overwrite: bool, /// Memory arena per thread in bytes. Must be above 15MB. - #[arg(short, default_value_t = 15000000)] - memory: usize, + #[arg(short, default_value_t = DEFAULT_INDEX_MEMORY)] + pub(super) memory: usize, } pub fn index(ctx: &mut CLIContext, args: &IndexArgs) -> Result<(), Box> { @@ -34,9 +36,9 @@ pub fn index(ctx: &mut CLIContext, args: &IndexArgs) -> Result<(), Box Result<(), Box lexicon(c, args), Commands::Lookup(ref args) => lookup(c, args), Commands::Merge(ref args) => merge(c, args), + Commands::Search(ref args) => search(c, args), }, &mut ctx, ); diff --git a/cli/src/search.rs b/cli/src/search.rs new file mode 100644 index 00000000..e6fe1946 --- /dev/null +++ b/cli/src/search.rs @@ -0,0 +1,57 @@ +use std::error::Error; + +use clap::{arg, command, Args}; +use odict::search::{get_default_index_dir, SearchOptions}; + +use crate::{enums::PrintFormat, print_entries, CLIContext, IndexArgs, DEFAULT_INDEX_MEMORY}; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct SearchArgs { + /// Path to a compiled dictionary or an alias + #[arg(required = true)] + dictionary: String, + + /// Format in which to print the results + #[arg(short, long, default_value_t = PrintFormat::JSON)] + format: PrintFormat, + + /// Creates a new index if one doesn't already exist + #[arg(long, default_value_t = false)] + index: bool, + + /// Search query + #[arg(required = true)] + query: String, +} + +pub fn search(ctx: &mut CLIContext, args: &SearchArgs) -> Result<(), Box> { + let file = ctx + .reader + .read_from_path_or_alias_with_manager(&args.dictionary, &ctx.alias_manager)?; + + let dict = file.to_dictionary()?; + + if args.index { + let index_path = get_default_index_dir().join(dict.id.as_str()); + + if !index_path.exists() { + crate::index( + ctx, + &IndexArgs { + dictionary: args.dictionary.clone(), + directory: None, + overwrite: false, + memory: DEFAULT_INDEX_MEMORY, + }, + )?; + } + } + + let results = dict.search(args.query.as_str(), SearchOptions::default())?; + + print_entries(ctx, vec![results], &args.format)?; + + Ok(()) +} diff --git a/go/go.work.sum b/go/go.work.sum index dd8e37f3..38ca3348 100644 --- a/go/go.work.sum +++ b/go/go.work.sum @@ -1,4 +1,3 @@ -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= @@ -6,45 +5,192 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/TheOpenDictionary/odict/lib/config v0.0.0-20230806153940-6b01ba7136fa/go.mod h1:+aU3saFQkiASuB07qTVt49KAMEJVE5V9U0zV2USCwYo= github.com/TheOpenDictionary/odict/lib/core v0.0.0-20230921060249-e2cb2527d998/go.mod h1:bz2jtd8Ob3xfAjDczf21YrQbLazM+SlQe4AydGa3K+8= -github.com/TheOpenDictionary/odict/lib/core v0.0.0-20231024210539-d4e83ae7bfdc/go.mod h1:6r7Uve6zyCBEQ3gF1eM68MMaKE28TahjOEXoXgqtYak= -github.com/TheOpenDictionary/odict/lib/dump v0.0.0-20231024210539-d4e83ae7bfdc/go.mod h1:n9iQP2j9K2UWqnr48FuF48n7y7WKJHidb9PH4MWVyTA= -github.com/TheOpenDictionary/odict/lib/search v0.0.0-20231024210539-d4e83ae7bfdc/go.mod h1:QQP23s5hPNJMgBhiD1SpHD1ZkuTJCxXOR7kNeR+QrT8= -github.com/TheOpenDictionary/odict/lib/server v0.0.0-20231024210539-d4e83ae7bfdc/go.mod h1:fnMKQbabDcNwRbn3H+oeRXABHhhVGfaHVgjOoUKw1Po= github.com/TheOpenDictionary/odict/lib/test v0.0.0-20231201204918-056ce8487757/go.mod h1:GCSWJlVAmBLPIwBHbQvEw0TM5s+iOZETPNbSDHk8BVo= github.com/TheOpenDictionary/odict/lib/test v0.0.0-20240109012151-688e6c29aa28/go.mod h1:GCSWJlVAmBLPIwBHbQvEw0TM5s+iOZETPNbSDHk8BVo= github.com/TheOpenDictionary/odict/lib/types v0.0.0-20230921060249-e2cb2527d998/go.mod h1:CFu/SVhm/v0fio+DwrsEgTCMLFctZcJbZxe4Ch5MY2U= github.com/TheOpenDictionary/odict/lib/utils v0.0.0-20230921060249-e2cb2527d998/go.mod h1:J+wpUCVDLh4i6YWJPMFVNMT/rK/6H08fNpzgxrrdTtY= github.com/TheOpenDictionary/odict/lib/utils v0.0.0-20231201204918-056ce8487757/go.mod h1:PpECSsE6EVzk6sV4eFTNs3cj9eR2vtOosDdsb7EtLlI= github.com/blevesearch/bleve_index_api v1.1.4/go.mod h1:PbcwjIcRmjhGbkS/lJCpfgVSMROV6TRubGGAODaK1W8= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/denisenkom/go-mssqldb v0.12.3/go.mod h1:k0mtMFOnU+AihqFxPMiF05rtiDrorD1Vrm1KEz5hxDo= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= -github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= -github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= +github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= +github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= +github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= +github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= +github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= +github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E= +github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= +github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= +github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= +github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= +github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= +github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= +github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= +github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= +github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= +github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= +github.com/jackc/pgx/v4 v4.18.1/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE= +github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/sijms/go-ora/v2 v2.7.6/go.mod h1:EHxlY6x7y9HAsdfumurRfTd+v8NrEOTR3Xl4FWlH6xk= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 5bc56589..e026c43e 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -6,23 +6,23 @@ edition = "2021" [features] dump = ["dep:serde_json"] config = ["dep:dirs"] -search = ["dep:tantivy", "dep:charabia"] +search = ["dep:tantivy", "dep:charabia", "dep:tantivy-tokenizer-api"] serve = ["dep:actix-web"] [dependencies] lz4_flex = { version = "0.11.2", default-features = false, features = [ - "frame", + "frame", ] } byteorder = "1.5.0" quick-xml = { version = "0.31.0", features = ["serialize"] } rayon = "1.8.1" regex = "1.10.3" rkyv = { version = "0.7.43", features = [ - "size_32", - "strict", - "alloc", - "archive_le", + "size_32", + "strict", + "alloc", + "archive_le", ] } serde = { version = "1.0.196", features = ["serde_derive"] } uuid = { version = "1.7.0", features = ["v4", "fast-rng", "macro-diagnostics"] } @@ -34,6 +34,7 @@ validation = "0.0.1" actix-web = { version = "4.5.1", optional = true } tantivy = { version = "0.21.1", optional = true } charabia = { version = "0.8.7", optional = true } +tantivy-tokenizer-api = { version = "0.2.0", optional = true } [dev-dependencies] insta = "1.35.1" diff --git a/lib/src/models/entry.rs b/lib/src/models/entry.rs index 4c1f98c3..0ac9689b 100644 --- a/lib/src/models/entry.rs +++ b/lib/src/models/entry.rs @@ -1,6 +1,6 @@ use std::error::Error; -use rkyv::{Deserialize, Infallible}; +use rkyv::{to_bytes, Deserialize, Infallible}; use crate::{serializable, Etymology}; @@ -18,6 +18,13 @@ serializable! { } } +impl Entry { + pub fn serialize(&self) -> Result, Box> { + let bytes = to_bytes::<_, 4096>(self)?; + Ok(bytes.to_vec()) + } +} + impl ArchivedEntry { pub fn to_entry(&self) -> Result> { let entry: Entry = self.deserialize(&mut Infallible)?; diff --git a/lib/src/search/constants.rs b/lib/src/search/constants.rs new file mode 100644 index 00000000..2d0197bc --- /dev/null +++ b/lib/src/search/constants.rs @@ -0,0 +1 @@ +pub const CHARABIA: &str = "CHARABIA"; diff --git a/lib/src/search/index.rs b/lib/src/search/index.rs index 6c7a5c11..1ab8fe91 100644 --- a/lib/src/search/index.rs +++ b/lib/src/search/index.rs @@ -3,9 +3,11 @@ use std::{error::Error, ffi::OsStr, fs::create_dir_all, fs::remove_dir_all, path use tantivy::{doc, Index}; use crate::config::get_config_dir; -use crate::{ArchivedDictionary, Dictionary, PreviewOptions}; +use crate::{Dictionary, PreviewOptions}; -use super::schema::{FIELD_DEFINITIONS, FIELD_TERM, SCHEMA}; +use super::constants::CHARABIA; +use super::schema::{FIELD_BUFFER, FIELD_DEFINITIONS, FIELD_TERM, SCHEMA}; +use super::tokenizer::CharabiaTokenizer; pub struct IndexOptions { pub memory: usize, @@ -58,45 +60,46 @@ impl AsRef for IndexOptions { } } -macro_rules! index { - ($t:ident) => { - impl $t { - pub fn index>(&self, options: Options) -> Result<(), Box> { - let opts = options.as_ref(); - let index_path = opts.dir.join(self.id.as_str()); +impl Dictionary { + pub fn index>( + &self, + options: Options, + ) -> Result<(), Box> { + let opts = options.as_ref(); + let index_path = opts.dir.join(self.id.as_str()); - if opts.overwrite && index_path.exists() { - remove_dir_all(&index_path)?; - } + if opts.overwrite && index_path.exists() { + remove_dir_all(&index_path)?; + } - if !index_path.exists() { - create_dir_all(&index_path)?; - } + if !index_path.exists() { + create_dir_all(&index_path)?; + } - let index = Index::create_in_dir(&index_path, SCHEMA.to_owned())?; + let index = Index::create_in_dir(&index_path, SCHEMA.to_owned())?; - let mut index_writer = index.writer(opts.memory)?; + index + .tokenizers() + .register(CHARABIA, CharabiaTokenizer::default()); - self.entries.values().enumerate().for_each(|(i, entry)| { - let document = doc!( - *FIELD_TERM => entry.term.as_str(), - *FIELD_DEFINITIONS => entry.preview(PreviewOptions::default()) - ); + let mut index_writer = index.writer(opts.memory)?; - if index_writer.add_document(document).is_ok() { - let cb = opts.cb_on_item.as_ref(); - cb(i, entry.term.as_str()); - } - }); + self.entries.values().enumerate().for_each(|(i, entry)| { + let document = doc!( + *FIELD_TERM => entry.term.as_str(), + *FIELD_DEFINITIONS => entry.preview(PreviewOptions::default()), + *FIELD_BUFFER => entry.serialize().unwrap() + ); - index_writer.commit()?; - index_writer.wait_merging_threads()?; + if index_writer.add_document(document).is_ok() { + let cb = opts.cb_on_item.as_ref(); + cb(i, entry.term.as_str()); + } + }); - Ok(()) - } - } - }; -} + index_writer.commit()?; + index_writer.wait_merging_threads()?; -index!(Dictionary); -index!(ArchivedDictionary); + Ok(()) + } +} diff --git a/lib/src/search/mod.rs b/lib/src/search/mod.rs index 18511a4e..45825f65 100644 --- a/lib/src/search/mod.rs +++ b/lib/src/search/mod.rs @@ -1,6 +1,8 @@ +mod constants; mod index; mod schema; mod search; +mod tokenizer; pub use self::index::*; pub use self::search::*; diff --git a/lib/src/search/schema.rs b/lib/src/search/schema.rs index 6d3d4c74..ddc44e5f 100644 --- a/lib/src/search/schema.rs +++ b/lib/src/search/schema.rs @@ -1,10 +1,20 @@ use once_cell::sync::Lazy; -use tantivy::schema::{Field, Schema, STORED, TEXT}; +use tantivy::schema::{Field, IndexRecordOption, Schema, TextFieldIndexing, TextOptions, STORED}; + +use super::constants::CHARABIA; pub(super) const SCHEMA: Lazy = Lazy::new(|| { let mut schema_builder = Schema::builder(); - schema_builder.add_text_field("term", TEXT | STORED); - schema_builder.add_text_field("definitions", TEXT); + + let text_indexing = TextFieldIndexing::default() + .set_tokenizer(CHARABIA) // Set custom tokenizer + .set_index_option(IndexRecordOption::WithFreqsAndPositions); + + let text_options = TextOptions::default().set_indexing_options(text_indexing); + + schema_builder.add_text_field("term", text_options.clone().set_stored()); + schema_builder.add_text_field("definitions", text_options); + schema_builder.add_bytes_field("buffer", STORED); schema_builder.build() }); @@ -12,3 +22,5 @@ pub(super) const FIELD_TERM: Lazy = Lazy::new(|| SCHEMA.get_field("term") pub(super) const FIELD_DEFINITIONS: Lazy = Lazy::new(|| SCHEMA.get_field("definitions").unwrap()); + +pub(super) const FIELD_BUFFER: Lazy = Lazy::new(|| SCHEMA.get_field("buffer").unwrap()); diff --git a/lib/src/search/search.rs b/lib/src/search/search.rs index e69de29b..4d936f17 100644 --- a/lib/src/search/search.rs +++ b/lib/src/search/search.rs @@ -0,0 +1,97 @@ +use std::{error::Error, ffi::OsStr, path::PathBuf}; + +use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; +use rkyv::{archived_root, Deserialize, Infallible}; +use tantivy::{collector::TopDocs, query::QueryParser, Index, ReloadPolicy}; + +use crate::{Dictionary, Entry}; + +use super::{ + constants::CHARABIA, + get_default_index_dir, + schema::{FIELD_BUFFER, FIELD_DEFINITIONS, FIELD_TERM}, + tokenizer::CharabiaTokenizer, +}; + +pub struct SearchOptions { + pub dir: PathBuf, + pub threshold: u32, + pub limit: usize, +} + +impl SearchOptions { + pub fn default() -> Self { + Self { + dir: get_default_index_dir(), + threshold: 1, + limit: 10, + } + } + + pub fn limit(mut self, limit: usize) -> Self { + self.limit = limit; + self + } + + pub fn threshold(mut self, threshold: u32) -> Self { + self.threshold = threshold; + self + } + + pub fn dir + ?Sized>(mut self, dir: &P) -> Self { + self.dir = PathBuf::from(dir); + self + } +} + +impl AsRef for SearchOptions { + fn as_ref(&self) -> &SearchOptions { + self + } +} + +impl Dictionary { + pub fn search>( + &self, + query: &str, + options: Options, + ) -> Result, Box> { + let opts = options.as_ref(); + let index_path = opts.dir.join(self.id.as_str()); + let index = Index::open_in_dir(&index_path)?; + + index + .tokenizers() + .register(CHARABIA, CharabiaTokenizer::default()); + + let reader = index + .reader_builder() + .reload_policy(ReloadPolicy::OnCommit) + .try_into()?; + + let searcher = reader.searcher(); + let query_parser = QueryParser::for_index(&index, vec![*FIELD_TERM, *FIELD_DEFINITIONS]); + let query_obj = query_parser.parse_query(query)?; + let top_docs = searcher.search(&query_obj, &TopDocs::with_limit(opts.limit))?; + let entries = top_docs + .par_iter() + .filter(|(score, _)| score >= &(opts.threshold as f32)) + .map(|(_, doc_address)| -> Entry { + let retrieved_doc = searcher.doc(*doc_address).unwrap(); + + let bytes = retrieved_doc + .get_first(*FIELD_BUFFER) + .unwrap() + .as_bytes() + .unwrap(); + + let archive = unsafe { archived_root::(&bytes[..]) }; + let entry: Entry = archive.deserialize(&mut Infallible).unwrap(); + + entry + }) + .collect(); + + Ok(entries) + } +} diff --git a/lib/src/search/tokenizer.rs b/lib/src/search/tokenizer.rs new file mode 100644 index 00000000..e49d15f8 --- /dev/null +++ b/lib/src/search/tokenizer.rs @@ -0,0 +1,118 @@ +#![forbid(unsafe_code)] + +use charabia::Tokenize; +use tantivy_tokenizer_api::{Token, TokenStream, Tokenizer}; + +#[derive(Clone)] +pub struct CharabiaTokenizer; + +impl Default for CharabiaTokenizer { + fn default() -> Self { + CharabiaTokenizer + } +} + +pub struct CharabiaTokenStream { + tokens: Vec, + index: usize, +} + +impl TokenStream for CharabiaTokenStream { + fn advance(&mut self) -> bool { + if self.index < self.tokens.len() { + self.index += 1; + true + } else { + false + } + } + + fn token(&self) -> &Token { + &self.tokens[self.index - 1] + } + + fn token_mut(&mut self) -> &mut Token { + &mut self.tokens[self.index - 1] + } +} + +impl Tokenizer for CharabiaTokenizer { + type TokenStream<'a> = CharabiaTokenStream; + + fn token_stream(&mut self, text: &str) -> CharabiaTokenStream { + let orig_tokens = text.tokenize(); + let mut tokens = Vec::new(); + + for token in orig_tokens { + tokens.push(Token { + offset_from: token.byte_start, + offset_to: token.byte_end, + position: token.char_start, + text: String::from(&text[token.byte_start..token.byte_end]), + position_length: token.char_end - token.char_start, + }); + } + + CharabiaTokenStream { tokens, index: 0 } + } +} + +#[cfg(test)] +mod tests { + use crate::search::tokenizer::CharabiaTokenizer; + use tantivy::tokenizer::*; + + #[test] + fn it_works() { + let mut tokenizer = CharabiaTokenizer {}; + + let mut token_stream = tokenizer.token_stream( + "张华考上了北京大学;李萍进了中等技术学校;我在百货公司当售货员:我们都有光明的前途", + ); + + let mut tokens = Vec::new(); + let mut token_text = Vec::new(); + + while let Some(token) = token_stream.next() { + tokens.push(token.clone()); + token_text.push(token.text.clone()); + } + + // offset should be byte-indexed + assert_eq!(tokens[0].offset_from, 0); + assert_eq!(tokens[0].offset_to, "张".bytes().len()); + assert_eq!(tokens[1].offset_from, "张".bytes().len()); + + // check tokenized text + assert_eq!( + token_text, + vec![ + "张", + "华", + "考上", + "了", + "北京大学", + ";", + "李", + "萍", + "进", + "了", + "中等", + "技术学校", + ";", + "我", + "在", + "百货公司", + "当", + "售货员", + ":", + "我们", + "都", + "有", + "光明", + "的", + "前途" + ] + ); + } +} diff --git a/lib/tests/index.rs b/lib/tests/index.rs index d38d0931..3d01cf51 100644 --- a/lib/tests/index.rs +++ b/lib/tests/index.rs @@ -8,13 +8,13 @@ mod index_tests { #[test] fn test_index() { - let archive = EXAMPLE_DICTIONARY_1.to_archive().unwrap(); + let dict = EXAMPLE_DICTIONARY_1.to_dictionary().unwrap(); let opts = IndexOptions::default().dir(".odict/.idx"); - let result1 = archive.index(&opts); + let result1 = dict.index(&opts); assert_eq!(result1.is_err(), false); - let result2 = archive.index(&opts); + let result2 = dict.index(&opts); assert_eq!(result2.is_err(), true); assert_eq!(result2.unwrap_err().to_string(), "Index already exists"); diff --git a/lib/tests/search.rs b/lib/tests/search.rs new file mode 100644 index 00000000..2081678d --- /dev/null +++ b/lib/tests/search.rs @@ -0,0 +1,23 @@ +mod helpers; + +#[cfg(test)] +mod index_tests { + + use super::helpers::EXAMPLE_DICTIONARY_1; + use insta::assert_snapshot; + use odict::dump::ToJSON; + use odict::search::{IndexOptions, SearchOptions}; + + #[test] + fn test_search() { + let dict = EXAMPLE_DICTIONARY_1.to_dictionary().unwrap(); + let dir = ".odict/.idx"; + + dict.index(IndexOptions::default().dir(dir)).unwrap(); + + let result = dict.search("a dog", SearchOptions::default().dir(dir)); + + assert_eq!(result.is_err(), false); + assert_snapshot!(result.unwrap().to_json(true).unwrap()); + } +} diff --git a/lib/tests/snapshots/search__index_tests__search.snap b/lib/tests/snapshots/search__index_tests__search.snap new file mode 100644 index 00000000..13fb4691 --- /dev/null +++ b/lib/tests/snapshots/search__index_tests__search.snap @@ -0,0 +1,26 @@ +--- +source: lib/tests/search.rs +expression: result.unwrap().to_json(true).unwrap() +--- +[ + { + "term": "dog", + "etymologies": [ + { + "pronunciation": "dooooog", + "description": "Latin root", + "senses": { + "un": { + "pos": "un", + "definitions": [ + { + "type": "definition", + "value": "a dog" + } + ] + } + } + } + ] + } +] From 6f65dc371ae4b51600673b853353406ecaf92cb3 Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Sat, 23 Mar 2024 17:40:01 -0700 Subject: [PATCH 015/393] feat(v2): add `new` command (#700) --- Cargo.lock | 24 +++++++++--------- cli/Cargo.toml | 8 +++++- cli/report.json | 5 ++++ cli/src/cli.rs | 8 +++++- cli/src/lib.rs | 2 ++ cli/src/main.rs | 1 + cli/src/new.rs | 54 ++++++++++++++++++++++++++++++++++++++++ lib/Cargo.toml | 3 ++- lib/report.json | 5 ++++ lib/src/search/index.rs | 5 ++++ lib/src/search/mod.rs | 6 ++++- lib/src/search/schema.rs | 11 +++++++- lib/src/search/search.rs | 6 +++-- 13 files changed, 119 insertions(+), 19 deletions(-) create mode 100644 cli/report.json create mode 100644 cli/src/new.rs create mode 100644 lib/report.json diff --git a/Cargo.lock b/Cargo.lock index 2127d78d..93c9ea87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -263,9 +263,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "anstream" -version = "0.6.12" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -418,9 +418,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -1126,9 +1126,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ "bytes", "fnv", @@ -1230,9 +1230,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -2302,9 +2302,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048a63e5b3ac996d78d402940b5fa47973d2d080c6c6fffa1d0f19c4445310b7" +checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8" [[package]] name = "rustls-webpki" @@ -2705,9 +2705,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 60ef3b7f..fff535a4 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -5,7 +5,13 @@ edition = "2021" publish = false [dependencies] -odict = { path = "../lib", features = ["config", "search", "serve", "dump"] } +odict = { path = "../lib", features = [ + "config", + "charabia", + "search", + "serve", + "dump", +] } clap = { version = "4.4.18", features = ["derive", "cargo"] } console = "0.15.8" once_cell = "1.19.0" diff --git a/cli/report.json b/cli/report.json new file mode 100644 index 00000000..a0ea5485 --- /dev/null +++ b/cli/report.json @@ -0,0 +1,5 @@ +{ + "version": 0, + "root_name": "Workspace", + "workspace_crates": {} +} \ No newline at end of file diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 8f7c7d01..a1a72207 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -1,7 +1,9 @@ use clap::{command, crate_version, Parser, Subcommand}; use crate::alias::AliasCommands; -use crate::{CompileArgs, DumpArgs, IndexArgs, LexiconArgs, LookupArgs, MergeArgs, SearchArgs}; +use crate::{ + CompileArgs, DumpArgs, IndexArgs, LexiconArgs, LookupArgs, MergeArgs, NewArgs, SearchArgs, +}; #[derive(Debug, Parser)] #[command(name = "odict", about = "the lighting-fast open-source dictionary compiler", version = crate_version!(), long_about = None)] @@ -48,6 +50,10 @@ pub enum Commands { #[command(arg_required_else_help = true)] Merge(MergeArgs), + /// Scaffolds a new ODict XML dictionary + #[command(arg_required_else_help = true)] + New(NewArgs), + /// Run a full-text query on a compiled dictionary #[command(arg_required_else_help = true)] Search(SearchArgs), diff --git a/cli/src/lib.rs b/cli/src/lib.rs index c68bb434..d5a9cfb2 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -8,6 +8,7 @@ mod index; mod lexicon; mod lookup; mod merge; +mod new; mod print; mod search; mod utils; @@ -21,6 +22,7 @@ pub use index::*; pub use lexicon::*; pub use lookup::*; pub use merge::*; +pub use new::*; pub use print::*; pub use search::*; pub use utils::*; diff --git a/cli/src/main.rs b/cli/src/main.rs index 49c685d0..76e70b6d 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -16,6 +16,7 @@ fn main() { Commands::Lexicon(ref args) => lexicon(c, args), Commands::Lookup(ref args) => lookup(c, args), Commands::Merge(ref args) => merge(c, args), + Commands::New(ref args) => cli::new(c, args), Commands::Search(ref args) => search(c, args), }, &mut ctx, diff --git a/cli/src/new.rs b/cli/src/new.rs new file mode 100644 index 00000000..a8dafb26 --- /dev/null +++ b/cli/src/new.rs @@ -0,0 +1,54 @@ +use std::{ + error::Error, + fs::{canonicalize, File}, + io::Write, + path::PathBuf, +}; + +use clap::{arg, command, Args}; + +use crate::CLIContext; + +#[derive(Debug, Args)] +#[command(args_conflicts_with_subcommands = true)] +#[command(flatten_help = true)] +pub struct NewArgs { + #[arg(required = true, help = "Name of your new dictionary file")] + file_name: String, + + #[arg(short, help = "Name attribute of the dictionary element")] + name: Option, +} + +pub fn new(ctx: &mut CLIContext, args: &NewArgs) -> Result<(), Box> { + let mut template = String::from( + " + +", + ); + + let output = PathBuf::from(format!("{}.xml", args.file_name)); + + if output.exists() { + return Err("\n🚫️ A file already exists with this name! Please choose another one.".into()); + } + + let mut file = File::create(&output)?; + + file.write_all(template.as_bytes())?; + + ctx.println(format!( + "\n✨ Created a new dictionary at {}!", + canonicalize(output)?.display() + )); + + Ok(()) +} diff --git a/lib/Cargo.toml b/lib/Cargo.toml index e026c43e..615e56a7 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -6,7 +6,8 @@ edition = "2021" [features] dump = ["dep:serde_json"] config = ["dep:dirs"] -search = ["dep:tantivy", "dep:charabia", "dep:tantivy-tokenizer-api"] +charabia = ["dep:charabia"] +search = ["dep:tantivy", "dep:tantivy-tokenizer-api"] serve = ["dep:actix-web"] diff --git a/lib/report.json b/lib/report.json new file mode 100644 index 00000000..a0ea5485 --- /dev/null +++ b/lib/report.json @@ -0,0 +1,5 @@ +{ + "version": 0, + "root_name": "Workspace", + "workspace_crates": {} +} \ No newline at end of file diff --git a/lib/src/search/index.rs b/lib/src/search/index.rs index 1ab8fe91..57565c2d 100644 --- a/lib/src/search/index.rs +++ b/lib/src/search/index.rs @@ -5,8 +5,12 @@ use tantivy::{doc, Index}; use crate::config::get_config_dir; use crate::{Dictionary, PreviewOptions}; +#[cfg(feature = "charabia")] use super::constants::CHARABIA; + use super::schema::{FIELD_BUFFER, FIELD_DEFINITIONS, FIELD_TERM, SCHEMA}; + +#[cfg(feature = "charabia")] use super::tokenizer::CharabiaTokenizer; pub struct IndexOptions { @@ -78,6 +82,7 @@ impl Dictionary { let index = Index::create_in_dir(&index_path, SCHEMA.to_owned())?; + #[cfg(feature = "charabia")] index .tokenizers() .register(CHARABIA, CharabiaTokenizer::default()); diff --git a/lib/src/search/mod.rs b/lib/src/search/mod.rs index 45825f65..983ec389 100644 --- a/lib/src/search/mod.rs +++ b/lib/src/search/mod.rs @@ -1,7 +1,11 @@ -mod constants; mod index; mod schema; mod search; + +#[cfg(feature = "charabia")] +mod constants; + +#[cfg(feature = "charabia")] mod tokenizer; pub use self::index::*; diff --git a/lib/src/search/schema.rs b/lib/src/search/schema.rs index ddc44e5f..ed0a9a6f 100644 --- a/lib/src/search/schema.rs +++ b/lib/src/search/schema.rs @@ -1,17 +1,26 @@ use once_cell::sync::Lazy; -use tantivy::schema::{Field, IndexRecordOption, Schema, TextFieldIndexing, TextOptions, STORED}; +use tantivy::schema::{Field, Schema, TextOptions, STORED}; +#[cfg(feature = "charabia")] +use tantivy::schema::{IndexRecordOption, TextFieldIndexing}; + +#[cfg(feature = "charabia")] use super::constants::CHARABIA; pub(super) const SCHEMA: Lazy = Lazy::new(|| { let mut schema_builder = Schema::builder(); + #[cfg(feature = "charabia")] let text_indexing = TextFieldIndexing::default() .set_tokenizer(CHARABIA) // Set custom tokenizer .set_index_option(IndexRecordOption::WithFreqsAndPositions); + #[cfg(feature = "charabia")] let text_options = TextOptions::default().set_indexing_options(text_indexing); + #[cfg(not(feature = "charabia"))] + let text_options = TextOptions::default(); + schema_builder.add_text_field("term", text_options.clone().set_stored()); schema_builder.add_text_field("definitions", text_options); schema_builder.add_bytes_field("buffer", STORED); diff --git a/lib/src/search/search.rs b/lib/src/search/search.rs index 4d936f17..278249f2 100644 --- a/lib/src/search/search.rs +++ b/lib/src/search/search.rs @@ -6,11 +6,12 @@ use tantivy::{collector::TopDocs, query::QueryParser, Index, ReloadPolicy}; use crate::{Dictionary, Entry}; +#[cfg(feature = "charabia")] +use super::{constants::CHARABIA, tokenizer::CharabiaTokenizer}; + use super::{ - constants::CHARABIA, get_default_index_dir, schema::{FIELD_BUFFER, FIELD_DEFINITIONS, FIELD_TERM}, - tokenizer::CharabiaTokenizer, }; pub struct SearchOptions { @@ -60,6 +61,7 @@ impl Dictionary { let index_path = opts.dir.join(self.id.as_str()); let index = Index::open_in_dir(&index_path)?; + #[cfg(feature = "charabia")] index .tokenizers() .register(CHARABIA, CharabiaTokenizer::default()); From e24160f4023b1be97b0d8cb98e03b82cecdedd8e Mon Sep 17 00:00:00 2001 From: Tyler Nickerson Date: Sun, 24 Mar 2024 23:12:40 -0700 Subject: [PATCH 016/393] feat(v2): add pretty printing (#701) --- Cargo.lock | 1 + cli/Cargo.toml | 11 +- cli/src/context.rs | 5 +- cli/src/print/md.rs | 43 ++++ cli/src/print/mod.rs | 5 + cli/src/print/pprint.rs | 236 ++++++++++++++++++ cli/src/{ => print}/print.rs | 3 +- lib/src/json/definition.rs | 2 +- lib/src/json/group.rs | 3 +- lib/src/json/note.rs | 2 +- lib/src/models/definition.rs | 4 +- lib/src/models/example.rs | 4 +- lib/src/models/group.rs | 3 +- lib/src/models/mdstring.rs | 28 ++- lib/src/models/mod.rs | 1 + .../snapshots/dump__dump_tests__json.snap | 25 +- 16 files changed, 352 insertions(+), 24 deletions(-) create mode 100644 cli/src/print/md.rs create mode 100644 cli/src/print/mod.rs create mode 100644 cli/src/print/pprint.rs rename cli/src/{ => print}/print.rs (90%) diff --git a/Cargo.lock b/Cargo.lock index 93c9ea87..f47c11af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -624,6 +624,7 @@ dependencies = [ "indicatif", "odict", "once_cell", + "pulldown-cmark", ] [[package]] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index fff535a4..6f68a84f 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -6,13 +6,14 @@ publish = false [dependencies] odict = { path = "../lib", features = [ - "config", - "charabia", - "search", - "serve", - "dump", + "config", + "charabia", + "search", + "serve", + "dump", ] } clap = { version = "4.4.18", features = ["derive", "cargo"] } console = "0.15.8" once_cell = "1.19.0" indicatif = "0.17.8" +pulldown-cmark = "0.10.0" diff --git a/cli/src/context.rs b/cli/src/context.rs index 312ae42c..2580e747 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -21,8 +21,8 @@ impl<'a> CLIContext<'a> { alias_manager: Lazy::new(|| AliasManager::default()), reader: Lazy::new(|| DictionaryReader::default()), writer: Lazy::new(|| DictionaryWriter::default()), - stdout: Term::stdout(), - stderr: Term::stderr(), + stdout: Term::buffered_stdout(), + stderr: Term::buffered_stdout(), } } @@ -30,5 +30,6 @@ impl<'a> CLIContext<'a> { self.stdout .write_all(format!("{}\n", msg).as_bytes()) .unwrap(); + self.stdout.flush().unwrap(); } } diff --git a/cli/src/print/md.rs b/cli/src/print/md.rs new file mode 100644 index 00000000..5a779048 --- /dev/null +++ b/cli/src/print/md.rs @@ -0,0 +1,43 @@ +use console::Style; +use odict::{MDString, MarkdownStrategy}; +use pulldown_cmark::{Event, Parser, Tag}; + +pub fn print_md(md_string: &MDString) -> String { + let md = md_string.parse(MarkdownStrategy::Disabled); + let parser = Parser::new(&md); + let mut tags_stack = Vec::new(); + let mut buffer = String::new(); + + for event in parser { + match event { + Event::Start(tag) => { + tags_stack.push(tag); + } + Event::End(_) => { + tags_stack.pop(); + } + Event::Text(content) => { + let mut style = Style::new(); + + if tags_stack.contains(&Tag::Emphasis) { + style = style.italic(); + } + + if tags_stack.contains(&Tag::Strong) { + style = style.bold(); + } + + if tags_stack.contains(&Tag::Strikethrough) { + style = style.strikethrough(); + } + + buffer.push_str(&style.apply_to(&content).to_string()); + } + Event::Code(content) => buffer.push_str(&content), + Event::SoftBreak => buffer.push(' '), + _ => (), + } + } + + buffer.trim().to_string() +} diff --git a/cli/src/print/mod.rs b/cli/src/print/mod.rs new file mode 100644 index 00000000..ea415804 --- /dev/null +++ b/cli/src/print/mod.rs @@ -0,0 +1,5 @@ +mod md; +mod pprint; +mod print; + +pub use print::*; diff --git a/cli/src/print/pprint.rs b/cli/src/print/pprint.rs new file mode 100644 index 00000000..d3ead196 --- /dev/null +++ b/cli/src/print/pprint.rs @@ -0,0 +1,236 @@ +use std::{borrow::Cow, error::Error}; + +use console::{style, Style}; +use odict::{ + Definition, DefinitionType, Entry, Etymology, Example, Group, MarkdownStrategy, Note, Sense, +}; +use once_cell::sync::Lazy; + +use crate::CLIContext; + +use super::md::print_md; + +const STYLE_POS: Lazy