ssml-split
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -42,4 +42,4 @@ <a name="SSMLSplit"></a> | ||
| options | <code>Object</code> | | Object with configuration options. | | ||
| options.softLimit | <code>number</code> | <code>1000</code> | Limit of a min batch size. | | ||
| options.hardLimit | <code>number</code> | <code>1500</code> | Limit of a max possible batch size. | | ||
| options.softLimit | <code>number</code> | <code>1500</code> | Limit of a min batch size. | | ||
| options.hardLimit | <code>number</code> | <code>3000</code> | Limit of a max possible batch size. | | ||
| [options.extraSplitChars] | <code>string</code> | <code>",;"</code> | String with characters, that can be used as split markers for plain text. Optional parameter. | | ||
@@ -50,3 +50,3 @@ | ||
### SSMLSplit.split(ssml) ⇒ <code>Array.<string></code> | ||
Split SSML text by batches of ~1500 (by default) chars. | ||
Split SSML text by batches of ~3000 (by default) chars. | ||
@@ -53,0 +53,0 @@ **Kind**: instance method of [<code>SSMLSplit</code>](#SSMLSplit) |
@@ -1,3 +0,3 @@ | ||
exports.SOFT_LIMIT = 1000 | ||
exports.HARD_LIMIT = 1500 | ||
exports.EXTRA_SPLIT_CHARS = ',;' | ||
exports.SOFT_LIMIT = 1500 | ||
exports.HARD_LIMIT = 3000 | ||
exports.EXTRA_SPLIT_CHARS = ',;' |
@@ -68,4 +68,4 @@ const pollyTextSplit = require('polly-text-split') | ||
* @param {Object} options Object with configuration options. | ||
* @param {number} options.softLimit=1000 Limit of a min batch size. | ||
* @param {number} options.hardLimit=1500 Limit of a max possible batch size. | ||
* @param {number} options.softLimit=1500 Limit of a min batch size. | ||
* @param {number} options.hardLimit=3000 Limit of a max possible batch size. | ||
* @param {string} [options.extraSplitChars=,;] String with characters, that can be used as split markers for plain text. Optional parameter. | ||
@@ -94,3 +94,3 @@ * @throws {ConfigurationValidationError} Argument `options` is not valid. | ||
/** | ||
* Split SSML text by batches of ~1500 (by default) chars. | ||
* Split SSML text by batches of ~3000 (by default) chars. | ||
* | ||
@@ -97,0 +97,0 @@ * @param {string} ssml String containing text with SSML tags. |
{ | ||
"name": "ssml-split", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Splits long texts with SSML tags by batches suitable for working with AWS Polly TTS and Google Cloud Text to Speech.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# SSML Split | ||
[](https://travis-ci.org/jvandenaardweg/ssml-split) | ||
[](https://coveralls.io/github/jvandenaardweg/ssml-split?branch=master) | ||
[](https://opensource.org/licenses/MIT) | ||
Splits SSML strings into batches AWS Polly ánd Google's Text to Speech API can consume. | ||
@@ -18,3 +22,5 @@ | ||
### Usage: | ||
`npm install ssml-split --save` | ||
``` | ||
npm install ssml-split --save | ||
``` | ||
@@ -25,3 +31,3 @@ ```javascript | ||
const options = { | ||
softLimit: 4000, // Allow the splitter to find the correct split moment between 4000-5000 characters | ||
softLimit: 2500, // Finds a possible split moment starting from 2500 characters | ||
hardLimit: 5000, // Google Text to Speech limitation | ||
@@ -38,3 +44,24 @@ includeSSMLTagsInCounter: true // Set true when using Google Text to Speech API, set to false with AWS Polly | ||
## Why? | ||
### Options | ||
#### AWS | ||
```javascript | ||
const options = { | ||
softLimit: 1500, | ||
hardLimit: 3000, // AWS Polly limitation | ||
includeSSMLTagsInCounter: false | ||
} | ||
``` | ||
```javascript | ||
const options = { | ||
softLimit: 2500, | ||
hardLimit: 5000, // Google Text to Speech API limitation | ||
includeSSMLTagsInCounter: true | ||
} | ||
``` | ||
You can tweak the `softLimit` to see what works for you. I suggest you keep the `hardLimit` at the limitation limit of the respective API. | ||
### Why not just use `polly-ssml-split`? | ||
AWS Polly just counts the characters between the SSML tags. Google's Text to Speech is a little bit different, it includes the SSML tag characters in the character count of the `5000` character limit. | ||
@@ -41,0 +68,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23151
482
83
0