sentence-splitter
Advanced tools
Comparing version 2.3.1 to 2.3.2
@@ -80,2 +80,3 @@ // LICENSE : MIT | ||
var isSplitPoint = false; | ||
var isInSentence = false; | ||
var newLineCharactersLength = newLineCharacters.length; | ||
@@ -108,9 +109,13 @@ for (; currentIndex < text.length; currentIndex++) { | ||
isSplitPoint = false; | ||
// Sentence<WhiteSpace>Sentence | ||
if (whiteSpaceCharacters.indexOf(char) !== -1) { | ||
results.push(createNode(Syntax.WhiteSpace, currentIndex, currentIndex + 1)); | ||
startPoint++; | ||
currentIndex++; | ||
} | ||
isInSentence = false; | ||
} | ||
// Sentence<WhiteSpace>*Sentence | ||
if (isInSentence === false && whiteSpaceCharacters.indexOf(char) !== -1) { | ||
// Add WhiteSpace | ||
results.push(createNode(Syntax.WhiteSpace, startPoint, currentIndex + 1)); | ||
startPoint++; | ||
} else { | ||
// New sentence start | ||
isInSentence = true; | ||
} | ||
} | ||
@@ -117,0 +122,0 @@ } |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"description": "split {japanese, english} text into sentences.", | ||
@@ -17,0 +17,0 @@ "main": "lib/sentence-splitter.js", |
@@ -66,2 +66,3 @@ // LICENSE : MIT | ||
let isSplitPoint = false; | ||
let isInSentence = false; | ||
const newLineCharactersLength = newLineCharacters.length; | ||
@@ -94,9 +95,13 @@ for (; currentIndex < text.length; currentIndex++) { | ||
isSplitPoint = false; | ||
// Sentence<WhiteSpace>Sentence | ||
if (whiteSpaceCharacters.indexOf(char) !== -1) { | ||
results.push(createNode(Syntax.WhiteSpace, currentIndex, currentIndex + 1)); | ||
startPoint++; | ||
currentIndex++; | ||
} | ||
isInSentence = false; | ||
} | ||
// Sentence<WhiteSpace>*Sentence | ||
if (isInSentence === false && whiteSpaceCharacters.indexOf(char) !== -1) { | ||
// Add WhiteSpace | ||
results.push(createNode(Syntax.WhiteSpace, startPoint, currentIndex + 1)); | ||
startPoint++; | ||
} else { | ||
// New sentence start | ||
isInSentence = true; | ||
} | ||
} | ||
@@ -103,0 +108,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26511
303