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 1.2.0 to 2.0.0

4

lib/sentence-splitter.js

@@ -8,3 +8,3 @@ // LICENSE : MIT

exports.Syntax = undefined;
exports.default = splitSentences;
exports.split = split;
exports.createWhiteSpaceNode = createWhiteSpaceNode;

@@ -27,3 +27,3 @@ exports.createSentenceNode = createSentenceNode;

};
function splitSentences(text) {
function split(text) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

@@ -30,0 +30,0 @@

@@ -14,3 +14,3 @@ {

},
"version": "1.2.0",
"version": "2.0.0",
"description": "split {japanese, english} text into sentences.",

@@ -17,0 +17,0 @@ "main": "lib/sentence-splitter.js",

@@ -14,4 +14,4 @@ # sentence-splitter

```js
import splitSentences from "sentence-splitter";
let sentences = splitSentences("text.\n\ntext");
import {split, Syntax} from "sentence-splitter";
let sentences = split("text.\n\ntext");
console.log(JSON.stringify(sentences, null, 4));

@@ -100,3 +100,3 @@ /*

// with splitting char options
let sentences = splitSentences("text¶text", {
let sentences = split("text¶text", {
charRegExp: /¶/

@@ -127,6 +127,18 @@ });

## FAQ
Get these `Syntax` constants value from the module:
### How to treat real sentence?
```js
import {Syntax} from "sentence-splitter";
console.log(Syntax.Sentence);// "Sentence"
### Treat Markdown break line
td:lr: set `newLineCharacters: "\n\n"` to option.
```js
let sentences = splitSentences(text, {
newLineCharacters: "\n\n" // `\n\n` as a separator
});
```
`sentence-splitter` split text into `Sentence` and `WhiteSpace`

@@ -184,3 +196,3 @@

TextC`;
let sentences = splitSentences(text, {
let sentences = split(text, {
newLineCharacters: "\n\n" // `\n\n` as a separator

@@ -229,2 +241,2 @@ });

MIT
MIT

@@ -12,3 +12,3 @@ // LICENSE : MIT

};
export default function splitSentences(text, options = {}) {
export function split(text, options = {}) {
const matchChar = options.charRegExp || defaultOptions.charRegExp;

@@ -15,0 +15,0 @@ const newLineCharacters = options.newLineCharacters || defaultOptions.newLineCharacters;

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