@prose-reader/metadata-fetcher 1.346.0 → 1.348.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.
@@ -8,6 +8,12 @@ export declare const normalizeForComparison: (value: string) => string;
8
8
  * `Spider Man` stay exact.
9
9
  */
10
10
  export declare const textSimilarity: (a: string, b: string) => number;
11
+ /**
12
+ * Every volume, part or book number a title states explicitly, whichever
13
+ * division word introduced it — a catalog states the same fact as a series
14
+ * `position`, where the division word is implicit.
15
+ */
16
+ export declare const titleDivisionNumbers: (value: string) => ReadonlySet<number>;
11
17
  /**
12
18
  * {@link textSimilarity}, with `Dune` matched against `Dune: a novel`.
13
19
  *
@@ -18,5 +24,18 @@ export declare const textSimilarity: (a: string, b: string) => number;
18
24
  * sides state different ones, the title score is `0` however similar the rest.
19
25
  */
20
26
  export declare const titleSimilarity: (a: string, b: string) => number;
27
+ /**
28
+ * The best {@link titleSimilarity} over the forms one candidate title takes —
29
+ * bare, or composed with its subtitle.
30
+ *
31
+ * A contradiction in **any** form still scores `0`: `Irina` agreeing with
32
+ * `Irina: … Vol. 2` is not evidence that the candidate's own `Vol. 1` does.
33
+ * Taking the plain maximum would let the shorter form launder a stated
34
+ * disagreement about which volume this is.
35
+ */
36
+ export declare const bestTitleSimilarity: (query: string, forms: ReadonlyArray<string>) => {
37
+ readonly score: number;
38
+ readonly candidate: string;
39
+ } | undefined;
21
40
  /** {@link textSimilarity} on sorted tokens: `Herbert, Frank` ≡ `Frank Herbert`. */
22
41
  export declare const personNameSimilarity: (a: string, b: string) => number;
@@ -10,8 +10,18 @@ export type GoogleBooksImageLinks = {
10
10
  readonly large?: string;
11
11
  readonly extraLarge?: string;
12
12
  };
13
+ export type GoogleBooksVolumeSeries = {
14
+ readonly seriesId?: string;
15
+ readonly orderNumber?: number;
16
+ };
17
+ /**
18
+ * Only the volume's place in its series is retained. `bookDisplayNumber` and
19
+ * `shortSeriesBookTitle` are display strings by Google's own definition — the
20
+ * sequence is `orderNumber` — and the payload never states the series name,
21
+ * only an id, so a name would have to be invented.
22
+ */
13
23
  export type GoogleBooksSeriesInfo = {
14
- readonly bookDisplayNumber?: string;
24
+ readonly volumeSeries?: ReadonlyArray<GoogleBooksVolumeSeries>;
15
25
  };
16
26
  /**
17
27
  * The subset of a Google Books `volumeInfo` record that has a normalized home.
@@ -1,28 +1,6 @@
1
1
  import { MetadataIdentifier, ResolvedMetadata } from '@prose-reader/archive-reader';
2
2
  import { GoogleBooksImageLinks, GoogleBooksVolume } from './parse.ts';
3
3
  export declare const GOOGLE_BOOKS_MAX_SUBJECTS = 25;
4
- /** Compile-enforced homes for the top-level Volume resource fields. */
5
- export declare const googleBooksVolumeMetadataHomes: {
6
- id: "identifiers";
7
- volumeInfo: "metadata";
8
- };
9
- /** Compile-enforced map from every parsed Google Books field to its home. */
10
- export declare const googleBooksVolumeInfoMetadataHomes: {
11
- title: "titles";
12
- subtitle: "titles";
13
- authors: "contributors";
14
- publisher: "publication.edition.publisher";
15
- publishedDate: "publication.edition.date";
16
- description: "description";
17
- industryIdentifiers: "identifiers";
18
- pageCount: "numberOfPages";
19
- categories: "subjects";
20
- language: "languages";
21
- imageLinks: "cover";
22
- infoLink: "candidate.url";
23
- canonicalVolumeLink: "candidate.url";
24
- seriesInfo: "titles";
25
- };
26
4
  /**
27
5
  * Prefer the largest cover Google announced and force HTTPS. Preserve the
28
6
  * query exactly: changing Google's `zoom`, `edge` or signed `imgtk` parameters
@@ -6,32 +6,15 @@ import { OpenLibraryDoc } from './parse.ts';
6
6
  * consumer persists. The API puts the meaningful ones first.
7
7
  */
8
8
  export declare const OPEN_LIBRARY_MAX_SUBJECTS = 25;
9
- /**
10
- * Where every {@link OpenLibraryDoc} field lands in {@link ResolvedMetadata},
11
- * compile-enforced: adding a field to the parser without declaring its home is
12
- * a type error. The archive parsers' losslessness contract, and the mapping
13
- * documentation.
14
- */
15
- export declare const openLibraryMetadataHomes: {
16
- readonly key: "identifiers";
17
- readonly title: "titles";
18
- readonly subtitle: "titles";
19
- readonly author_name: "contributors";
20
- readonly first_publish_year: "publication.original.date";
21
- readonly language: "languages";
22
- readonly subject: "subjects";
23
- readonly number_of_pages_median: "numberOfPages";
24
- readonly cover_i: "cover";
25
- readonly id_project_gutenberg: "identifiers";
26
- };
27
9
  export declare const OPEN_LIBRARY_IDENTIFIER_SCHEME = "OpenLibrary";
28
10
  /**
29
11
  * Normalizes one search hit into the cross-format vocabulary. Two choices
30
12
  * worth stating:
31
13
  *
32
- * - **`title` folds in `subtitle`** (`Dune: Messiah`): the vocabulary has one
33
- * title field, and an OPF `dc:title` normally carries the subtitle too, so
34
- * comparing a bare title against a full one would cost match score.
14
+ * - **`title` and `subtitle` stay separate**, as the catalog states them:
15
+ * `title` is the work's title and the subtitle is a `titles` entry. The
16
+ * matcher composes them when it compares, so nothing is lost by not
17
+ * pre-joining them here.
35
18
  * - **An ISBN identifier is added only for an ISBN lookup**, using the queried
36
19
  * value — the API answered "this work has that ISBN", a fact about the
37
20
  * record. A title-search hit describes a *work*, whose editions each have
@@ -1,22 +1,6 @@
1
1
  import { MetadataIdentifier, ResolvedMetadata } from '@prose-reader/archive-reader';
2
2
  import { ProjectGutenbergRecord } from './parse.ts';
3
3
  export declare const PROJECT_GUTENBERG_MAX_SUBJECTS = 25;
4
- /** Compile-enforced map from every parsed RDF field to its resolved home. */
5
- export declare const projectGutenbergMetadataHomes: {
6
- readonly id: "identifiers";
7
- readonly title: "titles";
8
- readonly publisher: "publication.edition.publisher";
9
- readonly issued: "publication.edition.date";
10
- readonly originalPublication: "publication.original";
11
- readonly rights: "rights";
12
- readonly description: "description";
13
- readonly summary: "description";
14
- readonly languages: "languages";
15
- readonly subjects: "subjects";
16
- readonly bookshelves: "subjects";
17
- readonly contributors: "contributors";
18
- readonly cover: "cover";
19
- };
20
4
  export declare const resolveProjectGutenbergRecord: (record: ProjectGutenbergRecord, options: {
21
5
  readonly baseUrl: string;
22
6
  readonly matchedIdentifier: MetadataIdentifier;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prose-reader/metadata-fetcher",
3
- "version": "1.346.0",
3
+ "version": "1.348.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -29,9 +29,9 @@
29
29
  "test:watch": "vitest watch"
30
30
  },
31
31
  "dependencies": {
32
- "@prose-reader/archive-reader": "^1.346.0",
33
- "@prose-reader/shared": "^1.346.0",
32
+ "@prose-reader/archive-reader": "^1.348.0",
33
+ "@prose-reader/shared": "^1.348.0",
34
34
  "xmldoc": "^2.0.0"
35
35
  },
36
- "gitHead": "4c52e5b82de55cf26d658f039909829b4476fd2b"
36
+ "gitHead": "13868ec22f78718ba0673f4de39a940287145c40"
37
37
  }