@mailwoman/kind-classifier 7.4.0 → 7.6.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/out/poi.d.ts.map +1 -1
- package/out/poi.js +15 -1
- package/out/poi.js.map +1 -1
- package/package.json +2 -2
- package/poi.ts +15 -1
package/out/poi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poi.d.ts","sourceRoot":"","sources":["../poi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAErE,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC9B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,kHAAkH;IAClH;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAA;IAC3B,kHAAkH;IAClH,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,uFAAuF;AACvF,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC,cAAc,CAAC,CAAA;AAEhG,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,cAAc,CAAA;IACrB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;IACf,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAA;CACjB;
|
|
1
|
+
{"version":3,"file":"poi.d.ts","sourceRoot":"","sources":["../poi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAErE,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC9B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,kHAAkH;IAClH;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAA;IAC3B,kHAAkH;IAClH,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,uFAAuF;AACvF,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC,cAAc,CAAC,CAAA;AAEhG,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,cAAc,CAAA;IACrB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;IACf,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAA;CACjB;AAyBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,eAAe,GACrB,eAAe,GAAG,IAAI,CA6BxB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,eAAe,EACvB,MAAM,CAAC,EAAE,MAAM,GACb,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,KAAK,MAAM,CAiB/D"}
|
package/out/poi.js
CHANGED
|
@@ -11,8 +11,22 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* Anchor separator between subject and place: comma, or near/in/at/around — scanned left-to-right until a prefix hits
|
|
13
13
|
* the lexicon.
|
|
14
|
+
*
|
|
15
|
+
* Linear by construction (no polynomial ReDoS): neither alternative places an unbounded whitespace quantifier _before_
|
|
16
|
+
* its required literal — the classic `\s*`/`\s+`-then-literal backtracking shape that CodeQL's `js/polynomial-redos`
|
|
17
|
+
* flags. The comma alternative starts at the literal `,`; the anchor alternative starts at a single `\s` immediately
|
|
18
|
+
* before a fixed anchor word. Every remaining quantifier (`,\s*`, `…\s+`) is _trailing_ — it runs only after the
|
|
19
|
+
* required literal has already matched and nothing follows it, so it never backtracks. Each start offset does O(1)
|
|
20
|
+
* work, making `matchAll` O(n).
|
|
21
|
+
*
|
|
22
|
+
* Behaviour is byte-identical to the previous `\s*,\s*|\s+(?:…)\s+` because `matchPOISubject` `.trim()`s both the
|
|
23
|
+
* subject (text before `.index`) and the remainder (text after the match), so surrounding whitespace on either side of
|
|
24
|
+
* the separator is redundant. The leading `\s*`/`\s+` only shifted the match _start_ within a whitespace run — trim
|
|
25
|
+
* absorbs that — while the retained _trailing_ greedy quantifier keeps the match _end_ (and thus `matchAll`'s
|
|
26
|
+
* lastIndex) identical, preserving the exact subsequent-match sequence. Verified: 0 divergences across 22.7k inputs
|
|
27
|
+
* (systematic + fuzzed adversarial whitespace + shared-whitespace anchor/comma chains).
|
|
14
28
|
*/
|
|
15
|
-
const ANCHOR_SEPARATOR =
|
|
29
|
+
const ANCHOR_SEPARATOR = /,\s*|\s(?:near|in|at|around)\s+/gi;
|
|
16
30
|
/** Longest subject we accept, in tokens. Lexicon phrases are short; 4 covers the table. */
|
|
17
31
|
const MAX_SUBJECT_TOKENS = 4;
|
|
18
32
|
/**
|
package/out/poi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poi.js","sourceRoot":"","sources":["../poi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmCH
|
|
1
|
+
{"version":3,"file":"poi.js","sourceRoot":"","sources":["../poi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmCH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,gBAAgB,GAAG,mCAAmC,CAAA;AAE5D,2FAA2F;AAC3F,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAY,EACZ,MAA0B,EAC1B,MAAuB;IAEvB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAE3B,IAAI,CAAC,OAAO;QAAE,O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,CAAC,CAAA;QAExF,IAAI,CAAC,OAAO;YAAE,OAAO,CAAC,CAAA;QAEtB,IAAI,OAAO,CAAC,SAAS,KAAK,EAAE;YAAE,OAAO,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAA;QAEpE,gFAAgF;QAChF,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;YAAE,OAAO,CAAC,CAAA;QAE9C,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAA;QAE5C,IAAI,QAAQ,GAAG,CAAC;YAAE,OAAO,CAAC,CAAA;QAE1B,OAAO,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAA;IACtC,CAAC,CAAA;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/kind-classifier",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"description": "Stage 2.5 of the runtime pipeline — categorize inputs by query shape (postcode_only / locality_only / structured_address / intersection / po_box / landmark / vague). Rule-based for v1.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@mailwoman/core": "7.
|
|
44
|
+
"@mailwoman/core": "7.6.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/poi.ts
CHANGED
|
@@ -45,8 +45,22 @@ export interface POISubjectMatch {
|
|
|
45
45
|
/**
|
|
46
46
|
* Anchor separator between subject and place: comma, or near/in/at/around — scanned left-to-right until a prefix hits
|
|
47
47
|
* the lexicon.
|
|
48
|
+
*
|
|
49
|
+
* Linear by construction (no polynomial ReDoS): neither alternative places an unbounded whitespace quantifier _before_
|
|
50
|
+
* its required literal — the classic `\s*`/`\s+`-then-literal backtracking shape that CodeQL's `js/polynomial-redos`
|
|
51
|
+
* flags. The comma alternative starts at the literal `,`; the anchor alternative starts at a single `\s` immediately
|
|
52
|
+
* before a fixed anchor word. Every remaining quantifier (`,\s*`, `…\s+`) is _trailing_ — it runs only after the
|
|
53
|
+
* required literal has already matched and nothing follows it, so it never backtracks. Each start offset does O(1)
|
|
54
|
+
* work, making `matchAll` O(n).
|
|
55
|
+
*
|
|
56
|
+
* Behaviour is byte-identical to the previous `\s*,\s*|\s+(?:…)\s+` because `matchPOISubject` `.trim()`s both the
|
|
57
|
+
* subject (text before `.index`) and the remainder (text after the match), so surrounding whitespace on either side of
|
|
58
|
+
* the separator is redundant. The leading `\s*`/`\s+` only shifted the match _start_ within a whitespace run — trim
|
|
59
|
+
* absorbs that — while the retained _trailing_ greedy quantifier keeps the match _end_ (and thus `matchAll`'s
|
|
60
|
+
* lastIndex) identical, preserving the exact subsequent-match sequence. Verified: 0 divergences across 22.7k inputs
|
|
61
|
+
* (systematic + fuzzed adversarial whitespace + shared-whitespace anchor/comma chains).
|
|
48
62
|
*/
|
|
49
|
-
const ANCHOR_SEPARATOR =
|
|
63
|
+
const ANCHOR_SEPARATOR = /,\s*|\s(?:near|in|at|around)\s+/gi
|
|
50
64
|
|
|
51
65
|
/** Longest subject we accept, in tokens. Lexicon phrases are short; 4 covers the table. */
|
|
52
66
|
const MAX_SUBJECT_TOKENS = 4
|