@mailwoman/corpus 10.8.0 → 11.0.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.
@@ -67,3 +67,19 @@ function codesFor(country: string): ReadonlyMap<string, string> {
67
67
  export function regionCodeFor(country: string, regionName: string): string | null {
68
68
  return codesFor(country.toUpperCase()).get(regionName.toLowerCase()) ?? null
69
69
  }
70
+
71
+ /**
72
+ * The name of the region `country`'s addresses write as `regionCode`, in lower case as the
73
+ * spec table holds it, title-cased word by word, or `null` when they write no such code.
74
+ */
75
+ export function regionNameFor(country: string, regionCode: string): string | null {
76
+ const wanted = regionCode.toUpperCase()
77
+
78
+ for (const [name, code] of codesFor(country.toUpperCase())) {
79
+ if (code.toUpperCase() === wanted) {
80
+ return name.replaceAll(/(^|\s)\p{L}/gu, (initial) => initial.toUpperCase())
81
+ }
82
+ }
83
+
84
+ return null
85
+ }
@@ -15,4 +15,9 @@
15
15
  * The code `country`'s addresses use for the region `regionName`, or `null` when they write the name.
16
16
  */
17
17
  export declare function regionCodeFor(country: string, regionName: string): string | null;
18
+ /**
19
+ * The name of the region `country`'s addresses write as `regionCode`, in lower case as the
20
+ * spec table holds it, title-cased word by word, or `null` when they write no such code.
21
+ */
22
+ export declare function regionNameFor(country: string, regionCode: string): string | null;
18
23
  //# sourceMappingURL=region-codes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"region-codes.d.ts","sourceRoot":"","sources":["../../../../../lib/adapters/wof/admin/json/region-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmDH;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEhF"}
1
+ {"version":3,"file":"region-codes.d.ts","sourceRoot":"","sources":["../../../../../lib/adapters/wof/admin/json/region-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmDH;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEhF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUhF"}
@@ -49,4 +49,17 @@ function codesFor(country) {
49
49
  export function regionCodeFor(country, regionName) {
50
50
  return codesFor(country.toUpperCase()).get(regionName.toLowerCase()) ?? null;
51
51
  }
52
+ /**
53
+ * The name of the region `country`'s addresses write as `regionCode`, in lower case as the
54
+ * spec table holds it, title-cased word by word, or `null` when they write no such code.
55
+ */
56
+ export function regionNameFor(country, regionCode) {
57
+ const wanted = regionCode.toUpperCase();
58
+ for (const [name, code] of codesFor(country.toUpperCase())) {
59
+ if (code.toUpperCase() === wanted) {
60
+ return name.replaceAll(/(^|\s)\p{L}/gu, (initial) => initial.toUpperCase());
61
+ }
62
+ }
63
+ return null;
64
+ }
52
65
  //# sourceMappingURL=region-codes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"region-codes.js","sourceRoot":"","sources":["../../../../../lib/adapters/wof/admin/json/region-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAWnE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAuC,CAAA;AAEvE;;GAEG;AACH,SAAS,QAAQ,CAAC,OAAe;IAChC,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAE5C,IAAI,MAAM;QAAE,OAAO,MAAM,CAAA;IAEzB,MAAM,KAAK,GAAG,IAAI,GAA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eAAe,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;QAC5E,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/corpus",
3
- "version": "10.8.0",
3
+ "version": "11.0.0",
4
4
  "description": "Mailwoman corpus pipeline: BIO-labeled dataset builder for the neural classifier.",
5
5
  "license": "AGPL-3.0-only OR LicenseRef-Commercial",
6
6
  "repository": {
@@ -116,23 +116,23 @@
116
116
  }
117
117
  },
118
118
  "dependencies": {
119
- "@mailwoman/ban": "10.8.0",
120
- "@mailwoman/bdc": "10.8.0",
121
- "@mailwoman/codex": "10.8.0",
122
- "@mailwoman/core": "10.8.0",
123
- "@mailwoman/dictionaries": "10.8.0",
124
- "@mailwoman/evidence": "10.8.0",
125
- "@mailwoman/gazetteer": "10.8.0",
126
- "@mailwoman/normalize": "10.8.0",
127
- "@mailwoman/poi-taxonomy": "10.8.0",
128
- "@mailwoman/postcode": "10.8.0",
129
- "@mailwoman/query-shape": "10.8.0",
130
- "@mailwoman/record": "10.8.0",
131
- "@mailwoman/resolver": "10.8.0",
132
- "@mailwoman/resolver-wof-sqlite": "10.8.0",
133
- "@mailwoman/spatial": "10.8.0",
134
- "@mailwoman/sqlite": "10.8.0",
135
- "@mailwoman/tiger": "10.8.0",
119
+ "@mailwoman/ban": "11.0.0",
120
+ "@mailwoman/bdc": "11.0.0",
121
+ "@mailwoman/codex": "11.0.0",
122
+ "@mailwoman/core": "11.0.0",
123
+ "@mailwoman/dictionaries": "11.0.0",
124
+ "@mailwoman/evidence": "11.0.0",
125
+ "@mailwoman/gazetteer": "11.0.0",
126
+ "@mailwoman/normalize": "11.0.0",
127
+ "@mailwoman/poi-taxonomy": "11.0.0",
128
+ "@mailwoman/postcode": "11.0.0",
129
+ "@mailwoman/query-shape": "11.0.0",
130
+ "@mailwoman/record": "11.0.0",
131
+ "@mailwoman/resolver": "11.0.0",
132
+ "@mailwoman/resolver-wof-sqlite": "11.0.0",
133
+ "@mailwoman/spatial": "11.0.0",
134
+ "@mailwoman/sqlite": "11.0.0",
135
+ "@mailwoman/tiger": "11.0.0",
136
136
  "apache-arrow": "^21.2.0",
137
137
  "fastest-levenshtein": "^1.0.16",
138
138
  "parquet-wasm": "0.9.0",