@mailwoman/kind-classifier 10.7.0 → 11.0.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/lib/classify.ts +10 -6
- package/lib/index.ts +1 -1
- package/lib/intent/markers.ts +7 -7
- package/lib/poi.ts +32 -41
- package/lib/rules.ts +1 -1
- package/out/classify.d.ts.map +1 -1
- package/out/classify.js +10 -6
- package/out/classify.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -1
- package/out/index.js.map +1 -1
- package/out/intent/markers.d.ts +5 -5
- package/out/intent/markers.d.ts.map +1 -1
- package/out/intent/markers.js +3 -3
- package/out/intent/markers.js.map +1 -1
- package/out/poi.d.ts +20 -11
- package/out/poi.d.ts.map +1 -1
- package/out/poi.js +30 -35
- package/out/poi.js.map +1 -1
- package/out/rules.js +1 -1
- package/out/rules.js.map +1 -1
- package/package.json +4 -4
package/lib/classify.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type { NormalizedInputLite, QueryShapeSegmentsView as QueryShapeLike } fr
|
|
|
17
17
|
|
|
18
18
|
import { deriveIntentMarkers } from "#intent/markers"
|
|
19
19
|
import { scoreBareToponym, scoreNearMe, scoreRoutePair } from "#intent/rules"
|
|
20
|
-
import {
|
|
20
|
+
import { matchPOISubject, type POIPhraseLookup, type POISubjectMatch, scorePOICategory, scorePOIQuery } from "#poi"
|
|
21
21
|
import {
|
|
22
22
|
scoreIntersection,
|
|
23
23
|
scoreLandmark,
|
|
@@ -80,14 +80,14 @@ const MARKER_KINDS: ReadonlySet<QueryKind> = new Set<QueryKind>(["route_pair", "
|
|
|
80
80
|
function withIntentMarkers(
|
|
81
81
|
verdict: QueryKindResult,
|
|
82
82
|
input: NormalizedInputLite,
|
|
83
|
-
|
|
83
|
+
poiSubject: POISubjectMatch | null = null,
|
|
84
84
|
locale?: string
|
|
85
85
|
): QueryKindResult {
|
|
86
86
|
const kinds = [{ kind: verdict.kind, confidence: verdict.confidence }, ...verdict.alternatives]
|
|
87
87
|
|
|
88
88
|
if (!kinds.some((k) => MARKER_KINDS.has(k.kind))) return verdict
|
|
89
89
|
|
|
90
|
-
const intentMarkers: QueryIntentMarker[] = deriveIntentMarkers(kinds, { input,
|
|
90
|
+
const intentMarkers: QueryIntentMarker[] = deriveIntentMarkers(kinds, { input, poiSubject, locale })
|
|
91
91
|
|
|
92
92
|
if (!intentMarkers.length) return verdict
|
|
93
93
|
|
|
@@ -147,8 +147,12 @@ export function createKindClassifier(
|
|
|
147
147
|
return async (input, shape, locale): Promise<QueryKindResult> => {
|
|
148
148
|
const localeTag = locale?.locale
|
|
149
149
|
const base = classifyKindSync(input, shape)
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
// One lexicon scan serves both POI scorers and the marker builder.
|
|
151
|
+
// Each lexicon query that misses the exact table costs an index read,
|
|
152
|
+
// and the scan queries once per prefix.
|
|
153
|
+
const poiSubject = matchPOISubject(input.normalized, localeTag ?? input.appliedLocale ?? null, poiLexicon)
|
|
154
|
+
const poiConfidence = scorePOIQuery(poiSubject, shape)
|
|
155
|
+
const categoryConfidence = scorePOICategory(poiSubject)
|
|
152
156
|
|
|
153
157
|
if (poiConfidence <= 0 && categoryConfidence <= 0) return base
|
|
154
158
|
|
|
@@ -169,6 +173,6 @@ export function createKindClassifier(
|
|
|
169
173
|
merged.push({ kind: "poi_category", confidence: categoryConfidence })
|
|
170
174
|
}
|
|
171
175
|
|
|
172
|
-
return withIntentMarkers(rank(merged), input,
|
|
176
|
+
return withIntentMarkers(rank(merged), input, poiSubject, localeTag)
|
|
173
177
|
}
|
|
174
178
|
}
|
package/lib/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type { KindClassifierOpts } from "#classify"
|
|
|
11
11
|
export { deriveIntentMarkers } from "#intent/markers"
|
|
12
12
|
export type { IntentMarkerContext } from "#intent/markers"
|
|
13
13
|
export { nearMeSubject, scoreBareToponym, scoreNearMe, scoreRoutePair } from "#intent/rules"
|
|
14
|
-
export {
|
|
14
|
+
export { matchPOISubject, poiCategoryOf } from "#poi"
|
|
15
15
|
export type { POIPhraseMatch, POIPhraseReading, POIPhraseLookup, POIQuerySpan, POISubjectMatch } from "#poi"
|
|
16
16
|
|
|
17
17
|
export {
|
package/lib/intent/markers.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type { QueryIntentMarker, QueryKind } from "@mailwoman/core/pipeline"
|
|
|
18
18
|
import type { NormalizedInputLite } from "@mailwoman/query-shape"
|
|
19
19
|
|
|
20
20
|
import { nearMeSubject } from "#intent/rules"
|
|
21
|
-
import {
|
|
21
|
+
import { poiCategoryOf, type POISubjectMatch } from "#poi"
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Context the marker builder needs beyond the scored kinds.
|
|
@@ -26,12 +26,12 @@ import { matchPOICategory, type POIPhraseLookup } from "#poi"
|
|
|
26
26
|
export interface IntentMarkerContext {
|
|
27
27
|
input: NormalizedInputLite
|
|
28
28
|
/**
|
|
29
|
-
* The
|
|
29
|
+
* The subject match the classifier's one lexicon scan of `input` produced, when a POI lexicon was wired.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
* kind not firing without
|
|
31
|
+
* `null` or absent means no `poi_category` marker can be built, consistent
|
|
32
|
+
* with the kind not firing without a lexicon.
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
poiSubject?: POISubjectMatch | null
|
|
35
35
|
locale?: string
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -95,8 +95,8 @@ export function deriveIntentMarkers(
|
|
|
95
95
|
})
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
if (fired.has("poi_category")
|
|
99
|
-
const match =
|
|
98
|
+
if (fired.has("poi_category")) {
|
|
99
|
+
const match = poiCategoryOf(ctx.poiSubject ?? null)
|
|
100
100
|
|
|
101
101
|
if (match) {
|
|
102
102
|
markers.push({
|
package/lib/poi.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { POISpatialRelation } from "@mailwoman/core/pipeline"
|
|
13
|
-
import type {
|
|
13
|
+
import type { QueryShapeSegmentsView as QueryShapeLike, TextSpan } from "@mailwoman/query-shape"
|
|
14
14
|
/**
|
|
15
15
|
* Comma-segment ceiling for a POI-led query.
|
|
16
16
|
*
|
|
@@ -33,8 +33,12 @@ export interface POIPhraseMatch {
|
|
|
33
33
|
confidence: number
|
|
34
34
|
/**
|
|
35
35
|
* How the phrase matched, or `null` when the lookup does not report it.
|
|
36
|
+
*
|
|
37
|
+
* `short_label` is a category label without its trailing `restaurant`, `store` or `shop`
|
|
38
|
+
* (`sushi`). {@linkcode matchPOISubject} accepts it only as a subject followed by an anchor.
|
|
39
|
+
* Such a phrase can also be a place name: `sushi`, `rice` and `german` all name WOF places.
|
|
36
40
|
*/
|
|
37
|
-
mechanism: "exact" | "locale_normalized" | "typo" | null
|
|
41
|
+
mechanism: "exact" | "locale_normalized" | "typo" | "short_label" | null
|
|
38
42
|
/**
|
|
39
43
|
* The phrase the lookup received, or `null` when the lookup does not report it.
|
|
40
44
|
*/
|
|
@@ -124,7 +128,7 @@ export interface POISubjectMatch {
|
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
/**
|
|
127
|
-
* Anchor separator between subject and place: comma, or near/in/at/around/to
|
|
131
|
+
* Anchor separator between subject and place: comma, or near/in/at/around/to/by/on,
|
|
128
132
|
* scanned left-to-right until a prefix hits the lexicon.
|
|
129
133
|
*
|
|
130
134
|
* Linear by construction (no polynomial ReDoS): neither alternative places an unbounded
|
|
@@ -140,7 +144,7 @@ export interface POISubjectMatch {
|
|
|
140
144
|
* The leading quantifier only shifted the match start within a whitespace run, while the retained
|
|
141
145
|
* trailing greedy quantifier keeps the match end and thus `matchAll`'s lastIndex identical.
|
|
142
146
|
*/
|
|
143
|
-
const ANCHOR_SEPARATOR = /,\s*|\s(near|in|at|around|to)\s+/gi
|
|
147
|
+
const ANCHOR_SEPARATOR = /,\s*|\s(near|in|at|around|to|by|on)\s+/gi
|
|
144
148
|
|
|
145
149
|
/**
|
|
146
150
|
* Longest subject accepted, in tokens: eight covers compound taxonomy phrases
|
|
@@ -177,7 +181,7 @@ export function matchPOISubject(text: string, locale: string | null, lookup: POI
|
|
|
177
181
|
|
|
178
182
|
if (!trimmed) return null
|
|
179
183
|
|
|
180
|
-
const whole = lookup(trimmed, locale ?? undefined)
|
|
184
|
+
const whole = lookup(trimmed, locale ?? undefined).filter((hit) => hit.mechanism !== "short_label")
|
|
181
185
|
|
|
182
186
|
if (whole.length) {
|
|
183
187
|
const matches = reachedMatches(whole)
|
|
@@ -245,33 +249,29 @@ export function matchPOISubject(text: string, locale: string | null, lookup: POI
|
|
|
245
249
|
}
|
|
246
250
|
|
|
247
251
|
/**
|
|
248
|
-
* `poi_query`
|
|
252
|
+
* `poi_query` confidence for a subject match, with confidence bands: a whole-input lexicon hit
|
|
249
253
|
* scores 0.92 (above venue-landmark's 0.88 ceiling, because an exact phrase beats a shape heuristic)
|
|
250
254
|
* and a subject plus anchor 0.9.
|
|
251
255
|
*
|
|
252
256
|
* The guards keep venue-led full addresses (class 2) on the structured-address path:
|
|
253
257
|
* a remainder leading with a house number, or a 4+-segment input, scores 0.
|
|
258
|
+
*
|
|
259
|
+
* The caller runs {@link matchPOISubject} once and hands the result to this scorer,
|
|
260
|
+
* {@link scorePOICategory} and {@link poiCategoryOf}, so one lexicon scan serves all three.
|
|
254
261
|
*/
|
|
255
|
-
export function
|
|
256
|
-
|
|
257
|
-
locale?: string
|
|
258
|
-
): (input: NormalizedInputLite, shape: QueryShapeLike) => number {
|
|
259
|
-
return (input, shape) => {
|
|
260
|
-
const matched = matchPOISubject(input.normalized, locale ?? input.appliedLocale ?? null, lookup)
|
|
261
|
-
|
|
262
|
-
if (!matched) return 0
|
|
262
|
+
export function scorePOIQuery(matched: POISubjectMatch | null, shape: QueryShapeLike): number {
|
|
263
|
+
if (!matched) return 0
|
|
263
264
|
|
|
264
|
-
|
|
265
|
+
if (matched.remainder === "") return 0.92 * matched.match.confidence
|
|
265
266
|
|
|
266
|
-
|
|
267
|
-
|
|
267
|
+
// Venue-led full address: "X, 350 5th Ave, …" stays a structured_address parse.
|
|
268
|
+
if (/^\d+\s/.test(matched.remainder)) return 0
|
|
268
269
|
|
|
269
|
-
|
|
270
|
+
const segCount = shape.segments?.length ?? 1
|
|
270
271
|
|
|
271
|
-
|
|
272
|
+
if (segCount > MAX_POI_SEGMENTS) return 0
|
|
272
273
|
|
|
273
|
-
|
|
274
|
-
}
|
|
274
|
+
return 0.9 * matched.match.confidence
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
/**
|
|
@@ -285,8 +285,8 @@ export function createScorePOIQuery(
|
|
|
285
285
|
const POI_CATEGORY_CONFIDENCE = 0.93
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
|
-
* `poi_category`
|
|
289
|
-
* to search
|
|
288
|
+
* `poi_category` confidence (ROAD_TO_V9 §4.4) for a subject match: a bare taxonomy category
|
|
289
|
+
* with nowhere to search, such as "tacos", "grocery store" or "drinking fountain".
|
|
290
290
|
*
|
|
291
291
|
* Fires only on a whole-input lexicon hit (`remainder === ""`) whose subject is a category.
|
|
292
292
|
* A brand (`kind: "brand"`) is excluded because `POIPhraseMatch.categoryID`
|
|
@@ -294,29 +294,20 @@ const POI_CATEGORY_CONFIDENCE = 0.93
|
|
|
294
294
|
*
|
|
295
295
|
* That value would misrepresent the marker's `categoryID` evidence.
|
|
296
296
|
*/
|
|
297
|
-
export function
|
|
298
|
-
|
|
299
|
-
locale?: string
|
|
300
|
-
): (input: NormalizedInputLite, shape: QueryShapeLike) => number {
|
|
301
|
-
return (input, _shape) => {
|
|
302
|
-
const matched = matchPOISubject(input.normalized, locale ?? input.appliedLocale ?? null, lookup)
|
|
303
|
-
|
|
304
|
-
if (!matched || matched.remainder !== "") return 0
|
|
297
|
+
export function scorePOICategory(matched: POISubjectMatch | null): number {
|
|
298
|
+
const category = poiCategoryOf(matched)
|
|
305
299
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
return POI_CATEGORY_CONFIDENCE * matched.match.confidence
|
|
309
|
-
}
|
|
300
|
+
return category ? POI_CATEGORY_CONFIDENCE * category.confidence : 0
|
|
310
301
|
}
|
|
311
302
|
|
|
312
303
|
/**
|
|
313
|
-
* The whole-input category hit behind a `poi_category` verdict, for the marker's evidence
|
|
314
|
-
*
|
|
315
|
-
*
|
|
304
|
+
* The whole-input category hit behind a `poi_category` verdict, for the marker's evidence.
|
|
305
|
+
*
|
|
306
|
+
* `null` when the subject match is not a bare category, under the same conditions
|
|
307
|
+
* as {@link scorePOICategory}.
|
|
308
|
+
* The shared conditions keep the score and the evidence from disagreeing.
|
|
316
309
|
*/
|
|
317
|
-
export function
|
|
318
|
-
const matched = matchPOISubject(text, locale, lookup)
|
|
319
|
-
|
|
310
|
+
export function poiCategoryOf(matched: POISubjectMatch | null): POIPhraseMatch | null {
|
|
320
311
|
if (!matched || matched.remainder !== "") return null
|
|
321
312
|
|
|
322
313
|
if (matched.match.kind !== "category") return null
|
package/lib/rules.ts
CHANGED
|
@@ -129,7 +129,7 @@ export function wordsOf(text: string): string[] {
|
|
|
129
129
|
export function isDisqualifyingStreetSuffix(word: string): boolean {
|
|
130
130
|
const canonical = US_STREET_SUFFIX_LOOKUP.get(word.trim().toLowerCase())
|
|
131
131
|
|
|
132
|
-
return canonical
|
|
132
|
+
return Boolean(canonical && !NAME_PRONE_US_SUFFIXES.has(canonical))
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/**
|
package/out/classify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../lib/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;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,
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../lib/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { deriveIntentMarkers } from "#intent/markers";
|
|
15
15
|
import { scoreBareToponym, scoreNearMe, scoreRoutePair } from "#intent/rules";
|
|
16
|
-
import {
|
|
16
|
+
import { matchPOISubject, scorePOICategory, scorePOIQuery } from "#poi";
|
|
17
17
|
import { scoreIntersection, scoreLandmark, scoreLocalityOnly, scorePoBox, scorePostcodeOnly, scoreStructuredAddress, scoreVague, scoreVenueLandmark, } from "#rules";
|
|
18
18
|
const SCORERS = [
|
|
19
19
|
{ kind: "po_box", score: scorePoBox },
|
|
@@ -53,11 +53,11 @@ const MARKER_KINDS = new Set(["route_pair", "near_me", "poi_category"]);
|
|
|
53
53
|
* Attach markers to a verdict or return it untouched, separate from {@link rank}
|
|
54
54
|
* because the lexicon-wired path merges `poi_query`/`poi_category` in first.
|
|
55
55
|
*/
|
|
56
|
-
function withIntentMarkers(verdict, input,
|
|
56
|
+
function withIntentMarkers(verdict, input, poiSubject = null, locale) {
|
|
57
57
|
const kinds = [{ kind: verdict.kind, confidence: verdict.confidence }, ...verdict.alternatives];
|
|
58
58
|
if (!kinds.some((k) => MARKER_KINDS.has(k.kind)))
|
|
59
59
|
return verdict;
|
|
60
|
-
const intentMarkers = deriveIntentMarkers(kinds, { input,
|
|
60
|
+
const intentMarkers = deriveIntentMarkers(kinds, { input, poiSubject, locale });
|
|
61
61
|
if (!intentMarkers.length)
|
|
62
62
|
return verdict;
|
|
63
63
|
return { ...verdict, intentMarkers };
|
|
@@ -89,8 +89,12 @@ export function createKindClassifier(opts = {}) {
|
|
|
89
89
|
return async (input, shape, locale) => {
|
|
90
90
|
const localeTag = locale?.locale;
|
|
91
91
|
const base = classifyKindSync(input, shape);
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// One lexicon scan serves both POI scorers and the marker builder.
|
|
93
|
+
// Each lexicon query that misses the exact table costs an index read,
|
|
94
|
+
// and the scan queries once per prefix.
|
|
95
|
+
const poiSubject = matchPOISubject(input.normalized, localeTag ?? input.appliedLocale ?? null, poiLexicon);
|
|
96
|
+
const poiConfidence = scorePOIQuery(poiSubject, shape);
|
|
97
|
+
const categoryConfidence = scorePOICategory(poiSubject);
|
|
94
98
|
if (poiConfidence <= 0 && categoryConfidence <= 0)
|
|
95
99
|
return base;
|
|
96
100
|
// Re-ranking over the union rather than special-casing whether POI beat the
|
|
@@ -107,7 +111,7 @@ export function createKindClassifier(opts = {}) {
|
|
|
107
111
|
if (categoryConfidence > 0) {
|
|
108
112
|
merged.push({ kind: "poi_category", confidence: categoryConfidence });
|
|
109
113
|
}
|
|
110
|
-
return withIntentMarkers(rank(merged), input,
|
|
114
|
+
return withIntentMarkers(rank(merged), input, poiSubject, localeTag);
|
|
111
115
|
};
|
|
112
116
|
}
|
|
113
117
|
//# sourceMappingURL=classify.js.map
|
package/out/classify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../lib/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC7E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../lib/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,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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CAAC;YAC5B,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC,CAAA;QACtE,CAAC;QAED,OAAO,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAA;IACrE,CAAC,CAAA;AACF,CAAC"}
|
package/out/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type { KindClassifierOpts } from "#classify";
|
|
|
10
10
|
export { deriveIntentMarkers } from "#intent/markers";
|
|
11
11
|
export type { IntentMarkerContext } from "#intent/markers";
|
|
12
12
|
export { nearMeSubject, scoreBareToponym, scoreNearMe, scoreRoutePair } from "#intent/rules";
|
|
13
|
-
export {
|
|
13
|
+
export { matchPOISubject, poiCategoryOf } from "#poi";
|
|
14
14
|
export type { POIPhraseMatch, POIPhraseReading, POIPhraseLookup, POIQuerySpan, POISubjectMatch } from "#poi";
|
|
15
15
|
export { scoreIntersection, scoreLandmark, scoreLocalityOnly, scorePoBox, scorePostcodeOnly, scoreStructuredAddress, scoreVague, scoreVenueLandmark, } from "#rules";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
export { classifyKind, classifyKindSync, createKindClassifier } from "#classify";
|
|
9
9
|
export { deriveIntentMarkers } from "#intent/markers";
|
|
10
10
|
export { nearMeSubject, scoreBareToponym, scoreNearMe, scoreRoutePair } from "#intent/rules";
|
|
11
|
-
export {
|
|
11
|
+
export { matchPOISubject, poiCategoryOf } from "#poi";
|
|
12
12
|
export { scoreIntersection, scoreLandmark, scoreLocalityOnly, scorePoBox, scorePostcodeOnly, scoreStructuredAddress, scoreVague, scoreVenueLandmark, } from "#rules";
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { QueryIntentMarker, QueryKind } from "@mailwoman/core/pipeline";
|
|
17
17
|
import type { NormalizedInputLite } from "@mailwoman/query-shape";
|
|
18
|
-
import { type
|
|
18
|
+
import { type POISubjectMatch } from "#poi";
|
|
19
19
|
/**
|
|
20
20
|
* Context the marker builder needs beyond the scored kinds.
|
|
21
21
|
*/
|
|
22
22
|
export interface IntentMarkerContext {
|
|
23
23
|
input: NormalizedInputLite;
|
|
24
24
|
/**
|
|
25
|
-
* The
|
|
25
|
+
* The subject match the classifier's one lexicon scan of `input` produced, when a POI lexicon was wired.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
* kind not firing without
|
|
27
|
+
* `null` or absent means no `poi_category` marker can be built, consistent
|
|
28
|
+
* with the kind not firing without a lexicon.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
poiSubject?: POISubjectMatch | null;
|
|
31
31
|
locale?: string;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../lib/intent/markers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAGjE,OAAO,
|
|
1
|
+
{"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../lib/intent/markers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;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
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* bare city name ambiguous.
|
|
15
15
|
*/
|
|
16
16
|
import { nearMeSubject } from "#intent/rules";
|
|
17
|
-
import {
|
|
17
|
+
import { poiCategoryOf } from "#poi";
|
|
18
18
|
/**
|
|
19
19
|
* Build the advisories for one classified query, taking the full verdict — top plus alternatives —
|
|
20
20
|
* because two of the four intent kinds live in `alternatives` by design (see `intent-rules.ts`).
|
|
@@ -67,8 +67,8 @@ export function deriveIntentMarkers(kinds, ctx) {
|
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
if (fired.has("poi_category")
|
|
71
|
-
const match =
|
|
70
|
+
if (fired.has("poi_category")) {
|
|
71
|
+
const match = poiCategoryOf(ctx.poiSubject ?? null);
|
|
72
72
|
if (match) {
|
|
73
73
|
markers.push({
|
|
74
74
|
kind: "poi_category",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markers.js","sourceRoot":"","sources":["../../lib/intent/markers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"markers.js","sourceRoot":"","sources":["../../lib/intent/markers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,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;QACr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,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACvD;aACD,CAAC,CAAA;QACH,CAAC;IACF,CAAC;IAED,OAAO,OAAO,CAAA;AACf,CAAC"}
|
package/out/poi.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Spec §3.1.
|
|
10
10
|
*/
|
|
11
11
|
import type { POISpatialRelation } from "@mailwoman/core/pipeline";
|
|
12
|
-
import type {
|
|
12
|
+
import type { QueryShapeSegmentsView as QueryShapeLike, TextSpan } from "@mailwoman/query-shape";
|
|
13
13
|
/**
|
|
14
14
|
* One lexicon hit for a candidate subject phrase.
|
|
15
15
|
*/
|
|
@@ -24,8 +24,12 @@ export interface POIPhraseMatch {
|
|
|
24
24
|
confidence: number;
|
|
25
25
|
/**
|
|
26
26
|
* How the phrase matched, or `null` when the lookup does not report it.
|
|
27
|
+
*
|
|
28
|
+
* `short_label` is a category label without its trailing `restaurant`, `store` or `shop`
|
|
29
|
+
* (`sushi`). {@linkcode matchPOISubject} accepts it only as a subject followed by an anchor.
|
|
30
|
+
* Such a phrase can also be a place name: `sushi`, `rice` and `german` all name WOF places.
|
|
27
31
|
*/
|
|
28
|
-
mechanism: "exact" | "locale_normalized" | "typo" | null;
|
|
32
|
+
mechanism: "exact" | "locale_normalized" | "typo" | "short_label" | null;
|
|
29
33
|
/**
|
|
30
34
|
* The phrase the lookup received, or `null` when the lookup does not report it.
|
|
31
35
|
*/
|
|
@@ -122,17 +126,20 @@ export interface POISubjectMatch {
|
|
|
122
126
|
*/
|
|
123
127
|
export declare function matchPOISubject(text: string, locale: string | null, lookup: POIPhraseLookup): POISubjectMatch | null;
|
|
124
128
|
/**
|
|
125
|
-
* `poi_query`
|
|
129
|
+
* `poi_query` confidence for a subject match, with confidence bands: a whole-input lexicon hit
|
|
126
130
|
* scores 0.92 (above venue-landmark's 0.88 ceiling, because an exact phrase beats a shape heuristic)
|
|
127
131
|
* and a subject plus anchor 0.9.
|
|
128
132
|
*
|
|
129
133
|
* The guards keep venue-led full addresses (class 2) on the structured-address path:
|
|
130
134
|
* a remainder leading with a house number, or a 4+-segment input, scores 0.
|
|
135
|
+
*
|
|
136
|
+
* The caller runs {@link matchPOISubject} once and hands the result to this scorer,
|
|
137
|
+
* {@link scorePOICategory} and {@link poiCategoryOf}, so one lexicon scan serves all three.
|
|
131
138
|
*/
|
|
132
|
-
export declare function
|
|
139
|
+
export declare function scorePOIQuery(matched: POISubjectMatch | null, shape: QueryShapeLike): number;
|
|
133
140
|
/**
|
|
134
|
-
* `poi_category`
|
|
135
|
-
* to search
|
|
141
|
+
* `poi_category` confidence (ROAD_TO_V9 §4.4) for a subject match: a bare taxonomy category
|
|
142
|
+
* with nowhere to search, such as "tacos", "grocery store" or "drinking fountain".
|
|
136
143
|
*
|
|
137
144
|
* Fires only on a whole-input lexicon hit (`remainder === ""`) whose subject is a category.
|
|
138
145
|
* A brand (`kind: "brand"`) is excluded because `POIPhraseMatch.categoryID`
|
|
@@ -140,11 +147,13 @@ export declare function createScorePOIQuery(lookup: POIPhraseLookup, locale?: st
|
|
|
140
147
|
*
|
|
141
148
|
* That value would misrepresent the marker's `categoryID` evidence.
|
|
142
149
|
*/
|
|
143
|
-
export declare function
|
|
150
|
+
export declare function scorePOICategory(matched: POISubjectMatch | null): number;
|
|
144
151
|
/**
|
|
145
|
-
* The whole-input category hit behind a `poi_category` verdict, for the marker's evidence
|
|
146
|
-
*
|
|
147
|
-
*
|
|
152
|
+
* The whole-input category hit behind a `poi_category` verdict, for the marker's evidence.
|
|
153
|
+
*
|
|
154
|
+
* `null` when the subject match is not a bare category, under the same conditions
|
|
155
|
+
* as {@link scorePOICategory}.
|
|
156
|
+
* The shared conditions keep the score and the evidence from disagreeing.
|
|
148
157
|
*/
|
|
149
|
-
export declare function
|
|
158
|
+
export declare function poiCategoryOf(matched: POISubjectMatch | null): POIPhraseMatch | null;
|
|
150
159
|
//# sourceMappingURL=poi.d.ts.map
|
package/out/poi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poi.d.ts","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"poi.d.ts","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;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,CAAA;IAClB;;;;;;OAMG;IACH,SAAS,EAAE,OAAO,GAAG,mBAAmB,GAAG,MAAM,GAAG,aAAa,GAAG,IAAI,CAAA;IACxE;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B;;OAEG;IACH,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,CAAA;IACnC;;;;OAIG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB;;;;;;;;;;;;;OAaG;IACH,OAAO,EAAE,gBAAgB,CAAA;IACzB;;;;;;;;;OASG;IACH,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;CACtC;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,KAAK,CAAA;AAEnD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC,cAAc,CAAC,CAAA;AAEhG;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAA;AAEnC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;OAIG;IACH,KAAK,EAAE,cAAc,CAAA;IACrB;;;;;OAKG;IACH,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,YAAY,CAAA;IACzB;;OAEG;IACH,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAA;IACnC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;IACjC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,YAAY,GAAG,IAAI,CAAA;CAC/B;AAuCD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,eAAe,GAAG,eAAe,GAAG,IAAI,CAuEpH;AAED;;;;;;;;;;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
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
const MAX_POI_SEGMENTS = 3;
|
|
18
18
|
/**
|
|
19
|
-
* Anchor separator between subject and place: comma, or near/in/at/around/to
|
|
19
|
+
* Anchor separator between subject and place: comma, or near/in/at/around/to/by/on,
|
|
20
20
|
* scanned left-to-right until a prefix hits the lexicon.
|
|
21
21
|
*
|
|
22
22
|
* Linear by construction (no polynomial ReDoS): neither alternative places an unbounded
|
|
@@ -32,7 +32,7 @@ const MAX_POI_SEGMENTS = 3;
|
|
|
32
32
|
* The leading quantifier only shifted the match start within a whitespace run, while the retained
|
|
33
33
|
* trailing greedy quantifier keeps the match end and thus `matchAll`'s lastIndex identical.
|
|
34
34
|
*/
|
|
35
|
-
const ANCHOR_SEPARATOR = /,\s*|\s(near|in|at|around|to)\s+/gi;
|
|
35
|
+
const ANCHOR_SEPARATOR = /,\s*|\s(near|in|at|around|to|by|on)\s+/gi;
|
|
36
36
|
/**
|
|
37
37
|
* Longest subject accepted, in tokens: eight covers compound taxonomy phrases
|
|
38
38
|
* while bounding lexicon probes.
|
|
@@ -65,7 +65,7 @@ export function matchPOISubject(text, locale, lookup) {
|
|
|
65
65
|
const inputStart = text.indexOf(trimmed);
|
|
66
66
|
if (!trimmed)
|
|
67
67
|
return null;
|
|
68
|
-
const whole = lookup(trimmed, locale ?? undefined);
|
|
68
|
+
const whole = lookup(trimmed, locale ?? undefined).filter((hit) => hit.mechanism !== "short_label");
|
|
69
69
|
if (whole.length) {
|
|
70
70
|
const matches = reachedMatches(whole);
|
|
71
71
|
return {
|
|
@@ -124,28 +124,28 @@ export function matchPOISubject(text, locale, lookup) {
|
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
|
-
* `poi_query`
|
|
127
|
+
* `poi_query` confidence for a subject match, with confidence bands: a whole-input lexicon hit
|
|
128
128
|
* scores 0.92 (above venue-landmark's 0.88 ceiling, because an exact phrase beats a shape heuristic)
|
|
129
129
|
* and a subject plus anchor 0.9.
|
|
130
130
|
*
|
|
131
131
|
* The guards keep venue-led full addresses (class 2) on the structured-address path:
|
|
132
132
|
* a remainder leading with a house number, or a 4+-segment input, scores 0.
|
|
133
|
+
*
|
|
134
|
+
* The caller runs {@link matchPOISubject} once and hands the result to this scorer,
|
|
135
|
+
* {@link scorePOICategory} and {@link poiCategoryOf}, so one lexicon scan serves all three.
|
|
133
136
|
*/
|
|
134
|
-
export function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return 0;
|
|
147
|
-
return 0.9 * matched.match.confidence;
|
|
148
|
-
};
|
|
137
|
+
export function scorePOIQuery(matched, shape) {
|
|
138
|
+
if (!matched)
|
|
139
|
+
return 0;
|
|
140
|
+
if (matched.remainder === "")
|
|
141
|
+
return 0.92 * matched.match.confidence;
|
|
142
|
+
// Venue-led full address: "X, 350 5th Ave, …" stays a structured_address parse.
|
|
143
|
+
if (/^\d+\s/.test(matched.remainder))
|
|
144
|
+
return 0;
|
|
145
|
+
const segCount = shape.segments?.length ?? 1;
|
|
146
|
+
if (segCount > MAX_POI_SEGMENTS)
|
|
147
|
+
return 0;
|
|
148
|
+
return 0.9 * matched.match.confidence;
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* Confidence band for a bare category, one notch above `poi_query`'s whole-input
|
|
@@ -157,8 +157,8 @@ export function createScorePOIQuery(lookup, locale) {
|
|
|
157
157
|
*/
|
|
158
158
|
const POI_CATEGORY_CONFIDENCE = 0.93;
|
|
159
159
|
/**
|
|
160
|
-
* `poi_category`
|
|
161
|
-
* to search
|
|
160
|
+
* `poi_category` confidence (ROAD_TO_V9 §4.4) for a subject match: a bare taxonomy category
|
|
161
|
+
* with nowhere to search, such as "tacos", "grocery store" or "drinking fountain".
|
|
162
162
|
*
|
|
163
163
|
* Fires only on a whole-input lexicon hit (`remainder === ""`) whose subject is a category.
|
|
164
164
|
* A brand (`kind: "brand"`) is excluded because `POIPhraseMatch.categoryID`
|
|
@@ -166,23 +166,18 @@ const POI_CATEGORY_CONFIDENCE = 0.93;
|
|
|
166
166
|
*
|
|
167
167
|
* That value would misrepresent the marker's `categoryID` evidence.
|
|
168
168
|
*/
|
|
169
|
-
export function
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (!matched || matched.remainder !== "")
|
|
173
|
-
return 0;
|
|
174
|
-
if (matched.match.kind !== "category")
|
|
175
|
-
return 0;
|
|
176
|
-
return POI_CATEGORY_CONFIDENCE * matched.match.confidence;
|
|
177
|
-
};
|
|
169
|
+
export function scorePOICategory(matched) {
|
|
170
|
+
const category = poiCategoryOf(matched);
|
|
171
|
+
return category ? POI_CATEGORY_CONFIDENCE * category.confidence : 0;
|
|
178
172
|
}
|
|
179
173
|
/**
|
|
180
|
-
* The whole-input category hit behind a `poi_category` verdict, for the marker's evidence
|
|
181
|
-
*
|
|
182
|
-
*
|
|
174
|
+
* The whole-input category hit behind a `poi_category` verdict, for the marker's evidence.
|
|
175
|
+
*
|
|
176
|
+
* `null` when the subject match is not a bare category, under the same conditions
|
|
177
|
+
* as {@link scorePOICategory}.
|
|
178
|
+
* The shared conditions keep the score and the evidence from disagreeing.
|
|
183
179
|
*/
|
|
184
|
-
export function
|
|
185
|
-
const matched = matchPOISubject(text, locale, lookup);
|
|
180
|
+
export function poiCategoryOf(matched) {
|
|
186
181
|
if (!matched || matched.remainder !== "")
|
|
187
182
|
return null;
|
|
188
183
|
if (matched.match.kind !== "category")
|
package/out/poi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poi.js","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"poi.js","sourceRoot":"","sources":["../lib/poi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAA;AA8G1B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,gBAAgB,GAAG,0CAA0C,CAAA;AAEnE;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAE5B;;;;;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AEvC,OAAO,QAAQ,CAAC,CAAC,CAAC,uBAAuB,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,OAA+B;IAC5D,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,SAAS,KAAK,EAAE;QAAE,OAAO,IAAI,CAAA;IAErD,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAA;IAElD,OAAO,OAAO,CAAC,KAAK,CAAA;AACrB,CAAC"}
|
package/out/rules.js
CHANGED
|
@@ -109,7 +109,7 @@ export function wordsOf(text) {
|
|
|
109
109
|
*/
|
|
110
110
|
export function isDisqualifyingStreetSuffix(word) {
|
|
111
111
|
const canonical = US_STREET_SUFFIX_LOOKUP.get(word.trim().toLowerCase());
|
|
112
|
-
return canonical
|
|
112
|
+
return Boolean(canonical && !NAME_PRONE_US_SUFFIXES.has(canonical));
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Removes postcode spans in the final segment and collapses the remaining separators.
|
package/out/rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../lib/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;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,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,EAAE,MAAM,IAAI,CAAC,CAAA;IAE5C,IAAI,QAAQ,GAAG,CAAC;QAAE,OAAO,CAAC,CAAA;IAE1B,OAAO,IAAI,CAAA;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAA0B,EAAE,KAAqB;IACvF,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAA;IAEnC,IAAI,GAAG,KAAK,CAAC;QAAE,OAAO,CAAC,CAAA;IACvB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAA;IAE5C,+FAA+F;IAC/F,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.0.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.0.0",
|
|
68
|
+
"@mailwoman/core": "11.0.0",
|
|
69
|
+
"@mailwoman/query-shape": "11.0.0"
|
|
70
70
|
}
|
|
71
71
|
}
|