eyecite-ts 0.5.0 → 0.6.1

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.
Files changed (40) hide show
  1. package/README.md +38 -8
  2. package/dist/annotate/index.cjs.map +1 -1
  3. package/dist/annotate/index.d.cts +1 -1
  4. package/dist/annotate/index.d.mts +1 -1
  5. package/dist/annotate/index.mjs.map +1 -1
  6. package/dist/{citation-25ZydLsu.d.mts → citation-BB_vC_7x.d.cts} +215 -12
  7. package/dist/citation-BB_vC_7x.d.cts.map +1 -0
  8. package/dist/{citation-Cymq3pJ-.d.cts → citation-Bg1QDUYb.d.mts} +215 -12
  9. package/dist/citation-Bg1QDUYb.d.mts.map +1 -0
  10. package/dist/data/index.cjs.map +1 -1
  11. package/dist/data/index.d.cts +90 -90
  12. package/dist/data/index.d.cts.map +1 -1
  13. package/dist/data/index.d.mts +90 -90
  14. package/dist/data/index.d.mts.map +1 -1
  15. package/dist/data/index.mjs.map +1 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +111 -128
  19. package/dist/index.d.cts.map +1 -1
  20. package/dist/index.d.mts +111 -128
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.mjs +1 -1
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/knownCodes-CI-vnoBO.cjs.map +1 -1
  25. package/dist/knownCodes-MkDSiR1j.mjs.map +1 -1
  26. package/dist/types-D0xwBESF.d.cts +115 -0
  27. package/dist/types-D0xwBESF.d.cts.map +1 -0
  28. package/dist/types-vAgBB1j3.d.mts +115 -0
  29. package/dist/types-vAgBB1j3.d.mts.map +1 -0
  30. package/dist/utils/index.cjs +7 -0
  31. package/dist/utils/index.cjs.map +1 -0
  32. package/dist/utils/index.d.cts +122 -0
  33. package/dist/utils/index.d.cts.map +1 -0
  34. package/dist/utils/index.d.mts +122 -0
  35. package/dist/utils/index.d.mts.map +1 -0
  36. package/dist/utils/index.mjs +7 -0
  37. package/dist/utils/index.mjs.map +1 -0
  38. package/package.json +10 -1
  39. package/dist/citation-25ZydLsu.d.mts.map +0 -1
  40. package/dist/citation-Cymq3pJ-.d.cts.map +0 -1
@@ -1,3 +1,70 @@
1
+ //#region src/extract/pincite.d.ts
2
+ /**
3
+ * Structured pincite information parsed from citation text.
4
+ */
5
+ interface PinciteInfo {
6
+ /** Primary page number */
7
+ page: number;
8
+ /** End page for ranges: "570-75" → 575 */
9
+ endPage?: number;
10
+ /** Footnote number: "570 n.3" → 3 */
11
+ footnote?: number;
12
+ /** True if this is a page range */
13
+ isRange: boolean;
14
+ /** Original text before parsing */
15
+ raw: string;
16
+ }
17
+ /**
18
+ * Parse a pincite string into structured components.
19
+ *
20
+ * Handles simple pages, ranges (with abbreviated end pages),
21
+ * footnote references, and "at" prefixes.
22
+ *
23
+ * @example
24
+ * parsePincite("570") // { page: 570, isRange: false, raw: "570" }
25
+ * parsePincite("570-75") // { page: 570, endPage: 575, isRange: true, raw: "570-75" }
26
+ * parsePincite("570 n.3") // { page: 570, footnote: 3, isRange: false, raw: "570 n.3" }
27
+ *
28
+ * @returns Parsed pincite info, or null if unparseable
29
+ */
30
+ declare function parsePincite(raw: string): PinciteInfo | null;
31
+ //#endregion
32
+ //#region src/clean/segmentMap.d.ts
33
+ /**
34
+ * Segment-based position mapping.
35
+ *
36
+ * Compresses a per-character position map into contiguous segments where the
37
+ * offset between clean and original coordinates is constant. Lookups use
38
+ * binary search (O(log k) where k = number of segments, typically 50-200).
39
+ */
40
+ interface Segment {
41
+ /** Start position in clean text */
42
+ cleanPos: number;
43
+ /** Corresponding start position in original text */
44
+ origPos: number;
45
+ /** Number of positions covered by this segment */
46
+ len: number;
47
+ }
48
+ declare class SegmentMap {
49
+ readonly segments: readonly Segment[];
50
+ constructor(segments: Segment[]);
51
+ /**
52
+ * Create an identity map (clean position === original position).
53
+ */
54
+ static identity(length: number): SegmentMap;
55
+ /**
56
+ * Compress a per-position Map into a SegmentMap.
57
+ * Adjacent entries with the same offset (origPos - cleanPos) are merged
58
+ * into a single segment.
59
+ */
60
+ static fromMap(map: Map<number, number>): SegmentMap;
61
+ /**
62
+ * Look up the original position for a clean-text position.
63
+ * Uses binary search on sorted segments.
64
+ */
65
+ lookup(cleanPos: number): number;
66
+ }
67
+ //#endregion
1
68
  //#region src/types/span.d.ts
2
69
  /**
3
70
  * Represents a text span with positions tracked through transformations.
@@ -37,13 +104,15 @@ interface TransformationMap {
37
104
  cleanToOriginal: Map<number, number>;
38
105
  /** Maps original text position to cleaned text position */
39
106
  originalToClean: Map<number, number>;
107
+ /** Compressed segment-based clean→original mapping for O(log k) lookup */
108
+ cleanToOriginalSegments?: SegmentMap;
40
109
  }
41
110
  //#endregion
42
111
  //#region src/types/citation.d.ts
43
112
  /**
44
113
  * Citation type discriminator for type-safe pattern matching.
45
114
  */
46
- type CitationType = "case" | "statute" | "journal" | "neutral" | "publicLaw" | "federalRegister" | "statutesAtLarge" | "id" | "supra" | "shortFormCase";
115
+ type CitationType = "case" | "statute" | "journal" | "neutral" | "publicLaw" | "federalRegister" | "statutesAtLarge" | "constitutional" | "id" | "supra" | "shortFormCase";
47
116
  /**
48
117
  * Warning generated during citation parsing.
49
118
  */
@@ -61,6 +130,11 @@ interface Warning {
61
130
  context?: string;
62
131
  }
63
132
  /**
133
+ * Introductory signal word classification for citation support level.
134
+ * Based on Bluebook signal categories (Rule 1.2).
135
+ */
136
+ type CitationSignal = "see" | "see also" | "see generally" | "cf" | "but see" | "but cf" | "compare" | "accord" | "contra";
137
+ /**
64
138
  * Base fields shared by all citation types.
65
139
  */
66
140
  interface CitationBase {
@@ -84,6 +158,75 @@ interface CitationBase {
84
158
  patternsChecked: number;
85
159
  /** Warnings for malformed or ambiguous regions */
86
160
  warnings?: Warning[];
161
+ /** Introductory signal word (e.g., "see", "see also", "but see") */
162
+ signal?: CitationSignal;
163
+ /** Group ID for string citations sharing the same proposition */
164
+ stringCitationGroupId?: string;
165
+ /** Position within the string citation group (0-indexed) */
166
+ stringCitationIndex?: number;
167
+ /** Total number of citations in this string citation group */
168
+ stringCitationGroupSize?: number;
169
+ /** Whether this citation appears in a footnote (only populated when detectFootnotes enabled) */
170
+ inFootnote?: boolean;
171
+ /** Footnote number, if applicable (only populated when detectFootnotes enabled) */
172
+ footnoteNumber?: number;
173
+ }
174
+ /**
175
+ * Court level and jurisdiction inferred from reporter series.
176
+ * Populated independently of the parenthetical-extracted `court` field.
177
+ */
178
+ interface CourtInference {
179
+ /** Court level classification */
180
+ level: "supreme" | "appellate" | "trial" | "unknown";
181
+ /** Jurisdiction classification */
182
+ jurisdiction: "federal" | "state" | "unknown";
183
+ /** 2-letter state code, only for state-specific reporters */
184
+ state?: string;
185
+ /** Confidence score 0.0-1.0 (1.0 for unambiguous, 0.7 for regional multi-state) */
186
+ confidence: number;
187
+ }
188
+ /**
189
+ * Signal-word classification for explanatory parentheticals.
190
+ * Based on the leading gerund/verb form in the parenthetical text.
191
+ */
192
+ type ParentheticalType = "holding" | "finding" | "stating" | "noting" | "explaining" | "quoting" | "citing" | "discussing" | "describing" | "recognizing" | "applying" | "rejecting" | "adopting" | "requiring" | "other";
193
+ /**
194
+ * An extracted explanatory parenthetical from a case citation.
195
+ *
196
+ * @example
197
+ * ```typescript
198
+ * { text: "holding that X requires Y", type: "holding" }
199
+ * { text: "citing Doe v. City for the same proposition", type: "citing" }
200
+ * ```
201
+ */
202
+ interface Parenthetical {
203
+ /** Full text content between the parentheses (excluding parens themselves) */
204
+ text: string;
205
+ /** Signal-word classification based on leading gerund */
206
+ type: ParentheticalType;
207
+ }
208
+ /**
209
+ * Normalized subsequent history signal classification.
210
+ * Maps variant spellings (aff'd, affirmed) to canonical forms.
211
+ */
212
+ type HistorySignal = "affirmed" | "reversed" | "cert_denied" | "cert_granted" | "overruled" | "vacated" | "remanded" | "modified" | "abrogated" | "superseded" | "disapproved" | "questioned" | "distinguished" | "withdrawn" | "reinstated";
213
+ /**
214
+ * A single subsequent history entry from a case citation.
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * { signal: "affirmed", rawSignal: "aff'd", signalSpan: { ... }, order: 0 }
219
+ * ```
220
+ */
221
+ interface SubsequentHistoryEntry {
222
+ /** Normalized signal classification */
223
+ signal: HistorySignal;
224
+ /** Raw signal text as it appeared in the document */
225
+ rawSignal: string;
226
+ /** Position of the signal text in the document */
227
+ signalSpan: Span;
228
+ /** Order in the history chain (0-based) */
229
+ order: number;
87
230
  }
88
231
  /**
89
232
  * Full case citation (volume-reporter-page format).
@@ -98,7 +241,11 @@ interface FullCaseCitation extends CitationBase {
98
241
  /** Page number — optional for blank page placeholder citations (e.g., "___" or "---") */
99
242
  page?: number;
100
243
  pincite?: number;
244
+ /** Structured pincite information (page, range, footnote) */
245
+ pinciteInfo?: PinciteInfo;
101
246
  court?: string;
247
+ /** Normalized court string: spaces collapsed, trailing period ensured */
248
+ normalizedCourt?: string;
102
249
  year?: number;
103
250
  /** Normalized reporter abbreviation from reporters-db (e.g., "F.2d" vs "F. 2d") */
104
251
  normalizedReporter?: string;
@@ -116,12 +263,29 @@ interface FullCaseCitation extends CitationBase {
116
263
  reporter: string;
117
264
  page: number;
118
265
  }>;
119
- /** Citation signal (introductory phrase) */
120
- signal?: "see" | "see also" | "cf" | "but see" | "compare";
121
- /** Parenthetical explanation following the citation */
122
- parenthetical?: string;
123
- /** Subsequent procedural history (e.g., "aff'd", "rev'd", "cert. denied") */
124
- subsequentHistory?: string;
266
+ /**
267
+ * Explanatory parentheticals following the citation.
268
+ * Only populated when explanatory content is found (not court/year/disposition).
269
+ * @example [{ text: "holding that X requires Y", type: "holding" }]
270
+ */
271
+ parentheticals?: Parenthetical[];
272
+ /**
273
+ * Subsequent history entries for this citation.
274
+ * Each entry describes a procedural event (affirmed, reversed, etc.).
275
+ * Only populated on the parent (original) citation.
276
+ * @example [{ signal: "affirmed", rawSignal: "aff'd", signalSpan: {...}, order: 0 }]
277
+ */
278
+ subsequentHistoryEntries?: SubsequentHistoryEntry[];
279
+ /**
280
+ * Back-pointer indicating this citation is a subsequent history citation.
281
+ * `index` is the parent's position in the results array returned by
282
+ * `extractCitations()` — it becomes invalid if the array is filtered or reordered.
283
+ * @example { index: 0, signal: "affirmed" }
284
+ */
285
+ subsequentHistoryOf?: {
286
+ index: number;
287
+ signal: HistorySignal;
288
+ };
125
289
  /**
126
290
  * Date information in multiple formats.
127
291
  * - iso: ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ)
@@ -189,6 +353,18 @@ interface FullCaseCitation extends CitationBase {
189
353
  */
190
354
  proceduralPrefix?: string;
191
355
  /**
356
+ * Nominative (historical) reporter volume for early SCOTUS citations.
357
+ * Present only when citation includes a nominative parenthetical, e.g.,
358
+ * `67 U.S. (2 Black) 635` → nominativeVolume: 2
359
+ */
360
+ nominativeVolume?: number;
361
+ /**
362
+ * Nominative (historical) reporter abbreviation for early SCOTUS citations.
363
+ * Present only when citation includes a nominative parenthetical, e.g.,
364
+ * `67 U.S. (2 Black) 635` → nominativeReporter: "Black"
365
+ */
366
+ nominativeReporter?: string;
367
+ /**
192
368
  * True when page position contains a blank placeholder ("___" or "---").
193
369
  * Populated by Phase 5 (Blank Page support).
194
370
  * When true, page field will be undefined and confidence reduced to 0.8.
@@ -200,6 +376,13 @@ interface FullCaseCitation extends CitationBase {
200
376
  * @example "en banc", "per curiam"
201
377
  */
202
378
  disposition?: string;
379
+ /**
380
+ * Court level/jurisdiction inferred from reporter series.
381
+ * Always populated independently of the parenthetical `court` field.
382
+ * Uses a curated static lookup table — does not depend on the reporter DB
383
+ * to preserve tree-shaking of the `eyecite-ts/data` entry point.
384
+ */
385
+ inferredCourt?: CourtInference;
203
386
  }
204
387
  /**
205
388
  * Statute citation (U.S. Code, state codes, etc.).
@@ -314,6 +497,26 @@ interface StatutesAtLargeCitation extends CitationBase {
314
497
  year?: number;
315
498
  }
316
499
  /**
500
+ * Constitutional citation (U.S. or state constitution).
501
+ *
502
+ * @example "U.S. Const. art. III, § 2"
503
+ * @example "U.S. Const. amend. XIV, § 1"
504
+ * @example "Cal. Const. art. I, § 7"
505
+ */
506
+ interface ConstitutionalCitation extends CitationBase {
507
+ type: "constitutional";
508
+ /** Jurisdiction code: "US", 2-letter state code, or undefined for bare "Const." */
509
+ jurisdiction?: string;
510
+ /** Article number (parsed from Roman numerals) — mutually exclusive with amendment */
511
+ article?: number;
512
+ /** Amendment number (parsed from Roman numerals) — mutually exclusive with article */
513
+ amendment?: number;
514
+ /** Section identifier (string to handle non-numeric like "3-a") */
515
+ section?: string;
516
+ /** Clause number (always numeric) */
517
+ clause?: number;
518
+ }
519
+ /**
317
520
  * Id. citation (refers to immediately preceding citation).
318
521
  *
319
522
  * @example "Id."
@@ -366,16 +569,16 @@ interface ShortFormCaseCitation extends CitationBase {
366
569
  * // ...
367
570
  * }
368
571
  */
369
- type Citation = FullCaseCitation | StatuteCitation | JournalCitation | NeutralCitation | PublicLawCitation | FederalRegisterCitation | StatutesAtLargeCitation | IdCitation | SupraCitation | ShortFormCaseCitation;
572
+ type Citation = FullCaseCitation | StatuteCitation | JournalCitation | NeutralCitation | PublicLawCitation | FederalRegisterCitation | StatutesAtLargeCitation | ConstitutionalCitation | IdCitation | SupraCitation | ShortFormCaseCitation;
370
573
  /**
371
574
  * Citation type discriminators grouped by category.
372
575
  */
373
- type FullCitationType = "case" | "statute" | "journal" | "neutral" | "publicLaw" | "federalRegister" | "statutesAtLarge";
576
+ type FullCitationType = "case" | "statute" | "journal" | "neutral" | "publicLaw" | "federalRegister" | "statutesAtLarge" | "constitutional";
374
577
  type ShortFormCitationType = "id" | "supra" | "shortFormCase";
375
578
  /**
376
579
  * Union of all full citation types (not short-form references).
377
580
  */
378
- type FullCitation = FullCaseCitation | StatuteCitation | JournalCitation | NeutralCitation | PublicLawCitation | FederalRegisterCitation | StatutesAtLargeCitation;
581
+ type FullCitation = FullCaseCitation | StatuteCitation | JournalCitation | NeutralCitation | PublicLawCitation | FederalRegisterCitation | StatutesAtLargeCitation | ConstitutionalCitation;
379
582
  /**
380
583
  * Union of all short-form citation types (Id., supra, short-form case).
381
584
  */
@@ -398,5 +601,5 @@ type CitationOfType<T extends CitationType> = Extract<Citation, {
398
601
  */
399
602
  type ExtractorMap = { [K in FullCitationType]: CitationOfType<K> };
400
603
  //#endregion
401
- export { TransformationMap as S, StatuteCitation as _, ExtractorMap as a, Warning as b, FullCitation as c, JournalCitation as d, NeutralCitation as f, ShortFormCitationType as g, ShortFormCitation as h, CitationType as i, FullCitationType as l, ShortFormCaseCitation as m, CitationBase as n, FederalRegisterCitation as o, PublicLawCitation as p, CitationOfType as r, FullCaseCitation as s, Citation as t, IdCitation as u, StatutesAtLargeCitation as v, Span as x, SupraCitation as y };
402
- //# sourceMappingURL=citation-Cymq3pJ-.d.cts.map
604
+ export { PinciteInfo as A, StatuteCitation as C, Warning as D, SupraCitation as E, Span as O, ShortFormCitationType as S, SubsequentHistoryEntry as T, Parenthetical as _, CitationType as a, ShortFormCaseCitation as b, ExtractorMap as c, FullCitation as d, FullCitationType as f, NeutralCitation as g, JournalCitation as h, CitationSignal as i, parsePincite as j, TransformationMap as k, FederalRegisterCitation as l, IdCitation as m, CitationBase as n, ConstitutionalCitation as o, HistorySignal as p, CitationOfType as r, CourtInference as s, Citation as t, FullCaseCitation as u, ParentheticalType as v, StatutesAtLargeCitation as w, ShortFormCitation as x, PublicLawCitation as y };
605
+ //# sourceMappingURL=citation-Bg1QDUYb.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"citation-Bg1QDUYb.d.mts","names":[],"sources":["../src/extract/pincite.ts","../src/clean/segmentMap.ts","../src/types/span.ts","../src/types/citation.ts"],"mappings":";;AAGA;;UAAiB,WAAA;EAAA;EAEf,IAAA;;EAEA,OAAA;;EAEA,QAAA;;EAEA,OAAA;EAsBF;EApBE,GAAA;AAAA;;;;;;ACLF;;;;;;;;iBDyBgB,YAAA,CAAa,GAAA,WAAc,WAAA;;;;AA9B3C;;;;;;UCKiB,OAAA;;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AyB,YAAA,IAAgB,OAAA,CAAQ,QAAA;EAAY,IAAA,EAAM,CAAA;AAAA;;;;;KAMnE,YAAA,WACJ,gBAAA,GAAmB,cAAA,CAAe,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../src/data/reporters.ts"],"sourcesContent":["/**\n * Reporter database integration for citation validation\n *\n * This module provides lazy-loadable access to the reporters-db database,\n * containing 1200+ court reporters with variant forms. The library works\n * in degraded mode (pattern-based extraction only) if reporters are not loaded.\n *\n * @example\n * // Degraded mode: extraction works without reporter data\n * const citations = await extract(text)\n *\n * @example\n * // Full mode: load reporters for validation\n * await loadReporters()\n * const citations = await extract(text) // Now with reporter validation\n */\n\n/**\n * Edition entry from reporters-db\n *\n * Represents a specific edition of a reporter with start/end dates.\n */\nexport interface ReporterEdition {\n /** Start date in ISO 8601 format */\n start: string | null\n /** End date in ISO 8601 format (null if ongoing) */\n end: string | null\n}\n\n/**\n * Reporter entry from reporters-db\n *\n * Represents a single court reporter with all metadata needed for\n * citation validation and enrichment.\n *\n * Note: The reporters-db structure has the actual data; this interface\n * represents it flexibly to handle all variations in the JSON.\n */\nexport interface ReporterEntry {\n /** Full reporter name (e.g., \"Federal Reporter\") */\n name: string\n /** Citation type: state, federal, specialty, neutral, state_regional, etc. */\n cite_type: string\n /** Editions keyed by abbreviation (e.g., {\"F.2d\": {...}, \"F.3d\": {...}}) */\n editions: Record<string, ReporterEdition>\n /** Variant forms mapped to canonical form (e.g., {\"F. 2d\": \"F.2d\"}) */\n variations?: Record<string, string | undefined>\n /** MLZ jurisdiction identifiers (optional) */\n mlz_jurisdiction?: string[]\n /** Publisher (optional) */\n publisher?: string\n /** Notes (optional) */\n notes?: string\n}\n\n/**\n * In-memory reporter database with fast O(1) lookup\n *\n * Uses Map-based indexing for case-insensitive abbreviation lookup.\n * All variant forms are indexed to support fuzzy matching.\n */\nexport interface ReportersDatabase {\n /** Fast O(1) lookup by abbreviation (lowercase normalized keys) */\n byAbbreviation: Map<string, ReporterEntry[]>\n /** All reporters (for iteration/filtering) */\n all: ReporterEntry[]\n}\n\n/**\n * Cached database instance (null until loadReporters() called)\n */\nlet cached: ReportersDatabase | null = null\n\n/**\n * Load reporter database asynchronously with lazy loading\n *\n * Dynamic import prevents loading 1200+ reporters until explicitly requested.\n * Result is cached after first load for subsequent calls.\n *\n * @returns Promise resolving to indexed reporter database\n *\n * @example\n * const db = await loadReporters()\n * const reporters = db.byAbbreviation.get('f.2d') // Fast O(1) lookup\n */\nexport async function loadReporters(): Promise<ReportersDatabase> {\n if (cached) return cached\n\n // Dynamic import prevents loading until requested (keeps core bundle small)\n const data = await import(\"../../data/reporters.json\", {\n assert: { type: \"json\" },\n })\n\n const byAbbreviation = new Map<string, ReporterEntry[]>()\n const all: ReporterEntry[] = []\n\n // reporters.json structure: { \"A.\": [...], \"F.2d\": [...], ... }\n const reportersData = (data.default || data) as Record<\n string,\n ReporterEntry[]\n >\n\n // Build fast lookup index with lowercase normalization\n for (const [_canonicalAbbr, reporters] of Object.entries(reportersData)) {\n for (const reporter of reporters) {\n all.push(reporter)\n\n // Index by all edition abbreviations\n for (const editionAbbr of Object.keys(reporter.editions)) {\n const key = editionAbbr.toLowerCase()\n if (!byAbbreviation.has(key)) {\n byAbbreviation.set(key, [])\n }\n byAbbreviation.get(key)?.push(reporter)\n }\n\n // Index all variations for fuzzy matching\n for (const [variant, _canonical] of Object.entries(\n reporter.variations || {},\n )) {\n const variantKey = variant.toLowerCase()\n if (!byAbbreviation.has(variantKey)) {\n byAbbreviation.set(variantKey, [])\n }\n byAbbreviation.get(variantKey)?.push(reporter)\n }\n }\n }\n\n cached = {\n byAbbreviation,\n all,\n }\n return cached\n}\n\n/**\n * Get cached reporter database synchronously (degraded mode support)\n *\n * Returns null if reporters not loaded yet. This enables the library to\n * work in degraded mode without reporter validation.\n *\n * @returns Cached database or null if not loaded\n *\n * @example\n * const db = getReportersSync()\n * if (db) {\n * // Full mode: validate citations\n * } else {\n * // Degraded mode: extract without validation\n * }\n */\nexport function getReportersSync(): ReportersDatabase | null {\n return cached\n}\n\n/**\n * Find reporters by abbreviation (case-insensitive)\n *\n * Loads reporter database if not already loaded. Returns all reporters\n * matching the abbreviation (including variant forms).\n *\n * @param abbr - Reporter abbreviation to look up\n * @returns Promise resolving to matching reporters (empty array if none)\n *\n * @example\n * const reporters = await findReportersByAbbreviation('F.2d')\n * // [{ abbreviation: 'F.2d', name: 'Federal Reporter, Second Series', ... }]\n *\n * @example\n * const unknown = await findReportersByAbbreviation('NONEXISTENT')\n * // [] (empty array, not error)\n */\nexport async function findReportersByAbbreviation(\n abbr: string,\n): Promise<ReporterEntry[]> {\n const db = await loadReporters()\n return db.byAbbreviation.get(abbr.toLowerCase()) ?? []\n}\n"],"mappings":"iHAuEA,IAAI,EAAmC,KAcvC,eAAsB,GAA4C,CAChE,GAAI,EAAQ,OAAO,EAGnB,IAAM,EAAO,MAAM,OAAO,4BAA6B,CACrD,OAAQ,CAAE,KAAM,OAAQ,CACzB,EAEK,EAAiB,IAAI,IACrB,EAAuB,EAAE,CAGzB,EAAiB,EAAK,SAAW,EAMvC,IAAK,GAAM,CAAC,EAAgB,KAAc,OAAO,QAAQ,EAAc,CACrE,IAAK,IAAM,KAAY,EAAW,CAChC,EAAI,KAAK,EAAS,CAGlB,IAAK,IAAM,KAAe,OAAO,KAAK,EAAS,SAAS,CAAE,CACxD,IAAM,EAAM,EAAY,aAAa,CAChC,EAAe,IAAI,EAAI,EAC1B,EAAe,IAAI,EAAK,EAAE,CAAC,CAE7B,EAAe,IAAI,EAAI,EAAE,KAAK,EAAS,CAIzC,IAAK,GAAM,CAAC,EAAS,KAAe,OAAO,QACzC,EAAS,YAAc,EAAE,CAC1B,CAAE,CACD,IAAM,EAAa,EAAQ,aAAa,CACnC,EAAe,IAAI,EAAW,EACjC,EAAe,IAAI,EAAY,EAAE,CAAC,CAEpC,EAAe,IAAI,EAAW,EAAE,KAAK,EAAS,EASpD,MAJA,GAAS,CACP,iBACA,MACD,CACM,EAmBT,SAAgB,GAA6C,CAC3D,OAAO,EAoBT,eAAsB,EACpB,EAC0B,CAE1B,OADW,MAAM,GAAe,EACtB,eAAe,IAAI,EAAK,aAAa,CAAC,EAAI,EAAE"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/data/reporters.ts"],"sourcesContent":["/**\n * Reporter database integration for citation validation\n *\n * This module provides lazy-loadable access to the reporters-db database,\n * containing 1200+ court reporters with variant forms. The library works\n * in degraded mode (pattern-based extraction only) if reporters are not loaded.\n *\n * @example\n * // Degraded mode: extraction works without reporter data\n * const citations = await extract(text)\n *\n * @example\n * // Full mode: load reporters for validation\n * await loadReporters()\n * const citations = await extract(text) // Now with reporter validation\n */\n\n/**\n * Edition entry from reporters-db\n *\n * Represents a specific edition of a reporter with start/end dates.\n */\nexport interface ReporterEdition {\n /** Start date in ISO 8601 format */\n start: string | null\n /** End date in ISO 8601 format (null if ongoing) */\n end: string | null\n}\n\n/**\n * Reporter entry from reporters-db\n *\n * Represents a single court reporter with all metadata needed for\n * citation validation and enrichment.\n *\n * Note: The reporters-db structure has the actual data; this interface\n * represents it flexibly to handle all variations in the JSON.\n */\nexport interface ReporterEntry {\n /** Full reporter name (e.g., \"Federal Reporter\") */\n name: string\n /** Citation type: state, federal, specialty, neutral, state_regional, etc. */\n cite_type: string\n /** Editions keyed by abbreviation (e.g., {\"F.2d\": {...}, \"F.3d\": {...}}) */\n editions: Record<string, ReporterEdition>\n /** Variant forms mapped to canonical form (e.g., {\"F. 2d\": \"F.2d\"}) */\n variations?: Record<string, string | undefined>\n /** MLZ jurisdiction identifiers (optional) */\n mlz_jurisdiction?: string[]\n /** Publisher (optional) */\n publisher?: string\n /** Notes (optional) */\n notes?: string\n}\n\n/**\n * In-memory reporter database with fast O(1) lookup\n *\n * Uses Map-based indexing for case-insensitive abbreviation lookup.\n * All variant forms are indexed to support fuzzy matching.\n */\nexport interface ReportersDatabase {\n /** Fast O(1) lookup by abbreviation (lowercase normalized keys) */\n byAbbreviation: Map<string, ReporterEntry[]>\n /** All reporters (for iteration/filtering) */\n all: ReporterEntry[]\n}\n\n/**\n * Cached database instance (null until loadReporters() called)\n */\nlet cached: ReportersDatabase | null = null\n\n/**\n * Load reporter database asynchronously with lazy loading\n *\n * Dynamic import prevents loading 1200+ reporters until explicitly requested.\n * Result is cached after first load for subsequent calls.\n *\n * @returns Promise resolving to indexed reporter database\n *\n * @example\n * const db = await loadReporters()\n * const reporters = db.byAbbreviation.get('f.2d') // Fast O(1) lookup\n */\nexport async function loadReporters(): Promise<ReportersDatabase> {\n if (cached) return cached\n\n // Dynamic import prevents loading until requested (keeps core bundle small)\n const data = await import(\"../../data/reporters.json\", {\n assert: { type: \"json\" },\n })\n\n const byAbbreviation = new Map<string, ReporterEntry[]>()\n const all: ReporterEntry[] = []\n\n // reporters.json structure: { \"A.\": [...], \"F.2d\": [...], ... }\n const reportersData = (data.default || data) as Record<string, ReporterEntry[]>\n\n // Build fast lookup index with lowercase normalization\n for (const [_canonicalAbbr, reporters] of Object.entries(reportersData)) {\n for (const reporter of reporters) {\n all.push(reporter)\n\n // Index by all edition abbreviations\n for (const editionAbbr of Object.keys(reporter.editions)) {\n const key = editionAbbr.toLowerCase()\n if (!byAbbreviation.has(key)) {\n byAbbreviation.set(key, [])\n }\n byAbbreviation.get(key)?.push(reporter)\n }\n\n // Index all variations for fuzzy matching\n for (const [variant, _canonical] of Object.entries(reporter.variations || {})) {\n const variantKey = variant.toLowerCase()\n if (!byAbbreviation.has(variantKey)) {\n byAbbreviation.set(variantKey, [])\n }\n byAbbreviation.get(variantKey)?.push(reporter)\n }\n }\n }\n\n cached = {\n byAbbreviation,\n all,\n }\n return cached\n}\n\n/**\n * Get cached reporter database synchronously (degraded mode support)\n *\n * Returns null if reporters not loaded yet. This enables the library to\n * work in degraded mode without reporter validation.\n *\n * @returns Cached database or null if not loaded\n *\n * @example\n * const db = getReportersSync()\n * if (db) {\n * // Full mode: validate citations\n * } else {\n * // Degraded mode: extract without validation\n * }\n */\nexport function getReportersSync(): ReportersDatabase | null {\n return cached\n}\n\n/**\n * Find reporters by abbreviation (case-insensitive)\n *\n * Loads reporter database if not already loaded. Returns all reporters\n * matching the abbreviation (including variant forms).\n *\n * @param abbr - Reporter abbreviation to look up\n * @returns Promise resolving to matching reporters (empty array if none)\n *\n * @example\n * const reporters = await findReportersByAbbreviation('F.2d')\n * // [{ abbreviation: 'F.2d', name: 'Federal Reporter, Second Series', ... }]\n *\n * @example\n * const unknown = await findReportersByAbbreviation('NONEXISTENT')\n * // [] (empty array, not error)\n */\nexport async function findReportersByAbbreviation(abbr: string): Promise<ReporterEntry[]> {\n const db = await loadReporters()\n return db.byAbbreviation.get(abbr.toLowerCase()) ?? []\n}\n"],"mappings":"iHAuEA,IAAI,EAAmC,KAcvC,eAAsB,GAA4C,CAChE,GAAI,EAAQ,OAAO,EAGnB,IAAM,EAAO,MAAM,OAAO,4BAA6B,CACrD,OAAQ,CAAE,KAAM,OAAQ,CACzB,EAEK,EAAiB,IAAI,IACrB,EAAuB,EAAE,CAGzB,EAAiB,EAAK,SAAW,EAGvC,IAAK,GAAM,CAAC,EAAgB,KAAc,OAAO,QAAQ,EAAc,CACrE,IAAK,IAAM,KAAY,EAAW,CAChC,EAAI,KAAK,EAAS,CAGlB,IAAK,IAAM,KAAe,OAAO,KAAK,EAAS,SAAS,CAAE,CACxD,IAAM,EAAM,EAAY,aAAa,CAChC,EAAe,IAAI,EAAI,EAC1B,EAAe,IAAI,EAAK,EAAE,CAAC,CAE7B,EAAe,IAAI,EAAI,EAAE,KAAK,EAAS,CAIzC,IAAK,GAAM,CAAC,EAAS,KAAe,OAAO,QAAQ,EAAS,YAAc,EAAE,CAAC,CAAE,CAC7E,IAAM,EAAa,EAAQ,aAAa,CACnC,EAAe,IAAI,EAAW,EACjC,EAAe,IAAI,EAAY,EAAE,CAAC,CAEpC,EAAe,IAAI,EAAW,EAAE,KAAK,EAAS,EASpD,MAJA,GAAS,CACP,iBACA,MACD,CACM,EAmBT,SAAgB,GAA6C,CAC3D,OAAO,EAoBT,eAAsB,EAA4B,EAAwC,CAExF,OADW,MAAM,GAAe,EACtB,eAAe,IAAI,EAAK,aAAa,CAAC,EAAI,EAAE"}
@@ -1,3 +1,93 @@
1
+ //#region src/data/knownCodes.d.ts
2
+ /**
3
+ * Known statutory code registry for abbreviated-code jurisdictions
4
+ *
5
+ * Provides a registry of state statutory codes that use abbreviated
6
+ * citation forms (e.g., "R.C. § 1.01", "MCL 750.83"). Used by the
7
+ * citation extractor to identify and normalize state statute citations.
8
+ */
9
+ /**
10
+ * A single entry in the known codes registry.
11
+ *
12
+ * PA has two entries (Pa.C.S. and P.S.) because it has two distinct
13
+ * code families with separate abbreviation sets.
14
+ */
15
+ interface CodeEntry {
16
+ /** Two-letter state abbreviation (e.g., "OH", "MI") */
17
+ jurisdiction: string;
18
+ /** Short canonical abbreviation used internally (e.g., "RC", "MCL") */
19
+ abbreviation: string;
20
+ /** All recognized text patterns that identify this code */
21
+ patterns: string[];
22
+ /** Citation family — determines which citation pattern family this belongs to */
23
+ family: "federal" | "named" | "abbreviated" | "chapterAct" | "prose";
24
+ }
25
+ /**
26
+ * Registry of state statutory codes that use abbreviated citation forms.
27
+ *
28
+ * Covers 12 jurisdictions. Pennsylvania has two entries because it
29
+ * maintains two distinct code families (Pa.C.S. and P.S.).
30
+ *
31
+ * Note: Short 2-letter patterns (GS, IC, PS, RC, FS) may produce false positives
32
+ * in non-legal text (e.g., "GS 5" for government service grade). The extraction
33
+ * layer mitigates this via confidence scoring — citations without a § symbol receive
34
+ * lower confidence (0.85 vs 0.95). Consumers should filter by confidence threshold.
35
+ */
36
+ declare const abbreviatedCodes: CodeEntry[];
37
+ /**
38
+ * Registry of state statutory codes that use named-code citation forms.
39
+ *
40
+ * Named-code jurisdictions identify their code by name in citations (e.g.,
41
+ * "N.Y. Penal Law § 120.05", "Cal. Civ. Proc. Code § 437c"), rather than by
42
+ * a standalone abbreviation. The jurisdiction prefix is handled by the
43
+ * extraction layer; these patterns cover only the code name portion.
44
+ *
45
+ * Ordering note: within each jurisdiction, more specific patterns must come
46
+ * before more general ones (e.g., "Civ. Proc." before "Civ.") so that
47
+ * findNamedCode's longest-match wins correctly.
48
+ *
49
+ * Covers 7 jurisdictions: NY (21 entries), CA (29 entries), TX (29 entries),
50
+ * MD (36 entries), VA (1 entry), AL (1 entry), MA (1 entry).
51
+ */
52
+ declare const namedCodes: CodeEntry[];
53
+ /**
54
+ * Find a CodeEntry by jurisdiction and code name token.
55
+ *
56
+ * Lookup strategy: for each candidate entry in the given jurisdiction,
57
+ * check whether the normalized codeName matches or starts with any of the
58
+ * entry's patterns (case-insensitive). Returns the entry with the longest
59
+ * matching pattern to prefer more specific codes over general ones
60
+ * (e.g., "Civ. Proc." over "Civ.").
61
+ *
62
+ * @param jurisdiction - Two-letter state abbreviation (e.g., "CA", "NY")
63
+ * @param codeName - The code name token to look up (e.g., "Penal", "Civ. Proc.")
64
+ * @returns Matching CodeEntry, or undefined if not found
65
+ *
66
+ * @example
67
+ * findNamedCode('NY', 'Penal') // → NY PEN entry
68
+ * findNamedCode('CA', 'Civ. Proc.') // → CA CCP entry (not CA CIV)
69
+ * findNamedCode('MD', 'Crim. Law') // → MD gcr entry
70
+ * findNamedCode('NY', 'Unknown') // → undefined
71
+ */
72
+ declare function findNamedCode(jurisdiction: string, codeName: string): CodeEntry | undefined;
73
+ /**
74
+ * Find a CodeEntry by an abbreviated text token.
75
+ *
76
+ * Lookup order:
77
+ * 1. Exact case-insensitive match against all patterns
78
+ * 2. Prefix match — returns the entry whose pattern is the longest
79
+ * prefix of `abbrevText` (handles tokens like "RCW" inside longer text)
80
+ *
81
+ * @param abbrevText - The abbreviation token to look up
82
+ * @returns Matching CodeEntry, or undefined if not found
83
+ *
84
+ * @example
85
+ * findAbbreviatedCode('R.C.') // → OH entry
86
+ * findAbbreviatedCode('MCL') // → MI entry
87
+ * findAbbreviatedCode('UNKNOWN') // → undefined
88
+ */
89
+ declare function findAbbreviatedCode(abbrevText: string): CodeEntry | undefined;
90
+ //#endregion
1
91
  //#region src/data/reporters.d.ts
2
92
  /**
3
93
  * Reporter database integration for citation validation
@@ -112,95 +202,5 @@ declare function getReportersSync(): ReportersDatabase | null;
112
202
  */
113
203
  declare function findReportersByAbbreviation(abbr: string): Promise<ReporterEntry[]>;
114
204
  //#endregion
115
- //#region src/data/knownCodes.d.ts
116
- /**
117
- * Known statutory code registry for abbreviated-code jurisdictions
118
- *
119
- * Provides a registry of state statutory codes that use abbreviated
120
- * citation forms (e.g., "R.C. § 1.01", "MCL 750.83"). Used by the
121
- * citation extractor to identify and normalize state statute citations.
122
- */
123
- /**
124
- * A single entry in the known codes registry.
125
- *
126
- * PA has two entries (Pa.C.S. and P.S.) because it has two distinct
127
- * code families with separate abbreviation sets.
128
- */
129
- interface CodeEntry {
130
- /** Two-letter state abbreviation (e.g., "OH", "MI") */
131
- jurisdiction: string;
132
- /** Short canonical abbreviation used internally (e.g., "RC", "MCL") */
133
- abbreviation: string;
134
- /** All recognized text patterns that identify this code */
135
- patterns: string[];
136
- /** Citation family — determines which citation pattern family this belongs to */
137
- family: "federal" | "named" | "abbreviated" | "chapterAct" | "prose";
138
- }
139
- /**
140
- * Registry of state statutory codes that use abbreviated citation forms.
141
- *
142
- * Covers 12 jurisdictions. Pennsylvania has two entries because it
143
- * maintains two distinct code families (Pa.C.S. and P.S.).
144
- *
145
- * Note: Short 2-letter patterns (GS, IC, PS, RC, FS) may produce false positives
146
- * in non-legal text (e.g., "GS 5" for government service grade). The extraction
147
- * layer mitigates this via confidence scoring — citations without a § symbol receive
148
- * lower confidence (0.85 vs 0.95). Consumers should filter by confidence threshold.
149
- */
150
- declare const abbreviatedCodes: CodeEntry[];
151
- /**
152
- * Registry of state statutory codes that use named-code citation forms.
153
- *
154
- * Named-code jurisdictions identify their code by name in citations (e.g.,
155
- * "N.Y. Penal Law § 120.05", "Cal. Civ. Proc. Code § 437c"), rather than by
156
- * a standalone abbreviation. The jurisdiction prefix is handled by the
157
- * extraction layer; these patterns cover only the code name portion.
158
- *
159
- * Ordering note: within each jurisdiction, more specific patterns must come
160
- * before more general ones (e.g., "Civ. Proc." before "Civ.") so that
161
- * findNamedCode's longest-match wins correctly.
162
- *
163
- * Covers 7 jurisdictions: NY (21 entries), CA (29 entries), TX (29 entries),
164
- * MD (36 entries), VA (1 entry), AL (1 entry), MA (1 entry).
165
- */
166
- declare const namedCodes: CodeEntry[];
167
- /**
168
- * Find a CodeEntry by jurisdiction and code name token.
169
- *
170
- * Lookup strategy: for each candidate entry in the given jurisdiction,
171
- * check whether the normalized codeName matches or starts with any of the
172
- * entry's patterns (case-insensitive). Returns the entry with the longest
173
- * matching pattern to prefer more specific codes over general ones
174
- * (e.g., "Civ. Proc." over "Civ.").
175
- *
176
- * @param jurisdiction - Two-letter state abbreviation (e.g., "CA", "NY")
177
- * @param codeName - The code name token to look up (e.g., "Penal", "Civ. Proc.")
178
- * @returns Matching CodeEntry, or undefined if not found
179
- *
180
- * @example
181
- * findNamedCode('NY', 'Penal') // → NY PEN entry
182
- * findNamedCode('CA', 'Civ. Proc.') // → CA CCP entry (not CA CIV)
183
- * findNamedCode('MD', 'Crim. Law') // → MD gcr entry
184
- * findNamedCode('NY', 'Unknown') // → undefined
185
- */
186
- declare function findNamedCode(jurisdiction: string, codeName: string): CodeEntry | undefined;
187
- /**
188
- * Find a CodeEntry by an abbreviated text token.
189
- *
190
- * Lookup order:
191
- * 1. Exact case-insensitive match against all patterns
192
- * 2. Prefix match — returns the entry whose pattern is the longest
193
- * prefix of `abbrevText` (handles tokens like "RCW" inside longer text)
194
- *
195
- * @param abbrevText - The abbreviation token to look up
196
- * @returns Matching CodeEntry, or undefined if not found
197
- *
198
- * @example
199
- * findAbbreviatedCode('R.C.') // → OH entry
200
- * findAbbreviatedCode('MCL') // → MI entry
201
- * findAbbreviatedCode('UNKNOWN') // → undefined
202
- */
203
- declare function findAbbreviatedCode(abbrevText: string): CodeEntry | undefined;
204
- //#endregion
205
205
  export { CodeEntry, ReporterEdition, ReporterEntry, ReportersDatabase, abbreviatedCodes, findAbbreviatedCode, findNamedCode, findReportersByAbbreviation, getReportersSync, loadReporters, namedCodes };
206
206
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/data/reporters.ts","../../src/data/knownCodes.ts"],"mappings":";;AAsBA;;;;;AAgBA;;;;;;;;;;;;;;;UAhBiB,eAAA;;EAEf,KAAA;;EAEA,GAAA;AAAA;;;;;;;;;;UAYe,aAAA;;EAEf,IAAA;;EAEA,SAAA;EA2CF;EAzCE,QAAA,EAAU,MAAA,SAAe,eAAA;;EAEzB,UAAA,GAAa,MAAA;EAuCgC;EArC7C,gBAAA;EAwGc;EAtGd,SAAA;EAsGkC;EApGlC,KAAA;AAAA;;;;;;;UASe,iBAAA;EAkHN;EAhHT,cAAA,EAAgB,GAAA,SAAY,aAAA;;EAE5B,GAAA,EAAK,aAAA;AAAA;;;;;;;;;;AC7BP;;;iBDiDsB,aAAA,CAAA,GAAiB,OAAA,CAAQ,iBAAA;;ACyE/C;;;;;AAyuBA;;;;;;;;;AA8DA;iBD7yBgB,gBAAA,CAAA,GAAoB,iBAAA;;;;;;;;;;;;;;;;;;iBAqBd,2BAAA,CACpB,IAAA,WACC,OAAA,CAAQ,aAAA;;;;AAzJX;;;;;AAgBA;;;;;;;UCxBiB,SAAA;;EAEf,YAAA;;EAEA,YAAA;;EAEA,QAAA;;EAEA,MAAA;AAAA;;;;ADuCF;;;;;;;;cCzBa,gBAAA,EAAkB,SAAA;;;;;;;ADiD/B;;;;;AAmEA;;;;cCMa,UAAA,EAAY,SAAA;ADezB;;;;;;;;;;;;AC/JA;;;;;;;AD+JA,iBC0tBgB,aAAA,CAAc,YAAA,UAAsB,QAAA,WAAmB,SAAA;;;AAn2BvE;;;;;AA0HA;;;;;AAyuBA;;;;iBA8DgB,mBAAA,CAAoB,UAAA,WAAqB,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