@sc-voice/tools 2.16.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 +1 -1
- package/src/text/tfidf-space.mjs +9 -2
package/package.json
CHANGED
package/src/text/tfidf-space.mjs
CHANGED
|
@@ -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 = /[.,:;$"'
|
|
55
|
+
const RE_PUNCT = /[.,:;$"'“”‘’!?«»\[\]]/g;
|
|
52
56
|
const RE_SPACE = /\s+/g;
|
|
53
|
-
return
|
|
57
|
+
return TfidfSpace.removeHtml(s)
|
|
58
|
+
.replace(RE_PUNCT, '')
|
|
59
|
+
.replace(RE_SPACE, ' ')
|
|
60
|
+
.trim();
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
static normalizeEN(s) {
|