@finbheara/domain 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +273 -2
- package/dist/age.js +420 -0
- package/dist/ceili.js +15 -0
- package/dist/chunks/place-7gqecaxd.js +201 -0
- package/dist/chunks/place-g6yw4cq6.js +134 -0
- package/dist/chunks/place-kr42294h.js +267 -0
- package/dist/chunks/place-qbp3xfb4.js +7412 -0
- package/dist/clrg-regions.js +603 -0
- package/dist/dance-types.js +14 -0
- package/dist/dance.js +41 -0
- package/dist/noun-index.js +233 -0
- package/dist/place.js +36 -0
- package/dist/school.js +2269 -0
- package/dist/tune.js +23 -0
- package/dist/types/age-types.d.ts +31 -0
- package/dist/types/age.d.ts +84 -0
- package/dist/types/ceili.d.ts +53 -0
- package/dist/types/clrg-regions.d.ts +31 -0
- package/dist/types/dance-match.d.ts +28 -0
- package/dist/types/dance-types.d.ts +9 -0
- package/dist/types/dance.d.ts +14 -0
- package/dist/types/noun-index.d.ts +67 -0
- package/dist/types/place-tree.d.ts +4 -0
- package/dist/types/place-types.d.ts +24 -0
- package/dist/types/place.d.ts +98 -0
- package/dist/types/school-compare.d.ts +39 -0
- package/dist/types/school-encoder.d.ts +8 -0
- package/dist/types/school-exception-vocabulary.d.ts +23 -0
- package/dist/types/school-fluff-vocabulary.d.ts +16 -0
- package/dist/types/school-fused-prefix.d.ts +1 -0
- package/dist/types/school-identity.d.ts +9 -0
- package/dist/types/school-institution-vocabulary.d.ts +20 -0
- package/dist/types/school-location.d.ts +16 -0
- package/dist/types/school-match-key.d.ts +5 -0
- package/dist/types/school-name.d.ts +82 -0
- package/dist/types/school-tokens.d.ts +20 -0
- package/dist/types/school.d.ts +11 -0
- package/dist/types/tune.d.ts +63 -0
- package/package.json +73 -5
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type Place } from "./place.ts";
|
|
2
|
+
import { type NotASchool, type RefusalReason, type SchoolNameException } from "./school-exception-vocabulary.ts";
|
|
3
|
+
import { type InstitutionType } from "./school-institution-vocabulary.ts";
|
|
4
|
+
export interface LexiconFlags {
|
|
5
|
+
surname: boolean;
|
|
6
|
+
given: boolean;
|
|
7
|
+
place: boolean;
|
|
8
|
+
tradename: boolean;
|
|
9
|
+
concept: boolean;
|
|
10
|
+
ambiguous: boolean;
|
|
11
|
+
raw: string;
|
|
12
|
+
}
|
|
13
|
+
export type SchoolLexicon = (key: string) => LexiconFlags | undefined;
|
|
14
|
+
export interface SchoolPart {
|
|
15
|
+
readonly base: string;
|
|
16
|
+
readonly parts: readonly SchoolPart[];
|
|
17
|
+
readonly lexicon: LexiconFlags | null;
|
|
18
|
+
}
|
|
19
|
+
export interface SchoolRefusal {
|
|
20
|
+
readonly reason: RefusalReason;
|
|
21
|
+
readonly printed: string;
|
|
22
|
+
readonly row: NotASchool;
|
|
23
|
+
readonly value: typeof SCHOOL_REFUSED;
|
|
24
|
+
}
|
|
25
|
+
export declare const SCHOOL_REFUSED = "!!!NOTASCHOOL";
|
|
26
|
+
export type SchoolConcern = "institution-inside-name" | "promoted-name" | "no-name-part" | "truncated-tail" | "lexicon-absent" | "ambiguous-part" | "place-from-lexicon";
|
|
27
|
+
export type Refusal = SchoolRefusal;
|
|
28
|
+
export type Concern = SchoolConcern;
|
|
29
|
+
export interface SchoolName {
|
|
30
|
+
readonly [Symbol.toStringTag]: "SchoolName";
|
|
31
|
+
toString(): string;
|
|
32
|
+
readonly sn0: string;
|
|
33
|
+
readonly sn1: string;
|
|
34
|
+
readonly sn2: string;
|
|
35
|
+
readonly sn3: string;
|
|
36
|
+
readonly sn4: string;
|
|
37
|
+
readonly parts: readonly SchoolPart[];
|
|
38
|
+
readonly institution: InstitutionType | null;
|
|
39
|
+
readonly location: Place | null;
|
|
40
|
+
readonly refusal: SchoolRefusal | null;
|
|
41
|
+
isEmpty(): boolean;
|
|
42
|
+
isSchool(): boolean;
|
|
43
|
+
surnames(): readonly string[];
|
|
44
|
+
readonly concerns: readonly SchoolConcern[];
|
|
45
|
+
}
|
|
46
|
+
export declare const TITLE_CASE_STATE_CODES: ReadonlySet<string>;
|
|
47
|
+
export declare function schoolInitials(name: SchoolName): SchoolInitials;
|
|
48
|
+
export interface SchoolPrintSplit {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly qualifier: string | null;
|
|
51
|
+
readonly location: Place | null;
|
|
52
|
+
readonly annotation: string | null;
|
|
53
|
+
}
|
|
54
|
+
export declare function schoolPrintSplit(print: string, reader: SchoolNameParser): SchoolPrintSplit;
|
|
55
|
+
export interface SchoolInitials {
|
|
56
|
+
readonly declared: string | null;
|
|
57
|
+
readonly derived: readonly string[];
|
|
58
|
+
}
|
|
59
|
+
export declare function realWords(name: SchoolName): readonly string[];
|
|
60
|
+
export declare function realWordsInPrintOrder(name: SchoolName): readonly string[];
|
|
61
|
+
export declare const DEFAULT_SCHOOL_NAME_CAPACITY = 16384;
|
|
62
|
+
export interface SchoolNameReaderOptions {
|
|
63
|
+
readonly lexicon?: SchoolLexicon;
|
|
64
|
+
readonly exceptions?: readonly SchoolNameException[];
|
|
65
|
+
readonly refusals?: readonly NotASchool[];
|
|
66
|
+
readonly garbage?: readonly NotASchool[];
|
|
67
|
+
readonly capacity?: number;
|
|
68
|
+
}
|
|
69
|
+
export declare function createSchoolNameReader(options?: SchoolNameReaderOptions): {
|
|
70
|
+
lexicon: SchoolLexicon | undefined;
|
|
71
|
+
schoolName: (print: string) => SchoolName;
|
|
72
|
+
schoolNameStats: () => {
|
|
73
|
+
hits: number;
|
|
74
|
+
misses: number;
|
|
75
|
+
evictions: number;
|
|
76
|
+
};
|
|
77
|
+
resetSchoolNameCache: (next?: number) => void;
|
|
78
|
+
capacity: () => number;
|
|
79
|
+
};
|
|
80
|
+
export type SchoolNameReader = ReturnType<typeof createSchoolNameReader>;
|
|
81
|
+
export type SchoolNameParser = Pick<SchoolNameReader, "schoolName">;
|
|
82
|
+
export declare const DEFAULT_SCHOOL_NAME_READER: SchoolNameReader;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { InstitutionType as RegisterType } from "./school-institution-vocabulary.ts";
|
|
2
|
+
export declare const LEGACY_EXCEPTION_PHRASES: ReadonlySet<string>;
|
|
3
|
+
export type SchoolTokenClass = "NAME_PART" | "INSTITUTION_TYPE" | "FLUFF" | "LOCATION_HINT";
|
|
4
|
+
export interface SchoolToken {
|
|
5
|
+
text: string;
|
|
6
|
+
class: SchoolTokenClass;
|
|
7
|
+
exception?: string;
|
|
8
|
+
short?: true;
|
|
9
|
+
institution?: InstitutionType;
|
|
10
|
+
place?: string;
|
|
11
|
+
promoted?: true;
|
|
12
|
+
}
|
|
13
|
+
export type InstitutionType = Exclude<RegisterType, "club">;
|
|
14
|
+
export declare const SCHOOL_FLUFF_TOKENS: ReadonlySet<string>;
|
|
15
|
+
export declare function canonicalPlace(token: string): string | undefined;
|
|
16
|
+
export declare function schoolTokens(raw: string): SchoolToken[];
|
|
17
|
+
export declare function nameParts(raw: string): string[];
|
|
18
|
+
export declare function promotedKey(raw: string): boolean;
|
|
19
|
+
export declare function institutionTypes(raw: string): InstitutionType[];
|
|
20
|
+
export declare function locationHints(raw: string): string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { createSchoolNameReader, DEFAULT_SCHOOL_NAME_CAPACITY, DEFAULT_SCHOOL_NAME_READER, realWords, realWordsInPrintOrder, schoolInitials, schoolPrintSplit, } from "./school-name.ts";
|
|
2
|
+
export type { LexiconFlags, SchoolConcern, SchoolInitials, SchoolLexicon, SchoolName, SchoolNameParser, SchoolNameReader, SchoolNameReaderOptions, SchoolPart, SchoolPrintSplit, SchoolRefusal, } from "./school-name.ts";
|
|
3
|
+
export { isColumnCutOf, isInitialismOf, isLadderLevel, mapOfSchools, probablySameSchool, SCHOOL_LEVEL_COLUMNS, schoolColumns, sameInEveryPart, schoolCompare, schoolTokensAt, setOfSchools, } from "./school-compare.ts";
|
|
4
|
+
export type { SchoolDop, SchoolLevelColumn, SchoolMap, SchoolSet } from "./school-compare.ts";
|
|
5
|
+
export { schoolEncoder } from "./school-encoder.ts";
|
|
6
|
+
export type { SchoolEncoderOptions } from "./school-encoder.ts";
|
|
7
|
+
export { compareSchoolNames, compareSchools } from "./school-identity.ts";
|
|
8
|
+
export type { IdentityResult, IdentityVerdict } from "./school-identity.ts";
|
|
9
|
+
export { foldSchoolName, hasSpecificToken, schoolKeyTokens } from "./school-match-key.ts";
|
|
10
|
+
export { NOT_A_SCHOOL, SCHOOL_NAME_EXCEPTIONS, } from "./school-exception-vocabulary.ts";
|
|
11
|
+
export type { NotASchool, RefusalReason, SchoolNameException, } from "./school-exception-vocabulary.ts";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type DanceMatch, type DanceRelation } from "./dance-match.ts";
|
|
2
|
+
import { type SetRhythm, type TimeSignature } from "./dance-types.ts";
|
|
3
|
+
export type TuneSetting = "traditional" | "contemporary";
|
|
4
|
+
export interface SpeedRange {
|
|
5
|
+
readonly min: number;
|
|
6
|
+
readonly max: number | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const SET_MIN_SPEED: Readonly<Record<SetRhythm, number>>;
|
|
9
|
+
export declare const PLAUSIBLE_SET_TEMPO_MAX = 150;
|
|
10
|
+
export interface TuneNode {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly irish: string | null;
|
|
14
|
+
readonly prints: readonly string[];
|
|
15
|
+
readonly irishPrints: readonly string[];
|
|
16
|
+
readonly time: TimeSignature;
|
|
17
|
+
readonly traditionalSpeed: number | null;
|
|
18
|
+
readonly maxSpeed: number | null;
|
|
19
|
+
}
|
|
20
|
+
export declare const TUNE_NODES: readonly TuneNode[];
|
|
21
|
+
export interface Tune {
|
|
22
|
+
readonly [Symbol.toStringTag]: "Tune";
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly irish: string | null;
|
|
26
|
+
readonly node: TuneNode;
|
|
27
|
+
toString(): string;
|
|
28
|
+
isTraditional(): boolean;
|
|
29
|
+
isContemporary(): boolean;
|
|
30
|
+
time(): TimeSignature;
|
|
31
|
+
rhythm(): SetRhythm;
|
|
32
|
+
speed(setting?: TuneSetting): number | SpeedRange | null;
|
|
33
|
+
}
|
|
34
|
+
export declare function allTunes(): readonly Tune[];
|
|
35
|
+
export declare function tuneById(id: string): Tune | undefined;
|
|
36
|
+
export declare function tempoLegal(tune: Tune | TuneReading, bpm: number, setting?: TuneSetting): boolean;
|
|
37
|
+
export declare function settingAt(tune: Tune, bpm: number): TuneSetting | null;
|
|
38
|
+
export interface TuneContext {
|
|
39
|
+
readonly setting?: TuneSetting;
|
|
40
|
+
readonly bpm?: number;
|
|
41
|
+
readonly rhythm?: SetRhythm;
|
|
42
|
+
readonly time?: TimeSignature;
|
|
43
|
+
}
|
|
44
|
+
export type TuneRefusal = "empty" | "dance-type" | "unmatched";
|
|
45
|
+
export interface TuneReading {
|
|
46
|
+
readonly [Symbol.toStringTag]: "TuneReading";
|
|
47
|
+
readonly print: string;
|
|
48
|
+
readonly folded: string;
|
|
49
|
+
readonly bpm: number | null;
|
|
50
|
+
readonly candidates: readonly Tune[];
|
|
51
|
+
readonly score: number;
|
|
52
|
+
readonly match: DanceMatch | null;
|
|
53
|
+
readonly refusal: TuneRefusal | null;
|
|
54
|
+
readonly misses: readonly string[];
|
|
55
|
+
readonly tune: Tune | undefined;
|
|
56
|
+
isTune(): boolean;
|
|
57
|
+
isSingular(): boolean;
|
|
58
|
+
isAmbiguous(): boolean;
|
|
59
|
+
refine(ctx: TuneContext): TuneReading;
|
|
60
|
+
toString(): string;
|
|
61
|
+
}
|
|
62
|
+
export declare function tune(print: string, ctx?: TuneContext): TuneReading;
|
|
63
|
+
export declare function tuneRelation(a: TuneReading, b: TuneReading): DanceRelation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,74 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@finbheara/domain",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Places, CLRG regions, school names, ages and dances as they are printed: read, compared and told apart",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"places",
|
|
7
|
+
"regions",
|
|
8
|
+
"school-names",
|
|
9
|
+
"ages",
|
|
10
|
+
"set-dances",
|
|
11
|
+
"normalization",
|
|
12
|
+
"irish-dance",
|
|
13
|
+
"gazetteer"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "Finbheara Systems",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"exports": {
|
|
20
|
+
"./place": {
|
|
21
|
+
"types": "./dist/types/place.d.ts",
|
|
22
|
+
"default": "./dist/place.js"
|
|
23
|
+
},
|
|
24
|
+
"./clrg-regions": {
|
|
25
|
+
"types": "./dist/types/clrg-regions.d.ts",
|
|
26
|
+
"default": "./dist/clrg-regions.js"
|
|
27
|
+
},
|
|
28
|
+
"./school": {
|
|
29
|
+
"types": "./dist/types/school.d.ts",
|
|
30
|
+
"default": "./dist/school.js"
|
|
31
|
+
},
|
|
32
|
+
"./tune": {
|
|
33
|
+
"types": "./dist/types/tune.d.ts",
|
|
34
|
+
"default": "./dist/tune.js"
|
|
35
|
+
},
|
|
36
|
+
"./ceili": {
|
|
37
|
+
"types": "./dist/types/ceili.d.ts",
|
|
38
|
+
"default": "./dist/ceili.js"
|
|
39
|
+
},
|
|
40
|
+
"./dance": {
|
|
41
|
+
"types": "./dist/types/dance.d.ts",
|
|
42
|
+
"default": "./dist/dance.js"
|
|
43
|
+
},
|
|
44
|
+
"./age": {
|
|
45
|
+
"types": "./dist/types/age.d.ts",
|
|
46
|
+
"default": "./dist/age.js"
|
|
47
|
+
},
|
|
48
|
+
"./dance-types": {
|
|
49
|
+
"types": "./dist/types/dance-types.d.ts",
|
|
50
|
+
"default": "./dist/dance-types.js"
|
|
51
|
+
},
|
|
52
|
+
"./noun-index": {
|
|
53
|
+
"types": "./dist/types/noun-index.d.ts",
|
|
54
|
+
"default": "./dist/noun-index.js"
|
|
55
|
+
},
|
|
56
|
+
"./package.json": "./package.json"
|
|
57
|
+
},
|
|
58
|
+
"files": ["dist/*.js", "dist/chunks/*.js", "dist/types/**/*.d.ts", "README.md", "LICENSE"],
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=22",
|
|
61
|
+
"bun": ">=1.4.2"
|
|
62
|
+
},
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "bun scripts/build.ts",
|
|
68
|
+
"guard": "bun scripts/guard-tarball.ts",
|
|
69
|
+
"prepublishOnly": "bun scripts/build.ts && bun scripts/guard-tarball.ts"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@finbheara/names": "0.12.0"
|
|
73
|
+
}
|
|
74
|
+
}
|