fix nplusone min sentence count

This commit is contained in:
2026-02-28 03:48:51 -08:00
parent 93e392910c
commit 39288a62b6

View File

@@ -247,7 +247,10 @@ export function isNPlusOneCandidateToken(token: MergedToken): boolean {
if (token.isKnown) { if (token.isKnown) {
return false; return false;
} }
return isNPlusOneWordCountToken(token);
}
function isNPlusOneWordCountToken(token: MergedToken): boolean {
if (token.partOfSpeech === PartOfSpeech.particle) { if (token.partOfSpeech === PartOfSpeech.particle) {
return false; return false;
} }
@@ -308,7 +311,7 @@ export function markNPlusOneTargets(tokens: MergedToken[], minSentenceWords = 3)
for (let i = start; i < endExclusive; i++) { for (let i = start; i < endExclusive; i++) {
const token = markedTokens[i]; const token = markedTokens[i];
if (!token) continue; if (!token) continue;
if (!isSentenceBoundaryToken(token) && token.surface.trim().length > 0) { if (isNPlusOneWordCountToken(token)) {
sentenceWordCount += 1; sentenceWordCount += 1;
} }