@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/out/rules.js
CHANGED
|
@@ -3,55 +3,47 @@
|
|
|
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
|
-
import { NAME_PRONE_US_SUFFIXES, US_STREET_SUFFIX_LOOKUP } from "@mailwoman/codex/us/street
|
|
9
|
+
import { NAME_PRONE_US_SUFFIXES, US_STREET_SUFFIX_LOOKUP } from "@mailwoman/codex/us/street/suffix";
|
|
10
|
+
import { classifyTokens, foldInputClass } from "@mailwoman/query-shape/character-class";
|
|
11
|
+
import { isPostcodeFormat } from "@mailwoman/query-shape/known-formats";
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
* and belongs to the structured-address scorer.
|
|
13
|
+
* Maximum length for a bare venue or landmark query.
|
|
16
14
|
*/
|
|
17
15
|
const MAX_LANDMARK_LENGTH = 50;
|
|
18
16
|
/**
|
|
19
|
-
*
|
|
17
|
+
* Maximum length for a bare postcode, including an optional country prefix and separators.
|
|
20
18
|
*/
|
|
21
19
|
const MAX_POSTCODE_ONLY_LENGTH = 16;
|
|
22
20
|
/**
|
|
23
|
-
*
|
|
24
|
-
* else too — a locality, a street — and another kind should win.
|
|
21
|
+
* Minimum fraction of the input that a postcode must cover for `postcode_only`.
|
|
25
22
|
*/
|
|
26
23
|
const MIN_POSTCODE_COVERAGE = 0.7;
|
|
27
24
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Exported so `intent-rules.ts`'s `bare_toponym` can share the exact same ceiling. Sharing it is what makes
|
|
31
|
-
* "bare_toponym is a strict refinement of locality_only" a structural property rather than two numbers that happen to
|
|
32
|
-
* agree today.
|
|
25
|
+
* Maximum length for a bare locality.
|
|
26
|
+
* The `bare_toponym` intent rule uses the same limit.
|
|
33
27
|
*/
|
|
34
28
|
export const MAX_LOCALITY_ONLY_LENGTH = 30;
|
|
35
29
|
/**
|
|
36
|
-
*
|
|
37
|
-
* and the phrase is more likely a full address line.
|
|
30
|
+
* Minimum word count for a short venue phrase.
|
|
38
31
|
*/
|
|
39
32
|
const VENUE_PHRASE_MIN_WORDS = 2;
|
|
40
33
|
/**
|
|
41
|
-
*
|
|
34
|
+
* Maximum word count for a short venue phrase.
|
|
42
35
|
*/
|
|
43
36
|
const VENUE_PHRASE_MAX_WORDS = 4;
|
|
44
37
|
/**
|
|
45
|
-
*
|
|
38
|
+
* Maximum word count for a longer single-segment venue phrase.
|
|
46
39
|
*/
|
|
47
40
|
const LONG_VENUE_PHRASE_MAX_WORDS = 6;
|
|
48
41
|
/**
|
|
49
|
-
* Length at which
|
|
50
|
-
* alphanumeric inputs score lower because they are as likely to be a unit number.
|
|
42
|
+
* Length at which single-segment alphanumeric input scores as a likely structured address.
|
|
51
43
|
*/
|
|
52
44
|
const ALPHANUMERIC_POSTCODE_MIN_LENGTH = 15;
|
|
53
45
|
/**
|
|
54
|
-
*
|
|
46
|
+
* Phrases that signal a relative landmark description.
|
|
55
47
|
*/
|
|
56
48
|
const LANDMARK_LEADERS = [
|
|
57
49
|
"behind",
|
|
@@ -65,29 +57,27 @@ const LANDMARK_LEADERS = [
|
|
|
65
57
|
"beside",
|
|
66
58
|
];
|
|
67
59
|
/**
|
|
68
|
-
*
|
|
60
|
+
* Patterns that signal a street intersection.
|
|
69
61
|
*/
|
|
70
62
|
const INTERSECTION_PATTERNS = [
|
|
71
63
|
/\bcorner of\b/i,
|
|
72
64
|
/\bintersection of\b/i,
|
|
73
65
|
/\bat the corner of\b/i,
|
|
74
|
-
// "5th and Main", "Broadway & 42nd"
|
|
66
|
+
// Examples: "5th and Main", "Broadway & 42nd".
|
|
75
67
|
/\b\w+(?:st|nd|rd|th|street|ave|avenue|blvd|boulevard|road|rd|lane|ln)?\s+(?:and|&|@)\s+\w+/i,
|
|
76
68
|
];
|
|
77
69
|
/**
|
|
78
|
-
*
|
|
79
|
-
* covers all locale variants (US "PO Box 123", FR "BP 42", etc.).
|
|
70
|
+
* Scores input in which QueryShape detected a PO Box format.
|
|
80
71
|
*/
|
|
81
72
|
export function scorePoBox(_input, shape) {
|
|
82
73
|
const hit = shape.knownFormats.find((f) => f.format === "po_box");
|
|
83
74
|
if (!hit)
|
|
84
75
|
return 0;
|
|
85
|
-
//
|
|
86
|
-
// both rules fire on the same input.
|
|
76
|
+
// The bonus makes a PO Box win a tie with a structured address.
|
|
87
77
|
return Math.min(1, hit.confidence + 0.1);
|
|
88
78
|
}
|
|
89
79
|
/**
|
|
90
|
-
*
|
|
80
|
+
* Scores street-intersection phrasing.
|
|
91
81
|
*/
|
|
92
82
|
export function scoreIntersection(input, _shape) {
|
|
93
83
|
const text = input.normalized;
|
|
@@ -98,8 +88,7 @@ export function scoreIntersection(input, _shape) {
|
|
|
98
88
|
return 0;
|
|
99
89
|
}
|
|
100
90
|
/**
|
|
101
|
-
*
|
|
102
|
-
* location relative to another place.
|
|
91
|
+
* Scores input that begins with a relative-landmark phrase.
|
|
103
92
|
*/
|
|
104
93
|
export function scoreLandmark(input, _shape) {
|
|
105
94
|
const lc = input.normalized.toLowerCase().trim();
|
|
@@ -110,59 +99,101 @@ export function scoreLandmark(input, _shape) {
|
|
|
110
99
|
return 0;
|
|
111
100
|
}
|
|
112
101
|
/**
|
|
113
|
-
*
|
|
114
|
-
* matters: a trailing comma or doubled separator otherwise yields an empty string that inflates the word count and
|
|
115
|
-
* falsifies every-word predicates like the proper-case check below.
|
|
102
|
+
* Splits text on whitespace and commas and drops empty tokens.
|
|
116
103
|
*/
|
|
117
104
|
export function wordsOf(text) {
|
|
118
|
-
return text.split(/[\s,]+/).filter((word) => word.length
|
|
105
|
+
return text.split(/[\s,]+/).filter((word) => word.length);
|
|
119
106
|
}
|
|
120
107
|
/**
|
|
121
|
-
*
|
|
122
|
-
* `@mailwoman/codex`, minus its curated name-prone canonicals (PARK, FIELD, HILL, LAKE, …). Those double as ordinary
|
|
123
|
-
* proper-name heads ("Wrigley Field", "Menlo Park"), and disqualifying on them would reject the very venue and place
|
|
124
|
-
* names the rules below exist to capture. Shared with `intent-rules.ts` so both rule sets read one definition.
|
|
108
|
+
* Reports whether a word is a USPS street suffix that rarely appears in place names.
|
|
125
109
|
*/
|
|
126
110
|
export function isDisqualifyingStreetSuffix(word) {
|
|
127
111
|
const canonical = US_STREET_SUFFIX_LOOKUP.get(word.trim().toLowerCase());
|
|
128
112
|
return canonical !== undefined && !NAME_PRONE_US_SUFFIXES.has(canonical);
|
|
129
113
|
}
|
|
130
114
|
/**
|
|
131
|
-
*
|
|
132
|
-
|
|
115
|
+
* Removes postcode spans in the final segment and collapses the remaining separators.
|
|
116
|
+
*/
|
|
117
|
+
export function withoutPostcodeSpans(text, shape) {
|
|
118
|
+
const merged = mergedPostcodeSpans(shape);
|
|
119
|
+
if (!merged.length)
|
|
120
|
+
return text;
|
|
121
|
+
let remainder = text;
|
|
122
|
+
// The loop removes spans from last to first.
|
|
123
|
+
// This order keeps the remaining offsets valid.
|
|
124
|
+
for (let index = merged.length - 1; index >= 0; index--) {
|
|
125
|
+
const span = merged[index];
|
|
126
|
+
remainder = remainder.slice(0, span.start) + remainder.slice(span.end);
|
|
127
|
+
}
|
|
128
|
+
return remainder
|
|
129
|
+
.replaceAll(/[\s,]+/gu, " ")
|
|
130
|
+
.replace(/[\s,]+$/u, "")
|
|
131
|
+
.trim();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Reports whether text contains a Unicode letter.
|
|
133
135
|
*
|
|
134
|
-
*
|
|
135
|
-
|
|
136
|
+
* By itself, the `alpha` character class can match punctuation-only input.
|
|
137
|
+
*/
|
|
138
|
+
export function carriesLetter(text) {
|
|
139
|
+
return /\p{L}/u.test(text);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Merges overlapping postcode hits in the final segment into sorted, disjoint spans.
|
|
143
|
+
*/
|
|
144
|
+
function mergedPostcodeSpans(shape) {
|
|
145
|
+
// Postcode hits in earlier segments are often house numbers.
|
|
146
|
+
const tail = shape.segments?.at(-1)?.span;
|
|
147
|
+
if (!tail)
|
|
148
|
+
return [];
|
|
149
|
+
const merged = [];
|
|
150
|
+
for (const hit of shape.knownFormats) {
|
|
151
|
+
if (!isPostcodeFormat(hit.format))
|
|
152
|
+
continue;
|
|
153
|
+
if (hit.span.start < tail.start || hit.span.end > tail.end)
|
|
154
|
+
continue;
|
|
155
|
+
merged.push({ start: hit.span.start, end: hit.span.end });
|
|
156
|
+
}
|
|
157
|
+
if (merged.length < 2)
|
|
158
|
+
return merged;
|
|
159
|
+
merged.sort((left, right) => left.start - right.start);
|
|
160
|
+
const disjoint = [merged[0]];
|
|
161
|
+
for (const span of merged.slice(1)) {
|
|
162
|
+
const last = disjoint.at(-1);
|
|
163
|
+
if (span.start <= last.end) {
|
|
164
|
+
last.end = Math.max(last.end, span.end);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
disjoint.push(span);
|
|
168
|
+
}
|
|
169
|
+
return disjoint;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Scores short capitalized venue names that have no street suffix or recognized format.
|
|
136
173
|
*/
|
|
137
174
|
export function scoreVenueLandmark(input, shape) {
|
|
138
175
|
const text = input.normalized.trim();
|
|
139
176
|
const len = text.length;
|
|
140
177
|
if (len === 0 || len > MAX_LANDMARK_LENGTH)
|
|
141
178
|
return 0;
|
|
142
|
-
// Must have at least one capitalized word.
|
|
143
179
|
if (!/[A-Z]/.test(text))
|
|
144
180
|
return 0;
|
|
145
|
-
// Reject if any known postcode format hit exists.
|
|
146
181
|
if (shape.knownFormats.length)
|
|
147
182
|
return 0;
|
|
148
|
-
// Reject if it looks like a multi-segment structured address (City, ST ZIP).
|
|
149
183
|
const segCount = shape.segments?.length ?? 1;
|
|
150
184
|
if (segCount > 2)
|
|
151
185
|
return 0;
|
|
152
|
-
// Reject if any word is an unambiguous street suffix.
|
|
153
186
|
const words = wordsOf(text);
|
|
154
187
|
for (const w of words) {
|
|
155
188
|
if (isDisqualifyingStreetSuffix(w))
|
|
156
189
|
return 0;
|
|
157
190
|
}
|
|
158
|
-
//
|
|
191
|
+
// A leading number usually is a house number.
|
|
159
192
|
if (/^\d+\s/.test(text))
|
|
160
193
|
return 0;
|
|
161
|
-
//
|
|
194
|
+
// Venue names often contain a number after the first word.
|
|
162
195
|
const hasInternalNumber = /\s\d+/.test(text) && !/^\d/.test(text);
|
|
163
|
-
// Check if every word starts with uppercase (proper-noun pattern).
|
|
164
196
|
const allProperCase = words.length > 1 && words.every((w) => /^[A-Z]/.test(w));
|
|
165
|
-
// Boost for short single-segment capitalized phrases (2-4 words).
|
|
166
197
|
const wordCount = words.length;
|
|
167
198
|
if (wordCount >= VENUE_PHRASE_MIN_WORDS && wordCount <= VENUE_PHRASE_MAX_WORDS && segCount === 1) {
|
|
168
199
|
if (hasInternalNumber)
|
|
@@ -171,41 +202,13 @@ export function scoreVenueLandmark(input, shape) {
|
|
|
171
202
|
return 0.88;
|
|
172
203
|
return 0.65;
|
|
173
204
|
}
|
|
174
|
-
// Longer single-segment capitalized phrases get moderate confidence.
|
|
175
205
|
if (wordCount <= LONG_VENUE_PHRASE_MAX_WORDS && segCount === 1 && allProperCase) {
|
|
176
206
|
return 0.75;
|
|
177
207
|
}
|
|
178
208
|
return 0;
|
|
179
209
|
}
|
|
180
210
|
/**
|
|
181
|
-
*
|
|
182
|
-
*/
|
|
183
|
-
const POSTCODE_FORMATS = new Set([
|
|
184
|
-
"us_zip",
|
|
185
|
-
"us_zip4",
|
|
186
|
-
"uk_postcode",
|
|
187
|
-
"fr_postcode",
|
|
188
|
-
"de_postcode",
|
|
189
|
-
"ca_postcode",
|
|
190
|
-
"jp_postcode",
|
|
191
|
-
"nl_postcode",
|
|
192
|
-
"cz_postcode",
|
|
193
|
-
"sk_postcode",
|
|
194
|
-
"se_postcode",
|
|
195
|
-
"gr_postcode",
|
|
196
|
-
]);
|
|
197
|
-
/**
|
|
198
|
-
* Test whether a format string is a postcode variant. Use the set rather than ad-hoc string-matching to avoid the
|
|
199
|
-
* `us_zip4.endsWith("_zip")` false-negative trap.
|
|
200
|
-
*/
|
|
201
|
-
export function isPostcodeFormat(format) {
|
|
202
|
-
return POSTCODE_FORMATS.has(format);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* `postcode_only` rule: input is short AND has a postcode format hit covering most of it.
|
|
206
|
-
*
|
|
207
|
-
* The "covering most of it" check is what distinguishes `"10118"` (postcode-only) from `"350 5th Ave 10118"`
|
|
208
|
-
* (structured-address with a postcode in it).
|
|
211
|
+
* Scores short input in which a postcode covers most of the text.
|
|
209
212
|
*/
|
|
210
213
|
export function scorePostcodeOnly(input, shape) {
|
|
211
214
|
const len = input.normalized.length;
|
|
@@ -215,61 +218,72 @@ export function scorePostcodeOnly(input, shape) {
|
|
|
215
218
|
if (!postcodeHit)
|
|
216
219
|
return 0;
|
|
217
220
|
const hitLen = postcodeHit.span.end - postcodeHit.span.start;
|
|
218
|
-
// At least 70% of the input must be the postcode for the rule to fire confidently.
|
|
219
221
|
if (hitLen / len < MIN_POSTCODE_COVERAGE)
|
|
220
222
|
return 0;
|
|
221
|
-
// Confidence scales with how much of the input is the postcode and how confident the format hit was.
|
|
222
223
|
return Math.min(1, postcodeHit.confidence * (hitLen / len) + 0.1);
|
|
223
224
|
}
|
|
224
225
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* Examples: `"Paris"`, `"NYC NY"`, `"Tokyo"`. Distinguishes from `structured_address` (multiple segments) and `vague`
|
|
228
|
-
* (long or mixed-class).
|
|
226
|
+
* Scores a place name with at most an administrative tail and an optional postcode.
|
|
229
227
|
*/
|
|
230
228
|
export function scoreLocalityOnly(input, shape) {
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
// Any recognized format other than a postcode rules out a bare locality.
|
|
230
|
+
let carriesPostcode = false;
|
|
231
|
+
for (const hit of shape.knownFormats) {
|
|
232
|
+
if (isPostcodeFormat(hit.format)) {
|
|
233
|
+
carriesPostcode = true;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
return 0;
|
|
237
|
+
}
|
|
238
|
+
// Only postcode hits in the final segment can be removed.
|
|
239
|
+
const removable = carriesPostcode ? mergedPostcodeSpans(shape) : [];
|
|
240
|
+
if (carriesPostcode && !removable.length)
|
|
233
241
|
return 0;
|
|
234
|
-
|
|
242
|
+
const withoutPostcode = carriesPostcode ? withoutPostcodeSpans(input.normalized, shape) : input.normalized;
|
|
243
|
+
const len = withoutPostcode.length;
|
|
244
|
+
if (len === 0 || len > MAX_LOCALITY_ONLY_LENGTH)
|
|
235
245
|
return 0;
|
|
236
|
-
if (
|
|
246
|
+
if (!carriesLetter(withoutPostcode))
|
|
237
247
|
return 0;
|
|
238
|
-
//
|
|
239
|
-
//
|
|
248
|
+
// The remaining text must be alphabetic.
|
|
249
|
+
// Its class is recomputed only after a postcode was removed.
|
|
250
|
+
if (shape.characterClass !== "alpha") {
|
|
251
|
+
if (!carriesPostcode)
|
|
252
|
+
return 0;
|
|
253
|
+
if (foldInputClass(classifyTokens(withoutPostcode)) !== "alpha")
|
|
254
|
+
return 0;
|
|
255
|
+
}
|
|
256
|
+
// A locality and an administrative tail use at most two segments.
|
|
240
257
|
const segCount = shape.segments?.length ?? 1;
|
|
241
258
|
if (segCount > 2)
|
|
242
259
|
return 0;
|
|
243
260
|
return 0.85;
|
|
244
261
|
}
|
|
245
262
|
/**
|
|
246
|
-
*
|
|
247
|
-
* mixed-class.
|
|
263
|
+
* Scores multi-component address shapes.
|
|
248
264
|
*/
|
|
249
265
|
export function scoreStructuredAddress(input, shape) {
|
|
250
266
|
const len = input.normalized.length;
|
|
251
267
|
if (len === 0)
|
|
252
268
|
return 0;
|
|
253
269
|
const segCount = shape.segments?.length ?? 1;
|
|
254
|
-
//
|
|
255
|
-
if (segCount >= 2 &&
|
|
270
|
+
// Digits outside the postcode are required, so a locality with a postcode does not score here.
|
|
271
|
+
if (segCount >= 2 &&
|
|
272
|
+
shape.characterClass === "alphanumeric" &&
|
|
273
|
+
/\d/u.test(withoutPostcodeSpans(input.normalized, shape))) {
|
|
256
274
|
return 0.9;
|
|
257
|
-
|
|
275
|
+
}
|
|
258
276
|
if (len >= ALPHANUMERIC_POSTCODE_MIN_LENGTH && shape.characterClass === "alphanumeric")
|
|
259
277
|
return 0.75;
|
|
260
|
-
// Multi-segment
|
|
278
|
+
// Multi-segment input without digits may still be a multi-word locality, so it scores lower.
|
|
261
279
|
if (segCount >= 2)
|
|
262
280
|
return 0.6;
|
|
263
|
-
// Single-segment, short, alphanumeric (e.g. "10118-1234" with no other content) — weak.
|
|
264
281
|
if (len < ALPHANUMERIC_POSTCODE_MIN_LENGTH && shape.characterClass === "alphanumeric")
|
|
265
282
|
return 0.4;
|
|
266
283
|
return 0;
|
|
267
284
|
}
|
|
268
285
|
/**
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* Returns a moderate baseline so `vague` always shows up as an alternative, even when other rules dominate. The
|
|
272
|
-
* coordinator decides whether to trust vague as the primary kind.
|
|
286
|
+
* Returns a low constant fallback score for ambiguous input.
|
|
273
287
|
*/
|
|
274
288
|
export function scoreVague(_input, _shape) {
|
|
275
289
|
return 0.3;
|
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;;;;;;;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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,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": "10.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": {
|
|
@@ -13,15 +13,10 @@
|
|
|
13
13
|
"out/**/*.js.map",
|
|
14
14
|
"out/**/*.d.ts",
|
|
15
15
|
"out/**/*.d.ts.map",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"**/*.ts",
|
|
19
|
-
"**/*.tsx",
|
|
20
|
-
"!*.test.ts",
|
|
21
|
-
"!*.test.tsx",
|
|
16
|
+
"lib/**/*.ts",
|
|
17
|
+
"lib/**/*.tsx",
|
|
22
18
|
"!**/*.test.ts",
|
|
23
|
-
"!**/*.test.tsx"
|
|
24
|
-
"!test/**"
|
|
19
|
+
"!**/*.test.tsx"
|
|
25
20
|
],
|
|
26
21
|
"type": "module",
|
|
27
22
|
"sideEffects": false,
|
|
@@ -39,25 +34,10 @@
|
|
|
39
34
|
"node": "./out/index.js",
|
|
40
35
|
"default": "./out/index.js"
|
|
41
36
|
},
|
|
42
|
-
"
|
|
43
|
-
"types": "./out
|
|
44
|
-
"node": "./out
|
|
45
|
-
"default": "./out
|
|
46
|
-
},
|
|
47
|
-
"./intent-rules": {
|
|
48
|
-
"types": "./out/intent-rules.d.ts",
|
|
49
|
-
"node": "./out/intent-rules.js",
|
|
50
|
-
"default": "./out/intent-rules.js"
|
|
51
|
-
},
|
|
52
|
-
"./rules": {
|
|
53
|
-
"types": "./out/rules.d.ts",
|
|
54
|
-
"node": "./out/rules.js",
|
|
55
|
-
"default": "./out/rules.js"
|
|
56
|
-
},
|
|
57
|
-
"./poi": {
|
|
58
|
-
"types": "./out/poi.d.ts",
|
|
59
|
-
"node": "./out/poi.js",
|
|
60
|
-
"default": "./out/poi.js"
|
|
37
|
+
"./*": {
|
|
38
|
+
"types": "./out/*.d.ts",
|
|
39
|
+
"node": "./out/*.js",
|
|
40
|
+
"default": "./out/*.js"
|
|
61
41
|
}
|
|
62
42
|
},
|
|
63
43
|
"publishConfig": {
|
|
@@ -69,25 +49,10 @@
|
|
|
69
49
|
"node": "./out/index.js",
|
|
70
50
|
"default": "./out/index.js"
|
|
71
51
|
},
|
|
72
|
-
"
|
|
73
|
-
"types": "./out
|
|
74
|
-
"node": "./out
|
|
75
|
-
"default": "./out
|
|
76
|
-
},
|
|
77
|
-
"./intent-rules": {
|
|
78
|
-
"types": "./out/intent-rules.d.ts",
|
|
79
|
-
"node": "./out/intent-rules.js",
|
|
80
|
-
"default": "./out/intent-rules.js"
|
|
81
|
-
},
|
|
82
|
-
"./rules": {
|
|
83
|
-
"types": "./out/rules.d.ts",
|
|
84
|
-
"node": "./out/rules.js",
|
|
85
|
-
"default": "./out/rules.js"
|
|
86
|
-
},
|
|
87
|
-
"./poi": {
|
|
88
|
-
"types": "./out/poi.d.ts",
|
|
89
|
-
"node": "./out/poi.js",
|
|
90
|
-
"default": "./out/poi.js"
|
|
52
|
+
"./*": {
|
|
53
|
+
"types": "./out/*.d.ts",
|
|
54
|
+
"node": "./out/*.js",
|
|
55
|
+
"default": "./out/*.js"
|
|
91
56
|
}
|
|
92
57
|
},
|
|
93
58
|
"imports": {
|
|
@@ -99,8 +64,8 @@
|
|
|
99
64
|
}
|
|
100
65
|
},
|
|
101
66
|
"dependencies": {
|
|
102
|
-
"@mailwoman/codex": "
|
|
103
|
-
"@mailwoman/core": "
|
|
104
|
-
"@mailwoman/query-shape": "
|
|
67
|
+
"@mailwoman/codex": "10.1.0",
|
|
68
|
+
"@mailwoman/core": "10.1.0",
|
|
69
|
+
"@mailwoman/query-shape": "10.1.0"
|
|
105
70
|
}
|
|
106
71
|
}
|