Changes
This commit is contained in:
@@ -193,7 +193,7 @@ class ReferenceCheckService
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
|
||||
// continue;
|
||||
$this->pushJob(intval($checkId), $delay);
|
||||
$checkIds[] = $checkId;
|
||||
$queued++;
|
||||
@@ -697,20 +697,32 @@ class ReferenceCheckService
|
||||
}
|
||||
|
||||
$hasPriorCiteInParagraph = ($prevTagEnd > $paragraphStart);
|
||||
// 同段后续引用:从上一 <blue> 后开始;段内首个引用:从段落开头到本标签前(非仅最后一句)
|
||||
// 同段后续引用:从上一 <blue> 后开始;段内首个引用:从段落开头到本标签前
|
||||
if ($hasPriorCiteInParagraph) {
|
||||
$localStart = $prevTagEnd;
|
||||
} else {
|
||||
$localStart = $this->capContextStartBeforeTag($content, $tagStart, $paragraphStart);
|
||||
$sentenceStart = $this->findSentenceStart($content, $tagStart);
|
||||
$localStart = $this->capContextStartBeforeTag(
|
||||
$content,
|
||||
$tagStart,
|
||||
max($paragraphStart, $sentenceStart)
|
||||
);
|
||||
}
|
||||
|
||||
// 默认:引用标签前的论述(如 Yin et al. [13] → 含 “higher than … Yin et al.”)
|
||||
// 默认:引用标签前的论述
|
||||
$localEnd = $tagStart;
|
||||
$originalText = $this->buildCitationContextText($content, $localStart, $localEnd);
|
||||
|
||||
// 标签前几乎无正文(如句末 … ICU nurses [14])→ 改用标签后至下一引用或句末
|
||||
// 同句多引(如 …[23] and external environment [24]):上一标签后仅几个词,回退到本句开头
|
||||
if ($hasPriorCiteInParagraph && mb_strlen($originalText) < 50) {
|
||||
$sentenceStart = $this->findSentenceStart($content, $tagStart);
|
||||
$localStart = max($paragraphStart, $sentenceStart);
|
||||
$originalText = $this->buildCitationContextText($content, $localStart, $localEnd);
|
||||
}
|
||||
|
||||
// 仅段内首个引用且标签前极短时才用标签后文(避免 [24] 误截到 [25] 所在句)
|
||||
if (!$this->isMeaningfulCitationContext($originalText)
|
||||
|| $this->shouldUseTrailingCitationContext($content, $localStart, $tagStart, $tagEnd)
|
||||
|| (!$hasPriorCiteInParagraph && $this->shouldUseTrailingCitationContext($content, $localStart, $tagStart, $tagEnd))
|
||||
) {
|
||||
$trailEnd = ($nextTagStart < $sentenceEnd) ? $nextTagStart : $sentenceEnd;
|
||||
$trailText = $this->buildCitationContextText($content, $tagEnd, $trailEnd);
|
||||
@@ -811,6 +823,7 @@ class ReferenceCheckService
|
||||
$text = trim(strip_tags($text));
|
||||
$text = preg_replace('/\s+/u', ' ', $text);
|
||||
$text = ltrim($text, "\xEF\xBB\xBF");
|
||||
$text = preg_replace('/^[\s.,。;、:!?]+/u', '', $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user