From b39957e9a6d738c4b00f3fa645da971ad426ec21 Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 16 Apr 2024 21:02:00 +0800 Subject: [PATCH] Make derive_builder optional --- Cargo.toml | 6 +++--- src/keywords/mod.rs | 1 + src/lib.rs | 4 ---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7e338ce..c29649c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ required-features = ["tfidf", "textrank"] [dependencies] cedarwood = "0.4" -derive_builder = "0.20.0" +derive_builder = { version = "0.20.0", optional = true } fxhash = "0.2.1" lazy_static = "1.0" ordered-float = { version = "4.0", optional = true } @@ -41,8 +41,8 @@ phf_codegen = "0.11" [features] default = ["default-dict"] default-dict = [] -tfidf = ["ordered-float"] -textrank = ["ordered-float"] +tfidf = ["dep:ordered-float", "dep:derive_builder"] +textrank = ["dep:ordered-float", "dep:derive_builder"] [workspace] members = [ diff --git a/src/keywords/mod.rs b/src/keywords/mod.rs index 938fea1..73b77cc 100644 --- a/src/keywords/mod.rs +++ b/src/keywords/mod.rs @@ -1,3 +1,4 @@ +use derive_builder::Builder; use lazy_static::lazy_static; use std::collections::BTreeSet; diff --git a/src/lib.rs b/src/lib.rs index 63a90cd..956554c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,10 +90,6 @@ pub use crate::keywords::tfidf::TfIdf; #[cfg(any(feature = "tfidf", feature = "textrank"))] pub use crate::keywords::{Keyword, KeywordExtract, KeywordExtractConfig, DEFAULT_STOP_WORDS}; -#[cfg(any(feature = "tfidf", feature = "textrank"))] -#[macro_use] -extern crate derive_builder; - mod errors; mod hmm; #[cfg(any(feature = "tfidf", feature = "textrank"))]