@finbheara/domain 0.60.1 → 0.62.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/README.md CHANGED
@@ -39,11 +39,11 @@ ESM, Node ≥ 22 or Bun ≥ 1.4.2. MIT. Not affiliated with or endorsed by any d
39
39
 
40
40
  | import | what |
41
41
  |---|---|
42
- | `@finbheara/domain/place` | `place()`, `createPlaceReader`, `placeRelation`, the `Place` types |
42
+ | `@finbheara/domain/place` | `place()`, `createPlaceReader`, `placeRelation`, `placeFromId`, `ownRegionCountries`, the `Place` types |
43
43
  | `@finbheara/domain/geocode` | `geocode()`: a location field read by the place store, then by every GeoNames town of AU, CA, GB, IE, NZ and US; `townCell` |
44
44
  | `@finbheara/domain/clrg-regions` | `REGIONS`, `regionOf`, `resolvePhrase` |
45
45
  | `@finbheara/domain/event` | `EVENT_REGISTER`, `EVENT_REGISTER_BY_CODE`, `EVENT_TIER`, `eventTier`, `isMajorEvent`, `eventCodeOfSlug`, the `EventRegisterRow` type: the CLRG championships of tier 1 to 3 (below) |
46
- | `@finbheara/domain/school` | `createSchoolNameReader`, `DEFAULT_SCHOOL_NAME_READER`, `compareSchoolNames`, `foldSchoolName`, `schoolEncoder`, `schoolColumns` |
46
+ | `@finbheara/domain/school` | `createSchoolNameReader`, `DEFAULT_SCHOOL_NAME_READER`, `compareSchoolNames`, `foldSchoolName`, `schoolEncoder`, `schoolColumns`, the word questions `namesInstitution`, `isSchoolVocabularyWord`, `isFluffOrFragment`, `notASchoolIn`, the `InstitutionType` type |
47
47
  | `@finbheara/domain/school-graph` | `schoolGraph`, `FAMILY_EDGES`, `LINK_YEARS`, `ANY_PATH`, `FAMILY_PATH`, and the `SchoolLink`/`LinkPath`/`LinkPolicy` types: how two schools are linked, as candidate paths with flags (below) |
48
48
  | `@finbheara/domain/tune` | `tune()`, `tuneRelation`, `tempoLegal`, `settingAt`, `TUNE_NODES`: the CLRG set dance list, each tune with its time, speeds and bars |
49
49
  | `@finbheara/domain/ceili` | `ceili()`, `ceiliRelation`, `CEILI_NODES`: the céilí handbook dances |
@@ -56,6 +56,7 @@ ESM, Node ≥ 22 or Bun ≥ 1.4.2. MIT. Not affiliated with or endorsed by any d
56
56
  | `@finbheara/domain/title` | `compTitle`, `titleRelation`, `matchTitle`, `ladderOf`, `populationIn`, `populationRelation`, `roundNumbersIn`, `roundFold`, `codePopulation`, `secondIn`: a competition title read and matched onto syllabus entries, a code's sex suffix, a second chance (below) |
57
57
  | `@finbheara/domain/code` | `createCodeReader`, `compCode`, `DEFAULT_CODE_READER`, the `CompCode` type: a competition code read at the feis it belongs to, from that feis's syllabus or, on a platform you name as standardized, from the code alone (below) |
58
58
  | `@finbheara/domain/schedule` | `scheduleAt`, `sameHall`, `readRunningOrder`, the `ScheduleSlot` type: which entries a hall runs (below) |
59
+ | `@finbheara/domain/internals` | NOT A PUBLIC API: the place store and the school reader's building blocks, for a tool that mirrors how this package builds its readings (below) |
59
60
 
60
61
  The library does no I/O and installs nothing process-wide. Every reader has a default and a
61
62
  factory: build your own with options when the default is not what you want.
@@ -117,6 +118,20 @@ A town followed by a county, district or region reads as the town only where tha
117
118
  it: `place("Coventry, West Midlands")` is Coventry, and `place("Coventry, Kent")` is two places.
118
119
  Which units hold each town is a table read off GeoNames.
119
120
 
121
+ A node is read by its id with `placeFromId`, and its fields are on the reading's `nodes`:
122
+
123
+ ```ts
124
+ import { ownRegionCountries, placeFromId } from "@finbheara/domain/place";
125
+
126
+ placeFromId("NZL").nodes.find((n) => n.id === "NZL")?.iso2; // "NZ"
127
+ ownRegionCountries().has("NZL"); // true: New Zealand is one CLRG region
128
+ ownRegionCountries().has("USA"); // false
129
+ ```
130
+
131
+ `ownRegionCountries` is every country whose CLRG region covers the whole of it on the map: New
132
+ Zealand, Australia, South Africa and the South American states. A region placed on no map (the
133
+ RCCEA) and a foreign member (Mexico, in the Southern Region) are not in it.
134
+
120
135
  ### Geocoding a location field
121
136
 
122
137
  `place()` holds the places a print of a school or a person may carry, and it reads no other
@@ -242,6 +257,26 @@ const reader = createSchoolNameReader({ lexicon: (key) => myLexicon.get(key) });
242
257
  compareSchoolNames("Ardvarna Academy", "Ardvarna Academy (Ontario)", reader);
243
258
  ```
244
259
 
260
+ ### One word at a time
261
+
262
+ A caller reading a print word by word, before or beside the reader, asks the vocabularies the
263
+ reader asks:
264
+
265
+ ```ts
266
+ import { isFluffOrFragment, isSchoolVocabularyWord, namesInstitution } from "@finbheara/domain/school";
267
+
268
+ namesInstitution("Ardvarna Academy (Calgary, AB)"); // true: `Academy`
269
+ namesInstitution("Ardvarna, Calgary"); // false
270
+ isSchoolVocabularyWord("Calgary"); // true: a place token
271
+ isSchoolVocabularyWord("Ardvarna"); // false
272
+ isFluffOrFragment("danc"); // true: a cut of `dance`
273
+ ```
274
+
275
+ `isSchoolVocabularyWord` is a place token, an institution word or a whole fluff word, and knows
276
+ no names: a caller with a lexicon asks it beside this. `isFluffOrFragment` reads a token
277
+ `foldSchoolName` has folded. `notASchoolIn(rows)` is the refusal check a reader builds from its
278
+ registers, for a caller that asks it without parsing: it answers the first row a print matches.
279
+
245
280
  ### Your own garbage
246
281
 
247
282
  The shipped refusals are generic: a card number, keyboard filler, a run with no letter in it,
@@ -789,6 +824,20 @@ seatName("Aoife Mhaolvarna").nn2; // "Mhaolvarna<<Aoife": nam
789
824
  `dancerPrintsNoName(print)`) is `roleName(role, print).printsNoName()` without the parse, for
790
825
  a walk that parses no name. Names' `isNoNamePrint` alone misses a role's own sentinel.
791
826
 
827
+ ## Internals
828
+
829
+ ```ts
830
+ /* Use at your own risk: not a public API, may change in any release. File an issue to make it public if you have a real use case. */
831
+ import { PLACE_NODES, schoolTokens } from "@finbheara/domain/internals";
832
+ ```
833
+
834
+ `@finbheara/domain/internals` exports the place store (`PLACE_NODES`, `AMBIGUOUS_PRINTS`) and
835
+ the school reader's building blocks (its token classes, its location zones, its fluff and
836
+ institution scans) for a tool that mirrors how this package builds its readings, such as a table
837
+ generated from the place store. It follows no semver: any release may rename or remove a name in
838
+ it. A question a reading answers belongs on `/place` or `/school` as an accessor, and an issue
839
+ asking for one is the way to get it there.
840
+
792
841
  ## Known gaps
793
842
 
794
843
  - `place()` reads `"Derry in Ireland"` and `"Calgary in Western Canada"` as `unread`: it does