@stll/anonymize-wasm 1.4.1 → 1.4.3

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-words-en.mjs","names":[],"sources":["../../src/data/common-words-en.json"],"sourcesContent":[""],"mappings":""}
@@ -0,0 +1,18 @@
1
+ //#region src/data/legal-form-leading-clauses.json
2
+ var _comment = "Per-language clause text that may precede an organization name before a legal-form suffix. `phrases` are trimmed unconditionally when found inside an over-captured legal-form span. `directPrefixes` are trimmed only when the text before the prefix already looks like prose, so company names such as `Stand By Me LLC` are preserved.";
3
+ var en = {
4
+ "phrases": [
5
+ "by and among",
6
+ "by and between",
7
+ "is between"
8
+ ],
9
+ "directPrefixes": ["by"]
10
+ };
11
+ var legal_form_leading_clauses_default = {
12
+ _comment,
13
+ en
14
+ };
15
+ //#endregion
16
+ export { _comment, legal_form_leading_clauses_default as default, en };
17
+
18
+ //# sourceMappingURL=legal-form-leading-clauses.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legal-form-leading-clauses.mjs","names":[],"sources":["../../src/data/legal-form-leading-clauses.json"],"sourcesContent":[""],"mappings":""}
package/dist/wasm.d.mts CHANGED
@@ -269,8 +269,19 @@ type Dictionaries = {
269
269
  /**
270
270
  * Pre-loaded city names, already merged across
271
271
  * all desired countries.
272
+ *
273
+ * Prefer `citiesByCountry` when callers also pass
274
+ * `denyListCountries` / `denyListRegions`; merged
275
+ * city arrays cannot be scoped after injection.
272
276
  */
273
277
  cities?: readonly string[];
278
+ /**
279
+ * Pre-loaded city names keyed by ISO 3166-1 alpha-2
280
+ * country code. When provided, the deny-list builder
281
+ * applies `denyListCountries` / `denyListRegions`
282
+ * before adding city patterns to the search automaton.
283
+ */
284
+ citiesByCountry?: Readonly<Record<string, readonly string[]>>;
274
285
  };
275
286
  type PipelineConfig = {
276
287
  threshold: number;
@@ -290,6 +301,15 @@ type PipelineConfig = {
290
301
  * deny-list search automaton.
291
302
  */
292
303
  enableNameCorpus: boolean;
304
+ /**
305
+ * Optional language scope for first-name/surname
306
+ * dictionaries, using the keys present in
307
+ * `dictionaries.firstNames` / `dictionaries.surnames`
308
+ * (for example `["en", "de"]`). When omitted, all
309
+ * injected name languages are used for backward
310
+ * compatibility.
311
+ */
312
+ nameCorpusLanguages?: string[];
293
313
  enableDenyList: boolean;
294
314
  denyListCountries?: string[];
295
315
  denyListRegions?: string[];
@@ -367,16 +387,17 @@ declare const CURRENCY_PATTERN_META: Readonly<RegexMeta>;
367
387
  declare const processRegexMatches: (allMatches: Match[], sliceStart: number, sliceEnd: number, meta_: readonly RegexMeta[]) => Entity[];
368
388
  //#endregion
369
389
  //#region src/detectors/deny-list.d.ts
370
- type DenyListConfig = Pick<PipelineConfig, "enableDenyList" | "enableNameCorpus" | "denyListCountries" | "denyListRegions" | "denyListExcludeCategories" | "customDenyList" | "dictionaries">;
390
+ type DenyListConfig = Pick<PipelineConfig, "enableDenyList" | "enableNameCorpus" | "nameCorpusLanguages" | "denyListCountries" | "denyListRegions" | "denyListExcludeCategories" | "customDenyList" | "dictionaries">;
371
391
  /**
372
392
  * Source tag for each pattern in the automaton.
373
393
  * "deny-list" = standard deny list entry
394
+ * "city" = city dictionary entry
374
395
  * "custom-deny-list" = caller-owned exact term
375
396
  * "first-name" = name corpus first name
376
397
  * "surname" = name corpus surname
377
398
  * "title" = academic/professional title
378
399
  */
379
- type PatternSource = "deny-list" | "custom-deny-list" | "first-name" | "surname" | "title";
400
+ type PatternSource = "deny-list" | "city" | "custom-deny-list" | "first-name" | "surname" | "title";
380
401
  /**
381
402
  * Pre-built deny list data. Constructed once by
382
403
  * `buildDenyList`, reused across `processDenyListMatches`
@@ -414,7 +435,7 @@ declare const buildDenyList: (config: DenyListConfig, ctx?: PipelineContext) =>
414
435
  * the search instance was built on a different context
415
436
  * (e.g. cachedSearch).
416
437
  */
417
- declare const ensureDenyListData: (ctx?: PipelineContext, dictionaries?: Dictionaries) => Promise<void>;
438
+ declare const ensureDenyListData: (ctx?: PipelineContext, dictionaries?: Dictionaries, nameCorpusLanguages?: readonly string[]) => Promise<void>;
418
439
  /**
419
440
  * Process deny list matches from the unified search.
420
441
  * Receives all matches; filters to the deny list slice
@@ -510,6 +531,7 @@ type PipelineContext = {
510
531
  searchKey: string;
511
532
  searchPromise: Promise<UnifiedSearchInstance> | null;
512
533
  nameCorpus: NameCorpusData | null;
534
+ nameCorpusKey: string;
513
535
  nameCorpusPromise: Promise<void> | null;
514
536
  stopwords: ReadonlySet<string> | null;
515
537
  stopwordsPromise: Promise<ReadonlySet<string>> | null;
@@ -551,6 +573,22 @@ declare const createPipelineContext: () => PipelineContext;
551
573
  declare const sanitizeEntities: (entities: Entity[]) => Entity[];
552
574
  declare const mergeAndDedup: (...layers: Entity[][]) => Entity[];
553
575
  type NerInferenceFn = (fullText: string, labels: string[], threshold: number, signal?: AbortSignal) => Promise<Entity[]>;
576
+ type PipelineSearchOptions = {
577
+ config: PipelineConfig;
578
+ gazetteerEntries?: GazetteerEntry[];
579
+ context?: PipelineContext;
580
+ };
581
+ /**
582
+ * Pre-build and cache the unified search instance for a
583
+ * pipeline configuration. Use the same context in
584
+ * `runPipeline` to reuse the prepared automata without
585
+ * passing `cachedSearch` around manually.
586
+ */
587
+ declare const preparePipelineSearch: ({
588
+ config,
589
+ gazetteerEntries,
590
+ context
591
+ }: PipelineSearchOptions) => Promise<UnifiedSearchInstance>;
554
592
  /**
555
593
  * Options for {@link runPipeline}.
556
594
  *
@@ -780,7 +818,7 @@ declare const propagateOrgNames: (entities: Entity[], fullText: string) => Entit
780
818
  * with per-language first names and surnames. When
781
819
  * omitted, only legacy config files are used.
782
820
  */
783
- declare const initNameCorpus: (ctx?: PipelineContext, dictionaries?: Dictionaries) => Promise<void>;
821
+ declare const initNameCorpus: (ctx?: PipelineContext, dictionaries?: Dictionaries, languages?: readonly string[]) => Promise<void>;
784
822
  /**
785
823
  * Detect person names by looking up tokens against the
786
824
  * name corpus, then chaining adjacent name-like tokens.
@@ -1062,5 +1100,5 @@ declare const levenshtein: (rawA: string, rawB: string) => number;
1062
1100
  */
1063
1101
  declare const normalizeForSearch: (text: string) => string;
1064
1102
  //#endregion
1065
- export { type AnonymisationOperator, CURRENCY_PATTERN_META, type CountryCode, type CustomDenyListEntry, type CustomRegexPattern, DATE_PATTERN_META, DEFAULT_ENTITY_LABELS, DEFAULT_OPERATOR_CONFIG, DETECTION_SOURCES, DETECTOR_PRIORITY, type DefinitionPattern, type DenyListCategory, type DenyListData, type DetectionSource, type Dictionaries, type DictionaryMeta, type DocumentZone, type Entity, type EntityResult, type GazetteerData, type GazetteerEntry, type HotwordRule, type NameCorpusData, type NerInferenceFn, OPERATOR_REGISTRY, OPERATOR_TYPES, type OperatorConfig, type OperatorType, type PipelineConfig, type PipelineContext, type PipelineOptions, REGEX_META, REGEX_PATTERNS, REGIONS, type RawInferenceResult, type RedactionResult, type RegexMeta, type RegionId, type ReviewDecision, type ReviewedEntity, type TriggerExtension, type TriggerGroupConfig, type TriggerRule, type TriggerStrategy, type TriggerValidation, type UnifiedResult, type UnifiedSearchInstance, ZONE_SCORE_ADJUSTMENTS, type ZoneSpan, applyHotwordRules, applyZoneAdjustments, boostNearMissEntities, buildDenyList, buildGazetteerPatterns, buildLegalFormPatterns, buildPlaceholderMap, buildStreetTypePatterns, buildTriggerPatterns, buildUnifiedSearch, chunkText, classifyZones, computeChunkOffsets, corefKey, createPipelineContext, deanonymise, decodeSpans, decodeTokenSpans, detectNameCorpus, ensureDenyListData, exportRedactionKey, extractDefinedTerms, filterFalsePositives, findCoreferenceSpans, getCurrencyPatterns, getDatePatterns, initAddressComponents, initHotwordRules, initNameCorpus, initZoneClassifier, levenshtein, mergeAndDedup, mergeChunkEntities, normalizeForSearch, prepareBatch, processAddressSeeds, processDenyListMatches, processGazetteerMatches, processLegalFormMatches, processRegexMatches, processTriggerMatches, propagateOrgNames, redactText, resolveCountries, resolveOperator, runPipeline, runUnifiedSearch, sanitizeEntities, tokenizeText, warmLegalRoleHeads };
1103
+ export { type AnonymisationOperator, CURRENCY_PATTERN_META, type CountryCode, type CustomDenyListEntry, type CustomRegexPattern, DATE_PATTERN_META, DEFAULT_ENTITY_LABELS, DEFAULT_OPERATOR_CONFIG, DETECTION_SOURCES, DETECTOR_PRIORITY, type DefinitionPattern, type DenyListCategory, type DenyListData, type DetectionSource, type Dictionaries, type DictionaryMeta, type DocumentZone, type Entity, type EntityResult, type GazetteerData, type GazetteerEntry, type HotwordRule, type NameCorpusData, type NerInferenceFn, OPERATOR_REGISTRY, OPERATOR_TYPES, type OperatorConfig, type OperatorType, type PipelineConfig, type PipelineContext, type PipelineOptions, type PipelineSearchOptions, REGEX_META, REGEX_PATTERNS, REGIONS, type RawInferenceResult, type RedactionResult, type RegexMeta, type RegionId, type ReviewDecision, type ReviewedEntity, type TriggerExtension, type TriggerGroupConfig, type TriggerRule, type TriggerStrategy, type TriggerValidation, type UnifiedResult, type UnifiedSearchInstance, ZONE_SCORE_ADJUSTMENTS, type ZoneSpan, applyHotwordRules, applyZoneAdjustments, boostNearMissEntities, buildDenyList, buildGazetteerPatterns, buildLegalFormPatterns, buildPlaceholderMap, buildStreetTypePatterns, buildTriggerPatterns, buildUnifiedSearch, chunkText, classifyZones, computeChunkOffsets, corefKey, createPipelineContext, deanonymise, decodeSpans, decodeTokenSpans, detectNameCorpus, ensureDenyListData, exportRedactionKey, extractDefinedTerms, filterFalsePositives, findCoreferenceSpans, getCurrencyPatterns, getDatePatterns, initAddressComponents, initHotwordRules, initNameCorpus, initZoneClassifier, levenshtein, mergeAndDedup, mergeChunkEntities, normalizeForSearch, prepareBatch, preparePipelineSearch, processAddressSeeds, processDenyListMatches, processGazetteerMatches, processLegalFormMatches, processRegexMatches, processTriggerMatches, propagateOrgNames, redactText, resolveCountries, resolveOperator, runPipeline, runUnifiedSearch, sanitizeEntities, tokenizeText, warmLegalRoleHeads };
1066
1104
  //# sourceMappingURL=wasm.d.mts.map