Skip to content

Commit

Permalink
version 0.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
blueshen committed Jun 21, 2023
1 parent ab7e3b8 commit b150276
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ik-rs"
version = "0.3.3"
version = "0.3.5"
authors = ["blueshen <zhiyi.shen@gmail.com>"]
license = "LGPL-2.1-only"
categories = ["database-implementations", "data-structures"]
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ mod test {

use [tantivy-ik](https://github.com/blueshen/tantivy-ik) project


# BenchMark

High performance
```shell
cargo bench
ik_tokenize_benchmark time: [19.366 µs 19.572 µs 19.850 µs]
change: [-1.5364% -0.4029% +0.7357%] (p = 0.51 > 0.05)

```
---
Welcome to rust developer and search engine developer join us, and maintain this project together!

Expand Down
8 changes: 4 additions & 4 deletions src/dict/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ impl Dictionary {

#[allow(dead_code)]
pub fn add_words(&mut self, words: Vec<&str>) -> () {
for word in words {
for word in words.iter() {
self.main_dict.insert(word);
}
}

#[allow(dead_code)]
pub fn disable_words(&mut self, words: Vec<&str>) -> () {
for word in words {
for word in words.iter() {
self.main_dict.delete(word);
}
}
Expand Down Expand Up @@ -122,7 +122,7 @@ impl Dictionary {
fn load_ext_dict(&mut self) -> bool {
let ext_dict_files = self.cfg.get_ext_dictionaries();
let mut ret = true;
for ext_dict_file in ext_dict_files {
for ext_dict_file in ext_dict_files.iter() {
if !load(&mut self.main_dict, ext_dict_file.as_str()) {
ret = false;
}
Expand All @@ -133,7 +133,7 @@ impl Dictionary {
fn load_stop_word_dict(&mut self) -> bool {
let ext_stop_word_dict_files = self.cfg.get_ext_stop_word_dictionaries();
let mut ret = true;
for stop_file in ext_stop_word_dict_files {
for stop_file in ext_stop_word_dict_files.iter() {
if !load(&mut self.stop_word_dict, stop_file.as_str()) {
ret = false;
}
Expand Down
6 changes: 3 additions & 3 deletions src/dict/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ impl TrieNode {
}

pub fn is_root(&self) -> bool {
match self.value {
None => true,
Some(_) => false,
if let Some(_) = self.value {
return false;
}
true
}

pub fn has_childs(&self) -> bool {
Expand Down

0 comments on commit b150276

Please sign in to comment.