@sc-voice/tools 2.15.0 → 2.17.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sc-voice/tools",
3
- "version": "2.15.0",
3
+ "version": "2.17.0",
4
4
  "description": "Utilities for SC-Voice",
5
5
  "main": "index.mjs",
6
6
  "files": [
@@ -46,11 +46,18 @@ export class TfidfSpace {
46
46
  });
47
47
  }
48
48
 
49
+ static removeHtml(s) {
50
+ return s.replace(/<[^>]*>/gi, '');
51
+ }
52
+
49
53
  static removeNonWords(s) {
50
54
  const RE_RESERVED = /[_-]/g; // allowed in bow words
51
- const RE_PUNCT = /[.,:;$"'“”‘’!?«»]/g;
55
+ const RE_PUNCT = /[.,:;$"'“”‘’!?«»\[\]]/g;
52
56
  const RE_SPACE = /\s+/g;
53
- return s.replace(RE_PUNCT, '').replace(RE_SPACE, ' ').trim();
57
+ return TfidfSpace.removeHtml(s)
58
+ .replace(RE_PUNCT, '')
59
+ .replace(RE_SPACE, ' ')
60
+ .trim();
54
61
  }
55
62
 
56
63
  static normalizeEN(s) {
@@ -261,6 +261,14 @@ export class Unicode {
261
261
  MAGENTA: '\u001b[35m',
262
262
  CYAN: '\u001b[36m',
263
263
  WHITE: '\u001b[37m',
264
+ BRIGHT_BLACK: '\u001b[90m',
265
+ BRIGHT_RED: '\u001b[91m',
266
+ BRIGHT_GREEN: '\u001b[92m',
267
+ BRIGHT_YELLOW: '\u001b[93m',
268
+ BRIGHT_BLUE: '\u001b[94m',
269
+ BRIGHT_MAGENTA: '\u001b[95m',
270
+ BRIGHT_CYAN: '\u001b[96m',
271
+ BRIGHT_WHITE: '\u001b[97m',
264
272
  NO_COLOR: '\u001b[0m',
265
273
  };
266
274
  }