@deadair/plugin-sdk 0.47.0 → 0.47.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,4 +68,12 @@ export declare function truncateSentences(value: string, maxChars: number): stri
68
68
  * branching on the length itself.
69
69
  */
70
70
  export declare function sentencesWithin(value: string, maxWords: number): string | undefined;
71
+ /**
72
+ * A passage as its whole sentences, in order, each with its closing quotes kept.
73
+ *
74
+ * On the same boundary {@link sentencesWithin} cuts at, so a caller choosing
75
+ * WHICH sentences to keep rather than how many sees exactly the sentences that
76
+ * function would have seen. A passage with no boundary is one sentence.
77
+ */
78
+ export declare function sentencesOf(value: string): string[];
71
79
  //# sourceMappingURL=html.text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"html.text.d.ts","sourceRoot":"","sources":["../src/html.text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4BH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO5E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMrE;AAkCD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYzE;AAeD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBnF"}
1
+ {"version":3,"file":"html.text.d.ts","sourceRoot":"","sources":["../src/html.text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4BH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO5E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMrE;AAkCD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYzE;AAeD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBnF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBnD"}
package/dist/index.js CHANGED
@@ -494,6 +494,22 @@ function sentencesWithin(value, maxWords) {
494
494
  return fits;
495
495
  }
496
496
  __name(sentencesWithin, "sentencesWithin");
497
+ function sentencesOf(value) {
498
+ const text2 = value.trim();
499
+ const sentences = [];
500
+ let start = 0;
501
+ SENTENCE_END.lastIndex = 0;
502
+ for (let match = SENTENCE_END.exec(text2); match !== null; match = SENTENCE_END.exec(text2)) {
503
+ if (!endsSentence(text2, match.index)) continue;
504
+ const end = match.index + 1 + closersIn(match[0]).length;
505
+ sentences.push(text2.slice(start, end).trim());
506
+ start = match.index + match[0].length;
507
+ }
508
+ const rest = text2.slice(start).trim();
509
+ if (rest.length > 0) sentences.push(rest);
510
+ return sentences;
511
+ }
512
+ __name(sentencesOf, "sentencesOf");
497
513
 
498
514
  // src/article.parse.ts
499
515
  var ARTICLE_MAX_CHARS = 2e3;
@@ -1387,6 +1403,7 @@ export {
1387
1403
  readRowSecret,
1388
1404
  retryAfterMs,
1389
1405
  rowSecretKey,
1406
+ sentencesOf,
1390
1407
  sentencesWithin,
1391
1408
  toPluginError,
1392
1409
  truncateSentences,