@finbheara/domain 0.24.0 → 0.26.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/dist/place.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  placesRelation2,
18
18
  probablySamePlace2,
19
19
  sameReading2
20
- } from "./chunks/place-g3py4821.js";
20
+ } from "./chunks/place-h2s1w0tq.js";
21
21
  import"./chunks/place-tcgfvemw.js";
22
22
  export {
23
23
  DEFAULT_PLACE_CAPACITY2 as DEFAULT_PLACE_CAPACITY,
package/dist/school.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  areAllPlaceTokens2,
13
13
  placeRelation2,
14
14
  sameReading2
15
- } from "./chunks/place-g3py4821.js";
15
+ } from "./chunks/place-h2s1w0tq.js";
16
16
  import {
17
17
  validity
18
18
  } from "./chunks/place-q9kwsmzd.js";
@@ -1530,6 +1530,36 @@ function createSchoolNameReader(options = {}) {
1530
1530
  token.cls = "NAME_PART";
1531
1531
  }
1532
1532
  }
1533
+ function guardShortSuffixInstitutions(tokens) {
1534
+ for (let i = 0;i < tokens.length; i++) {
1535
+ const token = tokens[i];
1536
+ if (token === undefined || token.cls !== "INSTITUTION_TYPE")
1537
+ continue;
1538
+ if (schoolInstitution(token.text)?.position !== "suffix")
1539
+ continue;
1540
+ if (token.text.replaceAll(" ", "").length > 2)
1541
+ continue;
1542
+ const named = (t) => t.cls === "NAME_PART";
1543
+ if (tokens.slice(0, i).some(named) && !tokens.slice(i + 1).some(named))
1544
+ continue;
1545
+ const back = token.words.map((w) => ({
1546
+ text: token.words.length === 1 ? token.text : foldSchoolName(w.printed),
1547
+ words: [w],
1548
+ cls: null
1549
+ }));
1550
+ for (const t of back) {
1551
+ if (isFluffWord(t.text))
1552
+ t.cls = "FLUFF";
1553
+ else if (t.text.length <= 2) {
1554
+ t.cls = "FLUFF";
1555
+ t.short = true;
1556
+ } else
1557
+ t.cls = "NAME_PART";
1558
+ }
1559
+ tokens.splice(i, 1, ...back);
1560
+ i += back.length - 1;
1561
+ }
1562
+ }
1533
1563
  function eatTruncatedTail(tokens) {
1534
1564
  let ate = false;
1535
1565
  const names = new Set(tokens.filter((t) => t.cls === "NAME_PART").map((t) => t.text));
@@ -1862,6 +1892,7 @@ function createSchoolNameReader(options = {}) {
1862
1892
  applyLabelExceptions(tokens);
1863
1893
  classifyWords(tokens);
1864
1894
  guardPrefixInstitutions(tokens);
1895
+ guardShortSuffixInstitutions(tokens);
1865
1896
  const declared = applyDeclaredInitialism(tokens);
1866
1897
  const truncated = eatTruncatedTail(tokens);
1867
1898
  const promoted = promote(tokens);
package/dist/tune.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  settingAt2,
9
9
  tune2,
10
10
  tuneRelation2
11
- } from "./chunks/place-yndzaae5.js";
11
+ } from "./chunks/place-26pfr6ak.js";
12
12
  import"./chunks/place-htxgptyv.js";
13
13
  export {
14
14
  PLAUSIBLE_SET_TEMPO_MAX2 as PLAUSIBLE_SET_TEMPO_MAX,
@@ -0,0 +1,12 @@
1
+ import type { PlaceContext } from "./place-types.ts";
2
+ import { type Place } from "./place.ts";
3
+ export interface GeocodeTown {
4
+ readonly id: string;
5
+ readonly parent: string;
6
+ readonly name: string;
7
+ readonly cell: string;
8
+ readonly geonameid: number;
9
+ }
10
+ export declare function geocodeTowns(): ReadonlyMap<string, GeocodeTown>;
11
+ export declare function geocode(print: string, ctx?: string | PlaceContext): Place;
12
+ export declare function townCell(id: string): string | undefined;
@@ -0,0 +1,3 @@
1
+ export declare const PLACE_TOWNS_TREE = "7766f91ef2cbbb099f93d878d1fd33d8b66bf6f3fe1a35590d0b5755f9a6dda6";
2
+ export declare const PLACE_TOWNS_SOURCES: Readonly<Record<string, string>>;
3
+ export declare const PLACE_TOWNS: Readonly<Record<string, string>>;
@@ -1,4 +1,5 @@
1
1
  import type { PlaceNode } from "./place-types.ts";
2
2
  export declare const AMBIGUOUS_PRINTS: readonly string[];
3
3
  export declare const CROSS_BORDER_REGIONS: readonly string[];
4
+ export declare const FOREIGN_MEMBER_REGIONS: readonly string[];
4
5
  export declare const PLACE_NODES: readonly PlaceNode[];
@@ -1,4 +1,4 @@
1
1
  import type { PlaceWithin } from "./place-types.ts";
2
- export declare const PLACE_WITHIN_TREE = "feeb35d256fbe6db963f6754bf34a706994922fde0492bc01ec3e152a4bcf891";
2
+ export declare const PLACE_WITHIN_TREE = "7766f91ef2cbbb099f93d878d1fd33d8b66bf6f3fe1a35590d0b5755f9a6dda6";
3
3
  export declare const PLACE_WITHIN_SOURCES: Readonly<Record<string, string>>;
4
4
  export declare const PLACE_WITHIN: Readonly<Record<string, PlaceWithin>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finbheara/domain",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "Places, CLRG regions, school names, ages, dances and a person's print in its role, as they are printed: read, compared and told apart",
5
5
  "keywords": [
6
6
  "places",
@@ -21,6 +21,10 @@
21
21
  "types": "./dist/types/place.d.ts",
22
22
  "default": "./dist/place.js"
23
23
  },
24
+ "./geocode": {
25
+ "types": "./dist/types/geocode.d.ts",
26
+ "default": "./dist/geocode.js"
27
+ },
24
28
  "./clrg-regions": {
25
29
  "types": "./dist/types/clrg-regions.d.ts",
26
30
  "default": "./dist/clrg-regions.js"