Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sentence-splitter

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sentence-splitter - npm Package Compare versions

Comparing version 2.3.1 to 2.3.2

17

lib/sentence-splitter.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc