参考文献模型校对换阿里云百炼,完善各种校对细节

This commit is contained in:
wyn
2026-08-06 10:14:36 +08:00
parent f4ebd10bfa
commit bffac7755d
7 changed files with 1551 additions and 135 deletions

View File

@@ -22,6 +22,8 @@ class ReferenceLiteratureFetchService
private $cmaJournal;
/** @var ReferenceCheckService */
private $refUtil;
/** @var \app\common\service\BibliographicMetaService */
private $bibMeta;
/** @var bool 预抓取阶段暂不调用 Yiigle 机构 API */
private $skipYiigle = false;
@@ -39,6 +41,7 @@ class ReferenceLiteratureFetchService
$this->unpaywall = new UnpaywallService();
$this->cmaJournal = new CmaJournalLiteratureService();
$this->refUtil = new ReferenceCheckService();
$this->bibMeta = new \app\common\service\BibliographicMetaService();
}
public function setSkipYiigle($skip = true)
@@ -304,6 +307,8 @@ class ReferenceLiteratureFetchService
$fetchLogs = [];
$pdfUrl = '';
$meshTerms = [];
$language = '';
$country = '';
// 0) 中华医学会期刊 DOIOpenAlex 中文摘要(可选 Yiigle 机构 API
if (CmaJournalLiteratureService::isCmaJournalDoi($doi)) {
@@ -380,6 +385,16 @@ class ReferenceLiteratureFetchService
if (!empty($pub['mesh_terms']) && is_array($pub['mesh_terms'])) {
$meshTerms = array_values(array_unique(array_merge($meshTerms, $pub['mesh_terms'])));
}
if ($language === '' && trim((string)($pub['language'] ?? '')) !== '') {
$language = strtolower(trim((string)$pub['language']));
}
if ($country === '') {
// 研究开展国以作者单位为准,期刊出版国只作兜底
$country = $this->bibMeta->detectCountry((array)($pub['affiliations'] ?? []));
if ($country === '' && trim((string)($pub['journal_country'] ?? '')) !== '') {
$country = $this->bibMeta->detectCountry((string)$pub['journal_country']);
}
}
$pubBlock = $this->formatPubmedBlock($pub, $doi);
if ($pubBlock !== '' && $abstract === '') {
$blocks[] = $pubBlock;
@@ -444,6 +459,8 @@ class ReferenceLiteratureFetchService
'raw_content' => $raw,
'pdf_url' => $pdfUrl,
'mesh_terms' => $meshTerms,
'language' => $language,
'country' => $country,
'sources' => array_values(array_unique($sources)),
'fetch_log' => trim('doi=' . $doi . '; sources=' . implode(',', $sources) . ($fetchLogs ? '; ' . implode('; ', $fetchLogs) : '')),
];
@@ -615,6 +632,8 @@ class ReferenceLiteratureFetchService
'raw_content' => '',
'pdf_url' => '',
'mesh_terms' => [],
'language' => '',
'country' => '',
'sources' => [],
'fetch_log' => (string)$reason,
];