Changes
This commit is contained in:
@@ -132,7 +132,7 @@ class ReferenceCheckService
|
||||
$this->setAmRefCheckStatus($amId, self::AM_STATUS_RUNNING);
|
||||
}
|
||||
public function checkOne(){
|
||||
$this->pushJob(intval(722), 0);
|
||||
$this->pushJob(intval(724), 0);
|
||||
}
|
||||
public function enqueueByArticle($articleId){
|
||||
if ($articleId <= 0) {
|
||||
@@ -196,7 +196,7 @@ class ReferenceCheckService
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
continue;
|
||||
|
||||
$this->pushJob(intval($checkId), $delay);
|
||||
$checkIds[] = $checkId;
|
||||
$queued++;
|
||||
@@ -205,7 +205,6 @@ class ReferenceCheckService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array_keys($amIdsWithJobs) as $amId) {
|
||||
$this->setAmRefCheckStatus($amId, self::AM_STATUS_RUNNING);
|
||||
}
|
||||
@@ -680,9 +679,6 @@ class ReferenceCheckService
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** 与上一引用间距低于此值(字符)时视为同句并列,从整句开头截取而非仅取两标签之间 */
|
||||
const CITE_GAP_SENTENCE_THRESHOLD = 60;
|
||||
|
||||
/**
|
||||
* 按引用位置截取局部上下文:优先取标签前叙述;同句多引时后续引用从上一标签后开始。
|
||||
*/
|
||||
@@ -703,38 +699,25 @@ class ReferenceCheckService
|
||||
}
|
||||
|
||||
$hasPriorCiteInParagraph = ($prevTagEnd > $paragraphStart);
|
||||
$sentenceStart = $this->findSentenceStart($content, $tagStart);
|
||||
|
||||
// 段内首个引用:整段到标签前;后续引用:取「本句」起点(可早于上一标签),避免只剩 “and external environment” 再误用标签后文本
|
||||
if ($hasPriorCiteInParagraph) {
|
||||
$gapText = $this->buildCitationContextText($content, $prevTagEnd, $tagStart);
|
||||
// 如 motivation [23] and external environment [24]:间距短,取整句而非仅 “and external environment”
|
||||
if (mb_strlen($gapText) < self::CITE_GAP_SENTENCE_THRESHOLD) {
|
||||
$sentenceStart = $this->findSentenceStart($content, $tagStart);
|
||||
$localStart = $this->capContextStartBeforeTag(
|
||||
$content,
|
||||
$tagStart,
|
||||
max($paragraphStart, $sentenceStart)
|
||||
);
|
||||
} else {
|
||||
// 如 … Yin et al. [13] on oncology nurses, but … Yang [14]:间距较长,取上一标签后至本标签前
|
||||
$localStart = $prevTagEnd;
|
||||
}
|
||||
$localStart = max($paragraphStart, $sentenceStart);
|
||||
} else {
|
||||
$localStart = $this->capContextStartBeforeTag($content, $tagStart, $paragraphStart);
|
||||
}
|
||||
|
||||
// 默认:引用标签前的论述(如 Yin et al. [13] → 含 “higher than … Yin et al.”)
|
||||
// 默认:引用标签前的论述
|
||||
$localEnd = $tagStart;
|
||||
$originalText = $this->buildCitationContextText($content, $localStart, $localEnd);
|
||||
|
||||
// 标签前几乎无正文(如句末 … ICU nurses [14])→ 改用标签后至下一引用或句末
|
||||
if (!$this->isMeaningfulCitationContext($originalText)
|
||||
|| $this->shouldUseTrailingCitationContext(
|
||||
$content,
|
||||
$localStart,
|
||||
$tagStart,
|
||||
$tagEnd,
|
||||
$hasPriorCiteInParagraph
|
||||
)
|
||||
) {
|
||||
// 仅段内首个引用、且标签前极短(如句末 ICU nurses [14])时,才改用标签后片段;同段多引禁止标签后截取(会错取下一句)
|
||||
$allowTrailing = !$hasPriorCiteInParagraph;
|
||||
if ($allowTrailing && (
|
||||
!$this->isMeaningfulCitationContext($originalText)
|
||||
|| $this->shouldUseTrailingCitationContext($content, $localStart, $tagStart, $tagEnd)
|
||||
)) {
|
||||
$trailEnd = ($nextTagStart < $sentenceEnd) ? $nextTagStart : $sentenceEnd;
|
||||
$trailText = $this->buildCitationContextText($content, $tagEnd, $trailEnd);
|
||||
if ($this->isMeaningfulCitationContext($trailText)) {
|
||||
@@ -760,23 +743,12 @@ class ReferenceCheckService
|
||||
|
||||
/**
|
||||
* 标签前仅有作者缩写等极短片段时,改用标签后上下文
|
||||
*
|
||||
* @param bool $hasPriorCiteInParagraph 同段多引时,短片段常为并列成分,不应误取标签后下一句
|
||||
*/
|
||||
private function shouldUseTrailingCitationContext(
|
||||
$content,
|
||||
$localStart,
|
||||
$tagStart,
|
||||
$tagEnd,
|
||||
$hasPriorCiteInParagraph = false
|
||||
) {
|
||||
private function shouldUseTrailingCitationContext($content, $localStart, $tagStart, $tagEnd)
|
||||
{
|
||||
$before = $this->buildCitationContextText($content, $localStart, $tagStart);
|
||||
if (!$this->isMeaningfulCitationContext($before)) {
|
||||
return !$hasPriorCiteInParagraph;
|
||||
}
|
||||
|
||||
if ($hasPriorCiteInParagraph) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return mb_strlen($before) < 25;
|
||||
@@ -845,7 +817,6 @@ 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