@whenis/booking 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nazar Fedyshyn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is furnished
10
+ to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @whenis/booking
2
+
3
+ [![npm](https://img.shields.io/npm/v/@whenis/booking?color=cb3837)](https://www.npmjs.com/package/@whenis/booking)
4
+ [![license](https://img.shields.io/npm/l/@whenis/booking?color=blue)](./LICENSE)
5
+
6
+ Booking-domain plugin for [whenis](https://github.com/norens/whenis).
7
+
8
+ A worked example of the plugin API — adds rules, lexicon entries, and an
9
+ enricher specific to hospitality / booking assistants while keeping the core
10
+ parser domain-neutral.
11
+
12
+ ## What it adds
13
+
14
+ | Pattern | Produces |
15
+ | ------------------------------------ | ------------------------------------------------------------------- |
16
+ | `на N ночей / днів` | `duration` IR with `nights = N` |
17
+ | `впродовж N днів`, `у найближчі N днів` | `window` IR (start = ref, end = ref + N − 1) |
18
+ | `наступні вихідні` / `ці вихідні` | `range` IR for Saturday–Sunday with correct week selection |
19
+ | `після свят`, `на свята` | `fuzzy` IR with `reason: 'holiday_ref'` |
20
+ | **Enricher:** `mostlyPastEnricher` | Adds `metadata.suggest_next_month = true` when the referenced month is ≥ 75 % elapsed |
21
+
22
+ ## Install
23
+
24
+ ```bash
25
+ pnpm add @whenis/core @whenis/locale-uk @whenis/booking
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```ts
31
+ import { createParser } from '@whenis/core';
32
+ import { uk } from '@whenis/locale-uk';
33
+ import { booking } from '@whenis/booking';
34
+
35
+ const parser = createParser({
36
+ locales: [uk],
37
+ plugins: [booking],
38
+ options: { preferFuture: true },
39
+ });
40
+ const ref = new Date('2026-05-28');
41
+
42
+ parser.parse('на 3 ночі', { reference: ref }).matches[0].candidates[0];
43
+ // → { type: 'duration', nights: 3, confidence: 1 }
44
+
45
+ parser.parse('впродовж 7 днів', { reference: ref }).matches[0].candidates[0];
46
+ // → { type: 'window', start: '2026-05-28', end: '2026-06-03', confidence: 1 }
47
+
48
+ parser.parse('після свят', { reference: ref }).matches[0].candidates[0];
49
+ // → { type: 'fuzzy', reason: 'holiday_ref', confidence: 0.3,
50
+ // metadata: { suggest_next_month: true } }
51
+ ```
52
+
53
+ ## License
54
+
55
+ [MIT](./LICENSE) © Nazar Fedyshyn
package/dist/index.cjs ADDED
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ booking: () => booking
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/rules.ts
28
+ var findTag = (t, kind) => t.tags.find((x) => x.kind === kind);
29
+ function makeWindow(n, unit) {
30
+ const days = unit === "week" ? n * 7 : n;
31
+ return {
32
+ type: "window",
33
+ from: { type: "relative", offset: { days: 0 }, direction: "this" },
34
+ to: { type: "relative", offset: { days: days - 1 }, direction: "future" }
35
+ };
36
+ }
37
+ var windowWithinNRule = {
38
+ name: "booking-window-within",
39
+ priority: 75,
40
+ pattern: [
41
+ { kind: "tag", tag: "Grabber", predicate: (t) => t.tags.some((x) => x.kind === "Grabber" && x.modifier === "within") },
42
+ { kind: "tag", tag: "Numeral" },
43
+ { kind: "tag", tag: "TimeUnit" }
44
+ ],
45
+ produce: (matched) => {
46
+ const n = findTag(matched[1], "Numeral");
47
+ const u = findTag(matched[2], "TimeUnit");
48
+ if (!n || n.kind !== "Numeral" || !u || u.kind !== "TimeUnit") return null;
49
+ if (u.unit !== "day" && u.unit !== "week") return null;
50
+ return makeWindow(n.value, u.unit);
51
+ }
52
+ };
53
+ var windowWithinNWithPrefixRule = {
54
+ name: "booking-window-within-prefixed",
55
+ priority: 76,
56
+ pattern: [
57
+ { kind: "tag", tag: "Connector", predicate: (t) => /^[ув]$/i.test(t.text) },
58
+ { kind: "tag", tag: "Grabber", predicate: (t) => t.tags.some((x) => x.kind === "Grabber" && x.modifier === "within") },
59
+ { kind: "tag", tag: "Numeral" },
60
+ { kind: "tag", tag: "TimeUnit" }
61
+ ],
62
+ produce: (matched) => {
63
+ const n = findTag(matched[2], "Numeral");
64
+ const u = findTag(matched[3], "TimeUnit");
65
+ if (!n || n.kind !== "Numeral" || !u || u.kind !== "TimeUnit") return null;
66
+ if (u.unit !== "day" && u.unit !== "week") return null;
67
+ return makeWindow(n.value, u.unit);
68
+ }
69
+ };
70
+ var stayDurationRule = {
71
+ name: "booking-stay-duration",
72
+ priority: 75,
73
+ pattern: [
74
+ { kind: "tag", tag: "Connector", predicate: (t) => /^на$/i.test(t.text) },
75
+ { kind: "tag", tag: "Numeral" },
76
+ { kind: "tag", tag: "TimeUnit" }
77
+ ],
78
+ produce: (matched) => {
79
+ const n = findTag(matched[1], "Numeral");
80
+ const u = findTag(matched[2], "TimeUnit");
81
+ if (!n || n.kind !== "Numeral" || !u || u.kind !== "TimeUnit") return null;
82
+ switch (u.unit) {
83
+ case "night":
84
+ return { type: "duration", nights: n.value };
85
+ case "day":
86
+ return { type: "duration", nights: n.value };
87
+ case "week":
88
+ return { type: "duration", nights: n.value * 7 };
89
+ default:
90
+ return null;
91
+ }
92
+ }
93
+ };
94
+ var weekendNextRule = {
95
+ name: "booking-weekend-next",
96
+ priority: 80,
97
+ pattern: [
98
+ { kind: "tag", tag: "Grabber", predicate: (t) => t.tags.some((x) => x.kind === "Grabber" && x.modifier === "next") },
99
+ { kind: "tag", tag: "Literal", predicate: (t) => /вихідн/i.test(t.text) }
100
+ ],
101
+ produce: () => ({
102
+ type: "range",
103
+ start: { type: "weekday", weekday: 6, modifier: "next" },
104
+ end: { type: "weekday", weekday: 7, modifier: "next" },
105
+ convention: "checkout"
106
+ })
107
+ };
108
+ var weekendThisRule = {
109
+ name: "booking-weekend-this",
110
+ priority: 80,
111
+ pattern: [
112
+ { kind: "tag", tag: "Pointer", predicate: (t) => t.tags.some((x) => x.kind === "Pointer" && x.direction === "this") },
113
+ { kind: "tag", tag: "Literal", predicate: (t) => /вихідн/i.test(t.text) }
114
+ ],
115
+ produce: () => ({
116
+ type: "range",
117
+ start: { type: "weekday", weekday: 6, modifier: "this" },
118
+ end: { type: "weekday", weekday: 7, modifier: "this" },
119
+ convention: "checkout"
120
+ })
121
+ };
122
+ var holidayPislyaRule = {
123
+ name: "booking-holiday-pislya",
124
+ priority: 90,
125
+ pattern: [
126
+ { kind: "tag", tag: "Literal", predicate: (t) => /^після$/i.test(t.text) },
127
+ { kind: "tag", tag: "Literal", predicate: (t) => /^свят/i.test(t.text) }
128
+ ],
129
+ produce: () => ({
130
+ type: "fuzzy",
131
+ granularity: "month",
132
+ ref: { type: "absolute" },
133
+ reason: "holiday_ref"
134
+ })
135
+ };
136
+ var holidayNaRule = {
137
+ name: "booking-holiday-na",
138
+ priority: 90,
139
+ pattern: [
140
+ { kind: "tag", tag: "Connector", predicate: (t) => /^на$/i.test(t.text) },
141
+ { kind: "tag", tag: "Literal", predicate: (t) => /^свят/i.test(t.text) }
142
+ ],
143
+ produce: () => ({
144
+ type: "fuzzy",
145
+ granularity: "month",
146
+ ref: { type: "absolute" },
147
+ reason: "holiday_ref"
148
+ })
149
+ };
150
+ var bookingRules = [
151
+ windowWithinNRule,
152
+ windowWithinNWithPrefixRule,
153
+ stayDurationRule,
154
+ weekendNextRule,
155
+ weekendThisRule,
156
+ holidayPislyaRule,
157
+ holidayNaRule
158
+ ];
159
+ var bookingTags = /* @__PURE__ */ new Map([
160
+ ["\u0432\u043F\u0440\u043E\u0434\u043E\u0432\u0436", [{ kind: "Grabber", modifier: "within" }]],
161
+ ["\u043D\u0430\u0439\u0431\u043B\u0438\u0436\u0447\u0456", [{ kind: "Grabber", modifier: "within" }]],
162
+ ["\u043D\u0430\u0439\u0431\u043B\u0438\u0436\u0447\u0438\u0445", [{ kind: "Grabber", modifier: "within" }]],
163
+ ["\u0443", [{ kind: "Connector", conn: "from" }]],
164
+ ["\u0432", [{ kind: "Connector", conn: "from" }]],
165
+ ["\u043D\u0430", [{ kind: "Connector", conn: "from" }]]
166
+ ]);
167
+
168
+ // src/enrichers.ts
169
+ var import_luxon = require("luxon");
170
+ var DEFAULT_THRESHOLD = 0.75;
171
+ var mostlyPastEnricher = {
172
+ apply(candidate, ctx) {
173
+ if (candidate.type !== "fuzzy") return candidate;
174
+ if (candidate.granularity !== "month") return candidate;
175
+ const ref = import_luxon.DateTime.fromJSDate(ctx.reference, { zone: ctx.timezone });
176
+ const elapsed = ref.day / (ref.daysInMonth ?? 30);
177
+ if (elapsed < DEFAULT_THRESHOLD) return candidate;
178
+ return {
179
+ ...candidate,
180
+ metadata: { ...candidate.metadata ?? {}, suggest_next_month: true }
181
+ };
182
+ }
183
+ };
184
+
185
+ // src/index.ts
186
+ var booking = {
187
+ name: "@whenis/booking",
188
+ tags: bookingTags,
189
+ rules: bookingRules,
190
+ enrichers: [mostlyPastEnricher]
191
+ };
192
+ // Annotate the CommonJS export names for ESM import in node:
193
+ 0 && (module.exports = {
194
+ booking
195
+ });
196
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/rules.ts","../src/enrichers.ts"],"sourcesContent":["import type { Plugin } from '@whenis/core';\nimport { bookingRules, bookingTags } from './rules';\nimport { mostlyPastEnricher } from './enrichers';\n\nexport const booking: Plugin = {\n name: '@whenis/booking',\n tags: bookingTags,\n rules: bookingRules,\n enrichers: [mostlyPastEnricher],\n};\n","import type { Rule, Token, Tag, IRNode } from '@whenis/core';\n\nconst findTag = (t: Token, kind: string) => t.tags.find(x => x.kind === kind);\n\nfunction makeWindow(n: number, unit: 'day' | 'week'): IRNode {\n const days = unit === 'week' ? n * 7 : n;\n return {\n type: 'window',\n from: { type: 'relative', offset: { days: 0 }, direction: 'this' },\n to: { type: 'relative', offset: { days: days - 1 }, direction: 'future' },\n };\n}\n\n// \"впродовж 7 днів\" — 3-token form\nexport const windowWithinNRule: Rule = {\n name: 'booking-window-within',\n priority: 75,\n pattern: [\n { kind: 'tag', tag: 'Grabber', predicate: (t) => t.tags.some(x => x.kind === 'Grabber' && x.modifier === 'within') },\n { kind: 'tag', tag: 'Numeral' },\n { kind: 'tag', tag: 'TimeUnit' },\n ],\n produce: (matched) => {\n const n = findTag(matched[1] as Token, 'Numeral');\n const u = findTag(matched[2] as Token, 'TimeUnit');\n if (!n || n.kind !== 'Numeral' || !u || u.kind !== 'TimeUnit') return null;\n if (u.unit !== 'day' && u.unit !== 'week') return null;\n return makeWindow(n.value, u.unit);\n },\n};\n\n// \"у найближчі 5 днів\" — 4-token form with leading «у/в» Connector\nexport const windowWithinNWithPrefixRule: Rule = {\n name: 'booking-window-within-prefixed',\n priority: 76,\n pattern: [\n { kind: 'tag', tag: 'Connector', predicate: (t) => /^[ув]$/i.test(t.text) },\n { kind: 'tag', tag: 'Grabber', predicate: (t) => t.tags.some(x => x.kind === 'Grabber' && x.modifier === 'within') },\n { kind: 'tag', tag: 'Numeral' },\n { kind: 'tag', tag: 'TimeUnit' },\n ],\n produce: (matched) => {\n const n = findTag(matched[2] as Token, 'Numeral');\n const u = findTag(matched[3] as Token, 'TimeUnit');\n if (!n || n.kind !== 'Numeral' || !u || u.kind !== 'TimeUnit') return null;\n if (u.unit !== 'day' && u.unit !== 'week') return null;\n return makeWindow(n.value, u.unit);\n },\n};\n\nexport const stayDurationRule: Rule = {\n name: 'booking-stay-duration',\n priority: 75,\n pattern: [\n { kind: 'tag', tag: 'Connector', predicate: (t) => /^на$/i.test(t.text) },\n { kind: 'tag', tag: 'Numeral' },\n { kind: 'tag', tag: 'TimeUnit' },\n ],\n produce: (matched) => {\n const n = findTag(matched[1] as Token, 'Numeral');\n const u = findTag(matched[2] as Token, 'TimeUnit');\n if (!n || n.kind !== 'Numeral' || !u || u.kind !== 'TimeUnit') return null;\n switch (u.unit) {\n case 'night': return { type: 'duration', nights: n.value };\n case 'day': return { type: 'duration', nights: n.value };\n case 'week': return { type: 'duration', nights: n.value * 7 };\n default: return null;\n }\n },\n};\n\nexport const weekendNextRule: Rule = {\n name: 'booking-weekend-next',\n priority: 80,\n pattern: [\n { kind: 'tag', tag: 'Grabber', predicate: (t) => t.tags.some(x => x.kind === 'Grabber' && x.modifier === 'next') },\n { kind: 'tag', tag: 'Literal', predicate: (t) => /вихідн/i.test(t.text) },\n ],\n produce: () => ({\n type: 'range',\n start: { type: 'weekday', weekday: 6, modifier: 'next' },\n end: { type: 'weekday', weekday: 7, modifier: 'next' },\n convention: 'checkout',\n }),\n};\n\nexport const weekendThisRule: Rule = {\n name: 'booking-weekend-this',\n priority: 80,\n pattern: [\n { kind: 'tag', tag: 'Pointer', predicate: (t) => t.tags.some(x => x.kind === 'Pointer' && x.direction === 'this') },\n { kind: 'tag', tag: 'Literal', predicate: (t) => /вихідн/i.test(t.text) },\n ],\n produce: () => ({\n type: 'range',\n start: { type: 'weekday', weekday: 6, modifier: 'this' },\n end: { type: 'weekday', weekday: 7, modifier: 'this' },\n convention: 'checkout',\n }),\n};\n\n// \"після свят\" — neither word has a tag in default UA lexicon, both arrive as Literal.\nexport const holidayPislyaRule: Rule = {\n name: 'booking-holiday-pislya',\n priority: 90,\n pattern: [\n { kind: 'tag', tag: 'Literal', predicate: (t) => /^після$/i.test(t.text) },\n { kind: 'tag', tag: 'Literal', predicate: (t) => /^свят/i.test(t.text) },\n ],\n produce: () => ({\n type: 'fuzzy',\n granularity: 'month',\n ref: { type: 'absolute' },\n reason: 'holiday_ref',\n }),\n};\n\n// \"на свята\" — «на» is tagged by booking as Connector; «свят*» arrives as Literal.\nexport const holidayNaRule: Rule = {\n name: 'booking-holiday-na',\n priority: 90,\n pattern: [\n { kind: 'tag', tag: 'Connector', predicate: (t) => /^на$/i.test(t.text) },\n { kind: 'tag', tag: 'Literal', predicate: (t) => /^свят/i.test(t.text) },\n ],\n produce: () => ({\n type: 'fuzzy',\n granularity: 'month',\n ref: { type: 'absolute' },\n reason: 'holiday_ref',\n }),\n};\n\nexport const bookingRules: Rule[] = [\n windowWithinNRule,\n windowWithinNWithPrefixRule,\n stayDurationRule,\n weekendNextRule,\n weekendThisRule,\n holidayPislyaRule,\n holidayNaRule,\n];\n\n// Tags the booking plugin contributes to ANY locale that uses it.\nexport const bookingTags = new Map<string, Tag[]>([\n ['впродовж', [{ kind: 'Grabber', modifier: 'within' }]],\n ['найближчі', [{ kind: 'Grabber', modifier: 'within' }]],\n ['найближчих', [{ kind: 'Grabber', modifier: 'within' }]],\n ['у', [{ kind: 'Connector', conn: 'from' }]],\n ['в', [{ kind: 'Connector', conn: 'from' }]],\n ['на', [{ kind: 'Connector', conn: 'from' }]],\n]);\n","import { DateTime } from 'luxon';\nimport type { Enricher, ResolverCtx, ResolvedDate } from '@whenis/core';\n\nconst DEFAULT_THRESHOLD = 0.75;\n\nexport const mostlyPastEnricher: Enricher = {\n apply(candidate: ResolvedDate, ctx: ResolverCtx): ResolvedDate {\n if (candidate.type !== 'fuzzy') return candidate;\n if (candidate.granularity !== 'month') return candidate;\n const ref = DateTime.fromJSDate(ctx.reference, { zone: ctx.timezone });\n const elapsed = ref.day / (ref.daysInMonth ?? 30);\n if (elapsed < DEFAULT_THRESHOLD) return candidate;\n return {\n ...candidate,\n metadata: { ...(candidate.metadata ?? {}), suggest_next_month: true },\n };\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,UAAU,CAAC,GAAU,SAAiB,EAAE,KAAK,KAAK,OAAK,EAAE,SAAS,IAAI;AAE5E,SAAS,WAAW,GAAW,MAA8B;AAC3D,QAAM,OAAO,SAAS,SAAS,IAAI,IAAI;AACvC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,EAAE,MAAM,YAAY,QAAQ,EAAE,MAAM,EAAE,GAAG,WAAW,OAAO;AAAA,IACjE,IAAM,EAAE,MAAM,YAAY,QAAQ,EAAE,MAAM,OAAO,EAAE,GAAG,WAAW,SAAS;AAAA,EAC5E;AACF;AAGO,IAAM,oBAA0B;AAAA,EACrC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAA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@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@whenis/core';
2
+
3
+ declare const booking: Plugin;
4
+
5
+ export { booking };
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@whenis/core';
2
+
3
+ declare const booking: Plugin;
4
+
5
+ export { booking };
package/dist/index.js ADDED
@@ -0,0 +1,169 @@
1
+ // src/rules.ts
2
+ var findTag = (t, kind) => t.tags.find((x) => x.kind === kind);
3
+ function makeWindow(n, unit) {
4
+ const days = unit === "week" ? n * 7 : n;
5
+ return {
6
+ type: "window",
7
+ from: { type: "relative", offset: { days: 0 }, direction: "this" },
8
+ to: { type: "relative", offset: { days: days - 1 }, direction: "future" }
9
+ };
10
+ }
11
+ var windowWithinNRule = {
12
+ name: "booking-window-within",
13
+ priority: 75,
14
+ pattern: [
15
+ { kind: "tag", tag: "Grabber", predicate: (t) => t.tags.some((x) => x.kind === "Grabber" && x.modifier === "within") },
16
+ { kind: "tag", tag: "Numeral" },
17
+ { kind: "tag", tag: "TimeUnit" }
18
+ ],
19
+ produce: (matched) => {
20
+ const n = findTag(matched[1], "Numeral");
21
+ const u = findTag(matched[2], "TimeUnit");
22
+ if (!n || n.kind !== "Numeral" || !u || u.kind !== "TimeUnit") return null;
23
+ if (u.unit !== "day" && u.unit !== "week") return null;
24
+ return makeWindow(n.value, u.unit);
25
+ }
26
+ };
27
+ var windowWithinNWithPrefixRule = {
28
+ name: "booking-window-within-prefixed",
29
+ priority: 76,
30
+ pattern: [
31
+ { kind: "tag", tag: "Connector", predicate: (t) => /^[ув]$/i.test(t.text) },
32
+ { kind: "tag", tag: "Grabber", predicate: (t) => t.tags.some((x) => x.kind === "Grabber" && x.modifier === "within") },
33
+ { kind: "tag", tag: "Numeral" },
34
+ { kind: "tag", tag: "TimeUnit" }
35
+ ],
36
+ produce: (matched) => {
37
+ const n = findTag(matched[2], "Numeral");
38
+ const u = findTag(matched[3], "TimeUnit");
39
+ if (!n || n.kind !== "Numeral" || !u || u.kind !== "TimeUnit") return null;
40
+ if (u.unit !== "day" && u.unit !== "week") return null;
41
+ return makeWindow(n.value, u.unit);
42
+ }
43
+ };
44
+ var stayDurationRule = {
45
+ name: "booking-stay-duration",
46
+ priority: 75,
47
+ pattern: [
48
+ { kind: "tag", tag: "Connector", predicate: (t) => /^на$/i.test(t.text) },
49
+ { kind: "tag", tag: "Numeral" },
50
+ { kind: "tag", tag: "TimeUnit" }
51
+ ],
52
+ produce: (matched) => {
53
+ const n = findTag(matched[1], "Numeral");
54
+ const u = findTag(matched[2], "TimeUnit");
55
+ if (!n || n.kind !== "Numeral" || !u || u.kind !== "TimeUnit") return null;
56
+ switch (u.unit) {
57
+ case "night":
58
+ return { type: "duration", nights: n.value };
59
+ case "day":
60
+ return { type: "duration", nights: n.value };
61
+ case "week":
62
+ return { type: "duration", nights: n.value * 7 };
63
+ default:
64
+ return null;
65
+ }
66
+ }
67
+ };
68
+ var weekendNextRule = {
69
+ name: "booking-weekend-next",
70
+ priority: 80,
71
+ pattern: [
72
+ { kind: "tag", tag: "Grabber", predicate: (t) => t.tags.some((x) => x.kind === "Grabber" && x.modifier === "next") },
73
+ { kind: "tag", tag: "Literal", predicate: (t) => /вихідн/i.test(t.text) }
74
+ ],
75
+ produce: () => ({
76
+ type: "range",
77
+ start: { type: "weekday", weekday: 6, modifier: "next" },
78
+ end: { type: "weekday", weekday: 7, modifier: "next" },
79
+ convention: "checkout"
80
+ })
81
+ };
82
+ var weekendThisRule = {
83
+ name: "booking-weekend-this",
84
+ priority: 80,
85
+ pattern: [
86
+ { kind: "tag", tag: "Pointer", predicate: (t) => t.tags.some((x) => x.kind === "Pointer" && x.direction === "this") },
87
+ { kind: "tag", tag: "Literal", predicate: (t) => /вихідн/i.test(t.text) }
88
+ ],
89
+ produce: () => ({
90
+ type: "range",
91
+ start: { type: "weekday", weekday: 6, modifier: "this" },
92
+ end: { type: "weekday", weekday: 7, modifier: "this" },
93
+ convention: "checkout"
94
+ })
95
+ };
96
+ var holidayPislyaRule = {
97
+ name: "booking-holiday-pislya",
98
+ priority: 90,
99
+ pattern: [
100
+ { kind: "tag", tag: "Literal", predicate: (t) => /^після$/i.test(t.text) },
101
+ { kind: "tag", tag: "Literal", predicate: (t) => /^свят/i.test(t.text) }
102
+ ],
103
+ produce: () => ({
104
+ type: "fuzzy",
105
+ granularity: "month",
106
+ ref: { type: "absolute" },
107
+ reason: "holiday_ref"
108
+ })
109
+ };
110
+ var holidayNaRule = {
111
+ name: "booking-holiday-na",
112
+ priority: 90,
113
+ pattern: [
114
+ { kind: "tag", tag: "Connector", predicate: (t) => /^на$/i.test(t.text) },
115
+ { kind: "tag", tag: "Literal", predicate: (t) => /^свят/i.test(t.text) }
116
+ ],
117
+ produce: () => ({
118
+ type: "fuzzy",
119
+ granularity: "month",
120
+ ref: { type: "absolute" },
121
+ reason: "holiday_ref"
122
+ })
123
+ };
124
+ var bookingRules = [
125
+ windowWithinNRule,
126
+ windowWithinNWithPrefixRule,
127
+ stayDurationRule,
128
+ weekendNextRule,
129
+ weekendThisRule,
130
+ holidayPislyaRule,
131
+ holidayNaRule
132
+ ];
133
+ var bookingTags = /* @__PURE__ */ new Map([
134
+ ["\u0432\u043F\u0440\u043E\u0434\u043E\u0432\u0436", [{ kind: "Grabber", modifier: "within" }]],
135
+ ["\u043D\u0430\u0439\u0431\u043B\u0438\u0436\u0447\u0456", [{ kind: "Grabber", modifier: "within" }]],
136
+ ["\u043D\u0430\u0439\u0431\u043B\u0438\u0436\u0447\u0438\u0445", [{ kind: "Grabber", modifier: "within" }]],
137
+ ["\u0443", [{ kind: "Connector", conn: "from" }]],
138
+ ["\u0432", [{ kind: "Connector", conn: "from" }]],
139
+ ["\u043D\u0430", [{ kind: "Connector", conn: "from" }]]
140
+ ]);
141
+
142
+ // src/enrichers.ts
143
+ import { DateTime } from "luxon";
144
+ var DEFAULT_THRESHOLD = 0.75;
145
+ var mostlyPastEnricher = {
146
+ apply(candidate, ctx) {
147
+ if (candidate.type !== "fuzzy") return candidate;
148
+ if (candidate.granularity !== "month") return candidate;
149
+ const ref = DateTime.fromJSDate(ctx.reference, { zone: ctx.timezone });
150
+ const elapsed = ref.day / (ref.daysInMonth ?? 30);
151
+ if (elapsed < DEFAULT_THRESHOLD) return candidate;
152
+ return {
153
+ ...candidate,
154
+ metadata: { ...candidate.metadata ?? {}, suggest_next_month: true }
155
+ };
156
+ }
157
+ };
158
+
159
+ // src/index.ts
160
+ var booking = {
161
+ name: "@whenis/booking",
162
+ tags: bookingTags,
163
+ rules: bookingRules,
164
+ enrichers: [mostlyPastEnricher]
165
+ };
166
+ export {
167
+ booking
168
+ };
169
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/rules.ts","../src/enrichers.ts","../src/index.ts"],"sourcesContent":["import type { Rule, Token, Tag, IRNode } from '@whenis/core';\n\nconst findTag = (t: Token, kind: string) => t.tags.find(x => x.kind === kind);\n\nfunction makeWindow(n: number, unit: 'day' | 'week'): IRNode {\n const days = unit === 'week' ? n * 7 : n;\n return {\n type: 'window',\n from: { type: 'relative', offset: { days: 0 }, direction: 'this' },\n to: { type: 'relative', offset: { days: days - 1 }, direction: 'future' },\n };\n}\n\n// \"впродовж 7 днів\" — 3-token form\nexport const windowWithinNRule: Rule = {\n name: 'booking-window-within',\n priority: 75,\n pattern: [\n { kind: 'tag', tag: 'Grabber', predicate: (t) => t.tags.some(x => x.kind === 'Grabber' && x.modifier === 'within') },\n { kind: 'tag', tag: 'Numeral' },\n { kind: 'tag', tag: 'TimeUnit' },\n ],\n produce: (matched) => {\n const n = findTag(matched[1] as Token, 'Numeral');\n const u = findTag(matched[2] as Token, 'TimeUnit');\n if (!n || n.kind !== 'Numeral' || !u || u.kind !== 'TimeUnit') return null;\n if (u.unit !== 'day' && u.unit !== 'week') return null;\n return makeWindow(n.value, u.unit);\n },\n};\n\n// \"у найближчі 5 днів\" — 4-token form with leading «у/в» Connector\nexport const windowWithinNWithPrefixRule: Rule = {\n name: 'booking-window-within-prefixed',\n priority: 76,\n pattern: [\n { kind: 'tag', tag: 'Connector', predicate: (t) => /^[ув]$/i.test(t.text) },\n { kind: 'tag', tag: 'Grabber', predicate: (t) => t.tags.some(x => x.kind === 'Grabber' && x.modifier === 'within') },\n { kind: 'tag', tag: 'Numeral' },\n { kind: 'tag', tag: 'TimeUnit' },\n ],\n produce: (matched) => {\n const n = findTag(matched[2] as Token, 'Numeral');\n const u = findTag(matched[3] as Token, 'TimeUnit');\n if (!n || n.kind !== 'Numeral' || !u || u.kind !== 'TimeUnit') return null;\n if (u.unit !== 'day' && u.unit !== 'week') return null;\n return makeWindow(n.value, u.unit);\n },\n};\n\nexport const stayDurationRule: Rule = {\n name: 'booking-stay-duration',\n priority: 75,\n pattern: [\n { kind: 'tag', tag: 'Connector', predicate: (t) => /^на$/i.test(t.text) },\n { kind: 'tag', tag: 'Numeral' },\n { kind: 'tag', tag: 'TimeUnit' },\n ],\n produce: (matched) => {\n const n = findTag(matched[1] as Token, 'Numeral');\n const u = findTag(matched[2] as Token, 'TimeUnit');\n if (!n || n.kind !== 'Numeral' || !u || u.kind !== 'TimeUnit') return null;\n switch (u.unit) {\n case 'night': return { type: 'duration', nights: n.value };\n case 'day': return { type: 'duration', nights: n.value };\n case 'week': return { type: 'duration', nights: n.value * 7 };\n default: return null;\n }\n },\n};\n\nexport const weekendNextRule: Rule = {\n name: 'booking-weekend-next',\n priority: 80,\n pattern: [\n { kind: 'tag', tag: 'Grabber', predicate: (t) => t.tags.some(x => x.kind === 'Grabber' && x.modifier === 'next') },\n { kind: 'tag', tag: 'Literal', predicate: (t) => /вихідн/i.test(t.text) },\n ],\n produce: () => ({\n type: 'range',\n start: { type: 'weekday', weekday: 6, modifier: 'next' },\n end: { type: 'weekday', weekday: 7, modifier: 'next' },\n convention: 'checkout',\n }),\n};\n\nexport const weekendThisRule: Rule = {\n name: 'booking-weekend-this',\n priority: 80,\n pattern: [\n { kind: 'tag', tag: 'Pointer', predicate: (t) => t.tags.some(x => x.kind === 'Pointer' && x.direction === 'this') },\n { kind: 'tag', tag: 'Literal', predicate: (t) => /вихідн/i.test(t.text) },\n ],\n produce: () => ({\n type: 'range',\n start: { type: 'weekday', weekday: 6, modifier: 'this' },\n end: { type: 'weekday', weekday: 7, modifier: 'this' },\n convention: 'checkout',\n }),\n};\n\n// \"після свят\" — neither word has a tag in default UA lexicon, both arrive as Literal.\nexport const holidayPislyaRule: Rule = {\n name: 'booking-holiday-pislya',\n priority: 90,\n pattern: [\n { kind: 'tag', tag: 'Literal', predicate: (t) => /^після$/i.test(t.text) },\n { kind: 'tag', tag: 'Literal', predicate: (t) => /^свят/i.test(t.text) },\n ],\n produce: () => ({\n type: 'fuzzy',\n granularity: 'month',\n ref: { type: 'absolute' },\n reason: 'holiday_ref',\n }),\n};\n\n// \"на свята\" — «на» is tagged by booking as Connector; «свят*» arrives as Literal.\nexport const holidayNaRule: Rule = {\n name: 'booking-holiday-na',\n priority: 90,\n pattern: [\n { kind: 'tag', tag: 'Connector', predicate: (t) => /^на$/i.test(t.text) },\n { kind: 'tag', tag: 'Literal', predicate: (t) => /^свят/i.test(t.text) },\n ],\n produce: () => ({\n type: 'fuzzy',\n granularity: 'month',\n ref: { type: 'absolute' },\n reason: 'holiday_ref',\n }),\n};\n\nexport const bookingRules: Rule[] = [\n windowWithinNRule,\n windowWithinNWithPrefixRule,\n stayDurationRule,\n weekendNextRule,\n weekendThisRule,\n holidayPislyaRule,\n holidayNaRule,\n];\n\n// Tags the booking plugin contributes to ANY locale that uses it.\nexport const bookingTags = new Map<string, Tag[]>([\n ['впродовж', [{ kind: 'Grabber', modifier: 'within' }]],\n ['найближчі', [{ kind: 'Grabber', modifier: 'within' }]],\n ['найближчих', [{ kind: 'Grabber', modifier: 'within' }]],\n ['у', [{ kind: 'Connector', conn: 'from' }]],\n ['в', [{ kind: 'Connector', conn: 'from' }]],\n ['на', [{ kind: 'Connector', conn: 'from' }]],\n]);\n","import { DateTime } from 'luxon';\nimport type { Enricher, ResolverCtx, ResolvedDate } from '@whenis/core';\n\nconst DEFAULT_THRESHOLD = 0.75;\n\nexport const mostlyPastEnricher: Enricher = {\n apply(candidate: ResolvedDate, ctx: ResolverCtx): ResolvedDate {\n if (candidate.type !== 'fuzzy') return candidate;\n if (candidate.granularity !== 'month') return candidate;\n const ref = DateTime.fromJSDate(ctx.reference, { zone: ctx.timezone });\n const elapsed = ref.day / (ref.daysInMonth ?? 30);\n if (elapsed < DEFAULT_THRESHOLD) return candidate;\n return {\n ...candidate,\n metadata: { ...(candidate.metadata ?? {}), suggest_next_month: true },\n };\n },\n};\n","import type { Plugin } from '@whenis/core';\nimport { bookingRules, bookingTags } from './rules';\nimport { mostlyPastEnricher } from './enrichers';\n\nexport const booking: Plugin = {\n name: '@whenis/booking',\n tags: bookingTags,\n rules: bookingRules,\n enrichers: [mostlyPastEnricher],\n};\n"],"mappings":";AAEA,IAAM,UAAU,CAAC,GAAU,SAAiB,EAAE,KAAK,KAAK,OAAK,EAAE,SAAS,IAAI;AAE5E,SAAS,WAAW,GAAW,MAA8B;AAC3D,QAAM,OAAO,SAAS,SAAS,IAAI,IAAI;AACvC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,EAAE,MAAM,YAAY,QAAQ,EAAE,MAAM,EAAE,GAAG,WAAW,OAAO;AAAA,IACjE,IAAM,EAAE,MAAM,YAAY,QAAQ,EAAE,MAAM,OAAO,EAAE,GAAG,WAAW,SAAS;AAAA,EAC5E;AACF;AAGO,IAAM,oBAA0B;AAAA,EACrC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,IACP,EAAE,MAAM,OAAO,KAAK,WAAW,WAAW,CAAC,MAAM,EAAE,KAAK,KAAK,OAAK,EAAE,SAAS,aAAa,EAAE,aAAa,QAAQ,EAAE;AAAA,IACnH,EAAE,MAAM,OAAO,KAAK,UAAU;AAAA,IAC9B,EAAE,MAAM,OAAO,KAAK,WAAW;AAAA,EACjC;AAAA,EACA,SAAS,CAAC,YAAY;AACpB,UAA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AW,UAAU,SAAS,CAAC,CAAC;AAAA,EACtD,CAAC,0DAAa,CAAC,EAAE,MAAM,WAAW,UAAU,SAAS,CAAC,CAAC;AAAA,EACvD,CAAC,gEAAc,CAAC,EAAE,MAAM,WAAW,UAAU,SAAS,CAAC,CAAC;AAAA,EACxD,CAAC,UAAK,CAAC,EAAE,MAAM,aAAa,MAAM,OAAO,CAAC,CAAC;AAAA,EAC3C,CAAC,UAAK,CAAC,EAAE,MAAM,aAAa,MAAM,OAAO,CAAC,CAAC;AAAA,EAC3C,CAAC,gBAAM,CAAC,EAAE,MAAM,aAAa,MAAM,OAAO,CAAC,CAAC;AAC9C,CAAC;;;ACvJD,SAAS,gBAAgB;AAGzB,IAAM,oBAAoB;AAEnB,IAAM,qBAA+B;AAAA,EAC1C,MAAM,WAAyB,KAAgC;AAC7D,QAAI,UAAU,SAAS,QAAS,QAAO;AACvC,QAAI,UAAU,gBAAgB,QAAS,QAAO;AAC9C,UAAM,MAAM,SAAS,WAAW,IAAI,WAAW,EAAE,MAAM,IAAI,SAAS,CAAC;AACrE,UAAM,UAAU,IAAI,OAAO,IAAI,eAAe;AAC9C,QAAI,UAAU,kBAAmB,QAAO;AACxC,WAAO;AAAA,MACL,GAAG;AAAA,MACH,UAAU,EAAE,GAAI,UAAU,YAAY,CAAC,GAAI,oBAAoB,KAAK;AAAA,IACtE;AAAA,EACF;AACF;;;ACbO,IAAM,UAAkB;AAAA,EAC7B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,WAAW,CAAC,kBAAkB;AAChC;","names":[]}
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@whenis/booking",
3
+ "version": "0.1.0",
4
+ "description": "Booking-domain plugin for whenis — search windows, stay durations, weekend semantics, holiday references, mostly-past month enricher.",
5
+ "keywords": [
6
+ "date",
7
+ "dates",
8
+ "booking",
9
+ "hospitality",
10
+ "travel",
11
+ "stay",
12
+ "reservation",
13
+ "plugin",
14
+ "nlp",
15
+ "natural-language",
16
+ "parser",
17
+ "whenis"
18
+ ],
19
+ "homepage": "https://github.com/norens/whenis/tree/main/packages/booking#readme",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/norens/whenis.git",
23
+ "directory": "packages/booking"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/norens/whenis/issues"
27
+ },
28
+ "author": "Nazar Fedyshyn <me@nazarf.dev>",
29
+ "license": "MIT",
30
+ "type": "module",
31
+ "main": "./dist/index.cjs",
32
+ "module": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
34
+ "exports": {
35
+ ".": {
36
+ "import": {
37
+ "types": "./dist/index.d.ts",
38
+ "default": "./dist/index.js"
39
+ },
40
+ "require": {
41
+ "types": "./dist/index.d.cts",
42
+ "default": "./dist/index.cjs"
43
+ }
44
+ }
45
+ },
46
+ "files": [
47
+ "dist",
48
+ "README.md",
49
+ "LICENSE"
50
+ ],
51
+ "sideEffects": false,
52
+ "engines": {
53
+ "node": ">=18"
54
+ },
55
+ "peerDependencies": {
56
+ "@whenis/core": "^0.1.0"
57
+ },
58
+ "dependencies": {
59
+ "luxon": "^3.5.0"
60
+ },
61
+ "devDependencies": {
62
+ "@types/luxon": "^3.4.0",
63
+ "@whenis/core": "0.1.0"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "scripts": {
69
+ "build": "tsup",
70
+ "typecheck": "tsc --noEmit"
71
+ }
72
+ }