pub struct ExtractorConfig {
pub score_threshold: f32,
pub cluster_depth: usize,
pub cluster_min_size: usize,
pub min_text_len: usize,
pub use_url_rule: bool,
pub non_article_paths: Vec<String>,
}Expand description
提取器配置,按需调整以适配不同站点。
§默认值
| 字段 | 默认值 | 说明 |
|---|---|---|
score_threshold | 1.5 | 低于此分的链接会被过滤 |
cluster_depth | 4 | DOM 路径签名向上遍历层数 |
cluster_min_size | 4 | 聚类大小 >= 此值视为强信号 |
min_text_len | 8 | 锚文本短于此值扣分 |
use_url_rule | true | 是否开启 UrlRule 辅助信号 |
non_article_paths | 24 条默认路径 | 含 /people/、/about/ 等 |
use crawlkit_parser::ExtractorConfig;
// 低阈值模式:捕获更多候选链接
let config = ExtractorConfig {
score_threshold: 0.5,
min_text_len: 4,
..ExtractorConfig::default()
};
// 严格模式:只保留高置信度链接
let strict = ExtractorConfig {
score_threshold: 3.0,
cluster_min_size: 6,
..ExtractorConfig::default()
};Fields§
§score_threshold: f32最终判定为“文章链接“的分数阈值
cluster_depth: usize向上查找父节点计算路径签名的层数(越大越精细,但也越容易把 结构略有差异的同类项拆散)
cluster_min_size: usize一个聚类至少要有多少条链接,才被视为“列表结构“强信号
min_text_len: usize锚文本短于此长度的链接会被判定为可能是导航/按钮而非标题
use_url_rule: bool是否叠加 UrlRule 的正则规则作为附加信号
non_article_paths: Vec<String>URL 路径关键词惩罚列表(如 /people/ /about/),可追加站点自定义路径
Trait Implementations§
Source§impl Clone for ExtractorConfig
impl Clone for ExtractorConfig
Source§fn clone(&self) -> ExtractorConfig
fn clone(&self) -> ExtractorConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExtractorConfig
impl Debug for ExtractorConfig
Auto Trait Implementations§
impl Freeze for ExtractorConfig
impl RefUnwindSafe for ExtractorConfig
impl Send for ExtractorConfig
impl Sync for ExtractorConfig
impl Unpin for ExtractorConfig
impl UnsafeUnpin for ExtractorConfig
impl UnwindSafe for ExtractorConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more