theopendictionary 2.0.0__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of theopendictionary might be problematic. Click here for more details.
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/Cargo.lock +12 -12
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/PKG-INFO +1 -1
- theopendictionary-2.1.0/internal/src/load.rs +55 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/CHANGELOG.md +15 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/Cargo.toml +3 -2
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/lookup.rs +40 -41
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/download/download.rs +2 -2
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/download/mod.rs +0 -2
- theopendictionary-2.1.0/lib/src/intern/interner.rs +83 -0
- theopendictionary-2.1.0/lib/src/intern/mod.rs +522 -0
- theopendictionary-2.1.0/lib/src/intern/polyfill.rs +12 -0
- theopendictionary-2.1.0/lib/src/intern/se.rs +27 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/lib.rs +4 -0
- {theopendictionary-2.0.0/lib/src/download → theopendictionary-2.1.0/lib/src}/remote.rs +43 -7
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/definition.rs +3 -2
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/dictionary.rs +5 -8
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/entry.rs +3 -5
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/entry_ref.rs +4 -1
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/enums.rs +3 -1
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/etymology.rs +2 -4
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/example.rs +1 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/group.rs +2 -3
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/media_url.rs +3 -3
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/note.rs +2 -3
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/pronunciation.rs +1 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/sense.rs +1 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/translation.rs +2 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/tokenize.rs +0 -1
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/CHANGELOG.md +9 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/Cargo.toml +1 -1
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/dictionary.rs +11 -13
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/lib.rs +3 -1
- theopendictionary-2.1.0/python/src/types/load.rs +81 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/lookup.rs +3 -12
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/test_load_options.py +45 -17
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/test_lookup.py +2 -2
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/test_options.py +2 -2
- theopendictionary-2.0.0/internal/src/load.rs +0 -49
- theopendictionary-2.0.0/python/src/types/load.rs +0 -52
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/Cargo.toml +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/internal/Cargo.toml +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/internal/src/enum_wrapper.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/internal/src/lib.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/report.json +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/alias.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/compress.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/config.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/compile.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/consts.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/lexicon.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/merge.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/mod.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/preview.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/rank.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/read.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/resolve.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/version.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/core/write.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/download/metadata.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/download/options.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/download/utils.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/error.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/ext.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/html/html.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/html/mod.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/definition.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/dictionary.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/entry.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/entry_ref.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/etymology.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/example.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/form.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/group.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/json.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/media_url.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/mod.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/note.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/pronunciation.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/sense.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/token.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/json/translation.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/definition.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/entry.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/etymology.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/example.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/group.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/md.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/mod.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/note.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/pprint.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/pronunciation.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/sense.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/md/utils.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/mod.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/definitions.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/dictionaries.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/entries.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/etymologies.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/examples.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/groups.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/mod.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/notes.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/pronunciations.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/senses.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/sql.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/sql/utils.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/format/xml.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/fs.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/md.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/odict.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/form.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/form_kind.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/id.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/mod.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/pos.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/pronunciation_kind.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/schema/serializable.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/search/charabia.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/search/constants.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/search/index.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/search/mod.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/search/schema.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/src/search/search.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/lib/tasks.toml +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/pyproject.toml +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/definition.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/entry.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/enums.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/etymology.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/example.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/form.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/group.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/index.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/media_url.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/mod.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/note.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/pronunciation.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/save.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/search.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/sense.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/token.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/tokenize.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/types/translation.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/src/utils.rs +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tasks.toml +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/__snapshots__/test_lookup.ambr +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/__snapshots__/test_tokenize.ambr +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/test_forms.py +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/test_lemma.py +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/test_pronunciation.py +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/test_rank.py +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/test_save_options.py +0 -0
- {theopendictionary-2.0.0 → theopendictionary-2.1.0}/python/tests/test_tokenize.py +0 -0
|
@@ -592,9 +592,9 @@ dependencies = [
|
|
|
592
592
|
|
|
593
593
|
[[package]]
|
|
594
594
|
name = "clap"
|
|
595
|
-
version = "4.5.
|
|
595
|
+
version = "4.5.50"
|
|
596
596
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
597
|
-
checksum = "
|
|
597
|
+
checksum = "0c2cfd7bf8a6017ddaa4e32ffe7403d547790db06bd171c1c53926faab501623"
|
|
598
598
|
dependencies = [
|
|
599
599
|
"clap_builder",
|
|
600
600
|
"clap_derive",
|
|
@@ -602,9 +602,9 @@ dependencies = [
|
|
|
602
602
|
|
|
603
603
|
[[package]]
|
|
604
604
|
name = "clap_builder"
|
|
605
|
-
version = "4.5.
|
|
605
|
+
version = "4.5.50"
|
|
606
606
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
607
|
-
checksum = "
|
|
607
|
+
checksum = "0a4c05b9e80c5ccd3a7ef080ad7b6ba7d6fc00a985b8b157197075677c82c7a0"
|
|
608
608
|
dependencies = [
|
|
609
609
|
"anstream",
|
|
610
610
|
"anstyle",
|
|
@@ -1212,7 +1212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
1212
1212
|
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
|
|
1213
1213
|
dependencies = [
|
|
1214
1214
|
"libc",
|
|
1215
|
-
"windows-sys 0.
|
|
1215
|
+
"windows-sys 0.52.0",
|
|
1216
1216
|
]
|
|
1217
1217
|
|
|
1218
1218
|
[[package]]
|
|
@@ -2098,7 +2098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
2098
2098
|
checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667"
|
|
2099
2099
|
dependencies = [
|
|
2100
2100
|
"cfg-if",
|
|
2101
|
-
"windows-targets 0.
|
|
2101
|
+
"windows-targets 0.52.6",
|
|
2102
2102
|
]
|
|
2103
2103
|
|
|
2104
2104
|
[[package]]
|
|
@@ -2553,7 +2553,7 @@ dependencies = [
|
|
|
2553
2553
|
|
|
2554
2554
|
[[package]]
|
|
2555
2555
|
name = "odict"
|
|
2556
|
-
version = "3.
|
|
2556
|
+
version = "3.1.0"
|
|
2557
2557
|
dependencies = [
|
|
2558
2558
|
"brotli",
|
|
2559
2559
|
"byteorder",
|
|
@@ -2587,7 +2587,7 @@ dependencies = [
|
|
|
2587
2587
|
|
|
2588
2588
|
[[package]]
|
|
2589
2589
|
name = "odict-cli"
|
|
2590
|
-
version = "3.
|
|
2590
|
+
version = "3.1.0"
|
|
2591
2591
|
dependencies = [
|
|
2592
2592
|
"actix-web",
|
|
2593
2593
|
"anyhow",
|
|
@@ -2620,7 +2620,7 @@ dependencies = [
|
|
|
2620
2620
|
|
|
2621
2621
|
[[package]]
|
|
2622
2622
|
name = "odict_python"
|
|
2623
|
-
version = "2.
|
|
2623
|
+
version = "2.1.0"
|
|
2624
2624
|
dependencies = [
|
|
2625
2625
|
"either",
|
|
2626
2626
|
"internal",
|
|
@@ -3101,7 +3101,7 @@ dependencies = [
|
|
|
3101
3101
|
"once_cell",
|
|
3102
3102
|
"socket2 0.5.10",
|
|
3103
3103
|
"tracing",
|
|
3104
|
-
"windows-sys 0.
|
|
3104
|
+
"windows-sys 0.52.0",
|
|
3105
3105
|
]
|
|
3106
3106
|
|
|
3107
3107
|
[[package]]
|
|
@@ -3454,7 +3454,7 @@ dependencies = [
|
|
|
3454
3454
|
"errno",
|
|
3455
3455
|
"libc",
|
|
3456
3456
|
"linux-raw-sys",
|
|
3457
|
-
"windows-sys 0.
|
|
3457
|
+
"windows-sys 0.52.0",
|
|
3458
3458
|
]
|
|
3459
3459
|
|
|
3460
3460
|
[[package]]
|
|
@@ -4573,7 +4573,7 @@ version = "0.1.10"
|
|
|
4573
4573
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
4574
4574
|
checksum = "0978bf7171b3d90bac376700cb56d606feb40f251a475a5d6634613564460b22"
|
|
4575
4575
|
dependencies = [
|
|
4576
|
-
"windows-sys 0.
|
|
4576
|
+
"windows-sys 0.52.0",
|
|
4577
4577
|
]
|
|
4578
4578
|
|
|
4579
4579
|
[[package]]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: theopendictionary
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
use odict::{
|
|
2
|
+
OpenDictionary,
|
|
3
|
+
alias::{AliasManager, AliasOptions},
|
|
4
|
+
remote::RemoteOptions,
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
pub struct LoadDictionaryOptions<'a> {
|
|
8
|
+
alias_options: odict::alias::AliasOptions,
|
|
9
|
+
remote_options: odict::remote::RemoteOptions<'a>,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl<'a> Default for LoadDictionaryOptions<'a> {
|
|
13
|
+
fn default() -> Self {
|
|
14
|
+
LoadDictionaryOptions {
|
|
15
|
+
alias_options: AliasOptions::default(),
|
|
16
|
+
remote_options: RemoteOptions::default(),
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
impl<'a> LoadDictionaryOptions<'a> {
|
|
22
|
+
pub fn with_alias_manager(mut self, manager: AliasManager) -> Self {
|
|
23
|
+
self.alias_options = AliasOptions::default().with_manager(manager);
|
|
24
|
+
self
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
pub fn with_remote_options(mut self, options: RemoteOptions<'a>) -> Self {
|
|
28
|
+
self.remote_options = options;
|
|
29
|
+
self
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pub async fn load_dictionary_with_options<'a>(
|
|
34
|
+
name: &str,
|
|
35
|
+
options: LoadDictionaryOptions<'a>,
|
|
36
|
+
) -> odict::Result<OpenDictionary> {
|
|
37
|
+
// Attempt to load first from the remote if the request matches the regex
|
|
38
|
+
match OpenDictionary::from_remote_with_options(name, options.remote_options).await {
|
|
39
|
+
Ok(dictionary) => Ok(dictionary),
|
|
40
|
+
// If the name is invalid, try loading from an alias
|
|
41
|
+
Err(odict::Error::InvalidDictionaryName(_)) => {
|
|
42
|
+
match OpenDictionary::from_alias_with_options(name, options.alias_options) {
|
|
43
|
+
Ok(dictionary) => Ok(dictionary),
|
|
44
|
+
// If no alias found, try loading from path
|
|
45
|
+
Err(odict::Error::AliasNotFound(_)) => OpenDictionary::from_path(name),
|
|
46
|
+
Err(e) => Err(e),
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
Err(e) => Err(e),
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
pub async fn load_dictionary(name: &str) -> odict::Result<OpenDictionary> {
|
|
54
|
+
load_dictionary_with_options(name, LoadDictionaryOptions::default()).await
|
|
55
|
+
}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.1.0](https://github.com/TheOpenDictionary/odict/compare/lib/v3.0.0...lib/v3.1.0) (2025-10-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Allow passing remote load options to Node and Python ([#1315](https://github.com/TheOpenDictionary/odict/issues/1315)) ([80a8361](https://github.com/TheOpenDictionary/odict/commit/80a8361e1cff88bffb5bf36cb354ca04ad89a343))
|
|
9
|
+
* Remove backwards compatibility for legacy follow for Node and Python ([#1308](https://github.com/TheOpenDictionary/odict/issues/1308)) ([785fac5](https://github.com/TheOpenDictionary/odict/commit/785fac54001df45841fa18d0c6822e36a337b5ec))
|
|
10
|
+
* Remove backwards compatibility for legacy follow for Node and Python ([#1310](https://github.com/TheOpenDictionary/odict/issues/1310)) ([2efe45d](https://github.com/TheOpenDictionary/odict/commit/2efe45d44babc1357bd10650360b4edd671513dd))
|
|
11
|
+
* String interning ([#1313](https://github.com/TheOpenDictionary/odict/issues/1313)) ([a1ce402](https://github.com/TheOpenDictionary/odict/commit/a1ce4025950f840674e1e4e159b60311672febc2))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* Inline interning library ([5833965](https://github.com/TheOpenDictionary/odict/commit/583396596017cc2a979d45de3237885671c136e7))
|
|
17
|
+
|
|
3
18
|
## [3.0.0](https://github.com/TheOpenDictionary/odict/compare/lib/v2.9.1...lib/v3.0.0) (2025-10-17)
|
|
4
19
|
|
|
5
20
|
|
|
@@ -3,7 +3,7 @@ name = "odict"
|
|
|
3
3
|
description = "A blazingly-fast dictionary file format for human languages"
|
|
4
4
|
homepage = "https://odict.org"
|
|
5
5
|
repository = "https://github.com/TheOpenDictionary/odict"
|
|
6
|
-
version = "3.
|
|
6
|
+
version = "3.1.0"
|
|
7
7
|
edition = "2021"
|
|
8
8
|
license = "MIT"
|
|
9
9
|
exclude = ["benches/*", "tests/*"]
|
|
@@ -77,6 +77,7 @@ reqwest = { version = "0.12.24", optional = true, default-features = false, feat
|
|
|
77
77
|
"http2",
|
|
78
78
|
"stream",
|
|
79
79
|
] }
|
|
80
|
+
strum = { version = "0.27.2", features = ["derive"] }
|
|
80
81
|
reqwest-middleware = { version = "0.4.2", optional = true }
|
|
81
82
|
reqwest-retry = { version = "0.7.0", optional = true }
|
|
82
83
|
futures-util = { version = "0.3", optional = true }
|
|
@@ -87,7 +88,7 @@ tantivy = { version = "0.25.0", optional = true }
|
|
|
87
88
|
dirs = { version = "6.0.0", optional = true }
|
|
88
89
|
# feature=sql
|
|
89
90
|
sea-query = { version = "0.32.7", optional = true }
|
|
90
|
-
|
|
91
|
+
|
|
91
92
|
|
|
92
93
|
[dev-dependencies]
|
|
93
94
|
criterion = { version = "0.7.0", features = ["async_tokio", "html_reports"] }
|
|
@@ -13,7 +13,6 @@ pub enum LookupStrategy {
|
|
|
13
13
|
#[derive(Debug, Clone)]
|
|
14
14
|
pub struct LookupOptions {
|
|
15
15
|
/// Whether to follow see_also links until finding an entry with etymologies.
|
|
16
|
-
/// true means follow redirects until etymology found, false means no following.
|
|
17
16
|
pub follow: bool,
|
|
18
17
|
pub strategy: LookupStrategy,
|
|
19
18
|
pub insensitive: bool,
|
|
@@ -118,7 +117,6 @@ macro_rules! lookup {
|
|
|
118
117
|
|
|
119
118
|
// Only try lowercase if it's different from the original query
|
|
120
119
|
if query_lower != query {
|
|
121
|
-
// Try direct lookup with lowercase (keep insensitive flag for redirect following)
|
|
122
120
|
if let Ok($opt::Some(result)) =
|
|
123
121
|
self.find_entry(follow, insensitive, &query_lower, directed_from, path)
|
|
124
122
|
{
|
|
@@ -150,51 +148,52 @@ macro_rules! lookup {
|
|
|
150
148
|
|
|
151
149
|
let mut path = Vec::new();
|
|
152
150
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if let LookupStrategy::Split(min_length) = strategy {
|
|
159
|
-
let chars: Vec<_> = query.chars().collect();
|
|
160
|
-
let mut start = 0;
|
|
161
|
-
let mut end = chars.len();
|
|
162
|
-
|
|
163
|
-
while start < end {
|
|
164
|
-
let substr: String = chars[start..end].iter().collect();
|
|
165
|
-
let mut substr_path = Vec::new();
|
|
166
|
-
let maybe_entry = self.find_entry(
|
|
167
|
-
follow,
|
|
168
|
-
insensitive,
|
|
169
|
-
substr.as_str(),
|
|
170
|
-
None,
|
|
171
|
-
&mut substr_path,
|
|
172
|
-
);
|
|
151
|
+
if let $opt::Some(result) =
|
|
152
|
+
self.find_entry(follow, insensitive, query, None, &mut path)?
|
|
153
|
+
{
|
|
154
|
+
return Ok(vec![result]);
|
|
155
|
+
}
|
|
173
156
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
157
|
+
let mut results: Vec<LookupResult<&$ret>> = Vec::new();
|
|
158
|
+
|
|
159
|
+
if let LookupStrategy::Split(min_length) = strategy {
|
|
160
|
+
let chars: Vec<_> = query.chars().collect();
|
|
161
|
+
let mut start = 0;
|
|
162
|
+
let mut end = chars.len();
|
|
163
|
+
|
|
164
|
+
while start < end {
|
|
165
|
+
let substr: String = chars[start..end].iter().collect();
|
|
166
|
+
let mut substr_path = Vec::new();
|
|
167
|
+
let maybe_entry = self.find_entry(
|
|
168
|
+
follow,
|
|
169
|
+
insensitive,
|
|
170
|
+
substr.as_str(),
|
|
171
|
+
None,
|
|
172
|
+
&mut substr_path,
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
match maybe_entry {
|
|
176
|
+
Ok($opt::Some(result)) => {
|
|
177
|
+
results.push(result);
|
|
178
|
+
start = end;
|
|
179
|
+
end = chars.len();
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
Ok($opt::None) => {
|
|
183
|
+
if substr.len() <= *min_length {
|
|
184
|
+
start = end;
|
|
185
|
+
end = chars.len();
|
|
186
|
+
continue;
|
|
189
187
|
}
|
|
190
|
-
|
|
191
|
-
end -= 1;
|
|
192
188
|
}
|
|
189
|
+
Err(e) => return Err(e),
|
|
193
190
|
}
|
|
194
191
|
|
|
195
|
-
|
|
192
|
+
end -= 1;
|
|
196
193
|
}
|
|
197
|
-
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
Ok(results)
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
pub fn lookup<'a, 'b, Query, Options>(
|
|
@@ -235,7 +235,7 @@ mod tests {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
#[tokio::test]
|
|
238
|
-
async fn
|
|
238
|
+
async fn test_download_caching_enabled() {
|
|
239
239
|
let mock_server = MockServer::start().await;
|
|
240
240
|
let test_data = b"cached dictionary data";
|
|
241
241
|
|
|
@@ -267,7 +267,7 @@ mod tests {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
#[tokio::test]
|
|
270
|
-
async fn
|
|
270
|
+
async fn test_download_caching_disabled() {
|
|
271
271
|
let mock_server = MockServer::start().await;
|
|
272
272
|
let test_data = b"non-cached dictionary data";
|
|
273
273
|
|
|
@@ -3,10 +3,8 @@ use crate::error::Result;
|
|
|
3
3
|
mod download;
|
|
4
4
|
mod metadata;
|
|
5
5
|
mod options;
|
|
6
|
-
mod remote;
|
|
7
6
|
mod utils;
|
|
8
7
|
|
|
9
8
|
pub use download::DictionaryDownloader;
|
|
10
9
|
pub use options::DownloadOptions;
|
|
11
|
-
pub use remote::*;
|
|
12
10
|
pub use utils::{classify_reqwest_error, parse_remote_dictionary_name, NetworkError};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
extern crate alloc;
|
|
2
|
+
|
|
3
|
+
use alloc::borrow::ToOwned;
|
|
4
|
+
use core::{borrow::Borrow, error::Error, fmt, hash::Hash};
|
|
5
|
+
use std::collections::HashMap;
|
|
6
|
+
|
|
7
|
+
use rkyv::{
|
|
8
|
+
rancor::{fail, Source},
|
|
9
|
+
ser::sharing::SharingState,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
use super::Interning;
|
|
13
|
+
|
|
14
|
+
/// A general-purpose value interner.
|
|
15
|
+
pub struct Interner<T> {
|
|
16
|
+
value_to_pos: HashMap<T, Option<usize>>,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl<T> Interner<T> {
|
|
20
|
+
/// Returns a new, empty interner.
|
|
21
|
+
pub fn new() -> Self {
|
|
22
|
+
Self {
|
|
23
|
+
value_to_pos: HashMap::new(),
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
impl<T> Default for Interner<T> {
|
|
29
|
+
fn default() -> Self {
|
|
30
|
+
Self::new()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#[derive(Debug)]
|
|
35
|
+
struct NotStarted;
|
|
36
|
+
|
|
37
|
+
impl fmt::Display for NotStarted {
|
|
38
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
39
|
+
write!(f, "value was not started interning")
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
impl Error for NotStarted {}
|
|
44
|
+
|
|
45
|
+
#[derive(Debug)]
|
|
46
|
+
struct AlreadyFinished;
|
|
47
|
+
|
|
48
|
+
impl fmt::Display for AlreadyFinished {
|
|
49
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
50
|
+
write!(f, "value was already finished interning")
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
impl Error for AlreadyFinished {}
|
|
55
|
+
|
|
56
|
+
impl<T, E> Interning<T, E> for Interner<T::Owned>
|
|
57
|
+
where
|
|
58
|
+
T::Owned: Hash + Eq + Borrow<T>,
|
|
59
|
+
T: Hash + Eq + ToOwned + ?Sized,
|
|
60
|
+
E: Source,
|
|
61
|
+
{
|
|
62
|
+
fn start_interning(&mut self, value: &T) -> SharingState {
|
|
63
|
+
match self.value_to_pos.get(value) {
|
|
64
|
+
None => {
|
|
65
|
+
self.value_to_pos.insert(value.to_owned(), None);
|
|
66
|
+
SharingState::Started
|
|
67
|
+
}
|
|
68
|
+
Some(None) => SharingState::Pending,
|
|
69
|
+
Some(Some(pos)) => SharingState::Finished(*pos),
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
fn finish_interning(&mut self, value: &T, pos: usize) -> Result<(), E> {
|
|
74
|
+
match self.value_to_pos.get_mut(value) {
|
|
75
|
+
None => fail!(NotStarted),
|
|
76
|
+
Some(Some(_)) => fail!(AlreadyFinished),
|
|
77
|
+
Some(x) => {
|
|
78
|
+
*x = Some(pos);
|
|
79
|
+
Ok(())
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|