sentence-splitter
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -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
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
18469
238