@gscdump/analysis 3.6.0 → 3.6.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.
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* `query_canonical` and detect/repair staleness on a rule change instead of
|
|
5
5
|
* silently mixing old and new keys. v1 = the original ASCII heuristic;
|
|
6
6
|
* v2 adds Unicode folding, the empty-canonical guard, and `pluralize`-based
|
|
7
|
-
* singularization.
|
|
7
|
+
* singularization. v3 drops quotes and treats sentence punctuation
|
|
8
|
+
* (`, ; ! ? ( ) [ ]`) as separators, so a stray `"` or `?` no longer keeps a
|
|
9
|
+
* query out of its canonical bucket.
|
|
8
10
|
*/
|
|
9
|
-
export declare const NORMALIZER_VERSION =
|
|
11
|
+
export declare const NORMALIZER_VERSION = 3;
|
|
10
12
|
/**
|
|
11
13
|
* Produce a canonical form of a search query for grouping near-duplicates.
|
|
12
14
|
* Idempotent: `normalizeQuery(normalizeQuery(q)) === normalizeQuery(q)`.
|
package/dist/query/normalize.mjs
CHANGED
|
@@ -147,10 +147,11 @@ function depluralize(token) {
|
|
|
147
147
|
depluralizedCache.set(token, singular);
|
|
148
148
|
return singular;
|
|
149
149
|
}
|
|
150
|
-
const SEPARATOR_RE = /[-_
|
|
150
|
+
const SEPARATOR_RE = /[-_/.@#:+,;!?()[\]]+/g;
|
|
151
|
+
const QUOTE_RE = /["'\u2018\u2019\u201C\u201D`]+/g;
|
|
151
152
|
const WHITESPACE_RE = /\s+/g;
|
|
152
153
|
const DIACRITICS_RE = /\p{Diacritic}/gu;
|
|
153
|
-
const NORMALIZER_VERSION =
|
|
154
|
+
const NORMALIZER_VERSION = 3;
|
|
154
155
|
function foldUnicode(s) {
|
|
155
156
|
let index = 0;
|
|
156
157
|
while (index < s.length && s.charCodeAt(index) <= 127) index++;
|
|
@@ -190,7 +191,7 @@ function isOrderSensitive(tokens) {
|
|
|
190
191
|
return false;
|
|
191
192
|
}
|
|
192
193
|
function normalizeQuery(query) {
|
|
193
|
-
const normalized = foldUnicode(query).toLowerCase().replace(SEPARATOR_RE, " ").replace(WHITESPACE_RE, " ").trim();
|
|
194
|
+
const normalized = foldUnicode(query).toLowerCase().replace(QUOTE_RE, "").replace(SEPARATOR_RE, " ").replace(WHITESPACE_RE, " ").trim();
|
|
194
195
|
if (normalized.length === 0) return "";
|
|
195
196
|
const cleaned = normalized.split(" ");
|
|
196
197
|
const mapped = [];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/analysis",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.6.
|
|
4
|
+
"version": "3.6.2",
|
|
5
5
|
"description": "GSC analyzers — striking-distance, opportunity, movers, decay, brand, clustering, concentration, seasonality. Pure row-based + DuckDB-native.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"node": ">=22"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@gscdump/engine": "^3.6.
|
|
65
|
-
"@gscdump/engine-gsc-api": "^3.6.
|
|
66
|
-
"gscdump": "^3.6.
|
|
64
|
+
"@gscdump/engine": "^3.6.2",
|
|
65
|
+
"@gscdump/engine-gsc-api": "^3.6.2",
|
|
66
|
+
"gscdump": "^3.6.2",
|
|
67
67
|
"pluralize": "^8.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|