@mailwoman/variant-aliases 10.0.0 → 10.2.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/index.ts CHANGED
@@ -8,12 +8,7 @@
8
8
  * The data file (`data/aliases.json`) catalogs ~35 hand-curated regional terms: "servo" → fuel
9
9
  * (en-AU), "マクド" → McDonald's (ja-JP), "PFK" → KFC (fr-CA), etc.
10
10
  *
11
- * See:
12
- *
13
- * - `docs/articles/understanding/exotic-poi/regional-variant-queries.md` for the linguistic
14
- * background and the source tables this data is derived from.
15
- * - Issue #166 for the v0.6.0+ runtime integration plan (kind classifier consumes this table to emit
16
- * `kind=amenity` / `kind=brand` proposals, filtered by `@mailwoman/locale-hint` output).
11
+ * The runtime uses this table when resolving POI intent.
17
12
  */
18
13
 
19
14
  export { VARIANT_ALIAS_VERSION, getAllAliases, lookupVariantAliases, resolveLocaleScope } from "#lookup"
package/lib/lookup.ts CHANGED
@@ -6,8 +6,6 @@
6
6
  * Regional variant alias lookup. Given a token (or short phrase) and a detected locale, return the
7
7
  * canonical amenity category or brand it refers to.
8
8
  *
9
- * This is the data-side foundation for #166 (variant alias table + locale-restricted category matching).
10
- * The runtime integration into the kind classifier is v0.6.0+ work.
11
9
  */
12
10
 
13
11
  import { readLocalJSONFile } from "@mailwoman/core/fs/readers"
@@ -18,8 +16,8 @@ import type { AliasLookupResult, LocaleScopeMatch, VariantAlias, VariantAliasTab
18
16
  const moduleDir = import.meta.dirname
19
17
 
20
18
  /**
21
- * Read the shipped alias table, located by the shared source-tree/`out/` probe in
22
- * `@mailwoman/core/module/packaged-data`.
19
+ * Read the shipped alias table, located by the shared source-tree/`out/` probe
20
+ * in `@mailwoman/core/module/packaged-data`.
23
21
  */
24
22
  async function loadTable(): Promise<VariantAliasTable> {
25
23
  return readLocalJSONFile<VariantAliasTable>(await resolvePackagedDataPath(moduleDir, "aliases.json"))
@@ -28,9 +26,10 @@ async function loadTable(): Promise<VariantAliasTable> {
28
26
  const TABLE = await loadTable()
29
27
 
30
28
  /**
31
- * Indexed by lowercased variant string for O(1) lookup. Multiple entries can share the same variant key (e.g. ambiguous
32
- * "takeaway" only matches GB but not AU if both list it differently), so each entry is an array of all aliases that
33
- * share the key.
29
+ * Indexed by lowercased variant string for O(1) lookup.
30
+ *
31
+ * Multiple entries can share the same variant key (e.g. Ambiguous "takeaway" only matches GB
32
+ * but not AU if both list it differently), so each entry is an array of all aliases that share the key.
34
33
  */
35
34
  const INDEX: ReadonlyMap<string, ReadonlyArray<VariantAlias>> = (() => {
36
35
  const map = new Map<string, VariantAlias[]>()
@@ -46,18 +45,18 @@ const INDEX: ReadonlyMap<string, ReadonlyArray<VariantAlias>> = (() => {
46
45
  })()
47
46
 
48
47
  /**
49
- * Decide how a locale-scoped record answers under a detected locale — the rule every locale-restricted vocabulary in
50
- * the pipeline follows.
48
+ * Decide how a locale-scoped record answers under a detected locale — the rule every
49
+ * locale-restricted vocabulary in the pipeline follows.
51
50
  *
52
51
  * - `unscoped` (confidence 1) when the record declares no locales at all.
53
52
  * - `exact` (confidence 1) when the detected locale is one the record declares.
54
- * - `language` (confidence 0.5) when only the language subtag agrees — weaker on purpose, because regional variants are
55
- * by definition regional.
56
- * - `null` otherwise, and for any scoped record when the locale is unknown: a phrasing declared regional cannot be
57
- * reached without knowing the region.
53
+ * - `language` (confidence 0.5) when only the language subtag agrees — weaker on purpose,
54
+ * because regional variants are by definition regional.
55
+ * - `null` for every scoped record when the locale is unknown: a phrasing declared
56
+ * regional cannot be reached without knowing the region.
58
57
  */
59
58
  export function resolveLocaleScope(
60
- locales: ReadonlyArray<string> | undefined,
59
+ locales: ReadonlyArray<string> | null,
61
60
  locale: string | undefined
62
61
  ): LocaleScopeMatch | null {
63
62
  if (!locales) return { scope: "unscoped", confidence: 1 }
@@ -79,12 +78,13 @@ export function resolveLocaleScope(
79
78
  * Confidence:
80
79
  *
81
80
  * - `1.0` when the detected locale (e.g. `en-AU`) is in the alias's `locales` list.
82
- * - `0.5` when only the language part matches (e.g. detected `en-IE`, alias supports `en-AU`). This is intentionally
83
- * weaker because regional variants are by definition regional.
81
+ * - `0.5` when only the language part matches (e.g. Detected `en-IE`, alias supports `en-AU`).
82
+ * This is intentionally weaker because regional variants are by definition regional.
84
83
  * - No match when neither holds.
85
84
  *
86
- * Returns ALL matches sorted by confidence descending. Multi-locale variants (like "petrol station" →
87
- * en-GB/en-AU/en-NZ/en-ZA) return one entry per locale list — the caller picks.
85
+ * @returns all matches sorted by confidence descending.
86
+ * Multi-locale variants (like "petrol station" → en-GB/en-AU/en-NZ/en-ZA) return
87
+ * one entry per locale list — the caller picks.
88
88
  */
89
89
  export function lookupVariantAliases(text: string, locale: string): AliasLookupResult[] {
90
90
  const norm = text.trim().toLowerCase()
@@ -111,7 +111,7 @@ export function lookupVariantAliases(text: string, locale: string): AliasLookupR
111
111
  }
112
112
 
113
113
  /**
114
- * Pure-data accessor for callers that want to enumerate the table (e.g. corpus synthesis).
114
+ * Pure-data accessor for callers that want to enumerate the table (e.g. Corpus synthesis).
115
115
  */
116
116
  export function getAllAliases(): ReadonlyArray<VariantAlias> {
117
117
  return TABLE.aliases
package/lib/types.ts CHANGED
@@ -9,27 +9,35 @@
9
9
  /**
10
10
  * The semantic kind of a variant — either a generic amenity category or a specific brand.
11
11
  *
12
- * - `amenity` aliases resolve to a category (`fuel`, `pharmacy`, `convenience`, ...). Several variants can map to the
13
- * same category ("servo" and "petrol station" both → `fuel`).
14
- * - `brand` aliases resolve to a canonical brand name. Multiple regional variants of the same brand ("Macca's", "McDo",
15
- * "Mickey D's", "マクド") all map to `McDonald's`.
12
+ * - `amenity` aliases resolve to a category (`fuel`, `pharmacy`, `convenience`, ...).
13
+ * Several variants can map to the same category ("servo" and "petrol station" both → `fuel`).
14
+ * - `brand` aliases resolve to a canonical brand name.
15
+ * Multiple regional variants of the same brand ("Macca's", "McDo", "Mickey D's", "マクド")
16
+ * all map to `McDonald's`.
16
17
  */
17
18
  export type VariantKind = "amenity" | "brand"
18
19
 
19
20
  interface VariantAliasBase {
20
21
  /**
21
- * The user-typed variant. Always lowercase for the lookup key (CJK preserved as-is).
22
+ * The user-typed variant.
23
+ *
24
+ * Always lowercase for the lookup key (CJK preserved as-is).
22
25
  */
23
26
  variant: string
24
27
  /**
25
- * BCP-47 locale tags where this variant is in active use. Used to filter lookups: only consider an alias when the
26
- * detected locale matches one of these. A query in `en-US` won't match Australian "servo" because `en-AU` is not in
27
- * `["en-US"]`.
28
+ * BCP-47 locale tags where this variant is in active use.
29
+ *
30
+ * Used to filter lookups: only consider an alias when the detected locale matches one of these.
31
+ * A query in `en-US` won't match Australian "servo" because `en-AU` is not in `["en-US"]`.
28
32
  */
29
33
  locales: ReadonlyArray<string>
30
34
  /**
31
- * Free-form regional refinement within the locale (e.g. "NYC", "Kansai", "Quebec"). Not used for matching today;
32
- * informational. A future enhancement could combine this with a coarse geolocation signal to further disambiguate.
35
+ * Free-form regional refinement within the locale (e.g. "NYC", "Kansai", "Quebec").
36
+ *
37
+ * Not used for matching today.
38
+ * Informational.
39
+ *
40
+ * A future enhancement could combine this with a coarse geolocation signal to further disambiguate.
33
41
  */
34
42
  regionHint?: string
35
43
  }
@@ -63,8 +71,9 @@ export interface VariantAliasTable {
63
71
  *
64
72
  * - `unscoped` — the record declares no locales and answers under any.
65
73
  * - `exact` — the query's locale tag is one the record declares.
66
- * - `language` — only the language subtag agrees. Weaker on purpose: a regional phrasing reached through its language
67
- * alone is a guess about the region.
74
+ * - `language` — only the language subtag agrees.
75
+ * Weaker on purpose: a regional phrasing reached through its language by
76
+ * itself is a guess about the region.
68
77
  */
69
78
  export type LocaleScope = "unscoped" | "exact" | "language"
70
79
 
package/out/index.d.ts CHANGED
@@ -8,12 +8,7 @@
8
8
  * The data file (`data/aliases.json`) catalogs ~35 hand-curated regional terms: "servo" → fuel
9
9
  * (en-AU), "マクド" → McDonald's (ja-JP), "PFK" → KFC (fr-CA), etc.
10
10
  *
11
- * See:
12
- *
13
- * - `docs/articles/understanding/exotic-poi/regional-variant-queries.md` for the linguistic
14
- * background and the source tables this data is derived from.
15
- * - Issue #166 for the v0.6.0+ runtime integration plan (kind classifier consumes this table to emit
16
- * `kind=amenity` / `kind=brand` proposals, filtered by `@mailwoman/locale-hint` output).
11
+ * The runtime uses this table when resolving POI intent.
17
12
  */
18
13
  export { VARIANT_ALIAS_VERSION, getAllAliases, lookupVariantAliases, resolveLocaleScope } from "#lookup";
19
14
  export type { AliasLookupResult, AmenityAlias, BrandAlias, LocaleScope, LocaleScopeMatch, VariantAlias, VariantAliasTable, VariantKind, } from "#types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAExG,YAAY,EACX,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,WAAW,GACX,MAAM,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAExG,YAAY,EACX,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,WAAW,GACX,MAAM,QAAQ,CAAA"}
package/out/index.js CHANGED
@@ -8,12 +8,7 @@
8
8
  * The data file (`data/aliases.json`) catalogs ~35 hand-curated regional terms: "servo" → fuel
9
9
  * (en-AU), "マクド" → McDonald's (ja-JP), "PFK" → KFC (fr-CA), etc.
10
10
  *
11
- * See:
12
- *
13
- * - `docs/articles/understanding/exotic-poi/regional-variant-queries.md` for the linguistic
14
- * background and the source tables this data is derived from.
15
- * - Issue #166 for the v0.6.0+ runtime integration plan (kind classifier consumes this table to emit
16
- * `kind=amenity` / `kind=brand` proposals, filtered by `@mailwoman/locale-hint` output).
11
+ * The runtime uses this table when resolving POI intent.
17
12
  */
18
13
  export { VARIANT_ALIAS_VERSION, getAllAliases, lookupVariantAliases, resolveLocaleScope } from "#lookup";
19
14
  //# 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;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA"}
package/out/lookup.d.ts CHANGED
@@ -6,38 +6,37 @@
6
6
  * Regional variant alias lookup. Given a token (or short phrase) and a detected locale, return the
7
7
  * canonical amenity category or brand it refers to.
8
8
  *
9
- * This is the data-side foundation for #166 (variant alias table + locale-restricted category matching).
10
- * The runtime integration into the kind classifier is v0.6.0+ work.
11
9
  */
12
10
  import type { AliasLookupResult, LocaleScopeMatch, VariantAlias } from "#types";
13
11
  /**
14
- * Decide how a locale-scoped record answers under a detected locale — the rule every locale-restricted vocabulary in
15
- * the pipeline follows.
12
+ * Decide how a locale-scoped record answers under a detected locale — the rule every
13
+ * locale-restricted vocabulary in the pipeline follows.
16
14
  *
17
15
  * - `unscoped` (confidence 1) when the record declares no locales at all.
18
16
  * - `exact` (confidence 1) when the detected locale is one the record declares.
19
- * - `language` (confidence 0.5) when only the language subtag agrees — weaker on purpose, because regional variants are
20
- * by definition regional.
21
- * - `null` otherwise, and for any scoped record when the locale is unknown: a phrasing declared regional cannot be
22
- * reached without knowing the region.
17
+ * - `language` (confidence 0.5) when only the language subtag agrees — weaker on purpose,
18
+ * because regional variants are by definition regional.
19
+ * - `null` for every scoped record when the locale is unknown: a phrasing declared
20
+ * regional cannot be reached without knowing the region.
23
21
  */
24
- export declare function resolveLocaleScope(locales: ReadonlyArray<string> | undefined, locale: string | undefined): LocaleScopeMatch | null;
22
+ export declare function resolveLocaleScope(locales: ReadonlyArray<string> | null, locale: string | undefined): LocaleScopeMatch | null;
25
23
  /**
26
24
  * Match a query token against the variant alias table, filtered by detected locale.
27
25
  *
28
26
  * Confidence:
29
27
  *
30
28
  * - `1.0` when the detected locale (e.g. `en-AU`) is in the alias's `locales` list.
31
- * - `0.5` when only the language part matches (e.g. detected `en-IE`, alias supports `en-AU`). This is intentionally
32
- * weaker because regional variants are by definition regional.
29
+ * - `0.5` when only the language part matches (e.g. Detected `en-IE`, alias supports `en-AU`).
30
+ * This is intentionally weaker because regional variants are by definition regional.
33
31
  * - No match when neither holds.
34
32
  *
35
- * Returns ALL matches sorted by confidence descending. Multi-locale variants (like "petrol station" →
36
- * en-GB/en-AU/en-NZ/en-ZA) return one entry per locale list — the caller picks.
33
+ * @returns all matches sorted by confidence descending.
34
+ * Multi-locale variants (like "petrol station" → en-GB/en-AU/en-NZ/en-ZA) return
35
+ * one entry per locale list — the caller picks.
37
36
  */
38
37
  export declare function lookupVariantAliases(text: string, locale: string): AliasLookupResult[];
39
38
  /**
40
- * Pure-data accessor for callers that want to enumerate the table (e.g. corpus synthesis).
39
+ * Pure-data accessor for callers that want to enumerate the table (e.g. Corpus synthesis).
41
40
  */
42
41
  export declare function getAllAliases(): ReadonlyArray<VariantAlias>;
43
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../lib/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,YAAY,EAAqB,MAAM,QAAQ,CAAA;AAgClG;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,EAC1C,MAAM,EAAE,MAAM,GAAG,SAAS,GACxB,gBAAgB,GAAG,IAAI,CAYzB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAsBtF;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAAC,YAAY,CAAC,CAE3D;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAAgB,CAAA"}
1
+ {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../lib/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,YAAY,EAAqB,MAAM,QAAQ,CAAA;AAiClG;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,EACrC,MAAM,EAAE,MAAM,GAAG,SAAS,GACxB,gBAAgB,GAAG,IAAI,CAYzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAsBtF;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAAC,YAAY,CAAC,CAE3D;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAAgB,CAAA"}
package/out/lookup.js CHANGED
@@ -6,24 +6,23 @@
6
6
  * Regional variant alias lookup. Given a token (or short phrase) and a detected locale, return the
7
7
  * canonical amenity category or brand it refers to.
8
8
  *
9
- * This is the data-side foundation for #166 (variant alias table + locale-restricted category matching).
10
- * The runtime integration into the kind classifier is v0.6.0+ work.
11
9
  */
12
10
  import { readLocalJSONFile } from "@mailwoman/core/fs/readers";
13
11
  import { resolvePackagedDataPath } from "@mailwoman/core/module/packaged-data";
14
12
  const moduleDir = import.meta.dirname;
15
13
  /**
16
- * Read the shipped alias table, located by the shared source-tree/`out/` probe in
17
- * `@mailwoman/core/module/packaged-data`.
14
+ * Read the shipped alias table, located by the shared source-tree/`out/` probe
15
+ * in `@mailwoman/core/module/packaged-data`.
18
16
  */
19
17
  async function loadTable() {
20
18
  return readLocalJSONFile(await resolvePackagedDataPath(moduleDir, "aliases.json"));
21
19
  }
22
20
  const TABLE = await loadTable();
23
21
  /**
24
- * Indexed by lowercased variant string for O(1) lookup. Multiple entries can share the same variant key (e.g. ambiguous
25
- * "takeaway" only matches GB but not AU if both list it differently), so each entry is an array of all aliases that
26
- * share the key.
22
+ * Indexed by lowercased variant string for O(1) lookup.
23
+ *
24
+ * Multiple entries can share the same variant key (e.g. Ambiguous "takeaway" only matches GB
25
+ * but not AU if both list it differently), so each entry is an array of all aliases that share the key.
27
26
  */
28
27
  const INDEX = (() => {
29
28
  const map = new Map();
@@ -36,15 +35,15 @@ const INDEX = (() => {
36
35
  return map;
37
36
  })();
38
37
  /**
39
- * Decide how a locale-scoped record answers under a detected locale — the rule every locale-restricted vocabulary in
40
- * the pipeline follows.
38
+ * Decide how a locale-scoped record answers under a detected locale — the rule every
39
+ * locale-restricted vocabulary in the pipeline follows.
41
40
  *
42
41
  * - `unscoped` (confidence 1) when the record declares no locales at all.
43
42
  * - `exact` (confidence 1) when the detected locale is one the record declares.
44
- * - `language` (confidence 0.5) when only the language subtag agrees — weaker on purpose, because regional variants are
45
- * by definition regional.
46
- * - `null` otherwise, and for any scoped record when the locale is unknown: a phrasing declared regional cannot be
47
- * reached without knowing the region.
43
+ * - `language` (confidence 0.5) when only the language subtag agrees — weaker on purpose,
44
+ * because regional variants are by definition regional.
45
+ * - `null` for every scoped record when the locale is unknown: a phrasing declared
46
+ * regional cannot be reached without knowing the region.
48
47
  */
49
48
  export function resolveLocaleScope(locales, locale) {
50
49
  if (!locales)
@@ -64,12 +63,13 @@ export function resolveLocaleScope(locales, locale) {
64
63
  * Confidence:
65
64
  *
66
65
  * - `1.0` when the detected locale (e.g. `en-AU`) is in the alias's `locales` list.
67
- * - `0.5` when only the language part matches (e.g. detected `en-IE`, alias supports `en-AU`). This is intentionally
68
- * weaker because regional variants are by definition regional.
66
+ * - `0.5` when only the language part matches (e.g. Detected `en-IE`, alias supports `en-AU`).
67
+ * This is intentionally weaker because regional variants are by definition regional.
69
68
  * - No match when neither holds.
70
69
  *
71
- * Returns ALL matches sorted by confidence descending. Multi-locale variants (like "petrol station" →
72
- * en-GB/en-AU/en-NZ/en-ZA) return one entry per locale list — the caller picks.
70
+ * @returns all matches sorted by confidence descending.
71
+ * Multi-locale variants (like "petrol station" → en-GB/en-AU/en-NZ/en-ZA) return
72
+ * one entry per locale list — the caller picks.
73
73
  */
74
74
  export function lookupVariantAliases(text, locale) {
75
75
  const norm = text.trim().toLowerCase();
@@ -89,7 +89,7 @@ export function lookupVariantAliases(text, locale) {
89
89
  return results;
90
90
  }
91
91
  /**
92
- * Pure-data accessor for callers that want to enumerate the table (e.g. corpus synthesis).
92
+ * Pure-data accessor for callers that want to enumerate the table (e.g. Corpus synthesis).
93
93
  */
94
94
  export function getAllAliases() {
95
95
  return TABLE.aliases;
package/out/lookup.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"lookup.js","sourceRoot":"","sources":["../lib/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAI9E,MAAM,SAAS,GAAG,OAAO,IAAI,CAAC,OAAO,CAAA;AAErC;;;GAGG;AACH,KAAK,UAAU,SAAS;IACvB,OAAO,iBAAiB,CAA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enity category or a specific brand.
10
10
  *
11
- * - `amenity` aliases resolve to a category (`fuel`, `pharmacy`, `convenience`, ...). Several variants can map to the
12
- * same category ("servo" and "petrol station" both → `fuel`).
13
- * - `brand` aliases resolve to a canonical brand name. Multiple regional variants of the same brand ("Macca's", "McDo",
14
- * "Mickey D's", "マクド") all map to `McDonald's`.
11
+ * - `amenity` aliases resolve to a category (`fuel`, `pharmacy`, `convenience`, ...).
12
+ * Several variants can map to the same category ("servo" and "petrol station" both → `fuel`).
13
+ * - `brand` aliases resolve to a canonical brand name.
14
+ * Multiple regional variants of the same brand ("Macca's", "McDo", "Mickey D's", "マクド")
15
+ * all map to `McDonald's`.
15
16
  */
16
17
  export type VariantKind = "amenity" | "brand";
17
18
  interface VariantAliasBase {
18
19
  /**
19
- * The user-typed variant. Always lowercase for the lookup key (CJK preserved as-is).
20
+ * The user-typed variant.
21
+ *
22
+ * Always lowercase for the lookup key (CJK preserved as-is).
20
23
  */
21
24
  variant: string;
22
25
  /**
23
- * BCP-47 locale tags where this variant is in active use. Used to filter lookups: only consider an alias when the
24
- * detected locale matches one of these. A query in `en-US` won't match Australian "servo" because `en-AU` is not in
25
- * `["en-US"]`.
26
+ * BCP-47 locale tags where this variant is in active use.
27
+ *
28
+ * Used to filter lookups: only consider an alias when the detected locale matches one of these.
29
+ * A query in `en-US` won't match Australian "servo" because `en-AU` is not in `["en-US"]`.
26
30
  */
27
31
  locales: ReadonlyArray<string>;
28
32
  /**
29
- * Free-form regional refinement within the locale (e.g. "NYC", "Kansai", "Quebec"). Not used for matching today;
30
- * informational. A future enhancement could combine this with a coarse geolocation signal to further disambiguate.
33
+ * Free-form regional refinement within the locale (e.g. "NYC", "Kansai", "Quebec").
34
+ *
35
+ * Not used for matching today.
36
+ * Informational.
37
+ *
38
+ * A future enhancement could combine this with a coarse geolocation signal to further disambiguate.
31
39
  */
32
40
  regionHint?: string;
33
41
  }
@@ -56,8 +64,9 @@ export interface VariantAliasTable {
56
64
  *
57
65
  * - `unscoped` — the record declares no locales and answers under any.
58
66
  * - `exact` — the query's locale tag is one the record declares.
59
- * - `language` — only the language subtag agrees. Weaker on purpose: a regional phrasing reached through its language
60
- * alone is a guess about the region.
67
+ * - `language` — only the language subtag agrees.
68
+ * Weaker on purpose: a regional phrasing reached through its language by
69
+ * itself is a guess about the region.
61
70
  */
62
71
  export type LocaleScope = "unscoped" | "exact" | "language";
63
72
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,CAAA;AAE7C,UAAU,gBAAgB;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACrD,IAAI,EAAE,SAAS,CAAA;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IACnD,IAAI,EAAE,OAAO,CAAA;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,UAAU,CAAA;AAEpD,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;CACpC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,WAAW,CAAA;IAClB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,YAAY,CAAA;IACnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;CAClB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,CAAA;AAE7C,UAAU,gBAAgB;IACzB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACrD,IAAI,EAAE,SAAS,CAAA;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IACnD,IAAI,EAAE,OAAO,CAAA;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,UAAU,CAAA;AAEpD,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;CACpC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,WAAW,CAAA;IAClB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,YAAY,CAAA;IACnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;CAClB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/variant-aliases",
3
- "version": "10.0.0",
3
+ "version": "10.2.0",
4
4
  "description": "Regional variant alias table — local terms for amenities/brands blocked by locale. 'servo' → fuel (en-AU), 'マクド' → McDonald's (ja-JP), 'PFK' → KFC (fr-CA).",
5
5
  "license": "AGPL-3.0-only OR LicenseRef-Commercial",
6
6
  "repository": {
@@ -14,15 +14,10 @@
14
14
  "out/**/*.d.ts",
15
15
  "out/**/*.d.ts.map",
16
16
  "data/**/*.json",
17
- "*.ts",
18
- "*.tsx",
19
- "**/*.ts",
20
- "**/*.tsx",
21
- "!*.test.ts",
22
- "!*.test.tsx",
17
+ "lib/**/*.ts",
18
+ "lib/**/*.tsx",
23
19
  "!**/*.test.ts",
24
- "!**/*.test.tsx",
25
- "!test/**"
20
+ "!**/*.test.tsx"
26
21
  ],
27
22
  "type": "module",
28
23
  "sideEffects": false,
@@ -40,10 +35,10 @@
40
35
  "node": "./out/index.js",
41
36
  "default": "./out/index.js"
42
37
  },
43
- "./lookup": {
44
- "types": "./out/lookup.d.ts",
45
- "node": "./out/lookup.js",
46
- "default": "./out/lookup.js"
38
+ "./*": {
39
+ "types": "./out/*.d.ts",
40
+ "node": "./out/*.js",
41
+ "default": "./out/*.js"
47
42
  }
48
43
  },
49
44
  "publishConfig": {
@@ -55,10 +50,10 @@
55
50
  "node": "./out/index.js",
56
51
  "default": "./out/index.js"
57
52
  },
58
- "./lookup": {
59
- "types": "./out/lookup.d.ts",
60
- "node": "./out/lookup.js",
61
- "default": "./out/lookup.js"
53
+ "./*": {
54
+ "types": "./out/*.d.ts",
55
+ "node": "./out/*.js",
56
+ "default": "./out/*.js"
62
57
  }
63
58
  },
64
59
  "imports": {
@@ -70,6 +65,6 @@
70
65
  }
71
66
  },
72
67
  "dependencies": {
73
- "@mailwoman/core": "10.0.0"
68
+ "@mailwoman/core": "10.2.0"
74
69
  }
75
70
  }