@mailwoman/kind-classifier 9.4.0 → 10.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 +13 -12
- package/lib/classify.ts +35 -36
- package/lib/index.ts +4 -11
- package/lib/{intent-markers.ts → intent/markers.ts} +29 -26
- package/lib/intent/rules.ts +306 -0
- package/lib/poi.ts +96 -84
- package/lib/rules.ts +142 -105
- package/out/classify.d.ts +18 -20
- package/out/classify.d.ts.map +1 -1
- package/out/classify.js +30 -33
- package/out/classify.js.map +1 -1
- package/out/index.d.ts +4 -11
- package/out/index.d.ts.map +1 -1
- package/out/index.js +3 -10
- package/out/index.js.map +1 -1
- package/out/intent/markers.d.ts +45 -0
- package/out/intent/markers.d.ts.map +1 -0
- package/out/intent/markers.js +88 -0
- package/out/intent/markers.js.map +1 -0
- package/out/intent/rules.d.ts +55 -0
- package/out/intent/rules.d.ts.map +1 -0
- package/out/intent/rules.js +281 -0
- package/out/intent/rules.js.map +1 -0
- package/out/poi.d.ts +64 -56
- package/out/poi.d.ts.map +1 -1
- package/out/poi.js +60 -50
- package/out/poi.js.map +1 -1
- package/out/rules.d.ts +22 -44
- package/out/rules.d.ts.map +1 -1
- package/out/rules.js +118 -104
- package/out/rules.js.map +1 -1
- package/package.json +15 -50
- package/lib/intent-rules.ts +0 -307
- package/out/intent-markers.d.ts +0 -46
- package/out/intent-markers.d.ts.map +0 -1
- package/out/intent-markers.js +0 -87
- package/out/intent-markers.js.map +0 -1
- package/out/intent-rules.d.ts +0 -59
- package/out/intent-rules.d.ts.map +0 -1
- package/out/intent-rules.js +0 -282
- package/out/intent-rules.js.map +0 -1
package/lib/rules.ts
CHANGED
|
@@ -3,65 +3,57 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Rule-based
|
|
7
|
-
* and returns a confidence
|
|
8
|
-
*
|
|
9
|
-
* Bitter-lesson-safe: only universal structural patterns — no place-name dictionaries. ~1 small
|
|
10
|
-
* regex set per new locale, not 50K dictionary entries.
|
|
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.
|
|
11
8
|
*/
|
|
12
9
|
|
|
13
|
-
import { NAME_PRONE_US_SUFFIXES, US_STREET_SUFFIX_LOOKUP } from "@mailwoman/codex/us/street
|
|
10
|
+
import { NAME_PRONE_US_SUFFIXES, US_STREET_SUFFIX_LOOKUP } from "@mailwoman/codex/us/street/suffix"
|
|
14
11
|
import type { NormalizedInputLite, QueryShapeSegmentsView as QueryShapeLike } from "@mailwoman/query-shape"
|
|
12
|
+
import { classifyTokens, foldInputClass } from "@mailwoman/query-shape/character-class"
|
|
13
|
+
import { isPostcodeFormat } from "@mailwoman/query-shape/known-formats"
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
17
|
-
* and belongs to the structured-address scorer.
|
|
15
|
+
* Maximum length for a bare venue or landmark query.
|
|
18
16
|
*/
|
|
19
17
|
const MAX_LANDMARK_LENGTH = 50
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
|
-
*
|
|
20
|
+
* Maximum length for a bare postcode, including an optional country prefix and separators.
|
|
23
21
|
*/
|
|
24
22
|
const MAX_POSTCODE_ONLY_LENGTH = 16
|
|
25
23
|
|
|
26
24
|
/**
|
|
27
|
-
*
|
|
28
|
-
* else too — a locality, a street — and another kind should win.
|
|
25
|
+
* Minimum fraction of the input that a postcode must cover for `postcode_only`.
|
|
29
26
|
*/
|
|
30
27
|
const MIN_POSTCODE_COVERAGE = 0.7
|
|
31
28
|
|
|
32
29
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* Exported so `intent-rules.ts`'s `bare_toponym` can share the exact same ceiling. Sharing it is what makes
|
|
36
|
-
* "bare_toponym is a strict refinement of locality_only" a structural property rather than two numbers that happen to
|
|
37
|
-
* agree today.
|
|
30
|
+
* Maximum length for a bare locality.
|
|
31
|
+
* The `bare_toponym` intent rule uses the same limit.
|
|
38
32
|
*/
|
|
39
33
|
export const MAX_LOCALITY_ONLY_LENGTH = 30
|
|
40
34
|
|
|
41
35
|
/**
|
|
42
|
-
*
|
|
43
|
-
* and the phrase is more likely a full address line.
|
|
36
|
+
* Minimum word count for a short venue phrase.
|
|
44
37
|
*/
|
|
45
38
|
const VENUE_PHRASE_MIN_WORDS = 2
|
|
46
39
|
|
|
47
40
|
/**
|
|
48
|
-
*
|
|
41
|
+
* Maximum word count for a short venue phrase.
|
|
49
42
|
*/
|
|
50
43
|
const VENUE_PHRASE_MAX_WORDS = 4
|
|
51
44
|
|
|
52
45
|
/**
|
|
53
|
-
*
|
|
46
|
+
* Maximum word count for a longer single-segment venue phrase.
|
|
54
47
|
*/
|
|
55
48
|
const LONG_VENUE_PHRASE_MAX_WORDS = 6
|
|
56
49
|
|
|
57
50
|
/**
|
|
58
|
-
* Length at which
|
|
59
|
-
* alphanumeric inputs score lower because they are as likely to be a unit number.
|
|
51
|
+
* Length at which single-segment alphanumeric input scores as a likely structured address.
|
|
60
52
|
*/
|
|
61
53
|
const ALPHANUMERIC_POSTCODE_MIN_LENGTH = 15
|
|
62
54
|
|
|
63
55
|
/**
|
|
64
|
-
*
|
|
56
|
+
* Phrases that signal a relative landmark description.
|
|
65
57
|
*/
|
|
66
58
|
const LANDMARK_LEADERS = [
|
|
67
59
|
"behind",
|
|
@@ -76,32 +68,30 @@ const LANDMARK_LEADERS = [
|
|
|
76
68
|
]
|
|
77
69
|
|
|
78
70
|
/**
|
|
79
|
-
*
|
|
71
|
+
* Patterns that signal a street intersection.
|
|
80
72
|
*/
|
|
81
73
|
const INTERSECTION_PATTERNS = [
|
|
82
74
|
/\bcorner of\b/i,
|
|
83
75
|
/\bintersection of\b/i,
|
|
84
76
|
/\bat the corner of\b/i,
|
|
85
|
-
// "5th and Main", "Broadway & 42nd"
|
|
77
|
+
// Examples: "5th and Main", "Broadway & 42nd".
|
|
86
78
|
/\b\w+(?:st|nd|rd|th|street|ave|avenue|blvd|boulevard|road|rd|lane|ln)?\s+(?:and|&|@)\s+\w+/i,
|
|
87
79
|
]
|
|
88
80
|
|
|
89
81
|
/**
|
|
90
|
-
*
|
|
91
|
-
* covers all locale variants (US "PO Box 123", FR "BP 42", etc.).
|
|
82
|
+
* Scores input in which QueryShape detected a PO Box format.
|
|
92
83
|
*/
|
|
93
84
|
export function scorePoBox(_input: NormalizedInputLite, shape: QueryShapeLike): number {
|
|
94
85
|
const hit = shape.knownFormats.find((f) => f.format === "po_box")
|
|
95
86
|
|
|
96
87
|
if (!hit) return 0
|
|
97
88
|
|
|
98
|
-
//
|
|
99
|
-
// both rules fire on the same input.
|
|
89
|
+
// The bonus makes a PO Box win a tie with a structured address.
|
|
100
90
|
return Math.min(1, hit.confidence + 0.1)
|
|
101
91
|
}
|
|
102
92
|
|
|
103
93
|
/**
|
|
104
|
-
*
|
|
94
|
+
* Scores street-intersection phrasing.
|
|
105
95
|
*/
|
|
106
96
|
export function scoreIntersection(input: NormalizedInputLite, _shape: QueryShapeLike): number {
|
|
107
97
|
const text = input.normalized
|
|
@@ -114,8 +104,7 @@ export function scoreIntersection(input: NormalizedInputLite, _shape: QueryShape
|
|
|
114
104
|
}
|
|
115
105
|
|
|
116
106
|
/**
|
|
117
|
-
*
|
|
118
|
-
* location relative to another place.
|
|
107
|
+
* Scores input that begins with a relative-landmark phrase.
|
|
119
108
|
*/
|
|
120
109
|
export function scoreLandmark(input: NormalizedInputLite, _shape: QueryShapeLike): number {
|
|
121
110
|
const lc = input.normalized.toLowerCase().trim()
|
|
@@ -128,19 +117,14 @@ export function scoreLandmark(input: NormalizedInputLite, _shape: QueryShapeLike
|
|
|
128
117
|
}
|
|
129
118
|
|
|
130
119
|
/**
|
|
131
|
-
*
|
|
132
|
-
* matters: a trailing comma or doubled separator otherwise yields an empty string that inflates the word count and
|
|
133
|
-
* falsifies every-word predicates like the proper-case check below.
|
|
120
|
+
* Splits text on whitespace and commas and drops empty tokens.
|
|
134
121
|
*/
|
|
135
122
|
export function wordsOf(text: string): string[] {
|
|
136
|
-
return text.split(/[\s,]+/).filter((word) => word.length
|
|
123
|
+
return text.split(/[\s,]+/).filter((word) => word.length)
|
|
137
124
|
}
|
|
138
125
|
|
|
139
126
|
/**
|
|
140
|
-
*
|
|
141
|
-
* `@mailwoman/codex`, minus its curated name-prone canonicals (PARK, FIELD, HILL, LAKE, …). Those double as ordinary
|
|
142
|
-
* proper-name heads ("Wrigley Field", "Menlo Park"), and disqualifying on them would reject the very venue and place
|
|
143
|
-
* names the rules below exist to capture. Shared with `intent-rules.ts` so both rule sets read one definition.
|
|
127
|
+
* Reports whether a word is a USPS street suffix that rarely appears in place names.
|
|
144
128
|
*/
|
|
145
129
|
export function isDisqualifyingStreetSuffix(word: string): boolean {
|
|
146
130
|
const canonical = US_STREET_SUFFIX_LOOKUP.get(word.trim().toLowerCase())
|
|
@@ -149,11 +133,80 @@ export function isDisqualifyingStreetSuffix(word: string): boolean {
|
|
|
149
133
|
}
|
|
150
134
|
|
|
151
135
|
/**
|
|
152
|
-
*
|
|
153
|
-
|
|
136
|
+
* Removes postcode spans in the final segment and collapses the remaining separators.
|
|
137
|
+
*/
|
|
138
|
+
export function withoutPostcodeSpans(text: string, shape: QueryShapeLike): string {
|
|
139
|
+
const merged = mergedPostcodeSpans(shape)
|
|
140
|
+
|
|
141
|
+
if (!merged.length) return text
|
|
142
|
+
|
|
143
|
+
let remainder = text
|
|
144
|
+
|
|
145
|
+
// The loop removes spans from last to first.
|
|
146
|
+
// This order keeps the remaining offsets valid.
|
|
147
|
+
for (let index = merged.length - 1; index >= 0; index--) {
|
|
148
|
+
const span = merged[index]!
|
|
149
|
+
|
|
150
|
+
remainder = remainder.slice(0, span.start) + remainder.slice(span.end)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return remainder
|
|
154
|
+
.replaceAll(/[\s,]+/gu, " ")
|
|
155
|
+
.replace(/[\s,]+$/u, "")
|
|
156
|
+
.trim()
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Reports whether text contains a Unicode letter.
|
|
154
161
|
*
|
|
155
|
-
*
|
|
156
|
-
|
|
162
|
+
* By itself, the `alpha` character class can match punctuation-only input.
|
|
163
|
+
*/
|
|
164
|
+
export function carriesLetter(text: string): boolean {
|
|
165
|
+
return /\p{L}/u.test(text)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Merges overlapping postcode hits in the final segment into sorted, disjoint spans.
|
|
170
|
+
*/
|
|
171
|
+
function mergedPostcodeSpans(shape: QueryShapeLike): Array<{ start: number; end: number }> {
|
|
172
|
+
// Postcode hits in earlier segments are often house numbers.
|
|
173
|
+
const tail = shape.segments?.at(-1)?.span
|
|
174
|
+
|
|
175
|
+
if (!tail) return []
|
|
176
|
+
|
|
177
|
+
const merged: Array<{ start: number; end: number }> = []
|
|
178
|
+
|
|
179
|
+
for (const hit of shape.knownFormats) {
|
|
180
|
+
if (!isPostcodeFormat(hit.format)) continue
|
|
181
|
+
|
|
182
|
+
if (hit.span.start < tail.start || hit.span.end > tail.end) continue
|
|
183
|
+
|
|
184
|
+
merged.push({ start: hit.span.start, end: hit.span.end })
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (merged.length < 2) return merged
|
|
188
|
+
|
|
189
|
+
merged.sort((left, right) => left.start - right.start)
|
|
190
|
+
|
|
191
|
+
const disjoint: Array<{ start: number; end: number }> = [merged[0]!]
|
|
192
|
+
|
|
193
|
+
for (const span of merged.slice(1)) {
|
|
194
|
+
const last = disjoint.at(-1)!
|
|
195
|
+
|
|
196
|
+
if (span.start <= last.end) {
|
|
197
|
+
last.end = Math.max(last.end, span.end)
|
|
198
|
+
|
|
199
|
+
continue
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
disjoint.push(span)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return disjoint
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Scores short capitalized venue names that have no street suffix or recognized format.
|
|
157
210
|
*/
|
|
158
211
|
export function scoreVenueLandmark(input: NormalizedInputLite, shape: QueryShapeLike): number {
|
|
159
212
|
const text = input.normalized.trim()
|
|
@@ -161,34 +214,28 @@ export function scoreVenueLandmark(input: NormalizedInputLite, shape: QueryShape
|
|
|
161
214
|
|
|
162
215
|
if (len === 0 || len > MAX_LANDMARK_LENGTH) return 0
|
|
163
216
|
|
|
164
|
-
// Must have at least one capitalized word.
|
|
165
217
|
if (!/[A-Z]/.test(text)) return 0
|
|
166
218
|
|
|
167
|
-
// Reject if any known postcode format hit exists.
|
|
168
219
|
if (shape.knownFormats.length) return 0
|
|
169
220
|
|
|
170
|
-
// Reject if it looks like a multi-segment structured address (City, ST ZIP).
|
|
171
221
|
const segCount = shape.segments?.length ?? 1
|
|
172
222
|
|
|
173
223
|
if (segCount > 2) return 0
|
|
174
224
|
|
|
175
|
-
// Reject if any word is an unambiguous street suffix.
|
|
176
225
|
const words = wordsOf(text)
|
|
177
226
|
|
|
178
227
|
for (const w of words) {
|
|
179
228
|
if (isDisqualifyingStreetSuffix(w)) return 0
|
|
180
229
|
}
|
|
181
230
|
|
|
182
|
-
//
|
|
231
|
+
// A leading number usually is a house number.
|
|
183
232
|
if (/^\d+\s/.test(text)) return 0
|
|
184
233
|
|
|
185
|
-
//
|
|
234
|
+
// Venue names often contain a number after the first word.
|
|
186
235
|
const hasInternalNumber = /\s\d+/.test(text) && !/^\d/.test(text)
|
|
187
236
|
|
|
188
|
-
// Check if every word starts with uppercase (proper-noun pattern).
|
|
189
237
|
const allProperCase = words.length > 1 && words.every((w) => /^[A-Z]/.test(w))
|
|
190
238
|
|
|
191
|
-
// Boost for short single-segment capitalized phrases (2-4 words).
|
|
192
239
|
const wordCount = words.length
|
|
193
240
|
|
|
194
241
|
if (wordCount >= VENUE_PHRASE_MIN_WORDS && wordCount <= VENUE_PHRASE_MAX_WORDS && segCount === 1) {
|
|
@@ -199,7 +246,6 @@ export function scoreVenueLandmark(input: NormalizedInputLite, shape: QueryShape
|
|
|
199
246
|
return 0.65
|
|
200
247
|
}
|
|
201
248
|
|
|
202
|
-
// Longer single-segment capitalized phrases get moderate confidence.
|
|
203
249
|
if (wordCount <= LONG_VENUE_PHRASE_MAX_WORDS && segCount === 1 && allProperCase) {
|
|
204
250
|
return 0.75
|
|
205
251
|
}
|
|
@@ -208,36 +254,7 @@ export function scoreVenueLandmark(input: NormalizedInputLite, shape: QueryShape
|
|
|
208
254
|
}
|
|
209
255
|
|
|
210
256
|
/**
|
|
211
|
-
*
|
|
212
|
-
*/
|
|
213
|
-
const POSTCODE_FORMATS: ReadonlySet<string> = new Set([
|
|
214
|
-
"us_zip",
|
|
215
|
-
"us_zip4",
|
|
216
|
-
"uk_postcode",
|
|
217
|
-
"fr_postcode",
|
|
218
|
-
"de_postcode",
|
|
219
|
-
"ca_postcode",
|
|
220
|
-
"jp_postcode",
|
|
221
|
-
"nl_postcode",
|
|
222
|
-
"cz_postcode",
|
|
223
|
-
"sk_postcode",
|
|
224
|
-
"se_postcode",
|
|
225
|
-
"gr_postcode",
|
|
226
|
-
])
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Test whether a format string is a postcode variant. Use the set rather than ad-hoc string-matching to avoid the
|
|
230
|
-
* `us_zip4.endsWith("_zip")` false-negative trap.
|
|
231
|
-
*/
|
|
232
|
-
export function isPostcodeFormat(format: string): boolean {
|
|
233
|
-
return POSTCODE_FORMATS.has(format)
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* `postcode_only` rule: input is short AND has a postcode format hit covering most of it.
|
|
238
|
-
*
|
|
239
|
-
* The "covering most of it" check is what distinguishes `"10118"` (postcode-only) from `"350 5th Ave 10118"`
|
|
240
|
-
* (structured-address with a postcode in it).
|
|
257
|
+
* Scores short input in which a postcode covers most of the text.
|
|
241
258
|
*/
|
|
242
259
|
export function scorePostcodeOnly(input: NormalizedInputLite, shape: QueryShapeLike): number {
|
|
243
260
|
const len = input.normalized.length
|
|
@@ -248,29 +265,49 @@ export function scorePostcodeOnly(input: NormalizedInputLite, shape: QueryShapeL
|
|
|
248
265
|
if (!postcodeHit) return 0
|
|
249
266
|
const hitLen = postcodeHit.span.end - postcodeHit.span.start
|
|
250
267
|
|
|
251
|
-
// At least 70% of the input must be the postcode for the rule to fire confidently.
|
|
252
268
|
if (hitLen / len < MIN_POSTCODE_COVERAGE) return 0
|
|
253
269
|
|
|
254
|
-
// Confidence scales with how much of the input is the postcode and how confident the format hit was.
|
|
255
270
|
return Math.min(1, postcodeHit.confidence * (hitLen / len) + 0.1)
|
|
256
271
|
}
|
|
257
272
|
|
|
258
273
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
* Examples: `"Paris"`, `"NYC NY"`, `"Tokyo"`. Distinguishes from `structured_address` (multiple segments) and `vague`
|
|
262
|
-
* (long or mixed-class).
|
|
274
|
+
* Scores a place name with at most an administrative tail and an optional postcode.
|
|
263
275
|
*/
|
|
264
276
|
export function scoreLocalityOnly(input: NormalizedInputLite, shape: QueryShapeLike): number {
|
|
265
|
-
|
|
277
|
+
// Any recognized format other than a postcode rules out a bare locality.
|
|
278
|
+
let carriesPostcode = false
|
|
279
|
+
|
|
280
|
+
for (const hit of shape.knownFormats) {
|
|
281
|
+
if (isPostcodeFormat(hit.format)) {
|
|
282
|
+
carriesPostcode = true
|
|
283
|
+
|
|
284
|
+
continue
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return 0
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Only postcode hits in the final segment can be removed.
|
|
291
|
+
const removable = carriesPostcode ? mergedPostcodeSpans(shape) : []
|
|
292
|
+
|
|
293
|
+
if (carriesPostcode && !removable.length) return 0
|
|
294
|
+
|
|
295
|
+
const withoutPostcode = carriesPostcode ? withoutPostcodeSpans(input.normalized, shape) : input.normalized
|
|
296
|
+
const len = withoutPostcode.length
|
|
266
297
|
|
|
267
298
|
if (len === 0 || len > MAX_LOCALITY_ONLY_LENGTH) return 0
|
|
268
299
|
|
|
269
|
-
if (
|
|
300
|
+
if (!carriesLetter(withoutPostcode)) return 0
|
|
270
301
|
|
|
271
|
-
|
|
272
|
-
//
|
|
273
|
-
|
|
302
|
+
// The remaining text must be alphabetic.
|
|
303
|
+
// Its class is recomputed only after a postcode was removed.
|
|
304
|
+
if (shape.characterClass !== "alpha") {
|
|
305
|
+
if (!carriesPostcode) return 0
|
|
306
|
+
|
|
307
|
+
if (foldInputClass(classifyTokens(withoutPostcode)) !== "alpha") return 0
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// A locality and an administrative tail use at most two segments.
|
|
274
311
|
const segCount = shape.segments?.length ?? 1
|
|
275
312
|
|
|
276
313
|
if (segCount > 2) return 0
|
|
@@ -279,8 +316,7 @@ export function scoreLocalityOnly(input: NormalizedInputLite, shape: QueryShapeL
|
|
|
279
316
|
}
|
|
280
317
|
|
|
281
318
|
/**
|
|
282
|
-
*
|
|
283
|
-
* mixed-class.
|
|
319
|
+
* Scores multi-component address shapes.
|
|
284
320
|
*/
|
|
285
321
|
export function scoreStructuredAddress(input: NormalizedInputLite, shape: QueryShapeLike): number {
|
|
286
322
|
const len = input.normalized.length
|
|
@@ -288,26 +324,27 @@ export function scoreStructuredAddress(input: NormalizedInputLite, shape: QueryS
|
|
|
288
324
|
if (len === 0) return 0
|
|
289
325
|
const segCount = shape.segments?.length ?? 1
|
|
290
326
|
|
|
291
|
-
//
|
|
292
|
-
if (
|
|
327
|
+
// Digits outside the postcode are required, so a locality with a postcode does not score here.
|
|
328
|
+
if (
|
|
329
|
+
segCount >= 2 &&
|
|
330
|
+
shape.characterClass === "alphanumeric" &&
|
|
331
|
+
/\d/u.test(withoutPostcodeSpans(input.normalized, shape))
|
|
332
|
+
) {
|
|
333
|
+
return 0.9
|
|
334
|
+
}
|
|
293
335
|
|
|
294
|
-
// Single-segment but reasonably long and alphanumeric = moderate confidence.
|
|
295
336
|
if (len >= ALPHANUMERIC_POSTCODE_MIN_LENGTH && shape.characterClass === "alphanumeric") return 0.75
|
|
296
337
|
|
|
297
|
-
// Multi-segment
|
|
338
|
+
// Multi-segment input without digits may still be a multi-word locality, so it scores lower.
|
|
298
339
|
if (segCount >= 2) return 0.6
|
|
299
340
|
|
|
300
|
-
// Single-segment, short, alphanumeric (e.g. "10118-1234" with no other content) — weak.
|
|
301
341
|
if (len < ALPHANUMERIC_POSTCODE_MIN_LENGTH && shape.characterClass === "alphanumeric") return 0.4
|
|
302
342
|
|
|
303
343
|
return 0
|
|
304
344
|
}
|
|
305
345
|
|
|
306
346
|
/**
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* Returns a moderate baseline so `vague` always shows up as an alternative, even when other rules dominate. The
|
|
310
|
-
* coordinator decides whether to trust vague as the primary kind.
|
|
347
|
+
* Returns a low constant fallback score for ambiguous input.
|
|
311
348
|
*/
|
|
312
349
|
export function scoreVague(_input: NormalizedInputLite, _shape: QueryShapeLike): number {
|
|
313
350
|
return 0.3
|
package/out/classify.d.ts
CHANGED
|
@@ -3,30 +3,25 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
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.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Per the project's "possibilities not constraints" principle, every kind that fires above 0
|
|
13
|
-
* surfaces in `alternatives` — the caller decides whether to act on the top kind only or consider
|
|
14
|
-
* runner-ups. The ROAD_TO_V9 §4 intent vocabulary leans on that: `bare_toponym` and `route_pair`
|
|
15
|
-
* are scored below their structural incumbent precisely so they land in `alternatives`, where they
|
|
16
|
-
* inform the markers without moving the routing decision.
|
|
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.
|
|
17
13
|
*/
|
|
18
14
|
import type { LocaleHint, QueryKindResult } from "@mailwoman/core/pipeline";
|
|
19
15
|
import type { NormalizedInputLite, QueryShapeSegmentsView as QueryShapeLike } from "@mailwoman/query-shape";
|
|
20
16
|
import { type POIPhraseLookup } from "#poi";
|
|
21
17
|
/**
|
|
22
|
-
* Classify the query shape into a `QueryKind
|
|
23
|
-
* shape)` pair.
|
|
18
|
+
* Classify the query shape into a `QueryKind`, synchronously and purely,
|
|
19
|
+
* producing the same result for the same `(input, shape)` pair.
|
|
24
20
|
*/
|
|
25
21
|
export declare function classifyKindSync(input: NormalizedInputLite, shape: QueryShapeLike): QueryKindResult;
|
|
26
22
|
/**
|
|
27
|
-
* Async variant matching the runtime
|
|
28
|
-
*
|
|
29
|
-
* The locale parameter is accepted for future locale-aware rules (Japanese honorifics, etc.) but not currently used.
|
|
23
|
+
* Async variant matching the runtime pipeline's `classifyKind` interface;
|
|
24
|
+
* `_locale` is accepted for future locale-aware rules but currently unused.
|
|
30
25
|
*/
|
|
31
26
|
export declare function classifyKind(input: NormalizedInputLite, shape: QueryShapeLike, _locale?: LocaleHint): Promise<QueryKindResult>;
|
|
32
27
|
/**
|
|
@@ -34,15 +29,18 @@ export declare function classifyKind(input: NormalizedInputLite, shape: QuerySha
|
|
|
34
29
|
*/
|
|
35
30
|
export interface KindClassifierOpts {
|
|
36
31
|
/**
|
|
37
|
-
* POI phrase lexicon (spec §3.1)
|
|
38
|
-
*
|
|
39
|
-
*
|
|
32
|
+
* POI phrase lexicon (spec §3.1); when present the `poi_query`
|
|
33
|
+
* and `poi_category` scorers join the rule set.
|
|
34
|
+
*
|
|
35
|
+
* They are injected rather than imported so this package stays dictionary-free.
|
|
36
|
+
* When absent, the returned classifier behaves identically to {@link classifyKind}.
|
|
40
37
|
*/
|
|
41
38
|
poiLexicon?: POIPhraseLookup;
|
|
42
39
|
}
|
|
43
40
|
/**
|
|
44
|
-
* Build a kind classifier
|
|
45
|
-
* additionally scores `poi_query` + `poi_category` (ROAD_TO_V9 §4.4)
|
|
41
|
+
* Build a kind classifier that is exactly {@link classifyKind} without options,
|
|
42
|
+
* or that additionally scores `poi_query` + `poi_category` (ROAD_TO_V9 §4.4)
|
|
43
|
+
* and merges them into the ranked result when given a `poiLexicon`.
|
|
46
44
|
*/
|
|
47
45
|
export declare function createKindClassifier(opts?: KindClassifierOpts): (input: NormalizedInputLite, shape: QueryShapeLike, locale?: LocaleHint) => Promise<QueryKindResult>;
|
|
48
46
|
//# sourceMappingURL=classify.d.ts.map
|
package/out/classify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../lib/classify.ts"],"names":[],"mappings":"AAAA
|
|
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,EAA+C,KAAK,eAAe,EAAE,MAAM,MAAM,CAAA;AA4ExF;;;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,CAgCtG"}
|
package/out/classify.js
CHANGED
|
@@ -3,20 +3,16 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
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.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Per the project's "possibilities not constraints" principle, every kind that fires above 0
|
|
13
|
-
* surfaces in `alternatives` — the caller decides whether to act on the top kind only or consider
|
|
14
|
-
* runner-ups. The ROAD_TO_V9 §4 intent vocabulary leans on that: `bare_toponym` and `route_pair`
|
|
15
|
-
* are scored below their structural incumbent precisely so they land in `alternatives`, where they
|
|
16
|
-
* inform the markers without moving the routing decision.
|
|
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.
|
|
17
13
|
*/
|
|
18
|
-
import { deriveIntentMarkers } from "#intent
|
|
19
|
-
import { scoreBareToponym, scoreNearMe, scoreRoutePair } from "#intent
|
|
14
|
+
import { deriveIntentMarkers } from "#intent/markers";
|
|
15
|
+
import { scoreBareToponym, scoreNearMe, scoreRoutePair } from "#intent/rules";
|
|
20
16
|
import { createScorePOICategory, createScorePOIQuery } from "#poi";
|
|
21
17
|
import { scoreIntersection, scoreLandmark, scoreLocalityOnly, scorePoBox, scorePostcodeOnly, scoreStructuredAddress, scoreVague, scoreVenueLandmark, } from "#rules";
|
|
22
18
|
const SCORERS = [
|
|
@@ -26,17 +22,17 @@ const SCORERS = [
|
|
|
26
22
|
{ kind: "postcode_only", score: scorePostcodeOnly },
|
|
27
23
|
{ kind: "locality_only", score: scoreLocalityOnly },
|
|
28
24
|
{ kind: "structured_address", score: scoreStructuredAddress },
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
25
|
+
// Intent is vocabulary rather than a stage.
|
|
26
|
+
// The sort below decides, so `bare_toponym` and `route_pair` sit here cosmetically
|
|
27
|
+
// and are scored under `locality_only` on purpose (see `intent-rules.ts`).
|
|
32
28
|
{ kind: "bare_toponym", score: scoreBareToponym },
|
|
33
29
|
{ kind: "route_pair", score: scoreRoutePair },
|
|
34
30
|
{ kind: "near_me", score: scoreNearMe },
|
|
35
31
|
{ kind: "vague", score: scoreVague },
|
|
36
32
|
];
|
|
37
33
|
/**
|
|
38
|
-
* Rank a scored list
|
|
39
|
-
* drift in how they break ties or build `alternatives`.
|
|
34
|
+
* Rank a scored list into a verdict, shared by the lexicon-free and lexicon-wired paths
|
|
35
|
+
* so the two cannot drift in how they break ties or build `alternatives`.
|
|
40
36
|
*/
|
|
41
37
|
function rank(scored) {
|
|
42
38
|
scored.sort((a, b) => b.confidence - a.confidence);
|
|
@@ -48,17 +44,17 @@ function rank(scored) {
|
|
|
48
44
|
};
|
|
49
45
|
}
|
|
50
46
|
/**
|
|
51
|
-
* Every kind whose verdict
|
|
52
|
-
*
|
|
47
|
+
* Every kind whose verdict includes `intentMarkers`, checked before the marker builder
|
|
48
|
+
* so the hot path pays one set membership test per kind.
|
|
53
49
|
*/
|
|
54
|
-
const
|
|
50
|
+
const MARKER_KINDS = new Set(["route_pair", "near_me", "poi_category"]);
|
|
55
51
|
/**
|
|
56
|
-
* Attach markers to a verdict
|
|
57
|
-
*
|
|
52
|
+
* Attach markers to a verdict or return it untouched, separate from {@link rank}
|
|
53
|
+
* because the lexicon-wired path merges `poi_query`/`poi_category` in first.
|
|
58
54
|
*/
|
|
59
55
|
function withIntentMarkers(verdict, input, poiLexicon, locale) {
|
|
60
56
|
const kinds = [{ kind: verdict.kind, confidence: verdict.confidence }, ...verdict.alternatives];
|
|
61
|
-
if (!kinds.some((k) =>
|
|
57
|
+
if (!kinds.some((k) => MARKER_KINDS.has(k.kind)))
|
|
62
58
|
return verdict;
|
|
63
59
|
const intentMarkers = deriveIntentMarkers(kinds, { input, poiLexicon, locale });
|
|
64
60
|
if (!intentMarkers.length)
|
|
@@ -66,24 +62,24 @@ function withIntentMarkers(verdict, input, poiLexicon, locale) {
|
|
|
66
62
|
return { ...verdict, intentMarkers };
|
|
67
63
|
}
|
|
68
64
|
/**
|
|
69
|
-
* Classify the query shape into a `QueryKind
|
|
70
|
-
* shape)` pair.
|
|
65
|
+
* Classify the query shape into a `QueryKind`, synchronously and purely,
|
|
66
|
+
* producing the same result for the same `(input, shape)` pair.
|
|
71
67
|
*/
|
|
72
68
|
export function classifyKindSync(input, shape) {
|
|
73
69
|
const scored = SCORERS.map((s) => ({ kind: s.kind, confidence: s.score(input, shape) })).filter((s) => s.confidence > 0);
|
|
74
70
|
return withIntentMarkers(rank(scored), input);
|
|
75
71
|
}
|
|
76
72
|
/**
|
|
77
|
-
* Async variant matching the runtime
|
|
78
|
-
*
|
|
79
|
-
* The locale parameter is accepted for future locale-aware rules (Japanese honorifics, etc.) but not currently used.
|
|
73
|
+
* Async variant matching the runtime pipeline's `classifyKind` interface;
|
|
74
|
+
* `_locale` is accepted for future locale-aware rules but currently unused.
|
|
80
75
|
*/
|
|
81
76
|
export async function classifyKind(input, shape, _locale) {
|
|
82
77
|
return classifyKindSync(input, shape);
|
|
83
78
|
}
|
|
84
79
|
/**
|
|
85
|
-
* Build a kind classifier
|
|
86
|
-
* additionally scores `poi_query` + `poi_category` (ROAD_TO_V9 §4.4)
|
|
80
|
+
* Build a kind classifier that is exactly {@link classifyKind} without options,
|
|
81
|
+
* or that additionally scores `poi_query` + `poi_category` (ROAD_TO_V9 §4.4)
|
|
82
|
+
* and merges them into the ranked result when given a `poiLexicon`.
|
|
87
83
|
*/
|
|
88
84
|
export function createKindClassifier(opts = {}) {
|
|
89
85
|
const { poiLexicon } = opts;
|
|
@@ -96,9 +92,10 @@ export function createKindClassifier(opts = {}) {
|
|
|
96
92
|
const categoryConfidence = createScorePOICategory(poiLexicon, localeTag)(input, shape);
|
|
97
93
|
if (poiConfidence <= 0 && categoryConfidence <= 0)
|
|
98
94
|
return base;
|
|
99
|
-
// Re-
|
|
100
|
-
//
|
|
101
|
-
//
|
|
95
|
+
// Re-ranking over the union rather than special-casing whether POI beat the
|
|
96
|
+
// base preserves the base's own alternatives.
|
|
97
|
+
// Those keep `bare_toponym`/`route_pair` visible to the marker builder even
|
|
98
|
+
// when a POI kind takes the top slot.
|
|
102
99
|
const merged = [
|
|
103
100
|
{ kind: base.kind, confidence: base.confidence },
|
|
104
101
|
...base.alternatives,
|
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;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC7E,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAwB,MAAM,MAAM,CAAA;AACxF,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV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