blitztext 0.2.0__tar.gz → 0.2.1__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.
- {blitztext-0.2.0 → blitztext-0.2.1}/Cargo.lock +1 -1
- {blitztext-0.2.0 → blitztext-0.2.1}/Cargo.toml +1 -1
- {blitztext-0.2.0 → blitztext-0.2.1}/PKG-INFO +1 -1
- {blitztext-0.2.0 → blitztext-0.2.1}/src/keyword_processor.rs +13 -2
- {blitztext-0.2.0 → blitztext-0.2.1}/.github/workflows/CI.yml +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/.gitignore +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/LICENSE +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/README.md +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/benches/benchmark.py +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/benches/benchmark.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/benches/benchmark_full.py +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/benches/benchmark_results.md +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/benches/benchmark_results_multi.png +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/benches/benchmark_results_single.png +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/blitztext.pyi +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/examples/basic_usage.py +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/examples/basic_usage.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/pyproject.toml +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/src/bin/manual_benchmark.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/src/char_set.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/src/compiled_trie.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/src/fuzzy.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/src/lib.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/src/trie.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/src/utils.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/tests/integration_test.rs +0 -0
- {blitztext-0.2.0 → blitztext-0.2.1}/tests/test_python_api.py +0 -0
|
@@ -26,7 +26,7 @@ pub struct KeywordProcessor {
|
|
|
26
26
|
/// Faster read-only copy of `root`, dropped when keywords change.
|
|
27
27
|
#[serde(skip)]
|
|
28
28
|
compiled: OnceLock<CompiledTrie>,
|
|
29
|
-
/// Number of nodes in `root
|
|
29
|
+
/// Number of nodes in `root`, kept current by add and remove; counted once after deserializing.
|
|
30
30
|
#[serde(skip)]
|
|
31
31
|
node_count: OnceLock<usize>,
|
|
32
32
|
/// Matching work done with `root` since keywords last changed, in text bytes.
|
|
@@ -84,7 +84,7 @@ impl KeywordProcessor {
|
|
|
84
84
|
case_sensitive,
|
|
85
85
|
allow_overlaps,
|
|
86
86
|
compiled: OnceLock::new(),
|
|
87
|
-
node_count: OnceLock::
|
|
87
|
+
node_count: OnceLock::from(1),
|
|
88
88
|
work_since_change: AtomicUsize::new(0),
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -1594,6 +1594,17 @@ mod tests {
|
|
|
1594
1594
|
assert_eq!(kp.replace_keywords("İstanbul istanbul", None), "İstanbul IST");
|
|
1595
1595
|
}
|
|
1596
1596
|
|
|
1597
|
+
#[test]
|
|
1598
|
+
fn node_count_stays_exact_through_adds_and_removes() {
|
|
1599
|
+
let mut kp = KeywordProcessor::new();
|
|
1600
|
+
for keyword in ["rust", "rusty", "go", "café"] {
|
|
1601
|
+
kp.add_keyword(keyword, None);
|
|
1602
|
+
}
|
|
1603
|
+
kp.remove_keyword("rusty");
|
|
1604
|
+
kp.remove_keyword("go");
|
|
1605
|
+
assert_eq!(kp.node_count.get(), Some(&kp.root.count_nodes()));
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1597
1608
|
#[test]
|
|
1598
1609
|
fn non_ascii_keywords_can_be_listed_looked_up_and_removed() {
|
|
1599
1610
|
let mut kp = KeywordProcessor::new();
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|