@mailwoman/kind-classifier 10.8.0 → 11.1.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/README.md +1 -1
- package/lib/classify.ts +11 -12
- package/lib/index.ts +5 -5
- package/lib/intent/markers.ts +15 -12
- package/lib/intent/rules.ts +18 -18
- package/lib/poi.ts +13 -12
- package/lib/rules.ts +7 -6
- package/out/classify.d.ts +8 -12
- package/out/classify.d.ts.map +1 -1
- package/out/classify.js +3 -14
- package/out/classify.js.map +1 -1
- package/out/index.d.ts +2 -5
- package/out/index.d.ts.map +1 -1
- package/out/index.js +4 -5
- package/out/index.js.map +1 -1
- package/out/intent/markers.d.ts +11 -11
- package/out/intent/markers.d.ts.map +1 -1
- package/out/intent/markers.js +3 -16
- package/out/intent/markers.js.map +1 -1
- package/out/intent/rules.d.ts +11 -14
- package/out/intent/rules.d.ts.map +1 -1
- package/out/intent/rules.js +8 -24
- package/out/intent/rules.js.map +1 -1
- package/out/poi.d.ts +10 -12
- package/out/poi.d.ts.map +1 -1
- package/out/poi.js +5 -13
- package/out/poi.js.map +1 -1
- package/out/rules.d.ts +0 -8
- package/out/rules.d.ts.map +1 -1
- package/out/rules.js +6 -6
- package/out/rules.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ the query kind.
|
|
|
5
5
|
|
|
6
6
|
It assigns an input to one of seven `QueryKind`s by combining rule-based scorers
|
|
7
7
|
over the `QueryShape` output. It returns alternatives alongside the top pick, so
|
|
8
|
-
the coordinator can fall back when the winning kind
|
|
8
|
+
the coordinator can fall back when the winning kind isn't actionable.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
import { classifyKind } from "@mailwoman/kind-classifier"
|
package/lib/classify.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* `classifyKind` is the entry point for Stage 2.5 (kind classification), composing the per-kind rules
|
|
7
|
-
* from `rules.ts` and `intent-rules.ts` and returning alternatives sorted by confidence.
|
|
5
|
+
* `classifyKind` is the entry point for Stage 2.5 (kind classification), composing the per-kind
|
|
6
|
+
* rules from `rules.ts` and `intent-rules.ts` and returning alternatives sorted by confidence.
|
|
8
7
|
*
|
|
9
|
-
* Per the project's "possibilities not constraints" principle, every kind that fires above
|
|
10
|
-
* in `alternatives` and the caller decides whether to act on the top kind only:
|
|
11
|
-
* `route_pair` are scored below their structural incumbent precisely
|
|
12
|
-
* where they inform the markers without moving the routing decision.
|
|
8
|
+
* Per the project's "possibilities not constraints" principle, every kind that fires above
|
|
9
|
+
* 0 surfaces in `alternatives` and the caller decides whether to act on the top kind only:
|
|
10
|
+
* `bare_toponym` and `route_pair` are scored below their structural incumbent precisely
|
|
11
|
+
* so they land in `alternatives`, where they inform the markers without moving the routing decision.
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
import type { LocaleHint, QueryIntentMarker, QueryKind, QueryKindResult } from "@mailwoman/core/pipeline"
|
|
@@ -126,14 +125,14 @@ export interface KindClassifierOpts {
|
|
|
126
125
|
* POI phrase lexicon (spec §3.1); when present the `poi_query`
|
|
127
126
|
* and `poi_category` scorers join the rule set.
|
|
128
127
|
*
|
|
129
|
-
* They
|
|
128
|
+
* They're injected rather than imported so this package stays dictionary-free.
|
|
130
129
|
* When absent, the returned classifier behaves identically to {@link classifyKind}.
|
|
131
130
|
*/
|
|
132
131
|
poiLexicon?: POIPhraseLookup
|
|
133
132
|
}
|
|
134
133
|
|
|
135
134
|
/**
|
|
136
|
-
* Build a kind classifier that
|
|
135
|
+
* Build a kind classifier that's exactly {@link classifyKind} without options,
|
|
137
136
|
* or that additionally scores `poi_query` + `poi_category` (ROAD_TO_V9 §4.4)
|
|
138
137
|
* and merges them into the ranked result when given a `poiLexicon`.
|
|
139
138
|
*/
|
package/lib/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Stage 2.5 classifier: compose rule-based scorers over QueryShape and return a top kind with alternatives.
|
|
5
|
+
* Stage 2.5 classifier: compose rule-based scorers over QueryShape
|
|
6
|
+
* and return a top kind with alternatives.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export { classifyKind, classifyKindSync, createKindClassifier } from "#classify"
|
package/lib/intent/markers.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
+
* Marker derivation for the ROAD_TO_V9 §4 intent vocabulary.
|
|
6
|
+
*
|
|
7
|
+
* This code is pure and synchronous.
|
|
8
|
+
* It is the only place the classifier turns a fired rule into something a caller reads.
|
|
9
|
+
*
|
|
10
|
+
* Three of the four intent kinds can raise their marker here from the string by itself.
|
|
11
|
+
* The fourth, Stage 2.5 cannot raise `bare_toponym`'s `declared_ambiguity` from the string by itself.
|
|
5
12
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
13
|
+
* Its trigger is the dominance margin of the resolved candidate list.
|
|
14
|
+
* `mailwoman/query-intent.ts` raises it after the resolve against `DECISIVE_MARGIN_LOG10`.
|
|
8
15
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* Its trigger is the dominance margin of the resolved candidate list. `mailwoman/query-intent.ts` raises it
|
|
12
|
-
* after the resolve against `DECISIVE_MARGIN_LOG10`. This module therefore never emits
|
|
13
|
-
* `declared_ambiguity`, since a marker asserting ambiguity from the string by itself would declare every
|
|
14
|
-
* bare city name ambiguous.
|
|
16
|
+
* This module therefore never emits `declared_ambiguity`, since a marker asserting
|
|
17
|
+
* ambiguity from the string by itself would declare every bare city name ambiguous.
|
|
15
18
|
*/
|
|
16
19
|
|
|
17
20
|
import type { QueryIntentMarker, QueryKind } from "@mailwoman/core/pipeline"
|
|
@@ -67,7 +70,7 @@ export function deriveIntentMarkers(
|
|
|
67
70
|
*
|
|
68
71
|
* The order is stable: pair first, then the admin reading.
|
|
69
72
|
* A consumer can index it.
|
|
70
|
-
* This order
|
|
73
|
+
* This order doesn't rank the entries.
|
|
71
74
|
*/
|
|
72
75
|
interpretations: ["two_toponyms", "locality_with_admin_context"],
|
|
73
76
|
},
|
package/lib/intent/rules.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ROAD_TO_V9 §4 — the query-intent rules, with the same `(input, shape) => number` interface as
|
|
7
|
-
* `rules.ts` and the same bitter-lesson invariant: universal structural patterns and bounded linguistic
|
|
8
|
-
* categories only, never a place-name dictionary, with the POI synonym table injected exactly as
|
|
9
|
-
* `poi.ts` does it.
|
|
5
|
+
* ROAD_TO_V9 §4 — the query-intent rules, with the same `(input, shape) => number`
|
|
6
|
+
* interface as `rules.ts` and the same bitter-lesson invariant: universal structural
|
|
7
|
+
* patterns and bounded linguistic categories only, never a place-name dictionary,
|
|
8
|
+
* with the POI synonym table injected exactly as `poi.ts` does it.
|
|
10
9
|
*
|
|
11
10
|
* `bare_toponym` and `route_pair` score below the structural kind that already owns their population
|
|
12
11
|
* (`locality_only`, 0.85), so they surface in `QueryKindResult.alternatives` and never as the top kind.
|
|
13
|
-
* The top kind is the only thing the coordinator routes on, so pinning it is what
|
|
14
|
-
* answer-neutral on the bare-city-name register.
|
|
12
|
+
* The top kind is the only thing the coordinator routes on, so pinning it is what
|
|
13
|
+
* makes these additions answer-neutral on the bare-city-name register.
|
|
14
|
+
* Their intent travels on the marker.
|
|
15
15
|
*
|
|
16
|
-
* `near_me` does win its top slot (0.91), because no incumbent reading competes
|
|
17
|
-
* ending "near me"
|
|
16
|
+
* `near_me` does win its top slot (0.91), because no incumbent reading competes
|
|
17
|
+
* for the slot: a query ending "near me" isn't a locality.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import type { NormalizedInputLite, QueryShapeSegmentsView as QueryShapeLike } from "@mailwoman/query-shape"
|
|
@@ -168,7 +168,7 @@ const TOPONYM_TAIL_NOUNS: ReadonlySet<string> = new Set([
|
|
|
168
168
|
* This is the bounded class `preposition + a reference to the asker`, where `me`,
|
|
169
169
|
* `here`, `my <noun>` are function words rather than places.
|
|
170
170
|
*
|
|
171
|
-
* Anchored to the end of the string (`$`) on purpose: the query
|
|
171
|
+
* Anchored to the end of the string (`$`) on purpose: the query identifies no anchor,
|
|
172
172
|
* so anything after the locator is an anchor and disqualifies it.
|
|
173
173
|
*
|
|
174
174
|
* Linear by construction: every alternative begins with a required literal and the only
|
|
@@ -194,9 +194,9 @@ function hasDeicticTail(lowercased: string): boolean {
|
|
|
194
194
|
* The conditions `bare_toponym` and `route_pair` share: no address grammar of any kind,
|
|
195
195
|
* one segment, alpha throughout.
|
|
196
196
|
*
|
|
197
|
-
* @returns the word list when the input clears them, `null` when it
|
|
197
|
+
* @returns the word list when the input clears them, `null` when it doesn't.
|
|
198
198
|
* The conditions are deliberately a superset of `scoreLocalityOnly`'s, so `bare_toponym` is
|
|
199
|
-
* a strict refinement of `locality_only` and can never fire where `locality_only`
|
|
199
|
+
* a strict refinement of `locality_only` and can never fire where `locality_only` didn't.
|
|
200
200
|
*/
|
|
201
201
|
function bareNameWords(input: NormalizedInputLite, shape: QueryShapeLike): string[] | null {
|
|
202
202
|
const text = input.normalized.trim()
|
|
@@ -211,7 +211,7 @@ function bareNameWords(input: NormalizedInputLite, shape: QueryShapeLike): strin
|
|
|
211
211
|
// beside it because `foldInputClass` answers `alpha` for input carrying no classified token.
|
|
212
212
|
if (shape.characterClass !== "alpha" || !carriesLetter(text)) return null
|
|
213
213
|
|
|
214
|
-
// A comma is the admin-context marker ("Paris, FR"), so one segment or the name
|
|
214
|
+
// A comma is the admin-context marker ("Paris, FR"), so one segment or the name isn't bare.
|
|
215
215
|
if ((shape.segments?.length ?? 1) !== 1) return null
|
|
216
216
|
|
|
217
217
|
const lowercased = text.toLowerCase()
|
|
@@ -231,7 +231,7 @@ function bareNameWords(input: NormalizedInputLite, shape: QueryShapeLike): strin
|
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
233
|
* `bare_toponym` rule: a single coherent place-name carrying no address grammar, feeding the
|
|
234
|
-
* declared-ambiguity path without asserting which place — that
|
|
234
|
+
* declared-ambiguity path without asserting which place — that's the resolver's question,
|
|
235
235
|
* decided by the answer's dominance margin in `mailwoman/query-intent.ts`.
|
|
236
236
|
*/
|
|
237
237
|
export function scoreBareToponym(input: NormalizedInputLite, shape: QueryShapeLike): number {
|
|
@@ -294,7 +294,7 @@ export function scoreNearMe(input: NormalizedInputLite, _shape: QueryShapeLike):
|
|
|
294
294
|
/**
|
|
295
295
|
* The subject of a `near_me` query is the requested category or thing with the locator stripped.
|
|
296
296
|
*
|
|
297
|
-
* It is empty when the rule
|
|
297
|
+
* It is empty when the rule wouldn't have fired.
|
|
298
298
|
* The subject builds marker evidence and never a route.
|
|
299
299
|
*/
|
|
300
300
|
export function nearMeSubject(input: NormalizedInputLite): string {
|
package/lib/poi.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* POI subject detection for the `poi_query` kind.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* The lexicon is injected (`POIPhraseLookup`) so this package keeps its bitter-lesson
|
|
8
|
+
* invariant (no dictionaries in-tree); the phrase table lives in `@mailwoman/poi-taxonomy`
|
|
9
|
+
* and is wired in by `createRuntimePipeline` behind the `poiQueryKind` flag.
|
|
9
10
|
* Spec §3.1.
|
|
10
11
|
*/
|
|
11
12
|
|
|
@@ -32,7 +33,7 @@ export interface POIPhraseMatch {
|
|
|
32
33
|
matchedPhrase: string
|
|
33
34
|
confidence: number
|
|
34
35
|
/**
|
|
35
|
-
* How the phrase matched, or `null` when the lookup
|
|
36
|
+
* How the phrase matched, or `null` when the lookup doesn't report it.
|
|
36
37
|
*
|
|
37
38
|
* `short_label` is a category label without its trailing `restaurant`, `store` or `shop`
|
|
38
39
|
* (`sushi`). {@linkcode matchPOISubject} accepts it only as a subject followed by an anchor.
|
|
@@ -40,7 +41,7 @@ export interface POIPhraseMatch {
|
|
|
40
41
|
*/
|
|
41
42
|
mechanism: "exact" | "locale_normalized" | "typo" | "short_label" | null
|
|
42
43
|
/**
|
|
43
|
-
* The phrase the lookup received, or `null` when the lookup
|
|
44
|
+
* The phrase the lookup received, or `null` when the lookup doesn't report it.
|
|
44
45
|
*/
|
|
45
46
|
inputPhrase: string | null
|
|
46
47
|
/**
|
|
@@ -60,7 +61,7 @@ export interface POIPhraseMatch {
|
|
|
60
61
|
* returns the categories one typed phrase could name, the curated reading first
|
|
61
62
|
* (`credit union` → the `bank` rollup its synonym redirects to), while an affordance
|
|
62
63
|
* rung returns every entity kind that affords one activity in a stable enumeration.
|
|
63
|
-
* The enumeration
|
|
64
|
+
* The enumeration doesn't express a preference.
|
|
64
65
|
*
|
|
65
66
|
* - `"preference"`: the hits are a preference list; {@link matchPOISubject} keeps the first.
|
|
66
67
|
* The committed lexicon's shape.
|
|
@@ -169,9 +170,9 @@ function reachedMatches(hits: ReadonlyArray<POIPhraseMatch>): POIPhraseMatch[] {
|
|
|
169
170
|
* separator whose prefix hits the lexicon (≤ 8 tokens).
|
|
170
171
|
*
|
|
171
172
|
* Scans separators left-to-right, because a lexicon phrase may itself contain a bare separator
|
|
172
|
-
* word ("walk in clinic") and the first separator
|
|
173
|
+
* word ("walk in clinic") and the first separator isn't necessarily the right split point.
|
|
173
174
|
* Returns null when the lexicon never fires, including comma-ridden full addresses
|
|
174
|
-
* whose leading segment
|
|
175
|
+
* whose leading segment isn't a phrase.
|
|
175
176
|
*
|
|
176
177
|
* The winning candidate's hits are listed per {@link reachedMatches}.
|
|
177
178
|
*/
|
|
@@ -303,7 +304,7 @@ export function scorePOICategory(matched: POISubjectMatch | null): number {
|
|
|
303
304
|
/**
|
|
304
305
|
* The whole-input category hit behind a `poi_category` verdict, for the marker's evidence.
|
|
305
306
|
*
|
|
306
|
-
* `null` when the subject match
|
|
307
|
+
* `null` when the subject match isn't a bare category, under the same conditions
|
|
307
308
|
* as {@link scorePOICategory}.
|
|
308
309
|
* The shared conditions keep the score and the evidence from disagreeing.
|
|
309
310
|
*/
|
package/lib/rules.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* Rule-based `QueryKind` scorers.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* Each scorer reads structural patterns in the normalized input and its QueryShape
|
|
8
|
+
* and returns a confidence from 0 to 1.
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import { NAME_PRONE_US_SUFFIXES, US_STREET_SUFFIX_LOOKUP } from "@mailwoman/codex/us/street/suffix"
|
|
@@ -324,7 +325,7 @@ export function scoreStructuredAddress(input: NormalizedInputLite, shape: QueryS
|
|
|
324
325
|
if (len === 0) return 0
|
|
325
326
|
const segCount = shape.segments?.length ?? 1
|
|
326
327
|
|
|
327
|
-
// Digits outside the postcode are required, so a locality with a postcode
|
|
328
|
+
// Digits outside the postcode are required, so a locality with a postcode doesn't score here.
|
|
328
329
|
if (
|
|
329
330
|
segCount >= 2 &&
|
|
330
331
|
shape.characterClass === "alphanumeric" &&
|
package/out/classify.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
2
|
+
* `classifyKind` is the entry point for Stage 2.5 (kind classification), composing the per-kind
|
|
3
|
+
* rules from `rules.ts` and `intent-rules.ts` and returning alternatives sorted by confidence.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* in `alternatives` and the caller decides whether to act on the top kind only: `bare_toponym` and
|
|
11
|
-
* `route_pair` are scored below their structural incumbent precisely so they land in `alternatives`,
|
|
12
|
-
* where they inform the markers without moving the routing decision.
|
|
5
|
+
* Per the project's "possibilities not constraints" principle, every kind that fires above
|
|
6
|
+
* 0 surfaces in `alternatives` and the caller decides whether to act on the top kind only:
|
|
7
|
+
* `bare_toponym` and `route_pair` are scored below their structural incumbent precisely
|
|
8
|
+
* so they land in `alternatives`, where they inform the markers without moving the routing decision.
|
|
13
9
|
*/
|
|
14
10
|
import type { LocaleHint, QueryKindResult } from "@mailwoman/core/pipeline";
|
|
15
11
|
import type { NormalizedInputLite, QueryShapeSegmentsView as QueryShapeLike } from "@mailwoman/query-shape";
|
|
@@ -32,13 +28,13 @@ export interface KindClassifierOpts {
|
|
|
32
28
|
* POI phrase lexicon (spec §3.1); when present the `poi_query`
|
|
33
29
|
* and `poi_category` scorers join the rule set.
|
|
34
30
|
*
|
|
35
|
-
* They
|
|
31
|
+
* They're injected rather than imported so this package stays dictionary-free.
|
|
36
32
|
* When absent, the returned classifier behaves identically to {@link classifyKind}.
|
|
37
33
|
*/
|
|
38
34
|
poiLexicon?: POIPhraseLookup;
|
|
39
35
|
}
|
|
40
36
|
/**
|
|
41
|
-
* Build a kind classifier that
|
|
37
|
+
* Build a kind classifier that's exactly {@link classifyKind} without options,
|
|
42
38
|
* or that additionally scores `poi_query` + `poi_category` (ROAD_TO_V9 §4.4)
|
|
43
39
|
* and merges them into the ranked result when given a `poiLexicon`.
|
|
44
40
|
*/
|
package/out/classify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../lib/classify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../lib/classify.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAgC,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACzG,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAI3G,OAAO,EAAmB,KAAK,eAAe,EAAyD,MAAM,MAAM,CAAA;AA6EnH;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,GAAG,eAAe,CAMnG;AAED;;;GAGG;AACH,wBAAsB,YAAY,CACjC,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,cAAc,EACrB,OAAO,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,eAAe,CAAC,CAE1B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,eAAe,CAAA;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,GAAE,kBAAuB,GAC3B,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,UAAU,KAAK,OAAO,CAAC,eAAe,CAAC,CAoCtG"}
|
package/out/classify.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* `classifyKind` is the entry point for Stage 2.5 (kind classification), composing the per-kind rules
|
|
7
|
-
* from `rules.ts` and `intent-rules.ts` and returning alternatives sorted by confidence.
|
|
8
|
-
*
|
|
9
|
-
* Per the project's "possibilities not constraints" principle, every kind that fires above 0 surfaces
|
|
10
|
-
* in `alternatives` and the caller decides whether to act on the top kind only: `bare_toponym` and
|
|
11
|
-
* `route_pair` are scored below their structural incumbent precisely so they land in `alternatives`,
|
|
12
|
-
* where they inform the markers without moving the routing decision.
|
|
13
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
14
3
|
import { deriveIntentMarkers } from "#intent/markers";
|
|
15
4
|
import { scoreBareToponym, scoreNearMe, scoreRoutePair } from "#intent/rules";
|
|
16
5
|
import { matchPOISubject, scorePOICategory, scorePOIQuery } from "#poi";
|
|
@@ -78,7 +67,7 @@ export async function classifyKind(input, shape, _locale) {
|
|
|
78
67
|
return classifyKindSync(input, shape);
|
|
79
68
|
}
|
|
80
69
|
/**
|
|
81
|
-
* Build a kind classifier that
|
|
70
|
+
* Build a kind classifier that's exactly {@link classifyKind} without options,
|
|
82
71
|
* or that additionally scores `poi_query` + `poi_category` (ROAD_TO_V9 §4.4)
|
|
83
72
|
* and merges them into the ranked result when given a `poiLexicon`.
|
|
84
73
|
*/
|
package/out/classify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../lib/classify.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../lib/classify.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAelE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC7E,OAAO,EAAE,eAAe,EAA8C,gBAAgB,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AACnH,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,kBAAkB,GAClB,MAAM,QAAQ,CAAA;AAOf,MAAM,OAAO,GAA8B;IAC1C,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE;IACrC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;IAC9F,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,EAAE;IAClD,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACnD,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACnD,EAAE,IAAI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"}
|
package/out/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Stage 2.5 classifier: compose rule-based scorers over QueryShape and return a top kind with alternatives.
|
|
2
|
+
* Stage 2.5 classifier: compose rule-based scorers over QueryShape
|
|
3
|
+
* and return a top kind with alternatives.
|
|
7
4
|
*/
|
|
8
5
|
export { classifyKind, classifyKindSync, createKindClassifier } from "#classify";
|
|
9
6
|
export type { KindClassifierOpts } from "#classify";
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChF,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC5F,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AACrD,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAE5G,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,kBAAkB,GAClB,MAAM,QAAQ,CAAA"}
|
package/out/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Stage 2.5 classifier: compose rule-based scorers over QueryShape and return a top kind with alternatives.
|
|
4
|
+
* Stage 2.5 classifier: compose rule-based scorers over QueryShape
|
|
5
|
+
* and return a top kind with alternatives.
|
|
7
6
|
*/
|
|
8
7
|
export { classifyKind, classifyKindSync, createKindClassifier } from "#classify";
|
|
9
8
|
export { deriveIntentMarkers } from "#intent/markers";
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEhF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC5F,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAGrD,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,kBAAkB,GAClB,MAAM,QAAQ,CAAA"}
|
package/out/intent/markers.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
2
|
+
* Marker derivation for the ROAD_TO_V9 §4 intent vocabulary.
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
* classifier turns a fired rule into something a caller reads.
|
|
4
|
+
* This code is pure and synchronous.
|
|
5
|
+
* It is the only place the classifier turns a fired rule into something a caller reads.
|
|
8
6
|
*
|
|
9
|
-
* Three of the four intent kinds can raise their marker here from the string by itself.
|
|
10
|
-
* Stage 2.5 cannot raise `bare_toponym`'s `declared_ambiguity` from the string by itself.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* `
|
|
14
|
-
*
|
|
7
|
+
* Three of the four intent kinds can raise their marker here from the string by itself.
|
|
8
|
+
* The fourth, Stage 2.5 cannot raise `bare_toponym`'s `declared_ambiguity` from the string by itself.
|
|
9
|
+
*
|
|
10
|
+
* Its trigger is the dominance margin of the resolved candidate list.
|
|
11
|
+
* `mailwoman/query-intent.ts` raises it after the resolve against `DECISIVE_MARGIN_LOG10`.
|
|
12
|
+
*
|
|
13
|
+
* This module therefore never emits `declared_ambiguity`, since a marker asserting
|
|
14
|
+
* ambiguity from the string by itself would declare every bare city name ambiguous.
|
|
15
15
|
*/
|
|
16
16
|
import type { QueryIntentMarker, QueryKind } from "@mailwoman/core/pipeline";
|
|
17
17
|
import type { NormalizedInputLite } from "@mailwoman/query-shape";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../lib/intent/markers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../lib/intent/markers.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAGjE,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,MAAM,CAAA;AAE1D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,mBAAmB,CAAA;IAC1B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,EAC7D,GAAG,EAAE,mBAAmB,GACtB,iBAAiB,EAAE,CAoErB"}
|
package/out/intent/markers.js
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Marker derivation for the ROAD_TO_V9 §4 intent vocabulary. This code is pure and synchronous. It is the only place the
|
|
7
|
-
* classifier turns a fired rule into something a caller reads.
|
|
8
|
-
*
|
|
9
|
-
* Three of the four intent kinds can raise their marker here from the string by itself. The fourth,
|
|
10
|
-
* Stage 2.5 cannot raise `bare_toponym`'s `declared_ambiguity` from the string by itself.
|
|
11
|
-
* Its trigger is the dominance margin of the resolved candidate list. `mailwoman/query-intent.ts` raises it
|
|
12
|
-
* after the resolve against `DECISIVE_MARGIN_LOG10`. This module therefore never emits
|
|
13
|
-
* `declared_ambiguity`, since a marker asserting ambiguity from the string by itself would declare every
|
|
14
|
-
* bare city name ambiguous.
|
|
15
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
16
3
|
import { nearMeSubject } from "#intent/rules";
|
|
17
4
|
import { poiCategoryOf } from "#poi";
|
|
18
5
|
/**
|
|
@@ -42,7 +29,7 @@ export function deriveIntentMarkers(kinds, ctx) {
|
|
|
42
29
|
*
|
|
43
30
|
* The order is stable: pair first, then the admin reading.
|
|
44
31
|
* A consumer can index it.
|
|
45
|
-
* This order
|
|
32
|
+
* This order doesn't rank the entries.
|
|
46
33
|
*/
|
|
47
34
|
interpretations: ["two_toponyms", "locality_with_admin_context"],
|
|
48
35
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markers.js","sourceRoot":"","sources":["../../lib/intent/markers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"markers.js","sourceRoot":"","sources":["../../lib/intent/markers.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAqBlE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAwB,MAAM,MAAM,CAAA;AAiB1D;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAClC,KAA6D,EAC7D,GAAwB;IAExB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAY,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IAC1D,MAAM,OAAO,GAAwB,EAAE,CAAA;IAEvC,IAAI,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7B,+EAA+E;QAC/E,qFAAqF;QACrF,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAEvD,OAAO,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,eAAe;YACrB,SAAS,EAAE,iBAAiB;YAC5B,OAAO,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,2HAA2H;YACxJ,QAAQ,EAAE;gBACT,MAAM;gBACN;;;;;;mBAMG;gBACH,eAAe,EAAE,CAAC,cAAc,EAAE,6BAA6B,CAAC;a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face as
|
|
7
|
-
* `rules.ts` and the same bitter-lesson invariant: universal structural patterns and bounded linguistic
|
|
8
|
-
* categories only, never a place-name dictionary, with the POI synonym table injected exactly as
|
|
9
|
-
* `poi.ts` does it.
|
|
2
|
+
* ROAD_TO_V9 §4 — the query-intent rules, with the same `(input, shape) => number`
|
|
3
|
+
* interface as `rules.ts` and the same bitter-lesson invariant: universal structural
|
|
4
|
+
* patterns and bounded linguistic categories only, never a place-name dictionary,
|
|
5
|
+
* with the POI synonym table injected exactly as `poi.ts` does it.
|
|
10
6
|
*
|
|
11
7
|
* `bare_toponym` and `route_pair` score below the structural kind that already owns their population
|
|
12
8
|
* (`locality_only`, 0.85), so they surface in `QueryKindResult.alternatives` and never as the top kind.
|
|
13
|
-
* The top kind is the only thing the coordinator routes on, so pinning it is what
|
|
14
|
-
* answer-neutral on the bare-city-name register.
|
|
9
|
+
* The top kind is the only thing the coordinator routes on, so pinning it is what
|
|
10
|
+
* makes these additions answer-neutral on the bare-city-name register.
|
|
11
|
+
* Their intent travels on the marker.
|
|
15
12
|
*
|
|
16
|
-
* `near_me` does win its top slot (0.91), because no incumbent reading competes
|
|
17
|
-
* ending "near me"
|
|
13
|
+
* `near_me` does win its top slot (0.91), because no incumbent reading competes
|
|
14
|
+
* for the slot: a query ending "near me" isn't a locality.
|
|
18
15
|
*/
|
|
19
16
|
import type { NormalizedInputLite, QueryShapeSegmentsView as QueryShapeLike } from "@mailwoman/query-shape";
|
|
20
17
|
/**
|
|
21
18
|
* `bare_toponym` rule: a single coherent place-name carrying no address grammar, feeding the
|
|
22
|
-
* declared-ambiguity path without asserting which place — that
|
|
19
|
+
* declared-ambiguity path without asserting which place — that's the resolver's question,
|
|
23
20
|
* decided by the answer's dominance margin in `mailwoman/query-intent.ts`.
|
|
24
21
|
*/
|
|
25
22
|
export declare function scoreBareToponym(input: NormalizedInputLite, shape: QueryShapeLike): number;
|
|
@@ -48,7 +45,7 @@ export declare function scoreNearMe(input: NormalizedInputLite, _shape: QuerySha
|
|
|
48
45
|
/**
|
|
49
46
|
* The subject of a `near_me` query is the requested category or thing with the locator stripped.
|
|
50
47
|
*
|
|
51
|
-
* It is empty when the rule
|
|
48
|
+
* It is empty when the rule wouldn't have fired.
|
|
52
49
|
* The subject builds marker evidence and never a route.
|
|
53
50
|
*/
|
|
54
51
|
export declare function nearMeSubject(input: NormalizedInputLite): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../lib/intent/rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../lib/intent/rules.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAoN3G;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAE1F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAgBxF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAatF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAQhE"}
|
package/out/intent/rules.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* ROAD_TO_V9 §4 — the query-intent rules, with the same `(input, shape) => number` interface as
|
|
7
|
-
* `rules.ts` and the same bitter-lesson invariant: universal structural patterns and bounded linguistic
|
|
8
|
-
* categories only, never a place-name dictionary, with the POI synonym table injected exactly as
|
|
9
|
-
* `poi.ts` does it.
|
|
10
|
-
*
|
|
11
|
-
* `bare_toponym` and `route_pair` score below the structural kind that already owns their population
|
|
12
|
-
* (`locality_only`, 0.85), so they surface in `QueryKindResult.alternatives` and never as the top kind.
|
|
13
|
-
* The top kind is the only thing the coordinator routes on, so pinning it is what makes these additions
|
|
14
|
-
* answer-neutral on the bare-city-name register. Their intent travels on the marker.
|
|
15
|
-
*
|
|
16
|
-
* `near_me` does win its top slot (0.91), because no incumbent reading competes for the slot: a query
|
|
17
|
-
* ending "near me" is not a locality.
|
|
18
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
19
3
|
import { carriesLetter, isDisqualifyingStreetSuffix, MAX_LOCALITY_ONLY_LENGTH, wordsOf } from "#rules";
|
|
20
4
|
/**
|
|
21
5
|
* Both refinement kinds sit a whole confidence step below `locality_only`'s 0.85
|
|
@@ -159,7 +143,7 @@ const TOPONYM_TAIL_NOUNS = new Set([
|
|
|
159
143
|
* This is the bounded class `preposition + a reference to the asker`, where `me`,
|
|
160
144
|
* `here`, `my <noun>` are function words rather than places.
|
|
161
145
|
*
|
|
162
|
-
* Anchored to the end of the string (`$`) on purpose: the query
|
|
146
|
+
* Anchored to the end of the string (`$`) on purpose: the query identifies no anchor,
|
|
163
147
|
* so anything after the locator is an anchor and disqualifies it.
|
|
164
148
|
*
|
|
165
149
|
* Linear by construction: every alternative begins with a required literal and the only
|
|
@@ -180,9 +164,9 @@ function hasDeicticTail(lowercased) {
|
|
|
180
164
|
* The conditions `bare_toponym` and `route_pair` share: no address grammar of any kind,
|
|
181
165
|
* one segment, alpha throughout.
|
|
182
166
|
*
|
|
183
|
-
* @returns the word list when the input clears them, `null` when it
|
|
167
|
+
* @returns the word list when the input clears them, `null` when it doesn't.
|
|
184
168
|
* The conditions are deliberately a superset of `scoreLocalityOnly`'s, so `bare_toponym` is
|
|
185
|
-
* a strict refinement of `locality_only` and can never fire where `locality_only`
|
|
169
|
+
* a strict refinement of `locality_only` and can never fire where `locality_only` didn't.
|
|
186
170
|
*/
|
|
187
171
|
function bareNameWords(input, shape) {
|
|
188
172
|
const text = input.normalized.trim();
|
|
@@ -196,7 +180,7 @@ function bareNameWords(input, shape) {
|
|
|
196
180
|
// beside it because `foldInputClass` answers `alpha` for input carrying no classified token.
|
|
197
181
|
if (shape.characterClass !== "alpha" || !carriesLetter(text))
|
|
198
182
|
return null;
|
|
199
|
-
// A comma is the admin-context marker ("Paris, FR"), so one segment or the name
|
|
183
|
+
// A comma is the admin-context marker ("Paris, FR"), so one segment or the name isn't bare.
|
|
200
184
|
if ((shape.segments?.length ?? 1) !== 1)
|
|
201
185
|
return null;
|
|
202
186
|
const lowercased = text.toLowerCase();
|
|
@@ -213,7 +197,7 @@ function bareNameWords(input, shape) {
|
|
|
213
197
|
}
|
|
214
198
|
/**
|
|
215
199
|
* `bare_toponym` rule: a single coherent place-name carrying no address grammar, feeding the
|
|
216
|
-
* declared-ambiguity path without asserting which place — that
|
|
200
|
+
* declared-ambiguity path without asserting which place — that's the resolver's question,
|
|
217
201
|
* decided by the answer's dominance margin in `mailwoman/query-intent.ts`.
|
|
218
202
|
*/
|
|
219
203
|
export function scoreBareToponym(input, shape) {
|
|
@@ -269,7 +253,7 @@ export function scoreNearMe(input, _shape) {
|
|
|
269
253
|
/**
|
|
270
254
|
* The subject of a `near_me` query is the requested category or thing with the locator stripped.
|
|
271
255
|
*
|
|
272
|
-
* It is empty when the rule
|
|
256
|
+
* It is empty when the rule wouldn't have fired.
|
|
273
257
|
* The subject builds marker evidence and never a route.
|
|
274
258
|
*/
|
|
275
259
|
export function nearMeSubject(input) {
|
package/out/intent/rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../lib/intent/rules.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../lib/intent/rules.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAoBlE,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACtG;;;GAGG;AACH,MAAM,uBAAuB,GAAG,IAAI,CAAA;AAEpC;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAElC;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAE/B;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAEhC;;;;;;;;;GASG;AACH,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC;IAC3D,UAAU;IACV,KAAK;IACL,KAAK;IACL,MAAM;IACN,IAAI;IACJ,MAAM;IACN,MAAM;IACN,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,IAAI;IACJ,KAAK;IACL,UAAU;IACV,KAAK;IACL,OAAO;IACP,OAAO;IACP,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,OAAO;IACP,KAAK;IACL,OAAO;IACP,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,oBAAoB;IACpB,KAAK;IACL,OAAO;IACP,KAAK;IACL,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,KAAK;IACL,IAAI;IACJ,MAAM;IACN,OAAO;IACP,MAAM;IACN,mFAAmF;IACnF,KAAK;IACL,6EAA6E;IAC7E,gFAAgF;IAChF,uEAAuE;IACvE,+DAA+D;IAC/D,KAAK;IAC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
-
* @author Teffen Ellis, et al.
|
|
2
|
+
* POI subject detection for the `poi_query` kind.
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* The lexicon is injected (`POIPhraseLookup`) so this package keeps its bitter-lesson
|
|
5
|
+
* invariant (no dictionaries in-tree); the phrase table lives in `@mailwoman/poi-taxonomy`
|
|
6
|
+
* and is wired in by `createRuntimePipeline` behind the `poiQueryKind` flag.
|
|
9
7
|
* Spec §3.1.
|
|
10
8
|
*/
|
|
11
9
|
import type { POISpatialRelation } from "@mailwoman/core/pipeline";
|
|
@@ -23,7 +21,7 @@ export interface POIPhraseMatch {
|
|
|
23
21
|
matchedPhrase: string;
|
|
24
22
|
confidence: number;
|
|
25
23
|
/**
|
|
26
|
-
* How the phrase matched, or `null` when the lookup
|
|
24
|
+
* How the phrase matched, or `null` when the lookup doesn't report it.
|
|
27
25
|
*
|
|
28
26
|
* `short_label` is a category label without its trailing `restaurant`, `store` or `shop`
|
|
29
27
|
* (`sushi`). {@linkcode matchPOISubject} accepts it only as a subject followed by an anchor.
|
|
@@ -31,7 +29,7 @@ export interface POIPhraseMatch {
|
|
|
31
29
|
*/
|
|
32
30
|
mechanism: "exact" | "locale_normalized" | "typo" | "short_label" | null;
|
|
33
31
|
/**
|
|
34
|
-
* The phrase the lookup received, or `null` when the lookup
|
|
32
|
+
* The phrase the lookup received, or `null` when the lookup doesn't report it.
|
|
35
33
|
*/
|
|
36
34
|
inputPhrase: string | null;
|
|
37
35
|
/**
|
|
@@ -51,7 +49,7 @@ export interface POIPhraseMatch {
|
|
|
51
49
|
* returns the categories one typed phrase could name, the curated reading first
|
|
52
50
|
* (`credit union` → the `bank` rollup its synonym redirects to), while an affordance
|
|
53
51
|
* rung returns every entity kind that affords one activity in a stable enumeration.
|
|
54
|
-
* The enumeration
|
|
52
|
+
* The enumeration doesn't express a preference.
|
|
55
53
|
*
|
|
56
54
|
* - `"preference"`: the hits are a preference list; {@link matchPOISubject} keeps the first.
|
|
57
55
|
* The committed lexicon's shape.
|
|
@@ -118,9 +116,9 @@ export interface POISubjectMatch {
|
|
|
118
116
|
* separator whose prefix hits the lexicon (≤ 8 tokens).
|
|
119
117
|
*
|
|
120
118
|
* Scans separators left-to-right, because a lexicon phrase may itself contain a bare separator
|
|
121
|
-
* word ("walk in clinic") and the first separator
|
|
119
|
+
* word ("walk in clinic") and the first separator isn't necessarily the right split point.
|
|
122
120
|
* Returns null when the lexicon never fires, including comma-ridden full addresses
|
|
123
|
-
* whose leading segment
|
|
121
|
+
* whose leading segment isn't a phrase.
|
|
124
122
|
*
|
|
125
123
|
* The winning candidate's hits are listed per {@link reachedMatches}.
|
|
126
124
|
*/
|
|
@@ -151,7 +149,7 @@ export declare function scorePOICategory(matched: POISubjectMatch | null): numbe
|
|
|
151
149
|
/**
|
|
152
150
|
* The whole-input category hit behind a `poi_category` verdict, for the marker's evidence.
|
|
153
151
|
*
|
|
154
|
-
* `null` when the subject match
|
|
152
|
+
* `null` when the subject match isn't a bare category, under the same conditions
|
|
155
153
|
* as {@link scorePOICategory}.
|
|
156
154
|
* The shared conditions keep the score and the evidence from disagreeing.
|
|
157
155
|
*/
|
package/out/poi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poi.d.ts","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"poi.d.ts","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,KAAK,EAAE,sBAAsB,IAAI,cAAc,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAShG;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM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;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAa5F;AAYD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,CAIxE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,cAAc,GAAG,IAAI,CAMpF"}
|
package/out/poi.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* POI subject detection for the `poi_query` kind. The lexicon is injected (`POIPhraseLookup`) so this
|
|
7
|
-
* package keeps its bitter-lesson invariant (no dictionaries in-tree); the phrase table lives in
|
|
8
|
-
* `@mailwoman/poi-taxonomy` and is wired in by `createRuntimePipeline` behind the `poiQueryKind` flag.
|
|
9
|
-
* Spec §3.1.
|
|
10
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
11
3
|
/**
|
|
12
4
|
* Comma-segment ceiling for a POI-led query.
|
|
13
5
|
*
|
|
@@ -54,9 +46,9 @@ function reachedMatches(hits) {
|
|
|
54
46
|
* separator whose prefix hits the lexicon (≤ 8 tokens).
|
|
55
47
|
*
|
|
56
48
|
* Scans separators left-to-right, because a lexicon phrase may itself contain a bare separator
|
|
57
|
-
* word ("walk in clinic") and the first separator
|
|
49
|
+
* word ("walk in clinic") and the first separator isn't necessarily the right split point.
|
|
58
50
|
* Returns null when the lexicon never fires, including comma-ridden full addresses
|
|
59
|
-
* whose leading segment
|
|
51
|
+
* whose leading segment isn't a phrase.
|
|
60
52
|
*
|
|
61
53
|
* The winning candidate's hits are listed per {@link reachedMatches}.
|
|
62
54
|
*/
|
|
@@ -173,7 +165,7 @@ export function scorePOICategory(matched) {
|
|
|
173
165
|
/**
|
|
174
166
|
* The whole-input category hit behind a `poi_category` verdict, for the marker's evidence.
|
|
175
167
|
*
|
|
176
|
-
* `null` when the subject match
|
|
168
|
+
* `null` when the subject match isn't a bare category, under the same conditions
|
|
177
169
|
* as {@link scorePOICategory}.
|
|
178
170
|
* The shared conditions keep the score and the evidence from disagreeing.
|
|
179
171
|
*/
|
package/out/poi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poi.js","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"poi.js","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAalE;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAA;AA8G1B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,gBAAgB,GAAG,0CAA0C,CAAA;AAEnE;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAE5B;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,IAAmC;IAC1D,OAAO,IAAI,CAAC,CAAC,CAAE,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAA;AAC3D,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,MAAqB,EAAE,MAAuB;IAC3F,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAExC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAEzB,MAAM,KAAK,GAAG,MAAM,CAAC,O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* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Rule-based `QueryKind` scorers. Each scorer reads structural patterns in the normalized input and
|
|
7
|
-
* its QueryShape and returns a confidence from 0 to 1.
|
|
8
|
-
*/
|
|
9
1
|
import type { NormalizedInputLite, QueryShapeSegmentsView as QueryShapeLike } from "@mailwoman/query-shape";
|
|
10
2
|
/**
|
|
11
3
|
* Maximum length for a bare locality.
|
package/out/rules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../lib/rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../lib/rules.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAkB3G;;;GAGG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAgD1C;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAOrF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAQ5F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAQxF;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9C;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAmBhF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AA0CD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CA2C5F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAY3F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAwC3F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAuBhG;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAEtF"}
|
package/out/rules.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
4
|
+
* Rule-based `QueryKind` scorers.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Each scorer reads structural patterns in the normalized input and its QueryShape
|
|
7
|
+
* and returns a confidence from 0 to 1.
|
|
8
8
|
*/
|
|
9
9
|
import { NAME_PRONE_US_SUFFIXES, US_STREET_SUFFIX_LOOKUP } from "@mailwoman/codex/us/street/suffix";
|
|
10
10
|
import { classifyTokens, foldInputClass } from "@mailwoman/query-shape/character-class";
|
|
@@ -267,7 +267,7 @@ export function scoreStructuredAddress(input, shape) {
|
|
|
267
267
|
if (len === 0)
|
|
268
268
|
return 0;
|
|
269
269
|
const segCount = shape.segments?.length ?? 1;
|
|
270
|
-
// Digits outside the postcode are required, so a locality with a postcode
|
|
270
|
+
// Digits outside the postcode are required, so a locality with a postcode doesn't score here.
|
|
271
271
|
if (segCount >= 2 &&
|
|
272
272
|
shape.characterClass === "alphanumeric" &&
|
|
273
273
|
/\d/u.test(withoutPostcodeSpans(input.normalized, shape))) {
|
package/out/rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../lib/rules.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../lib/rules.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;GAKG;AAEH,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAEnG,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AACvE;;GAEG;AACH,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAE9B;;GAEG;AACH,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAEnC;;GAEG;AACH,MAAM,qBAAqB,GAAG,GAAG,CAAA;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAE1C;;GAEG;AACH,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAEhC;;GAEG;AACH,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAEhC;;GAEG;AACH,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAErC;;GAEG;AACH,MAAM,gCAAgC,GAAG,EAAE,CAAA;AAE3C;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACxB,QAAQ;IACR,MAAM;IACN,aAAa;IACb,UAAU;IACV,SAAS;IACT,QAAQ;IACR,aAAa;IACb,UAAU;IACV,QAAQ;CACR,CAAA;AAED;;GAEG;AACH,MAAM,qBAAqB,GAAG;IAC7B,g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AC;QAAE,OAAO,CAAC,CAAA;IACvB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAA;IAE5C,8FAA8F;IAC9F,IACC,QAAQ,IAAI,CAAC;QACb,KAAK,CAAC,cAAc,KAAK,cAAc;QACvC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,EACxD,CAAC;QACF,OAAO,GAAG,CAAA;IACX,CAAC;IAED,IAAI,GAAG,IAAI,gCAAgC,IAAI,KAAK,CAAC,cAAc,KAAK,cAAc;QAAE,OAAO,IAAI,CAAA;IAEnG,6FAA6F;IAC7F,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,GAAG,CAAA;IAE7B,IAAI,GAAG,GAAG,gCAAgC,IAAI,KAAK,CAAC,cAAc,KAAK,cAAc;QAAE,OAAO,GAAG,CAAA;IAEjG,OAAO,CAAC,CAAA;AACT,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAA2B,EAAE,MAAsB;IAC7E,OAAO,GAAG,CAAA;AACX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/kind-classifier",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.1.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": {
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@mailwoman/codex": "
|
|
68
|
-
"@mailwoman/core": "
|
|
69
|
-
"@mailwoman/query-shape": "
|
|
67
|
+
"@mailwoman/codex": "11.1.0",
|
|
68
|
+
"@mailwoman/core": "11.1.0",
|
|
69
|
+
"@mailwoman/query-shape": "11.1.0"
|
|
70
70
|
}
|
|
71
71
|
}
|