参考文献格式

This commit is contained in:
wangjinlei
2026-08-06 17:19:40 +08:00
parent 16961465ac
commit 32b3233378

View File

@@ -143,7 +143,11 @@ class ReferenceTypeClassifier
$hasDoi = (bool)preg_match('/\bdoi:\s*10\./i', $text) || (bool)preg_match('#doi\.org/#i', $text);
$hasUrl = (bool)preg_match('#https?://#i', $text);
// 期刊卷期页结构,如 2020;382(8):727-733 或 2020;10:100
$hasJournalVol = (bool)preg_match('/\b(19|20)\d{2}\s*[;:]\s*\d+\s*(\(\d+\))?\s*:\s*[A-Za-z]?\d+/', $text);
// 年份与卷号之间容忍多余标点与全角符号(作者原文常见 "2026;, 44(5): 24-31"
$hasJournalVol = (bool)preg_match(
'/\b(19|20)\d{2}[\s;:,]+\d+\s*(\(\s*[^)]{1,12}\))?\s*[:]\s*[A-Za-z]?\d+/u',
$text
);
// 1) 学位论文
if (preg_match('/\[(ph\.?d\.?|master(\'s)?|doctoral|masters)?\s*(thesis|dissertation)\]/i', $text)
@@ -161,11 +165,13 @@ class ReferenceTypeClassifier
}
// 3) 网页 / 在线资源
if (preg_match('/\[(internet|online)\]/i', $text)
// "Available at:"/"Accessed" 同样出现在带 DOI 的期刊著录里(本系统自己的输出就带这个后缀),
// 故这些短语只在既无 DOI 也无卷期页结构时才作为网页依据
$hasWebPhrase = preg_match('/\[(internet|online)\]/i', $text)
|| preg_match('/\baccessed\b/i', $text)
|| preg_match('/\bavailable\s+(from|at)\b/i', $text)
|| preg_match('/\bcited\s+(19|20)\d{2}/i', $text)
|| ($hasUrl && !$hasDoi && !$hasJournalVol)) {
|| preg_match('/\bcited\s+(19|20)\d{2}/i', $text);
if (($hasWebPhrase || $hasUrl) && !$hasDoi && !$hasJournalVol) {
return ['type' => self::TYPE_WEB, 'confidence' => 0.8];
}