@whiteslove/parsing-lexicon 0.2.0 → 0.2.2

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.
Files changed (94) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +137 -137
  3. package/index.d.ts +374 -374
  4. package/package.json +77 -75
  5. package/src/central-asia-locations.js +211 -211
  6. package/src/central-asia.js +233 -233
  7. package/src/contact.d.ts +44 -44
  8. package/src/contact.js +159 -159
  9. package/src/countries.js +175 -175
  10. package/src/country-context.d.ts +10 -10
  11. package/src/country-context.js +22 -22
  12. package/src/currency.d.ts +14 -14
  13. package/src/currency.js +66 -66
  14. package/src/geo.js +169 -169
  15. package/src/geography-central-asia.js +42 -42
  16. package/src/geography-detection.d.ts +14 -14
  17. package/src/geography-detection.js +64 -64
  18. package/src/geography-display.d.ts +13 -13
  19. package/src/geography-display.js +113 -113
  20. package/src/geography.js +210 -210
  21. package/src/hiring-advanced.js +147 -147
  22. package/src/hiring-candidate-fields.d.ts +9 -9
  23. package/src/hiring-candidate-fields.js +92 -92
  24. package/src/hiring-context.d.ts +64 -64
  25. package/src/hiring-context.js +412 -412
  26. package/src/hiring-language-extensions.d.ts +19 -19
  27. package/src/hiring-language-extensions.js +139 -139
  28. package/src/hiring-languages.js +135 -135
  29. package/src/hiring-location-fields.d.ts +3 -3
  30. package/src/hiring-location-fields.js +53 -53
  31. package/src/hiring-professions-ro.js +191 -191
  32. package/src/hiring-professions.js +437 -437
  33. package/src/hiring-requirements.d.ts +16 -16
  34. package/src/hiring-requirements.js +170 -170
  35. package/src/hiring-salary-context.d.ts +27 -27
  36. package/src/hiring-salary-context.js +76 -76
  37. package/src/hiring-semantics.d.ts +29 -29
  38. package/src/hiring-semantics.js +218 -218
  39. package/src/hiring-skills.d.ts +21 -21
  40. package/src/hiring-skills.js +315 -315
  41. package/src/hiring-source-aliases.d.ts +32 -32
  42. package/src/hiring-source-aliases.js +185 -185
  43. package/src/hiring-source-semantics.d.ts +31 -31
  44. package/src/hiring-source-semantics.js +293 -293
  45. package/src/hiring-temporal.d.ts +15 -15
  46. package/src/hiring-temporal.js +67 -67
  47. package/src/hiring-vacancy-fields.d.ts +5 -5
  48. package/src/hiring-vacancy-fields.js +23 -23
  49. package/src/hiring-work-semantics.d.ts +34 -34
  50. package/src/hiring-work-semantics.js +72 -72
  51. package/src/hiring.js +180 -180
  52. package/src/housing-address.d.ts +18 -18
  53. package/src/housing-address.js +217 -210
  54. package/src/housing-commercial.d.ts +1 -0
  55. package/src/housing-commercial.js +9 -0
  56. package/src/housing-context.d.ts +36 -36
  57. package/src/housing-context.js +183 -183
  58. package/src/housing-features.js +30 -30
  59. package/src/housing-intent.d.ts +9 -9
  60. package/src/housing-intent.js +132 -132
  61. package/src/housing-listing-fields.js +131 -131
  62. package/src/housing-money.d.ts +7 -7
  63. package/src/housing-money.js +102 -102
  64. package/src/housing-source-aliases.d.ts +8 -8
  65. package/src/housing-source-aliases.js +51 -51
  66. package/src/housing-structured.d.ts +55 -55
  67. package/src/housing-structured.js +219 -219
  68. package/src/housing.js +200 -200
  69. package/src/index.js +45 -44
  70. package/src/kz-location-extensions.js +307 -307
  71. package/src/landmarks.js +21 -21
  72. package/src/lexicon-core.js +58 -58
  73. package/src/location-merge.js +106 -106
  74. package/src/locations.js +456 -456
  75. package/src/money-core.d.ts +10 -10
  76. package/src/money-core.js +81 -81
  77. package/src/money-lexicon.d.ts +5 -5
  78. package/src/money-lexicon.js +79 -79
  79. package/src/money.js +154 -154
  80. package/src/normalization.js +384 -384
  81. package/src/odesa-metropolitan.js +144 -144
  82. package/src/romania-geography.js +47 -47
  83. package/src/tashkent-colloquial.js +80 -72
  84. package/src/tashkent-housing-geography.d.ts +38 -38
  85. package/src/tashkent-housing-geography.js +211 -211
  86. package/src/tashkent-pois.js +215 -215
  87. package/src/tashkent-residential-complexes.js +272 -272
  88. package/src/ua-location-extensions-major.js +118 -118
  89. package/src/ua-location-extensions-metro.js +9 -9
  90. package/src/ua-location-extensions-regional.js +246 -246
  91. package/src/ua-secondary-cities.d.ts +2 -2
  92. package/src/ua-secondary-cities.js +57 -57
  93. package/src/ukraine.js +75 -75
  94. package/src/uz-location-extensions.js +259 -259
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 MARHARYTA KUBAI
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
10
- furnished 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.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MARHARYTA KUBAI
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
10
+ furnished 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 CHANGED
@@ -1,137 +1,137 @@
1
- # @whiteslove/parsing-lexicon
2
-
3
- Deterministic multilingual parsing primitives shared by Whiteslove housing and hiring services.
4
-
5
- The package is the canonical home for lexical data, normalization and reusable deterministic extraction. It is intentionally network-free and does **not** contain UI copy, persistence rules, source orchestration or consumer-specific business logic.
6
-
7
- ## What it covers
8
-
9
- ### Geography
10
-
11
- - Countries and multilingual aliases for the markets used by Whiteslove services.
12
- - Canonical city, region, district, microdistrict, locality and metro matching.
13
- - Uzbekistan and Kazakhstan location extensions.
14
- - Ukraine city/region catalog with current and historical names, major/regional city detail and metro/location extensions.
15
- - Tashkent districts, metro, colloquial areas, residential complexes and POIs.
16
- - Odesa metropolitan entities with separate administrative, suburb/locality, informal-area, development-area, POI and search-cluster semantics.
17
- - Normalization for apostrophe/dash variants and Cyrillic search folding across RU/UZ/KZ/UA input.
18
-
19
- ### Housing
20
-
21
- - Deal/action and listing-kind taxonomy.
22
- - Property/building type, condition, layout, furniture and listing-status context.
23
- - Rooms, bedrooms, floors, total floors, building year and area extraction.
24
- - Deposit, prepayment, utilities and commission/payment context.
25
- - Seller/agency/owner confidence and no-commission semantics.
26
- - Tenant policies, documents, financing, availability and location relations.
27
- - Infrastructure/proximity extraction such as walking time to metro.
28
-
29
- ### Hiring
30
-
31
- - Candidate vs vacancy intent and non-content/spam classification.
32
- - Section-aware vacancy/CV parsing.
33
- - Profession taxonomy and profession context without duplicating consumer technology-skill catalogs.
34
- - Salary range, currency and pay-period extraction.
35
- - Experience requirements and seniority.
36
- - Work mode, employment types, schedules and probation.
37
- - Languages, CEFR levels and requirement relation (`required`, `preferred`, `notRequired`, `candidateHas`).
38
- - Work authorization, visa sponsorship, relocation, contracts, benefits and hiring status context.
39
-
40
- ## Architecture
41
-
42
- Consumers should resolve data in this order:
43
-
44
- ```text
45
- structured source fields
46
- -> shared canonical lexicon
47
- -> deterministic parser
48
- -> AI fallback / enrichment
49
- ```
50
-
51
- Lexical aliases belong here. Consumers keep source adapters, persistence, ranking/filtering semantics and UI/API contracts.
52
-
53
- The package must remain dependency-light and must never require a runtime lexicon HTTP service, Redis or a message broker.
54
-
55
- ## Usage
56
-
57
- ```js
58
- import {
59
- canonicalCity,
60
- canonicalTashkentMetro,
61
- normalizeForMatch,
62
- parseHousingStructured,
63
- parseHiringContext,
64
- parseHiringSalary,
65
- } from '@whiteslove/parsing-lexicon';
66
-
67
- canonicalCity('Қарағанды', 'KZ');
68
- // Karaganda
69
-
70
- canonicalTashkentMetro('метро Максим Горький');
71
- // Buyuk Ipak Yoli
72
-
73
- normalizeForMatch('Oʻzbekiston');
74
- // o zbekiston
75
-
76
- parseHousingStructured('3 xona, 5/9, 78 m², depozit 500$, metroga 5 minut piyoda');
77
-
78
- parseHiringSalary('Salary: $3,000–4,500 per month');
79
-
80
- parseHiringContext(
81
- 'Senior Frontend Engineer. English B2 required. Remote. Visa sponsorship available.',
82
- { mode: 'vacancy', title: 'Senior Frontend Engineer' },
83
- );
84
- ```
85
-
86
- Subpath exports are available for consumers that need narrower modules, including `./geo`, `./locations`, `./housing-context`, `./housing-structured`, `./hiring-context`, `./hiring-professions` and `./money`.
87
-
88
- ## Data-quality rules
89
-
90
- - Add aliases to the existing canonical entity instead of creating source-specific regex tables.
91
- - Keep administrative entities distinct from colloquial/search concepts.
92
- - Preserve ambiguity guards where a bare term can mean several things.
93
- - Structured source fields take precedence over inferred values.
94
- - Add a regression for every production parsing bug.
95
- - Canonical dictionaries are immutable at runtime.
96
- - Duplicate canonical/alias entries and unsupported language-key drift are covered by invariants.
97
-
98
- ## Lexicon statistics
99
-
100
- Snapshot for `c509d92` (2026-08-25). The audit traverses exported lexicon data from `src/`, excludes functions, regular expressions and obvious service/path strings, then normalizes strings with Unicode NFKC, trim, whitespace collapse and lowercase.
101
-
102
- | Metric | Count |
103
- | --- | ---: |
104
- | Alias/translation-like string occurrences across exports | 153,617 |
105
- | Unique alias/translation strings, exact | 17,681 |
106
- | **Unique alias/translation strings, normalized** | **17,397** |
107
- | All exported lexicon strings, normalized | 17,406 |
108
- | Normalization merge groups | 282 |
109
-
110
- The occurrence count is intentionally much larger than the unique count because aggregate modules re-export the same canonical datasets. For package size and vocabulary breadth, the normalized unique count is the useful number.
111
-
112
- ### Vocabulary by domain
113
-
114
- | Domain | Occurrences across exports | Unique exact | Unique normalized |
115
- | --- | ---: | ---: | ---: |
116
- | Geography / locations | 64,898 | 10,149 | **9,967** |
117
- | Hiring — professions & skills | 6,738 | 2,350 | **2,324** |
118
- | Hiring — other semantics | 3,592 | 2,589 | **2,558** |
119
- | Housing | 2,554 | 1,975 | **1,971** |
120
- | Hiring — languages | 552 | 495 | **478** |
121
- | Country / source aliases | 170 | 126 | **126** |
122
-
123
- Domain rows are not additive: the same canonical string can be reachable through multiple exported structures and categories.
124
-
125
- Language totals are not inferred from script alone because many valid aliases are intentionally shared or untagged (for example names that are identical in RU/UK or EN/UZ Latin). A language-by-language table should therefore be generated only from explicitly language-tagged data rather than guessed from Unicode characters.
126
-
127
- ## Development
128
-
129
- Requires Node.js 20+.
130
-
131
- ```bash
132
- npm install
133
- npm test
134
- npm pack
135
- ```
136
-
137
- `npm pack` produces the distributable `@whiteslove/parsing-lexicon` tarball from the files declared in `package.json`.
1
+ # @whiteslove/parsing-lexicon
2
+
3
+ Deterministic multilingual parsing primitives shared by Whiteslove housing and hiring services.
4
+
5
+ The package is the canonical home for lexical data, normalization and reusable deterministic extraction. It is intentionally network-free and does **not** contain UI copy, persistence rules, source orchestration or consumer-specific business logic.
6
+
7
+ ## What it covers
8
+
9
+ ### Geography
10
+
11
+ - Countries and multilingual aliases for the markets used by Whiteslove services.
12
+ - Canonical city, region, district, microdistrict, locality and metro matching.
13
+ - Uzbekistan and Kazakhstan location extensions.
14
+ - Ukraine city/region catalog with current and historical names, major/regional city detail and metro/location extensions.
15
+ - Tashkent districts, metro, colloquial areas, residential complexes and POIs.
16
+ - Odesa metropolitan entities with separate administrative, suburb/locality, informal-area, development-area, POI and search-cluster semantics.
17
+ - Normalization for apostrophe/dash variants and Cyrillic search folding across RU/UZ/KZ/UA input.
18
+
19
+ ### Housing
20
+
21
+ - Deal/action and listing-kind taxonomy.
22
+ - Property/building type, condition, layout, furniture and listing-status context.
23
+ - Rooms, bedrooms, floors, total floors, building year and area extraction.
24
+ - Deposit, prepayment, utilities and commission/payment context.
25
+ - Seller/agency/owner confidence and no-commission semantics.
26
+ - Tenant policies, documents, financing, availability and location relations.
27
+ - Infrastructure/proximity extraction such as walking time to metro.
28
+
29
+ ### Hiring
30
+
31
+ - Candidate vs vacancy intent and non-content/spam classification.
32
+ - Section-aware vacancy/CV parsing.
33
+ - Profession taxonomy and profession context without duplicating consumer technology-skill catalogs.
34
+ - Salary range, currency and pay-period extraction.
35
+ - Experience requirements and seniority.
36
+ - Work mode, employment types, schedules and probation.
37
+ - Languages, CEFR levels and requirement relation (`required`, `preferred`, `notRequired`, `candidateHas`).
38
+ - Work authorization, visa sponsorship, relocation, contracts, benefits and hiring status context.
39
+
40
+ ## Architecture
41
+
42
+ Consumers should resolve data in this order:
43
+
44
+ ```text
45
+ structured source fields
46
+ -> shared canonical lexicon
47
+ -> deterministic parser
48
+ -> AI fallback / enrichment
49
+ ```
50
+
51
+ Lexical aliases belong here. Consumers keep source adapters, persistence, ranking/filtering semantics and UI/API contracts.
52
+
53
+ The package must remain dependency-light and must never require a runtime lexicon HTTP service, Redis or a message broker.
54
+
55
+ ## Usage
56
+
57
+ ```js
58
+ import {
59
+ canonicalCity,
60
+ canonicalTashkentMetro,
61
+ normalizeForMatch,
62
+ parseHousingStructured,
63
+ parseHiringContext,
64
+ parseHiringSalary,
65
+ } from '@whiteslove/parsing-lexicon';
66
+
67
+ canonicalCity('Қарағанды', 'KZ');
68
+ // Karaganda
69
+
70
+ canonicalTashkentMetro('метро Максим Горький');
71
+ // Buyuk Ipak Yoli
72
+
73
+ normalizeForMatch('Oʻzbekiston');
74
+ // o zbekiston
75
+
76
+ parseHousingStructured('3 xona, 5/9, 78 m², depozit 500$, metroga 5 minut piyoda');
77
+
78
+ parseHiringSalary('Salary: $3,000–4,500 per month');
79
+
80
+ parseHiringContext(
81
+ 'Senior Frontend Engineer. English B2 required. Remote. Visa sponsorship available.',
82
+ { mode: 'vacancy', title: 'Senior Frontend Engineer' },
83
+ );
84
+ ```
85
+
86
+ Subpath exports are available for consumers that need narrower modules, including `./geo`, `./locations`, `./housing-context`, `./housing-structured`, `./hiring-context`, `./hiring-professions` and `./money`.
87
+
88
+ ## Data-quality rules
89
+
90
+ - Add aliases to the existing canonical entity instead of creating source-specific regex tables.
91
+ - Keep administrative entities distinct from colloquial/search concepts.
92
+ - Preserve ambiguity guards where a bare term can mean several things.
93
+ - Structured source fields take precedence over inferred values.
94
+ - Add a regression for every production parsing bug.
95
+ - Canonical dictionaries are immutable at runtime.
96
+ - Duplicate canonical/alias entries and unsupported language-key drift are covered by invariants.
97
+
98
+ ## Lexicon statistics
99
+
100
+ Snapshot for `c509d92` (2026-08-25). The audit traverses exported lexicon data from `src/`, excludes functions, regular expressions and obvious service/path strings, then normalizes strings with Unicode NFKC, trim, whitespace collapse and lowercase.
101
+
102
+ | Metric | Count |
103
+ | --- | ---: |
104
+ | Alias/translation-like string occurrences across exports | 153,617 |
105
+ | Unique alias/translation strings, exact | 17,681 |
106
+ | **Unique alias/translation strings, normalized** | **17,397** |
107
+ | All exported lexicon strings, normalized | 17,406 |
108
+ | Normalization merge groups | 282 |
109
+
110
+ The occurrence count is intentionally much larger than the unique count because aggregate modules re-export the same canonical datasets. For package size and vocabulary breadth, the normalized unique count is the useful number.
111
+
112
+ ### Vocabulary by domain
113
+
114
+ | Domain | Occurrences across exports | Unique exact | Unique normalized |
115
+ | --- | ---: | ---: | ---: |
116
+ | Geography / locations | 64,898 | 10,149 | **9,967** |
117
+ | Hiring — professions & skills | 6,738 | 2,350 | **2,324** |
118
+ | Hiring — other semantics | 3,592 | 2,589 | **2,558** |
119
+ | Housing | 2,554 | 1,975 | **1,971** |
120
+ | Hiring — languages | 552 | 495 | **478** |
121
+ | Country / source aliases | 170 | 126 | **126** |
122
+
123
+ Domain rows are not additive: the same canonical string can be reachable through multiple exported structures and categories.
124
+
125
+ Language totals are not inferred from script alone because many valid aliases are intentionally shared or untagged (for example names that are identical in RU/UK or EN/UZ Latin). A language-by-language table should therefore be generated only from explicitly language-tagged data rather than guessed from Unicode characters.
126
+
127
+ ## Development
128
+
129
+ Requires Node.js 20+.
130
+
131
+ ```bash
132
+ npm install
133
+ npm test
134
+ npm pack
135
+ ```
136
+
137
+ `npm pack` produces the distributable `@whiteslove/parsing-lexicon` tarball from the files declared in `package.json`.