Skip to content

Commit 3bde20c

Browse files
authored
refactor: project structure (#130)
Signed-off-by: tison <wander4096@gmail.com>
1 parent 3f79e15 commit 3bde20c

File tree

18 files changed

+90
-76
lines changed

18 files changed

+90
-76
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ jobs:
3131
- name: Cache cargo build
3232
uses: Swatinem/rust-cache@v2
3333
- name: Check build with --no-default-features
34-
run: cargo build --no-default-features
34+
run: cargo build --workspace --no-default-features
3535
- name: Check build with default features
36-
run: cargo build
36+
run: cargo build --workspace
3737
- name: Check build with tfidf feature
38-
run: cargo build --features tfidf
38+
run: cargo build --workspace --features tfidf
3939
- name: Check build with textrank feature
40-
run: cargo build --features textrank
40+
run: cargo build --workspace --features textrank
4141
- name: Test
42-
run: cargo test --all-features --all --benches
42+
run: cargo test --workspace --all-features --all --benches
4343

4444
codecov:
4545
name: Code Coverage

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
2-
target
3-
Cargo.lock
4-
**/*.rs.bk
1+
/target
2+
/Cargo.lock

Cargo.toml

Lines changed: 20 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,28 @@
1-
[package]
2-
name = "jieba-rs"
3-
version = "0.8.0"
4-
authors = ["messense <messense@icloud.com>", "Paul Meng <me@paulme.ng>"]
5-
categories = ["text-processing"]
6-
description = "The Jieba Chinese Word Segmentation Implemented in Rust"
7-
keywords = ["nlp", "chinese", "segmenation"]
8-
license = "MIT"
9-
readme = "README.md"
10-
repository = "https://github.com/messense/jieba-rs"
11-
edition.workspace = true
12-
13-
[package.metadata.docs.rs]
14-
all-features = true
15-
16-
[dev-dependencies]
17-
codspeed-criterion-compat = { workspace = true }
18-
wasm-bindgen-test = { workspace = true }
19-
rayon = { workspace = true }
20-
21-
[target.'cfg(unix)'.dev-dependencies]
22-
tikv-jemallocator = "0.6.0"
23-
24-
[[bench]]
25-
name = "jieba_benchmark"
26-
harness = false
27-
required-features = ["tfidf", "textrank"]
28-
29-
[dependencies]
30-
jieba-macros = { workspace = true }
31-
cedarwood = { workspace = true }
32-
derive_builder = { workspace = true, optional = true }
33-
fxhash = { workspace = true }
34-
include-flate = { workspace = true }
35-
ordered-float = { workspace = true, optional = true }
36-
phf = { workspace = true }
37-
regex = { workspace = true }
38-
39-
[features]
40-
default = ["default-dict"]
41-
default-dict = []
42-
tfidf = ["dep:ordered-float", "dep:derive_builder"]
43-
textrank = ["dep:ordered-float", "dep:derive_builder"]
44-
451
[workspace]
462
resolver = "3"
47-
members = [".", "capi", "jieba-macros", "examples/weicheng"]
3+
members = ["capi", "jieba", "jieba-macros", "examples/weicheng"]
484

495
[workspace.package]
506
edition = "2024"
7+
license = "MIT"
8+
readme = "README.md"
9+
repository = "https://github.com/messense/jieba-rs"
5110

5211
[workspace.dependencies]
53-
c_fixed_string = "0.2.0"
54-
cedarwood = "0.4"
55-
codspeed-criterion-compat = "3.0.4"
56-
derive_builder = "0.20.0"
57-
fxhash = "0.2.1"
58-
include-flate = "0.3.0"
12+
# Workspace dependencies
13+
jieba-rs = { version = "0.8.0", path = "jieba" }
5914
jieba-macros = { version = "0.8.0", path = "jieba-macros" }
60-
ordered-float = "5.0"
61-
phf = "0.12.1"
62-
phf_codegen = "0.12.1"
63-
rayon = "1.10"
64-
regex = "1.11.1"
65-
wasm-bindgen-test = "0.3.0"
15+
16+
# Crates.io dependencies
17+
c_fixed_string = { version = "0.2" }
18+
cedarwood = { version = "0.4" }
19+
codspeed-criterion-compat = { version = "3.0.4" }
20+
derive_builder = { version = "0.20.0" }
21+
fxhash = { version = "0.2.1" }
22+
include-flate = { version = "0.3.0" }
23+
ordered-float = { version = "5.0" }
24+
phf = { version = "0.12.1" }
25+
phf_codegen = { version = "0.12.1" }
26+
rayon = { version = "1.10" }
27+
regex = { version = "1.11.1" }
28+
wasm-bindgen-test = { version = "0.3.0" }

capi/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
[package]
22
name = "jieba-capi"
33
version = "0.1.0"
4-
authors = ["messense <messense@icloud.com>"]
4+
55
edition.workspace = true
6+
license.workspace = true
7+
readme.workspace = true
8+
repository.workspace = true
69

710
[dependencies]
8-
jieba-rs = { version = "0.8.0", path = "../", features = ["textrank", "tfidf"] }
11+
jieba-rs = { version = "0.8.0", workspace = true, features = [
12+
"textrank",
13+
"tfidf",
14+
] }
915
c_fixed_string = { workspace = true }
1016

1117
[lib]

examples/weicheng/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[package]
22
name = "weicheng"
3+
publish = false
34
version = "0.1.0"
4-
authors = ["messense <messense@icloud.com>"]
5+
56
edition.workspace = true
67

78
[dependencies]
8-
jieba-rs = { path = "../.." }
9+
jieba-rs = { workspace = true }
910

1011
[target.'cfg(unix)'.dependencies]
1112
tikv-jemallocator = "0.6.0"

jieba-macros/Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
[package]
22
name = "jieba-macros"
33
version = "0.8.0"
4+
45
categories = ["text-processing"]
5-
description = "jieba-rs proc-macro"
6-
keywords = ["nlp", "chinese", "segmenation"]
7-
license = "MIT"
8-
readme = "../README.md"
9-
repository = "https://github.com/messense/jieba-rs"
6+
description = "Collections of proc-macro for jieba-rs"
7+
keywords = ["nlp", "chinese", "segmentation"]
8+
109
edition.workspace = true
10+
license.workspace = true
11+
readme.workspace = true
12+
repository.workspace = true
1113

1214
[lib]
1315
proc-macro = true

jieba/Cargo.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[package]
2+
name = "jieba-rs"
3+
version = "0.8.0"
4+
5+
categories = ["text-processing"]
6+
description = "Jieba Chinese Word Segmentation in Rust"
7+
keywords = ["nlp", "chinese", "segmentation"]
8+
9+
edition.workspace = true
10+
license.workspace = true
11+
readme.workspace = true
12+
repository.workspace = true
13+
14+
[package.metadata.docs.rs]
15+
all-features = true
16+
17+
[features]
18+
default = ["default-dict"]
19+
default-dict = []
20+
tfidf = ["dep:ordered-float", "dep:derive_builder"]
21+
textrank = ["dep:ordered-float", "dep:derive_builder"]
22+
23+
[dependencies]
24+
jieba-macros = { workspace = true }
25+
cedarwood = { workspace = true }
26+
derive_builder = { workspace = true, optional = true }
27+
fxhash = { workspace = true }
28+
include-flate = { workspace = true }
29+
ordered-float = { workspace = true, optional = true }
30+
phf = { workspace = true }
31+
regex = { workspace = true }
32+
33+
[dev-dependencies]
34+
codspeed-criterion-compat = { workspace = true }
35+
wasm-bindgen-test = { workspace = true }
36+
rayon = { workspace = true }
37+
38+
[target.'cfg(unix)'.dev-dependencies]
39+
tikv-jemallocator = "0.6.0"
40+
41+
[[bench]]
42+
name = "jieba_benchmark"
43+
harness = false
44+
required-features = ["tfidf", "textrank"]
File renamed without changes.

0 commit comments

Comments
 (0)