update
This commit is contained in:
@@ -225,7 +225,7 @@ fn extract_person_with_jieba(title: &str) -> Option<String> {
|
||||
let word = tag.word.trim();
|
||||
if word.len() < 2 { continue; }
|
||||
|
||||
let priority = match tag.tag.as_str() {
|
||||
let priority = match tag.tag {
|
||||
"nr" => 0, // 人名(最高优先级)
|
||||
"nrfg" => 1, // 古体人名
|
||||
"nrt" => 2, // 音译人名
|
||||
@@ -482,14 +482,14 @@ pub fn extract_person_and_tags(title: &str) -> (Option<String>, Vec<(String, Str
|
||||
}
|
||||
|
||||
/// 从 jieba 分词结果中提取人名
|
||||
fn extract_person_from_tags(tags: &[jieba_rs::Token]) -> Option<String> {
|
||||
fn extract_person_from_tags(tags: &[jieba_rs::Tag]) -> Option<String> {
|
||||
let mut candidates: Vec<(String, usize)> = Vec::new();
|
||||
|
||||
for tag in tags {
|
||||
let word = tag.word.trim();
|
||||
if word.len() < 2 { continue; }
|
||||
|
||||
let priority = match tag.tag.as_str() {
|
||||
let priority = match tag.tag {
|
||||
"nr" => 0, // 人名(最高优先级)
|
||||
"nrfg" => 1, // 古体人名
|
||||
"nrt" => 2, // 音译人名
|
||||
@@ -509,7 +509,7 @@ fn extract_person_from_tags(tags: &[jieba_rs::Token]) -> Option<String> {
|
||||
|
||||
/// 从 jieba 分词结果中提取标签(排除人名)
|
||||
fn extract_tags_from_jieba_result(
|
||||
tags: &[jieba_rs::Token],
|
||||
tags: &[jieba_rs::Tag],
|
||||
person_name: Option<&str>,
|
||||
) -> Vec<(String, String)> {
|
||||
use std::collections::HashSet;
|
||||
@@ -553,7 +553,7 @@ fn extract_tags_from_jieba_result(
|
||||
if !seen.insert(word_lower.clone()) { continue; }
|
||||
|
||||
// 按词性分类
|
||||
let pos = tag.tag.as_str();
|
||||
let pos = tag.tag;
|
||||
let category = match pos {
|
||||
"n" | "ng" => "noun",
|
||||
"nz" => "proper",
|
||||
|
||||
Reference in New Issue
Block a user