image-pii-redactor 0.5.0 → 0.5.2
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/dist/image-pii-redactor.js +459 -433
- package/dist/image-pii-redactor.js.map +1 -1
- package/package.json +1 -1
|
@@ -75,7 +75,7 @@ const { is: xs, defineProperty: Cs, getOwnPropertyDescriptor: $s, getOwnProperty
|
|
|
75
75
|
return n;
|
|
76
76
|
} }, $r = (e, t) => !xs(e, t), Xr = { attribute: !0, type: String, converter: wn, reflect: !1, useDefault: !1, hasChanged: $r };
|
|
77
77
|
Symbol.metadata ??= Symbol("metadata"), $n.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
78
|
-
let
|
|
78
|
+
let gt = class extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
80
80
|
this._$Ei(), (this.l ??= []).push(t);
|
|
81
81
|
}
|
|
@@ -256,15 +256,15 @@ let pt = class extends HTMLElement {
|
|
|
256
256
|
firstUpdated(t) {
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
|
-
|
|
259
|
+
gt.elementStyles = [], gt.shadowRootOptions = { mode: "open" }, gt[It("elementProperties")] = /* @__PURE__ */ new Map(), gt[It("finalized")] = /* @__PURE__ */ new Map(), Es?.({ ReactiveElement: gt }), ($n.reactiveElementVersions ??= []).push("2.1.2");
|
|
260
260
|
/**
|
|
261
261
|
* @license
|
|
262
262
|
* Copyright 2017 Google LLC
|
|
263
263
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
264
264
|
*/
|
|
265
|
-
const Nr = globalThis, Yr = (e) => e, Pn = Nr.trustedTypes, eo = Pn ? Pn.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ga = "$lit$", ze = `lit$${Math.random().toFixed(9).slice(2)}$`, ma = "?" + ze, Ds = `<${ma}>`,
|
|
265
|
+
const Nr = globalThis, Yr = (e) => e, Pn = Nr.trustedTypes, eo = Pn ? Pn.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ga = "$lit$", ze = `lit$${Math.random().toFixed(9).slice(2)}$`, ma = "?" + ze, Ds = `<${ma}>`, tt = document, Ht = () => tt.createComment(""), Gt = (e) => e === null || typeof e != "object" && typeof e != "function", jr = Array.isArray, Os = (e) => jr(e) || typeof e?.[Symbol.iterator] == "function", Dn = `[
|
|
266
266
|
\f\r]`, Ct = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, to = /-->/g, no = />/g, We = RegExp(`>|${Dn}(?:([^\\s"'>=/]+)(${Dn}*=${Dn}*(?:[^
|
|
267
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), ro = /'/g, oo = /"/g, ba = /^(?:script|style|textarea|title)$/i, ya = (e) => (t, ...n) => ({ _$litType$: e, strings: t, values: n }), se = ya(1), kn = ya(2),
|
|
267
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ro = /'/g, oo = /"/g, ba = /^(?:script|style|textarea|title)$/i, ya = (e) => (t, ...n) => ({ _$litType$: e, strings: t, values: n }), se = ya(1), kn = ya(2), wt = Symbol.for("lit-noChange"), j = Symbol.for("lit-nothing"), io = /* @__PURE__ */ new WeakMap(), Ze = tt.createTreeWalker(tt, 129);
|
|
268
268
|
function va(e, t) {
|
|
269
269
|
if (!jr(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
270
270
|
return eo !== void 0 ? eo.createHTML(t) : t;
|
|
@@ -281,27 +281,27 @@ const Hs = (e, t) => {
|
|
|
281
281
|
}
|
|
282
282
|
return [va(e, i + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
283
283
|
};
|
|
284
|
-
class
|
|
284
|
+
class Ft {
|
|
285
285
|
constructor({ strings: t, _$litType$: n }, r) {
|
|
286
286
|
let o;
|
|
287
287
|
this.parts = [];
|
|
288
288
|
let i = 0, a = 0;
|
|
289
289
|
const s = t.length - 1, u = this.parts, [c, l] = Hs(t, n);
|
|
290
|
-
if (this.el =
|
|
290
|
+
if (this.el = Ft.createElement(c, r), Ze.currentNode = this.el.content, n === 2 || n === 3) {
|
|
291
291
|
const h = this.el.content.firstChild;
|
|
292
292
|
h.replaceWith(...h.childNodes);
|
|
293
293
|
}
|
|
294
|
-
for (; (o =
|
|
294
|
+
for (; (o = Ze.nextNode()) !== null && u.length < s; ) {
|
|
295
295
|
if (o.nodeType === 1) {
|
|
296
296
|
if (o.hasAttributes()) for (const h of o.getAttributeNames()) if (h.endsWith(ga)) {
|
|
297
297
|
const d = l[a++], m = o.getAttribute(h).split(ze), M = /([.?@])?(.*)/.exec(d);
|
|
298
|
-
u.push({ type: 1, index: i, name: M[2], strings: m, ctor: M[1] === "." ?
|
|
298
|
+
u.push({ type: 1, index: i, name: M[2], strings: m, ctor: M[1] === "." ? Fs : M[1] === "?" ? Ss : M[1] === "@" ? zs : Nn }), o.removeAttribute(h);
|
|
299
299
|
} else h.startsWith(ze) && (u.push({ type: 6, index: i }), o.removeAttribute(h));
|
|
300
300
|
if (ba.test(o.tagName)) {
|
|
301
301
|
const h = o.textContent.split(ze), d = h.length - 1;
|
|
302
302
|
if (d > 0) {
|
|
303
303
|
o.textContent = Pn ? Pn.emptyScript : "";
|
|
304
|
-
for (let m = 0; m < d; m++) o.append(h[m], Ht()),
|
|
304
|
+
for (let m = 0; m < d; m++) o.append(h[m], Ht()), Ze.nextNode(), u.push({ type: 2, index: ++i });
|
|
305
305
|
o.append(h[d], Ht());
|
|
306
306
|
}
|
|
307
307
|
}
|
|
@@ -314,17 +314,17 @@ class Gt {
|
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
static createElement(t, n) {
|
|
317
|
-
const r =
|
|
317
|
+
const r = tt.createElement("template");
|
|
318
318
|
return r.innerHTML = t, r;
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
if (t ===
|
|
321
|
+
function Pt(e, t, n = e, r) {
|
|
322
|
+
if (t === wt) return t;
|
|
323
323
|
let o = r !== void 0 ? n._$Co?.[r] : n._$Cl;
|
|
324
|
-
const i =
|
|
325
|
-
return o?.constructor !== i && (o?._$AO?.(!1), i === void 0 ? o = void 0 : (o = new i(e), o._$AT(e, n, r)), r !== void 0 ? (n._$Co ??= [])[r] = o : n._$Cl = o), o !== void 0 && (t =
|
|
324
|
+
const i = Gt(t) ? void 0 : t._$litDirective$;
|
|
325
|
+
return o?.constructor !== i && (o?._$AO?.(!1), i === void 0 ? o = void 0 : (o = new i(e), o._$AT(e, n, r)), r !== void 0 ? (n._$Co ??= [])[r] = o : n._$Cl = o), o !== void 0 && (t = Pt(e, o._$AS(e, t.values), o, r)), t;
|
|
326
326
|
}
|
|
327
|
-
class
|
|
327
|
+
class Gs {
|
|
328
328
|
constructor(t, n) {
|
|
329
329
|
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = n;
|
|
330
330
|
}
|
|
@@ -335,17 +335,17 @@ class Fs {
|
|
|
335
335
|
return this._$AM._$AU;
|
|
336
336
|
}
|
|
337
337
|
u(t) {
|
|
338
|
-
const { el: { content: n }, parts: r } = this._$AD, o = (t?.creationScope ??
|
|
339
|
-
|
|
340
|
-
let i =
|
|
338
|
+
const { el: { content: n }, parts: r } = this._$AD, o = (t?.creationScope ?? tt).importNode(n, !0);
|
|
339
|
+
Ze.currentNode = o;
|
|
340
|
+
let i = Ze.nextNode(), a = 0, s = 0, u = r[0];
|
|
341
341
|
for (; u !== void 0; ) {
|
|
342
342
|
if (a === u.index) {
|
|
343
343
|
let c;
|
|
344
344
|
u.type === 2 ? c = new Tr(i, i.nextSibling, this, t) : u.type === 1 ? c = new u.ctor(i, u.name, u.strings, this, t) : u.type === 6 && (c = new Bs(i, this, t)), this._$AV.push(c), u = r[++s];
|
|
345
345
|
}
|
|
346
|
-
a !== u?.index && (i =
|
|
346
|
+
a !== u?.index && (i = Ze.nextNode(), a++);
|
|
347
347
|
}
|
|
348
|
-
return
|
|
348
|
+
return Ze.currentNode = tt, o;
|
|
349
349
|
}
|
|
350
350
|
p(t) {
|
|
351
351
|
let n = 0;
|
|
@@ -357,7 +357,7 @@ let Tr = class wa {
|
|
|
357
357
|
return this._$AM?._$AU ?? this._$Cv;
|
|
358
358
|
}
|
|
359
359
|
constructor(t, n, r, o) {
|
|
360
|
-
this.type = 2, this._$AH =
|
|
360
|
+
this.type = 2, this._$AH = j, this._$AN = void 0, this._$AA = t, this._$AB = n, this._$AM = r, this.options = o, this._$Cv = o?.isConnected ?? !0;
|
|
361
361
|
}
|
|
362
362
|
get parentNode() {
|
|
363
363
|
let t = this._$AA.parentNode;
|
|
@@ -371,7 +371,7 @@ let Tr = class wa {
|
|
|
371
371
|
return this._$AB;
|
|
372
372
|
}
|
|
373
373
|
_$AI(t, n = this) {
|
|
374
|
-
t =
|
|
374
|
+
t = Pt(this, t, n), Gt(t) ? t === j || t == null || t === "" ? (this._$AH !== j && this._$AR(), this._$AH = j) : t !== this._$AH && t !== wt && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Os(t) ? this.k(t) : this._(t);
|
|
375
375
|
}
|
|
376
376
|
O(t) {
|
|
377
377
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -380,19 +380,19 @@ let Tr = class wa {
|
|
|
380
380
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
381
381
|
}
|
|
382
382
|
_(t) {
|
|
383
|
-
this._$AH !==
|
|
383
|
+
this._$AH !== j && Gt(this._$AH) ? this._$AA.nextSibling.data = t : this.T(tt.createTextNode(t)), this._$AH = t;
|
|
384
384
|
}
|
|
385
385
|
$(t) {
|
|
386
|
-
const { values: n, _$litType$: r } = t, o = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el =
|
|
386
|
+
const { values: n, _$litType$: r } = t, o = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = Ft.createElement(va(r.h, r.h[0]), this.options)), r);
|
|
387
387
|
if (this._$AH?._$AD === o) this._$AH.p(n);
|
|
388
388
|
else {
|
|
389
|
-
const i = new
|
|
389
|
+
const i = new Gs(o, this), a = i.u(this.options);
|
|
390
390
|
i.p(n), this.T(a), this._$AH = i;
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
_$AC(t) {
|
|
394
394
|
let n = io.get(t.strings);
|
|
395
|
-
return n === void 0 && io.set(t.strings, n = new
|
|
395
|
+
return n === void 0 && io.set(t.strings, n = new Ft(t)), n;
|
|
396
396
|
}
|
|
397
397
|
k(t) {
|
|
398
398
|
jr(this._$AH) || (this._$AH = [], this._$AR());
|
|
@@ -419,29 +419,29 @@ class Nn {
|
|
|
419
419
|
return this._$AM._$AU;
|
|
420
420
|
}
|
|
421
421
|
constructor(t, n, r, o, i) {
|
|
422
|
-
this.type = 1, this._$AH =
|
|
422
|
+
this.type = 1, this._$AH = j, this._$AN = void 0, this.element = t, this.name = n, this._$AM = o, this.options = i, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = j;
|
|
423
423
|
}
|
|
424
424
|
_$AI(t, n = this, r, o) {
|
|
425
425
|
const i = this.strings;
|
|
426
426
|
let a = !1;
|
|
427
|
-
if (i === void 0) t =
|
|
427
|
+
if (i === void 0) t = Pt(this, t, n, 0), a = !Gt(t) || t !== this._$AH && t !== wt, a && (this._$AH = t);
|
|
428
428
|
else {
|
|
429
429
|
const s = t;
|
|
430
430
|
let u, c;
|
|
431
|
-
for (t = i[0], u = 0; u < i.length - 1; u++) c =
|
|
431
|
+
for (t = i[0], u = 0; u < i.length - 1; u++) c = Pt(this, s[r + u], n, u), c === wt && (c = this._$AH[u]), a ||= !Gt(c) || c !== this._$AH[u], c === j ? t = j : t !== j && (t += (c ?? "") + i[u + 1]), this._$AH[u] = c;
|
|
432
432
|
}
|
|
433
433
|
a && !o && this.j(t);
|
|
434
434
|
}
|
|
435
435
|
j(t) {
|
|
436
|
-
t ===
|
|
436
|
+
t === j ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
-
class
|
|
439
|
+
class Fs extends Nn {
|
|
440
440
|
constructor() {
|
|
441
441
|
super(...arguments), this.type = 3;
|
|
442
442
|
}
|
|
443
443
|
j(t) {
|
|
444
|
-
this.element[this.name] = t ===
|
|
444
|
+
this.element[this.name] = t === j ? void 0 : t;
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
class Ss extends Nn {
|
|
@@ -449,7 +449,7 @@ class Ss extends Nn {
|
|
|
449
449
|
super(...arguments), this.type = 4;
|
|
450
450
|
}
|
|
451
451
|
j(t) {
|
|
452
|
-
this.element.toggleAttribute(this.name, !!t && t !==
|
|
452
|
+
this.element.toggleAttribute(this.name, !!t && t !== j);
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
class zs extends Nn {
|
|
@@ -457,8 +457,8 @@ class zs extends Nn {
|
|
|
457
457
|
super(t, n, r, o, i), this.type = 5;
|
|
458
458
|
}
|
|
459
459
|
_$AI(t, n = this) {
|
|
460
|
-
if ((t =
|
|
461
|
-
const r = this._$AH, o = t ===
|
|
460
|
+
if ((t = Pt(this, t, n, 0) ?? j) === wt) return;
|
|
461
|
+
const r = this._$AH, o = t === j && r !== j || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, i = t !== j && (r === j || o);
|
|
462
462
|
o && this.element.removeEventListener(this.name, this, r), i && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
463
463
|
}
|
|
464
464
|
handleEvent(t) {
|
|
@@ -473,11 +473,11 @@ class Bs {
|
|
|
473
473
|
return this._$AM._$AU;
|
|
474
474
|
}
|
|
475
475
|
_$AI(t) {
|
|
476
|
-
|
|
476
|
+
Pt(this, t);
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
const Vs = Nr.litHtmlPolyfillSupport;
|
|
480
|
-
Vs?.(
|
|
480
|
+
Vs?.(Ft, Tr), (Nr.litHtmlVersions ??= []).push("3.3.2");
|
|
481
481
|
const Ms = (e, t, n) => {
|
|
482
482
|
const r = n?.renderBefore ?? t;
|
|
483
483
|
let o = r._$litPart$;
|
|
@@ -493,7 +493,7 @@ const Ms = (e, t, n) => {
|
|
|
493
493
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
494
494
|
*/
|
|
495
495
|
const Ir = globalThis;
|
|
496
|
-
let Et = class extends
|
|
496
|
+
let Et = class extends gt {
|
|
497
497
|
constructor() {
|
|
498
498
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
499
499
|
}
|
|
@@ -512,7 +512,7 @@ let Et = class extends pt {
|
|
|
512
512
|
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
513
513
|
}
|
|
514
514
|
render() {
|
|
515
|
-
return
|
|
515
|
+
return wt;
|
|
516
516
|
}
|
|
517
517
|
};
|
|
518
518
|
Et._$litElement$ = !0, Et.finalized = !0, Ir.litElementHydrateSupport?.({ LitElement: Et });
|
|
@@ -555,7 +555,7 @@ const Ks = { attribute: !0, type: String, converter: wn, reflect: !1, hasChanged
|
|
|
555
555
|
}
|
|
556
556
|
throw Error("Unsupported decorator location: " + r);
|
|
557
557
|
};
|
|
558
|
-
function
|
|
558
|
+
function rt(e) {
|
|
559
559
|
return (t, n) => typeof n == "object" ? _s(e, t, n) : ((r, o, i) => {
|
|
560
560
|
const a = o.hasOwnProperty(i);
|
|
561
561
|
return o.constructor.createProperty(i, r), a ? Object.getOwnPropertyDescriptor(o, i) : void 0;
|
|
@@ -567,7 +567,7 @@ function kt(e) {
|
|
|
567
567
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
568
568
|
*/
|
|
569
569
|
function J(e) {
|
|
570
|
-
return
|
|
570
|
+
return rt({ ...e, state: !0, attribute: !1 });
|
|
571
571
|
}
|
|
572
572
|
/**
|
|
573
573
|
* @license
|
|
@@ -1191,16 +1191,16 @@ async function ru(e, t = "eng", n) {
|
|
|
1191
1191
|
for (let S = 0; S < m.length; S++) {
|
|
1192
1192
|
const En = m[S].words ?? [];
|
|
1193
1193
|
for (let Jt = 0; Jt < En.length; Jt++) {
|
|
1194
|
-
const
|
|
1194
|
+
const st = En[Jt], Ut = st.text, vs = d, ws = d + Ut.length;
|
|
1195
1195
|
l.push({
|
|
1196
1196
|
text: Ut,
|
|
1197
1197
|
bbox: {
|
|
1198
|
-
x0:
|
|
1199
|
-
y0:
|
|
1200
|
-
x1:
|
|
1201
|
-
y1:
|
|
1198
|
+
x0: st.bbox.x0,
|
|
1199
|
+
y0: st.bbox.y0,
|
|
1200
|
+
x1: st.bbox.x1,
|
|
1201
|
+
y1: st.bbox.y1
|
|
1202
1202
|
},
|
|
1203
|
-
confidence:
|
|
1203
|
+
confidence: st.confidence,
|
|
1204
1204
|
charStart: vs,
|
|
1205
1205
|
charEnd: ws,
|
|
1206
1206
|
lineIndex: S
|
|
@@ -1209,8 +1209,8 @@ async function ru(e, t = "eng", n) {
|
|
|
1209
1209
|
S < m.length - 1 && (h += `
|
|
1210
1210
|
`, d += 1);
|
|
1211
1211
|
}
|
|
1212
|
-
const M = c.data,
|
|
1213
|
-
return { fullText: h, words: l, imageWidth:
|
|
1212
|
+
const M = c.data, at = M.imageWidth ?? a, ys = M.imageHeight ?? s;
|
|
1213
|
+
return { fullText: h, words: l, imageWidth: at, imageHeight: ys };
|
|
1214
1214
|
}
|
|
1215
1215
|
function ou(e, t, n) {
|
|
1216
1216
|
return e.filter((r) => r.charStart < n && r.charEnd > t);
|
|
@@ -1224,18 +1224,18 @@ let iu = () => new Worker(new URL(
|
|
|
1224
1224
|
}), Ie = null, Er = 0;
|
|
1225
1225
|
function au() {
|
|
1226
1226
|
return Ie || (Ie = iu(), Ie.onmessage = (e) => {
|
|
1227
|
-
const t = e.data, n =
|
|
1228
|
-
n && (t.type === "PROGRESS" ? n.onProgress?.(t.event) : t.type === "RESULT" ? (
|
|
1227
|
+
const t = e.data, n = qe.get(t.id);
|
|
1228
|
+
n && (t.type === "PROGRESS" ? n.onProgress?.(t.event) : t.type === "RESULT" ? (qe.delete(t.id), n.resolve(t.entities)) : t.type === "DONE" ? (qe.delete(t.id), n.resolve(void 0)) : t.type === "ERROR" && (qe.delete(t.id), n.reject(new Error(t.message))));
|
|
1229
1229
|
}, Ie.onerror = (e) => {
|
|
1230
|
-
for (const [t, n] of
|
|
1231
|
-
n.reject(new Error(`NER worker crashed: ${e.message}`)),
|
|
1230
|
+
for (const [t, n] of qe)
|
|
1231
|
+
n.reject(new Error(`NER worker crashed: ${e.message}`)), qe.delete(t);
|
|
1232
1232
|
Ie = null;
|
|
1233
1233
|
}), Ie;
|
|
1234
1234
|
}
|
|
1235
|
-
const
|
|
1235
|
+
const qe = /* @__PURE__ */ new Map();
|
|
1236
1236
|
function Dr(e, t) {
|
|
1237
1237
|
return new Promise((n, r) => {
|
|
1238
|
-
|
|
1238
|
+
qe.set(e.id, { resolve: n, reject: r, onProgress: t }), au().postMessage(e);
|
|
1239
1239
|
});
|
|
1240
1240
|
}
|
|
1241
1241
|
async function su(e, t, n = 0.7, r) {
|
|
@@ -1290,11 +1290,17 @@ const cu = [
|
|
|
1290
1290
|
label: "IP_ADDRESS",
|
|
1291
1291
|
pattern: /\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/g
|
|
1292
1292
|
},
|
|
1293
|
-
// Dates
|
|
1293
|
+
// Dates — numeric formats (MM/DD/YYYY, YYYY-MM-DD, etc.)
|
|
1294
1294
|
{
|
|
1295
1295
|
label: "DATE",
|
|
1296
1296
|
pattern: /\b(?:\d{1,2}[/.-]\d{1,2}[/.-]\d{2,4}|\d{4}[/.-]\d{1,2}[/.-]\d{1,2})\b/g
|
|
1297
1297
|
},
|
|
1298
|
+
// Dates — written-out month name (e.g. "October 24, 2025" or "January 2025")
|
|
1299
|
+
// Matches: <MonthName> [<day>,] <year>
|
|
1300
|
+
{
|
|
1301
|
+
label: "DATE",
|
|
1302
|
+
pattern: /\b(?:January|February|March|April|May|June|July|August|September|October|November|December)\s+(?:\d{1,2},\s*)?\d{4}\b/g
|
|
1303
|
+
},
|
|
1298
1304
|
// URLs with paths (may contain identifying query params)
|
|
1299
1305
|
{
|
|
1300
1306
|
label: "URL",
|
|
@@ -1681,11 +1687,11 @@ const Hu = function(e) {
|
|
|
1681
1687
|
r.add("#" + i[a]);
|
|
1682
1688
|
}), r;
|
|
1683
1689
|
});
|
|
1684
|
-
},
|
|
1690
|
+
}, Gu = {
|
|
1685
1691
|
one: {
|
|
1686
1692
|
cacheDoc: Hu
|
|
1687
1693
|
}
|
|
1688
|
-
},
|
|
1694
|
+
}, Fu = {
|
|
1689
1695
|
/** */
|
|
1690
1696
|
cache: function() {
|
|
1691
1697
|
return this._cache = this.methods.one.cacheDoc(this.document), this;
|
|
@@ -1695,7 +1701,7 @@ const Hu = function(e) {
|
|
|
1695
1701
|
return this._cache = null, this;
|
|
1696
1702
|
}
|
|
1697
1703
|
}, Su = function(e) {
|
|
1698
|
-
Object.assign(e.prototype,
|
|
1704
|
+
Object.assign(e.prototype, Fu);
|
|
1699
1705
|
}, zu = {
|
|
1700
1706
|
cache: function(e) {
|
|
1701
1707
|
e._cache = e.methods.one.cacheDoc(e.document);
|
|
@@ -1703,7 +1709,7 @@ const Hu = function(e) {
|
|
|
1703
1709
|
}, Bu = {
|
|
1704
1710
|
api: Su,
|
|
1705
1711
|
compute: zu,
|
|
1706
|
-
methods:
|
|
1712
|
+
methods: Gu
|
|
1707
1713
|
}, Vu = {
|
|
1708
1714
|
/** */
|
|
1709
1715
|
toLowerCase: function() {
|
|
@@ -1737,7 +1743,7 @@ const Hu = function(e) {
|
|
|
1737
1743
|
Array.prototype.splice.apply(e, r);
|
|
1738
1744
|
}
|
|
1739
1745
|
return e;
|
|
1740
|
-
},
|
|
1746
|
+
}, vt = function(e) {
|
|
1741
1747
|
const t = / $/, n = /[-–—]/, r = e[e.length - 1];
|
|
1742
1748
|
r && !t.test(r.post) && !n.test(r.post) && (r.post += " ");
|
|
1743
1749
|
}, fo = (e, t, n) => {
|
|
@@ -1758,10 +1764,10 @@ const Hu = function(e) {
|
|
|
1758
1764
|
o.tags.has("ProperNoun") || o.tags.has("Acronym") || ho(o.text) && o.text.length > 1 && (o.text = Lu(o.text));
|
|
1759
1765
|
}, Ku = function(e, t, n, r) {
|
|
1760
1766
|
const [o, i, a] = t;
|
|
1761
|
-
i === 0 || a === r[o].length ?
|
|
1767
|
+
i === 0 || a === r[o].length ? vt(n) : (vt(n), vt([e[t[1]]])), Wu(e, i, n), xa(e, i, n);
|
|
1762
1768
|
}, _u = function(e, t, n, r) {
|
|
1763
1769
|
const [o, , i] = t, a = (r[o] || []).length;
|
|
1764
|
-
i < a ? (fo(e, i, n),
|
|
1770
|
+
i < a ? (fo(e, i, n), vt(n)) : a === i && (vt(e), fo(e, i, n), r[o + 1] && (n[n.length - 1].post += " ")), xa(e, t[2], n), t[4] = n[n.length - 1].id;
|
|
1765
1771
|
};
|
|
1766
1772
|
let $t = 0;
|
|
1767
1773
|
const po = (e) => (e = e.length < 3 ? "0" + e : e, e.length < 3 ? "0" + e : e), Ca = function(e) {
|
|
@@ -1791,7 +1797,7 @@ const po = (e) => (e = e.length < 3 ? "0" + e : e, e.length < 3 ? "0" + e : e),
|
|
|
1791
1797
|
});
|
|
1792
1798
|
const s = t.toView(i);
|
|
1793
1799
|
return t.ptrs = a, s.compute(["id", "index", "freeze", "lexicon"]), s.world.compute.preTagger && s.compute("preTagger"), s.compute("unfreeze"), s;
|
|
1794
|
-
},
|
|
1800
|
+
}, nt = {
|
|
1795
1801
|
insertAfter: function(e) {
|
|
1796
1802
|
return bo(e, this, !1);
|
|
1797
1803
|
},
|
|
@@ -1799,9 +1805,9 @@ const po = (e) => (e = e.length < 3 ? "0" + e : e, e.length < 3 ? "0" + e : e),
|
|
|
1799
1805
|
return bo(e, this, !0);
|
|
1800
1806
|
}
|
|
1801
1807
|
};
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1808
|
+
nt.append = nt.insertAfter;
|
|
1809
|
+
nt.prepend = nt.insertBefore;
|
|
1810
|
+
nt.insert = nt.insertAfter;
|
|
1805
1811
|
const Ru = /\$[0-9a-z]+/g, Or = {}, qu = (e) => /^\p{Lu}[\p{Ll}'’]/u.test(e) || /^\p{Lu}$/u.test(e), Qu = (e) => e.replace(/^\p{Ll}/u, (t) => t.toUpperCase()), Zu = (e) => e.replace(/^\p{Lu}/u, (t) => t.toLowerCase()), Xu = function(e, t, n) {
|
|
1806
1812
|
return e.forEach((r) => {
|
|
1807
1813
|
const o = t(r);
|
|
@@ -2033,7 +2039,7 @@ const rc = (e, t) => e.normal < t.normal ? -1 : e.normal > t.normal ? 1 : 0, oc
|
|
|
2033
2039
|
}, wc = function() {
|
|
2034
2040
|
let e = this.ptrs;
|
|
2035
2041
|
return !e || e.length < 1 ? this : (e = e.map((t) => t.slice(0, 3)), this.ptrs = e, this);
|
|
2036
|
-
}, Pc = { harden: vc, soften: wc }, kc = Object.assign({}, Vu,
|
|
2042
|
+
}, Pc = { harden: vc, soften: wc }, kc = Object.assign({}, Vu, nt, Or, or, St, gc, yc, Pc), Ac = function(e) {
|
|
2037
2043
|
Object.assign(e.prototype, kc);
|
|
2038
2044
|
}, xc = {
|
|
2039
2045
|
id: function(e) {
|
|
@@ -2142,7 +2148,7 @@ const rc = (e, t) => e.normal < t.normal ? -1 : e.normal > t.normal ? 1 : 0, oc
|
|
|
2142
2148
|
contractions: $c,
|
|
2143
2149
|
numberSuffixes: Nc
|
|
2144
2150
|
}
|
|
2145
|
-
},
|
|
2151
|
+
}, Gn = function(e, t, n) {
|
|
2146
2152
|
const [r, o] = t;
|
|
2147
2153
|
!n || n.length === 0 || (n = n.map((i, a) => (i.implicit = i.text, i.machine = i.text, i.pre = "", i.post = "", i.text = "", i.normal = "", i.index = [r, o + a], i)), n[0] && (n[0].pre = e[r][o].pre, n[n.length - 1].post = e[r][o].post, n[0].text = e[r][o].text, n[0].normal = e[r][o].normal), e[r].splice(o, 1, ...n));
|
|
2148
2154
|
}, Tc = /'/, Ic = /* @__PURE__ */ new Set([
|
|
@@ -2173,13 +2179,13 @@ const rc = (e, t) => e.normal < t.normal ? -1 : e.normal > t.normal ? 1 : 0, oc
|
|
|
2173
2179
|
return null;
|
|
2174
2180
|
}, Hc = function(e, t) {
|
|
2175
2181
|
return e[t].normal === "ain't" || e[t].normal === "aint" ? null : [e[t].normal.replace(/n't/, ""), "not"];
|
|
2176
|
-
}, Hr = /'/,
|
|
2182
|
+
}, Hr = /'/, Gc = /(e|é|aison|sion|tion)$/, Fc = /(age|isme|acle|ege|oire)$/, Sc = (e, t) => {
|
|
2177
2183
|
const n = e[t].normal.split(Hr)[1];
|
|
2178
2184
|
return n && n.endsWith("e") ? ["la", n] : ["le", n];
|
|
2179
2185
|
}, zc = (e, t) => {
|
|
2180
2186
|
const n = e[t].normal.split(Hr)[1];
|
|
2181
|
-
return n &&
|
|
2182
|
-
}, Bc = (e, t) => ["je", e[t].normal.split(Hr)[1]],
|
|
2187
|
+
return n && Gc.test(n) && !Fc.test(n) ? ["du", n] : n && n.endsWith("s") ? ["des", n] : ["de", n];
|
|
2188
|
+
}, Bc = (e, t) => ["je", e[t].normal.split(Hr)[1]], Fn = {
|
|
2183
2189
|
preJ: Bc,
|
|
2184
2190
|
preL: Sc,
|
|
2185
2191
|
preD: zc
|
|
@@ -2206,11 +2212,11 @@ const rc = (e, t) => e.normal < t.normal ? -1 : e.normal > t.normal ? 1 : 0, oc
|
|
|
2206
2212
|
d: (e, t) => Oc(e, t)
|
|
2207
2213
|
}, Po = {
|
|
2208
2214
|
// j'aime
|
|
2209
|
-
j: (e, t) =>
|
|
2215
|
+
j: (e, t) => Fn.preJ(e, t),
|
|
2210
2216
|
// l'amour
|
|
2211
|
-
l: (e, t) =>
|
|
2217
|
+
l: (e, t) => Fn.preL(e, t),
|
|
2212
2218
|
// d'amerique
|
|
2213
|
-
d: (e, t) =>
|
|
2219
|
+
d: (e, t) => Fn.preD(e, t)
|
|
2214
2220
|
}, Uc = function(e, t, n, r) {
|
|
2215
2221
|
for (let o = 0; o < e.length; o += 1) {
|
|
2216
2222
|
const i = e[o];
|
|
@@ -2241,14 +2247,14 @@ const rc = (e, t) => e.normal < t.normal ? -1 : e.normal > t.normal ? 1 : 0, oc
|
|
|
2241
2247
|
}
|
|
2242
2248
|
let h = Uc(i, a[u], c, l);
|
|
2243
2249
|
if (!h && wo.hasOwnProperty(l) && (h = wo[l](a, u, t)), !h && Po.hasOwnProperty(c) && (h = Po[c](a, u)), c === "there" && l === "s" && (h = Rc(a, u)), h) {
|
|
2244
|
-
h = Sn(h, e),
|
|
2250
|
+
h = Sn(h, e), Gn(n, [s, u], h), vo(n[s], e, u, h.length);
|
|
2245
2251
|
continue;
|
|
2246
2252
|
}
|
|
2247
2253
|
if (Jc.test(a[u].normal)) {
|
|
2248
|
-
h = Wc(a, u), h && (h = Sn(h, e),
|
|
2254
|
+
h = Wc(a, u), h && (h = Sn(h, e), Gn(n, [s, u], h), o.one.setTag(h, "NumberRange", t), h[2] && h[2].tags.has("Time") && o.one.setTag([h[0]], "Time", t, null, "time-range"), vo(n[s], e, u, h.length));
|
|
2249
2255
|
continue;
|
|
2250
2256
|
}
|
|
2251
|
-
h = _c(a, u, t), h && (h = Sn(h, e),
|
|
2257
|
+
h = _c(a, u, t), h && (h = Sn(h, e), Gn(n, [s, u], h), o.one.setTag([h[1]], "Unit", t, null, "contraction-unit"));
|
|
2252
2258
|
}
|
|
2253
2259
|
});
|
|
2254
2260
|
}, Qc = { contractions: qc }, Zc = {
|
|
@@ -2263,9 +2269,9 @@ const rc = (e, t) => e.normal < t.normal ? -1 : e.normal > t.normal ? 1 : 0, oc
|
|
|
2263
2269
|
if (a[l] !== void 0 && s[u + 1]) {
|
|
2264
2270
|
const h = u + a[l] - 1;
|
|
2265
2271
|
for (let d = h; d > u; d -= 1) {
|
|
2266
|
-
const m = s.slice(u, d + 1), M = m.map((
|
|
2272
|
+
const m = s.slice(u, d + 1), M = m.map((at) => at.machine || at.normal).join(" ");
|
|
2267
2273
|
if (i.hasOwnProperty(M) === !0) {
|
|
2268
|
-
o(m, i[M], t, !1, "1-frozen-multi-lexicon"), m.forEach((
|
|
2274
|
+
o(m, i[M], t, !1, "1-frozen-multi-lexicon"), m.forEach((at) => at.frozen = !0);
|
|
2269
2275
|
continue;
|
|
2270
2276
|
}
|
|
2271
2277
|
}
|
|
@@ -2612,34 +2618,34 @@ const vl = {
|
|
|
2612
2618
|
return [e[0], e[1], t[2]];
|
|
2613
2619
|
}, Dl = function(e) {
|
|
2614
2620
|
return Object.prototype.toString.call(e) === "[object Array]";
|
|
2615
|
-
},
|
|
2621
|
+
}, Gr = (e, t, n) => typeof e == "string" || Dl(e) ? t.match(e, n) : e || t.none(), Fr = function(e, t) {
|
|
2616
2622
|
const [n, r, o] = e;
|
|
2617
2623
|
return t.document[n] && t.document[n][r] && (e[3] = e[3] || t.document[n][r].id, t.document[n][o - 1] && (e[4] = e[4] || t.document[n][o - 1].id)), e;
|
|
2618
|
-
},
|
|
2619
|
-
|
|
2620
|
-
const { splitAll: n } = this.methods.one.pointer, r =
|
|
2624
|
+
}, kt = {};
|
|
2625
|
+
kt.splitOn = function(e, t) {
|
|
2626
|
+
const { splitAll: n } = this.methods.one.pointer, r = Gr(e, this, t).fullPointer, o = n(this.fullPointer, r);
|
|
2621
2627
|
let i = [];
|
|
2622
2628
|
return o.forEach((a) => {
|
|
2623
2629
|
i.push(a.passthrough), i.push(a.before), i.push(a.match), i.push(a.after);
|
|
2624
|
-
}), i = i.filter((a) => a), i = i.map((a) =>
|
|
2630
|
+
}), i = i.filter((a) => a), i = i.map((a) => Fr(a, this)), this.update(i);
|
|
2625
2631
|
};
|
|
2626
|
-
|
|
2627
|
-
const { splitAll: n } = this.methods.one.pointer, r =
|
|
2632
|
+
kt.splitBefore = function(e, t) {
|
|
2633
|
+
const { splitAll: n } = this.methods.one.pointer, r = Gr(e, this, t).fullPointer, o = n(this.fullPointer, r);
|
|
2628
2634
|
for (let a = 0; a < o.length; a += 1)
|
|
2629
2635
|
!o[a].after && o[a + 1] && o[a + 1].before && o[a].match && o[a].match[0] === o[a + 1].before[0] && (o[a].after = o[a + 1].before, delete o[a + 1].before);
|
|
2630
2636
|
let i = [];
|
|
2631
2637
|
return o.forEach((a) => {
|
|
2632
2638
|
i.push(a.passthrough), i.push(a.before), a.match && a.after ? i.push(Ia(a.match, a.after)) : i.push(a.match);
|
|
2633
|
-
}), i = i.filter((a) => a), i = i.map((a) =>
|
|
2639
|
+
}), i = i.filter((a) => a), i = i.map((a) => Fr(a, this)), this.update(i);
|
|
2634
2640
|
};
|
|
2635
|
-
|
|
2636
|
-
const { splitAll: n } = this.methods.one.pointer, r =
|
|
2641
|
+
kt.splitAfter = function(e, t) {
|
|
2642
|
+
const { splitAll: n } = this.methods.one.pointer, r = Gr(e, this, t).fullPointer, o = n(this.fullPointer, r);
|
|
2637
2643
|
let i = [];
|
|
2638
2644
|
return o.forEach((a) => {
|
|
2639
2645
|
i.push(a.passthrough), a.before && a.match ? i.push(Ia(a.before, a.match)) : (i.push(a.before), i.push(a.match)), i.push(a.after);
|
|
2640
|
-
}), i = i.filter((a) => a), i = i.map((a) =>
|
|
2646
|
+
}), i = i.filter((a) => a), i = i.map((a) => Fr(a, this)), this.update(i);
|
|
2641
2647
|
};
|
|
2642
|
-
|
|
2648
|
+
kt.split = kt.splitAfter;
|
|
2643
2649
|
const Ol = function(e, t) {
|
|
2644
2650
|
return !e || !t || e[0] !== t[0] ? !1 : e[2] === t[1];
|
|
2645
2651
|
}, jo = function(e, t, n) {
|
|
@@ -2662,18 +2668,18 @@ const Ol = function(e, t) {
|
|
|
2662
2668
|
join: function() {
|
|
2663
2669
|
return jo(this);
|
|
2664
2670
|
}
|
|
2665
|
-
}, ye = Object.assign({}, Cl, El,
|
|
2671
|
+
}, ye = Object.assign({}, Cl, El, kt, Hl);
|
|
2666
2672
|
ye.lookBehind = ye.before;
|
|
2667
2673
|
ye.lookBefore = ye.before;
|
|
2668
2674
|
ye.lookAhead = ye.after;
|
|
2669
2675
|
ye.lookAfter = ye.after;
|
|
2670
2676
|
ye.notIf = ye.ifNo;
|
|
2671
|
-
const
|
|
2677
|
+
const Gl = function(e) {
|
|
2672
2678
|
Object.assign(e.prototype, ye);
|
|
2673
|
-
},
|
|
2679
|
+
}, Fl = /(?:^|\s)([![^]*(?:<[^<]*>)?\/.*?[^\\/]\/[?\]+*$~]*)(?:\s|$)/, Sl = /([!~[^]*(?:<[^<]*>)?\([^)]+[^\\)]\)[?\]+*$~]*)(?:\s|$)/, zl = / /g, Bl = (e) => /^[![^]*(<[^<]*>)?\(/.test(e) && /\)[?\]+*$~]*$/.test(e), To = (e) => /^[![^]*(<[^<]*>)?\//.test(e) && /\/[?\]+*$~]*$/.test(e), Io = function(e) {
|
|
2674
2680
|
return e = e.map((t) => t.trim()), e = e.filter((t) => t), e;
|
|
2675
2681
|
}, Vl = function(e) {
|
|
2676
|
-
const t = e.split(
|
|
2682
|
+
const t = e.split(Fl);
|
|
2677
2683
|
let n = [];
|
|
2678
2684
|
t.forEach((o) => {
|
|
2679
2685
|
if (To(o)) {
|
|
@@ -2686,23 +2692,23 @@ const Fl = function(e) {
|
|
|
2686
2692
|
return n.forEach((o) => {
|
|
2687
2693
|
Bl(o) || To(o) ? r.push(o) : r = r.concat(o.split(zl));
|
|
2688
2694
|
}), r = Io(r), r;
|
|
2689
|
-
}, Eo = /\{([0-9]+)?(, *[0-9]*)?\}/, Do = /&&/, Ml = new RegExp(/^<\s*(\S+)\s*>/), Oo = (e) => e.charAt(0).toUpperCase() + e.substring(1), ue = (e) => e.charAt(e.length - 1), te = (e) => e.charAt(0),
|
|
2690
|
-
return e =
|
|
2695
|
+
}, Eo = /\{([0-9]+)?(, *[0-9]*)?\}/, Do = /&&/, Ml = new RegExp(/^<\s*(\S+)\s*>/), Oo = (e) => e.charAt(0).toUpperCase() + e.substring(1), ue = (e) => e.charAt(e.length - 1), te = (e) => e.charAt(0), mt = (e) => e.substring(1), bt = (e) => e.substring(0, e.length - 1), Nt = function(e) {
|
|
2696
|
+
return e = mt(e), e = bt(e), e;
|
|
2691
2697
|
}, Ea = function(e, t) {
|
|
2692
2698
|
const n = {};
|
|
2693
2699
|
for (let r = 0; r < 2; r += 1) {
|
|
2694
|
-
if (ue(e) === "$" && (n.end = !0, e =
|
|
2700
|
+
if (ue(e) === "$" && (n.end = !0, e = bt(e)), te(e) === "^" && (n.start = !0, e = mt(e)), ue(e) === "?" && (n.optional = !0, e = bt(e)), (te(e) === "[" || ue(e) === "]") && (n.group = null, te(e) === "[" && (n.groupStart = !0), ue(e) === "]" && (n.groupEnd = !0), e = e.replace(/^\[/, ""), e = e.replace(/\]$/, ""), te(e) === "<")) {
|
|
2695
2701
|
const o = Ml.exec(e);
|
|
2696
2702
|
o.length >= 2 && (n.group = o[1], e = e.replace(o[0], ""));
|
|
2697
2703
|
}
|
|
2698
|
-
if (ue(e) === "+" && (n.greedy = !0, e =
|
|
2704
|
+
if (ue(e) === "+" && (n.greedy = !0, e = bt(e)), e !== "*" && ue(e) === "*" && e !== "\\*" && (n.greedy = !0, e = bt(e)), te(e) === "!" && (n.negative = !0, e = mt(e)), te(e) === "~" && ue(e) === "~" && e.length > 2 && (e = Nt(e), n.fuzzy = !0, n.min = t.fuzzy || 0.85, /\(/.test(e) === !1))
|
|
2699
2705
|
return n.word = e, n;
|
|
2700
2706
|
if (te(e) === "/" && ue(e) === "/")
|
|
2701
2707
|
return e = Nt(e), t.caseSensitive && (n.use = "text"), n.regex = new RegExp(e), n;
|
|
2702
2708
|
if (Eo.test(e) === !0 && (e = e.replace(Eo, (o, i, a) => (a === void 0 ? (n.min = Number(i), n.max = Number(i)) : (a = a.replace(/, */, ""), i === void 0 ? (n.min = 0, n.max = Number(a)) : (n.min = Number(i), n.max = Number(a || 999))), n.greedy = !0, n.min || (n.optional = !0), ""))), te(e) === "(" && ue(e) === ")") {
|
|
2703
|
-
Do.test(e) ? (n.choices = e.split(Do), n.operator = "and") : (n.choices = e.split("|"), n.operator = "or"), n.choices[0] =
|
|
2709
|
+
Do.test(e) ? (n.choices = e.split(Do), n.operator = "and") : (n.choices = e.split("|"), n.operator = "or"), n.choices[0] = mt(n.choices[0]);
|
|
2704
2710
|
const o = n.choices.length - 1;
|
|
2705
|
-
n.choices[o] =
|
|
2711
|
+
n.choices[o] = bt(n.choices[o]), n.choices = n.choices.map((i) => i.trim()), n.choices = n.choices.filter((i) => i), n.choices = n.choices.map((i) => i.split(/ /g).map((a) => Ea(a, t))), e = "";
|
|
2706
2712
|
}
|
|
2707
2713
|
if (te(e) === "{" && ue(e) === "}") {
|
|
2708
2714
|
if (e = Nt(e), n.root = e, /\//.test(e)) {
|
|
@@ -2716,7 +2722,7 @@ const Fl = function(e) {
|
|
|
2716
2722
|
if (te(e) === "%" && ue(e) === "%")
|
|
2717
2723
|
return e = Nt(e), n.switch = e, n;
|
|
2718
2724
|
}
|
|
2719
|
-
return te(e) === "#" ? (n.tag =
|
|
2725
|
+
return te(e) === "#" ? (n.tag = mt(e), n.tag = Oo(n.tag), n) : te(e) === "@" ? (n.method = mt(e), n) : e === "." ? (n.anything = !0, n) : e === "*" ? (n.anything = !0, n.greedy = !0, n.optional = !0, n) : (e && (e = e.replace("\\*", "*"), e = e.replace("\\.", "."), t.caseSensitive ? n.use = "text" : e = e.toLowerCase(), n.word = e), n);
|
|
2720
2726
|
}, Ll = /[a-z0-9][-–—][a-z]/i, Wl = function(e, t) {
|
|
2721
2727
|
const n = t.model.one.prefixes;
|
|
2722
2728
|
for (let r = e.length - 1; r >= 0; r -= 1) {
|
|
@@ -2735,10 +2741,10 @@ const Fl = function(e) {
|
|
|
2735
2741
|
}, Ho = function(e, t) {
|
|
2736
2742
|
const { all: n } = t.methods.two.transform.verb || {}, r = e.root;
|
|
2737
2743
|
return n ? n(r, t.model) : [];
|
|
2738
|
-
},
|
|
2744
|
+
}, Go = function(e, t) {
|
|
2739
2745
|
const { all: n } = t.methods.two.transform.noun || {};
|
|
2740
2746
|
return n ? n(e.root, t.model) : [e.root];
|
|
2741
|
-
},
|
|
2747
|
+
}, Fo = function(e, t) {
|
|
2742
2748
|
const { all: n } = t.methods.two.transform.adjective || {};
|
|
2743
2749
|
return n ? n(e.root, t.model) : [e.root];
|
|
2744
2750
|
}, Kl = function(e, t) {
|
|
@@ -2746,7 +2752,7 @@ const Fl = function(e) {
|
|
|
2746
2752
|
if (n.root)
|
|
2747
2753
|
if (t.methods.two && t.methods.two.transform) {
|
|
2748
2754
|
let r = [];
|
|
2749
|
-
n.pos ? n.pos === "Verb" ? r = r.concat(Ho(n, t)) : n.pos === "Noun" ? r = r.concat(
|
|
2755
|
+
n.pos ? n.pos === "Verb" ? r = r.concat(Ho(n, t)) : n.pos === "Noun" ? r = r.concat(Go(n, t)) : n.pos === "Adjective" && (r = r.concat(Fo(n, t))) : (r = r.concat(Ho(n, t)), r = r.concat(Go(n, t)), r = r.concat(Fo(n, t))), r = r.filter((o) => o), r.length > 0 && (n.operator = "or", n.fastOr = new Set(r));
|
|
2750
2756
|
} else
|
|
2751
2757
|
n.machine = n.root, delete n.id, delete n.root;
|
|
2752
2758
|
return n;
|
|
@@ -3208,7 +3214,7 @@ const rh = function(e, t) {
|
|
|
3208
3214
|
return r && (e = r(e, n)), n.methods.one.parseMatch(e, t, n);
|
|
3209
3215
|
}
|
|
3210
3216
|
}, Ah = {
|
|
3211
|
-
api:
|
|
3217
|
+
api: Gl,
|
|
3212
3218
|
methods: Ph,
|
|
3213
3219
|
lib: kh
|
|
3214
3220
|
}, xh = /^\../, Ch = /^#./, $h = (e) => (e = e.replace(/&/g, "&"), e = e.replace(/</g, "<"), e = e.replace(/>/g, ">"), e = e.replace(/"/g, """), e = e.replace(/'/g, "'"), e), Nh = function(e) {
|
|
@@ -3237,7 +3243,7 @@ const rh = function(e, t) {
|
|
|
3237
3243
|
t.hasOwnProperty(a.id) && (r += t[a.id].join("")), r += a.pre || "", r += a.text || "", n.hasOwnProperty(a.id) && (r += n[a.id].join("")), r += a.post || "";
|
|
3238
3244
|
}
|
|
3239
3245
|
}), r;
|
|
3240
|
-
}, Ih = { html: Th }, Ha = /[,:;)\]*.?~!\u0022\uFF02\u201D\u2019\u00BB\u203A\u2032\u2033\u2034\u301E\u00B4—-]+$/, ar = /^[(['"*~\uFF02\u201C\u2018\u201F\u201B\u201E\u2E42\u201A\u00AB\u2039\u2035\u2036\u2037\u301D\u0060\u301F]+/, Eh = /[,:;)('"\u201D\]]/, Dh = /^[-–—]$/, Oh = / /,
|
|
3246
|
+
}, Ih = { html: Th }, Ha = /[,:;)\]*.?~!\u0022\uFF02\u201D\u2019\u00BB\u203A\u2032\u2033\u2034\u301E\u00B4—-]+$/, ar = /^[(['"*~\uFF02\u201C\u2018\u201F\u201B\u201E\u2E42\u201A\u00AB\u2039\u2035\u2036\u2037\u301D\u0060\u301F]+/, Eh = /[,:;)('"\u201D\]]/, Dh = /^[-–—]$/, Oh = / /, Qe = function(e, t, n = !0) {
|
|
3241
3247
|
let r = "";
|
|
3242
3248
|
return e.forEach((o) => {
|
|
3243
3249
|
let i = o.pre || "", a = o.post || "";
|
|
@@ -3250,7 +3256,7 @@ const rh = function(e, t) {
|
|
|
3250
3256
|
if (!e || !e[0] || !e[0][0])
|
|
3251
3257
|
return n;
|
|
3252
3258
|
for (let r = 0; r < e.length; r += 1)
|
|
3253
|
-
n +=
|
|
3259
|
+
n += Qe(e[r], t, !0);
|
|
3254
3260
|
if (t.keepSpace || (n = n.trim()), t.keepEndPunct === !1) {
|
|
3255
3261
|
e[0][0].tags.has("Emoticon") || (n = n.replace(ar, ""));
|
|
3256
3262
|
const r = e[e.length - 1];
|
|
@@ -3290,19 +3296,19 @@ const rh = function(e, t) {
|
|
|
3290
3296
|
};
|
|
3291
3297
|
Le.clean = Le.normal;
|
|
3292
3298
|
Le.reduced = Le.root;
|
|
3293
|
-
const
|
|
3294
|
-
let
|
|
3295
|
-
for (;
|
|
3296
|
-
|
|
3299
|
+
const Ga = [];
|
|
3300
|
+
let Xe = 0;
|
|
3301
|
+
for (; Xe < 64; )
|
|
3302
|
+
Ga[Xe] = 0 | Math.sin(++Xe % Math.PI) * 4294967296;
|
|
3297
3303
|
const zr = function(e) {
|
|
3298
3304
|
let t, n, r, o = decodeURI(encodeURI(e)) + "", i = o.length;
|
|
3299
3305
|
const a = [t = 1732584193, n = 4023233417, ~t, ~n], s = [];
|
|
3300
3306
|
for (e = --i / 4 + 2 | 15, s[--e] = i * 8; ~i; )
|
|
3301
3307
|
s[i >> 2] |= o.charCodeAt(i) << 8 * i--;
|
|
3302
|
-
for (
|
|
3308
|
+
for (Xe = o = 0; Xe < e; Xe += 16) {
|
|
3303
3309
|
for (i = a; o < 64; i = [
|
|
3304
3310
|
r = i[3],
|
|
3305
|
-
t + ((r = i[0] + [t & n | ~t & r, r & t | ~r & n, t ^ n ^ r, n ^ (t | ~r)][i = o >> 4] +
|
|
3311
|
+
t + ((r = i[0] + [t & n | ~t & r, r & t | ~r & n, t ^ n ^ r, n ^ (t | ~r)][i = o >> 4] + Ga[o] + ~~s[Xe | [o, 5 * o + 1, 3 * o + 5, 7 * o][i] & 15]) << (i = [7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21][4 * i + o++ % 4]) | r >>> -i),
|
|
3306
3312
|
t,
|
|
3307
3313
|
n
|
|
3308
3314
|
])
|
|
@@ -3312,18 +3318,18 @@ const zr = function(e) {
|
|
|
3312
3318
|
for (e = ""; o < 32; )
|
|
3313
3319
|
e += (a[o >> 3] >> (1 ^ o++) * 4 & 15).toString(16);
|
|
3314
3320
|
return e;
|
|
3315
|
-
},
|
|
3321
|
+
}, Gh = {
|
|
3316
3322
|
text: !0,
|
|
3317
3323
|
terms: !0
|
|
3318
3324
|
}, Bo = { case: "none", unicode: "some", form: "machine", punctuation: "some" }, Vn = function(e, t) {
|
|
3319
3325
|
return Object.assign({}, e, t);
|
|
3320
3326
|
}, Oe = {
|
|
3321
|
-
text: (e) =>
|
|
3322
|
-
normal: (e) =>
|
|
3323
|
-
implicit: (e) =>
|
|
3324
|
-
machine: (e) =>
|
|
3325
|
-
root: (e) =>
|
|
3326
|
-
hash: (e) => zr(
|
|
3327
|
+
text: (e) => Qe(e, { keepPunct: !0 }, !1),
|
|
3328
|
+
normal: (e) => Qe(e, Vn(Le.normal, { keepPunct: !0 }), !1),
|
|
3329
|
+
implicit: (e) => Qe(e, Vn(Le.implicit, { keepPunct: !0 }), !1),
|
|
3330
|
+
machine: (e) => Qe(e, Bo, !1),
|
|
3331
|
+
root: (e) => Qe(e, Vn(Bo, { form: "root" }), !1),
|
|
3332
|
+
hash: (e) => zr(Qe(e, { keepPunct: !0 }, !1)),
|
|
3327
3333
|
offset: (e) => {
|
|
3328
3334
|
const t = Oe.text(e).length;
|
|
3329
3335
|
return {
|
|
@@ -3344,8 +3350,8 @@ const zr = function(e) {
|
|
|
3344
3350
|
Oe.sentences = Oe.sentence;
|
|
3345
3351
|
Oe.clean = Oe.normal;
|
|
3346
3352
|
Oe.reduced = Oe.root;
|
|
3347
|
-
const
|
|
3348
|
-
return t = t || {}, typeof t == "string" && (t = {}), t = Object.assign({},
|
|
3353
|
+
const Fh = function(e, t) {
|
|
3354
|
+
return t = t || {}, typeof t == "string" && (t = {}), t = Object.assign({}, Gh, t), t.offset && e.compute("offset"), e.docs.map((n, r) => {
|
|
3349
3355
|
const o = {};
|
|
3350
3356
|
return Object.keys(t).forEach((i) => {
|
|
3351
3357
|
t[i] && Oe[i] && (o[i] = Oe[i](n, e, r));
|
|
@@ -3354,7 +3360,7 @@ const Gh = function(e, t) {
|
|
|
3354
3360
|
}, sr = {
|
|
3355
3361
|
/** return data */
|
|
3356
3362
|
json: function(e) {
|
|
3357
|
-
const t =
|
|
3363
|
+
const t = Fh(this, e);
|
|
3358
3364
|
return typeof e == "number" ? t[e] : t;
|
|
3359
3365
|
}
|
|
3360
3366
|
};
|
|
@@ -3372,7 +3378,7 @@ const Sh = () => typeof window < "u" && window.document, zh = function(e) {
|
|
|
3372
3378
|
n[i[3]] = { fn: t[r], end: i[2] };
|
|
3373
3379
|
});
|
|
3374
3380
|
}), n;
|
|
3375
|
-
},
|
|
3381
|
+
}, Fa = function(e, t) {
|
|
3376
3382
|
const n = Vh(e, t);
|
|
3377
3383
|
let r = "";
|
|
3378
3384
|
return e.docs.forEach((o, i) => {
|
|
@@ -3392,7 +3398,7 @@ const Sh = () => typeof window < "u" && window.document, zh = function(e) {
|
|
|
3392
3398
|
}), Object.keys(t).map((r) => ({ normal: r, count: t[r] })).sort((r, o) => r.count > o.count ? -1 : 0);
|
|
3393
3399
|
}, Wh = function(e) {
|
|
3394
3400
|
if (Mh(e))
|
|
3395
|
-
return
|
|
3401
|
+
return Fa(this, e);
|
|
3396
3402
|
if (e === "text")
|
|
3397
3403
|
return this.text();
|
|
3398
3404
|
if (e === "normal")
|
|
@@ -3426,7 +3432,7 @@ const Sh = () => typeof window < "u" && window.document, zh = function(e) {
|
|
|
3426
3432
|
out: Wh,
|
|
3427
3433
|
/** */
|
|
3428
3434
|
wrap: function(e) {
|
|
3429
|
-
return
|
|
3435
|
+
return Fa(this, e);
|
|
3430
3436
|
}
|
|
3431
3437
|
}, _h = (e) => Object.prototype.toString.call(e) === "[object Object]", Jh = {
|
|
3432
3438
|
/** */
|
|
@@ -3872,9 +3878,9 @@ const bd = function(e) {
|
|
|
3872
3878
|
let s = o[a];
|
|
3873
3879
|
s && (s = s.replace(/^#/, ""), La(i, s, n, r));
|
|
3874
3880
|
});
|
|
3875
|
-
},
|
|
3881
|
+
}, Gd = function(e) {
|
|
3876
3882
|
return Object.prototype.toString.call(e) === "[object Array]";
|
|
3877
|
-
},
|
|
3883
|
+
}, Fd = (e, t, n = "") => {
|
|
3878
3884
|
const r = (a) => "\x1B[33m\x1B[3m" + a + "\x1B[0m", o = (a) => "\x1B[3m" + a + "\x1B[0m", i = e.map((a) => a.text || "[" + a.implicit + "]").join(" ");
|
|
3879
3885
|
typeof t != "string" && t.length > 2 && (t = t.slice(0, 2).join(", #") + " +"), t = typeof t != "string" ? t.join(", #") : t, console.log(` ${r(i).padEnd(24)} \x1B[32m→\x1B[0m #${t.padEnd(22)} ${o(n)}`);
|
|
3880
3886
|
}, Wa = function(e, t, n = {}, r, o) {
|
|
@@ -3882,7 +3888,7 @@ const bd = function(e) {
|
|
|
3882
3888
|
if (!t)
|
|
3883
3889
|
return;
|
|
3884
3890
|
const a = typeof process > "u" || !process.env ? self.env || {} : process.env;
|
|
3885
|
-
if (a && a.DEBUG_TAGS &&
|
|
3891
|
+
if (a && a.DEBUG_TAGS && Fd(e, t, o), Gd(t) === !0) {
|
|
3886
3892
|
t.forEach((s) => Wa(e, s, n, r));
|
|
3887
3893
|
return;
|
|
3888
3894
|
}
|
|
@@ -4110,7 +4116,7 @@ const Ka = function(e) {
|
|
|
4110
4116
|
Ka.prototype.plugin = function(e) {
|
|
4111
4117
|
e(this);
|
|
4112
4118
|
};
|
|
4113
|
-
const
|
|
4119
|
+
const ut = {
|
|
4114
4120
|
Noun: "blue",
|
|
4115
4121
|
Verb: "green",
|
|
4116
4122
|
Negative: "green",
|
|
@@ -4123,12 +4129,12 @@ const at = {
|
|
|
4123
4129
|
Hyphenated: "cyan",
|
|
4124
4130
|
Adverb: "cyan"
|
|
4125
4131
|
}, Ud = function(e) {
|
|
4126
|
-
if (
|
|
4127
|
-
return
|
|
4128
|
-
if (
|
|
4129
|
-
return
|
|
4130
|
-
const t = e._cache.parents.find((n) =>
|
|
4131
|
-
return
|
|
4132
|
+
if (ut.hasOwnProperty(e.id))
|
|
4133
|
+
return ut[e.id];
|
|
4134
|
+
if (ut.hasOwnProperty(e.is))
|
|
4135
|
+
return ut[e.is];
|
|
4136
|
+
const t = e._cache.parents.find((n) => ut[n]);
|
|
4137
|
+
return ut[t];
|
|
4132
4138
|
}, Rd = function(e) {
|
|
4133
4139
|
const t = {};
|
|
4134
4140
|
return e.forEach((n) => {
|
|
@@ -4427,7 +4433,7 @@ let lr = [
|
|
|
4427
4433
|
lr = lr.reduce((e, t) => (e[t] = !0, e), {});
|
|
4428
4434
|
const Hf = function(e) {
|
|
4429
4435
|
return Object.prototype.toString.call(e) === "[object Array]";
|
|
4430
|
-
},
|
|
4436
|
+
}, Gf = function(e, t) {
|
|
4431
4437
|
let n = [], r = [];
|
|
4432
4438
|
if (e = e || "", typeof e == "number" && (e = String(e)), Hf(e))
|
|
4433
4439
|
return e;
|
|
@@ -4445,7 +4451,7 @@ const Hf = function(e) {
|
|
|
4445
4451
|
Ef.test(s) === !0 && lr.hasOwnProperty(s) === !1 && Df.test(s) === !1 ? (n.length > 0 ? (n[n.length - 1] += i, n.push(s)) : n.push(i + s), i = "") : i += s;
|
|
4446
4452
|
}
|
|
4447
4453
|
return i && (n.length === 0 && (n[0] = ""), n[n.length - 1] += i), n = If(n), n = jf(n), n = n.filter((a) => a), n;
|
|
4448
|
-
}, Zo = /\p{Letter}/u, qt = /[\p{Number}\p{Currency_Symbol}]/u,
|
|
4454
|
+
}, Zo = /\p{Letter}/u, qt = /[\p{Number}\p{Currency_Symbol}]/u, Ff = /^[a-z]\.([a-z]\.)+/i, Sf = /[sn]['’]$/, zf = function(e, t) {
|
|
4449
4455
|
const { prePunctuation: n, postPunctuation: r, emoticons: o } = t.one;
|
|
4450
4456
|
let i = e, a = "", s = "";
|
|
4451
4457
|
const u = Array.from(e);
|
|
@@ -4466,7 +4472,7 @@ const Hf = function(e) {
|
|
|
4466
4472
|
if (r[h] !== !0) {
|
|
4467
4473
|
if (Zo.test(h) || qt.test(h))
|
|
4468
4474
|
break;
|
|
4469
|
-
h === "." &&
|
|
4475
|
+
h === "." && Ff.test(i) === !0 || h === "'" && Sf.test(i) === !0 || (s = u.pop() + s);
|
|
4470
4476
|
}
|
|
4471
4477
|
}
|
|
4472
4478
|
return e = u.join(""), e === "" && (i = i.replace(/ *$/, (l) => (s = l || "", "")), e = i, a = ""), { str: e, pre: a, post: s };
|
|
@@ -4516,7 +4522,7 @@ const Hf = function(e) {
|
|
|
4516
4522
|
tokenize: {
|
|
4517
4523
|
splitSentences: Cf,
|
|
4518
4524
|
isSentence: ep,
|
|
4519
|
-
splitTerms:
|
|
4525
|
+
splitTerms: Gf,
|
|
4520
4526
|
splitWhitespace: Bf,
|
|
4521
4527
|
fromString: Rf
|
|
4522
4528
|
}
|
|
@@ -5038,7 +5044,7 @@ const fp = {
|
|
|
5038
5044
|
}, Op = (e) => Object.prototype.toString.call(e) === "[object Object]", Hp = {
|
|
5039
5045
|
safe: !0,
|
|
5040
5046
|
min: 3
|
|
5041
|
-
},
|
|
5047
|
+
}, Gp = function(e = [], t = {}) {
|
|
5042
5048
|
const n = this.model();
|
|
5043
5049
|
t = Object.assign({}, Hp, t), Op(e) && (Object.assign(n.one.lexicon, e), e = Object.keys(e));
|
|
5044
5050
|
const r = Dp(e, t, this.world());
|
|
@@ -5049,8 +5055,8 @@ const fp = {
|
|
|
5049
5055
|
}
|
|
5050
5056
|
n.one.typeahead[o] = r[o];
|
|
5051
5057
|
}), this;
|
|
5052
|
-
},
|
|
5053
|
-
typeahead:
|
|
5058
|
+
}, Fp = {
|
|
5059
|
+
typeahead: Gp
|
|
5054
5060
|
}, Sp = {
|
|
5055
5061
|
one: {
|
|
5056
5062
|
typeahead: {}
|
|
@@ -5059,7 +5065,7 @@ const fp = {
|
|
|
5059
5065
|
}, zp = {
|
|
5060
5066
|
model: Sp,
|
|
5061
5067
|
api: Ep,
|
|
5062
|
-
lib:
|
|
5068
|
+
lib: Fp,
|
|
5063
5069
|
compute: Tp,
|
|
5064
5070
|
hooks: ["typeahead"]
|
|
5065
5071
|
};
|
|
@@ -5243,26 +5249,26 @@ const qa = {
|
|
|
5243
5249
|
Verb: "true¦born,cannot,gonna,has,keep tabs,msg",
|
|
5244
5250
|
"Person|Verb": "true¦b8ch7dr6foster,gra5ja9lan4ma2ni9ollie,p1rob,s0wade;kip,pike,t5ue;at,eg,ier2;ck,r0;k,shal;ce;ce,nt;ew;ase,u1;iff,l1ob,u0;ck;aze,ossom",
|
|
5245
5251
|
"Person|Date": "true¦a2j0sep;an0une;!uary;p0ugust,v0;ril"
|
|
5246
|
-
},
|
|
5252
|
+
}, Ye = 36, hr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", ti = hr.split("").reduce(function(e, t, n) {
|
|
5247
5253
|
return e[t] = n, e;
|
|
5248
5254
|
}, {}), Bp = function(e) {
|
|
5249
5255
|
if (hr[e] !== void 0)
|
|
5250
5256
|
return hr[e];
|
|
5251
|
-
let t = 1, n =
|
|
5252
|
-
for (; e >= n; e -= n, t++, n *=
|
|
5257
|
+
let t = 1, n = Ye, r = "";
|
|
5258
|
+
for (; e >= n; e -= n, t++, n *= Ye)
|
|
5253
5259
|
;
|
|
5254
5260
|
for (; t--; ) {
|
|
5255
|
-
const o = e %
|
|
5256
|
-
r = String.fromCharCode((o < 10 ? 48 : 55) + o) + r, e = (e - o) /
|
|
5261
|
+
const o = e % Ye;
|
|
5262
|
+
r = String.fromCharCode((o < 10 ? 48 : 55) + o) + r, e = (e - o) / Ye;
|
|
5257
5263
|
}
|
|
5258
5264
|
return r;
|
|
5259
5265
|
}, Vp = function(e) {
|
|
5260
5266
|
if (ti[e] !== void 0)
|
|
5261
5267
|
return ti[e];
|
|
5262
|
-
let t = 0, n = 1, r =
|
|
5263
|
-
for (; n < e.length; t += r, n++, r *=
|
|
5268
|
+
let t = 0, n = 1, r = Ye, o = 1;
|
|
5269
|
+
for (; n < e.length; t += r, n++, r *= Ye)
|
|
5264
5270
|
;
|
|
5265
|
-
for (let i = e.length - 1; i >= 0; i--, o *=
|
|
5271
|
+
for (let i = e.length - 1; i >= 0; i--, o *= Ye) {
|
|
5266
5272
|
let a = e.charCodeAt(i) - 48;
|
|
5267
5273
|
a > 10 && (a -= 7), t += a * o;
|
|
5268
5274
|
}
|
|
@@ -6503,26 +6509,26 @@ const f = "Singular", H = {
|
|
|
6503
6509
|
afterTags: Object.assign({}, Ve.afterTags, H.afterTags, Xt.afterTags),
|
|
6504
6510
|
beforeWords: Object.assign({}, Ve.beforeWords, H.beforeWords, Xt.beforeWords),
|
|
6505
6511
|
afterWords: Object.assign({}, Ve.afterWords, H.afterWords, Xt.afterWords)
|
|
6506
|
-
},
|
|
6512
|
+
}, ct = "Singular", Ke = "Infinitive", ag = {
|
|
6507
6513
|
beforeTags: Object.assign({}, Z.beforeTags, H.beforeTags, {
|
|
6508
6514
|
// Noun: undefined
|
|
6509
|
-
Adjective:
|
|
6515
|
+
Adjective: ct,
|
|
6510
6516
|
//great name
|
|
6511
|
-
Particle:
|
|
6517
|
+
Particle: ct
|
|
6512
6518
|
//brought under control
|
|
6513
6519
|
}),
|
|
6514
6520
|
afterTags: Object.assign({}, Z.afterTags, H.afterTags, {
|
|
6515
6521
|
ProperNoun: Ke,
|
|
6516
6522
|
Gerund: Ke,
|
|
6517
6523
|
Adjective: Ke,
|
|
6518
|
-
Copula:
|
|
6524
|
+
Copula: ct
|
|
6519
6525
|
}),
|
|
6520
6526
|
beforeWords: Object.assign({}, Z.beforeWords, H.beforeWords, {
|
|
6521
6527
|
// is time
|
|
6522
|
-
is:
|
|
6523
|
-
was:
|
|
6528
|
+
is: ct,
|
|
6529
|
+
was: ct,
|
|
6524
6530
|
//balance of power
|
|
6525
|
-
of:
|
|
6531
|
+
of: ct,
|
|
6526
6532
|
have: null
|
|
6527
6533
|
//have cash
|
|
6528
6534
|
}),
|
|
@@ -6586,43 +6592,43 @@ const f = "Singular", H = {
|
|
|
6586
6592
|
wanted: x
|
|
6587
6593
|
// and:true, //sue and jeff
|
|
6588
6594
|
}
|
|
6589
|
-
},
|
|
6595
|
+
}, D = "Month", sg = "Person", Yt = {
|
|
6590
6596
|
beforeTags: {
|
|
6591
|
-
Date:
|
|
6592
|
-
Value:
|
|
6597
|
+
Date: D,
|
|
6598
|
+
Value: D
|
|
6593
6599
|
},
|
|
6594
6600
|
afterTags: {
|
|
6595
|
-
Date:
|
|
6596
|
-
Value:
|
|
6601
|
+
Date: D,
|
|
6602
|
+
Value: D
|
|
6597
6603
|
},
|
|
6598
6604
|
beforeWords: {
|
|
6599
|
-
by:
|
|
6600
|
-
in:
|
|
6601
|
-
on:
|
|
6602
|
-
during:
|
|
6603
|
-
after:
|
|
6604
|
-
before:
|
|
6605
|
-
between:
|
|
6606
|
-
until:
|
|
6607
|
-
til:
|
|
6608
|
-
sometime:
|
|
6609
|
-
of:
|
|
6605
|
+
by: D,
|
|
6606
|
+
in: D,
|
|
6607
|
+
on: D,
|
|
6608
|
+
during: D,
|
|
6609
|
+
after: D,
|
|
6610
|
+
before: D,
|
|
6611
|
+
between: D,
|
|
6612
|
+
until: D,
|
|
6613
|
+
til: D,
|
|
6614
|
+
sometime: D,
|
|
6615
|
+
of: D,
|
|
6610
6616
|
//5th of april
|
|
6611
|
-
this:
|
|
6617
|
+
this: D,
|
|
6612
6618
|
//this april
|
|
6613
|
-
next:
|
|
6614
|
-
last:
|
|
6615
|
-
previous:
|
|
6616
|
-
following:
|
|
6619
|
+
next: D,
|
|
6620
|
+
last: D,
|
|
6621
|
+
previous: D,
|
|
6622
|
+
following: D,
|
|
6617
6623
|
with: sg
|
|
6618
6624
|
// for: p,
|
|
6619
6625
|
},
|
|
6620
6626
|
afterWords: {
|
|
6621
|
-
sometime:
|
|
6622
|
-
in:
|
|
6623
|
-
of:
|
|
6624
|
-
until:
|
|
6625
|
-
the:
|
|
6627
|
+
sometime: D,
|
|
6628
|
+
in: D,
|
|
6629
|
+
of: D,
|
|
6630
|
+
until: D,
|
|
6631
|
+
the: D
|
|
6626
6632
|
//june the 4th
|
|
6627
6633
|
}
|
|
6628
6634
|
}, ug = {
|
|
@@ -6697,7 +6703,7 @@ const f = "Singular", H = {
|
|
|
6697
6703
|
long: ce
|
|
6698
6704
|
//foot long
|
|
6699
6705
|
}
|
|
6700
|
-
},
|
|
6706
|
+
}, yt = {
|
|
6701
6707
|
"Actor|Verb": Yp,
|
|
6702
6708
|
"Adj|Gerund": eg,
|
|
6703
6709
|
"Adj|Noun": tg,
|
|
@@ -6715,13 +6721,13 @@ const f = "Singular", H = {
|
|
|
6715
6721
|
const n = Object.keys(e).reduce((r, o) => (r[o] = e[o] === "Infinitive" ? "PresentTense" : "Plural", r), {});
|
|
6716
6722
|
return Object.assign(n, t);
|
|
6717
6723
|
};
|
|
6718
|
-
|
|
6719
|
-
beforeWords: tn(
|
|
6724
|
+
yt["Plural|Verb"] = {
|
|
6725
|
+
beforeWords: tn(yt["Noun|Verb"].beforeWords, {
|
|
6720
6726
|
had: "Plural",
|
|
6721
6727
|
//had tears
|
|
6722
6728
|
have: "Plural"
|
|
6723
6729
|
}),
|
|
6724
|
-
afterWords: tn(
|
|
6730
|
+
afterWords: tn(yt["Noun|Verb"].afterWords, {
|
|
6725
6731
|
his: "PresentTense",
|
|
6726
6732
|
her: "PresentTense",
|
|
6727
6733
|
its: "PresentTense",
|
|
@@ -6732,7 +6738,7 @@ bt["Plural|Verb"] = {
|
|
|
6732
6738
|
by: "PresentTense"
|
|
6733
6739
|
//it works by
|
|
6734
6740
|
}),
|
|
6735
|
-
beforeTags: tn(
|
|
6741
|
+
beforeTags: tn(yt["Noun|Verb"].beforeTags, {
|
|
6736
6742
|
Conjunction: "PresentTense",
|
|
6737
6743
|
//and changes
|
|
6738
6744
|
Noun: void 0,
|
|
@@ -6740,7 +6746,7 @@ bt["Plural|Verb"] = {
|
|
|
6740
6746
|
ProperNoun: "PresentTense"
|
|
6741
6747
|
//john plays
|
|
6742
6748
|
}),
|
|
6743
|
-
afterTags: tn(
|
|
6749
|
+
afterTags: tn(yt["Noun|Verb"].afterTags, {
|
|
6744
6750
|
Gerund: "Plural",
|
|
6745
6751
|
//ice caps disappearing
|
|
6746
6752
|
Noun: "PresentTense",
|
|
@@ -6749,7 +6755,7 @@ bt["Plural|Verb"] = {
|
|
|
6749
6755
|
//changes seven gears
|
|
6750
6756
|
})
|
|
6751
6757
|
};
|
|
6752
|
-
const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W = "PastTense",
|
|
6758
|
+
const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W = "PastTense", lt = "Adverb", ne = "Plural", G = "Actor", nn = "Verb", q = "Noun", pg = "ProperNoun", fe = "LastName", ri = "Modal", C = "Place", Wn = "Participle", gg = [
|
|
6753
6759
|
null,
|
|
6754
6760
|
null,
|
|
6755
6761
|
{
|
|
@@ -6757,7 +6763,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6757
6763
|
ea: w,
|
|
6758
6764
|
ia: q,
|
|
6759
6765
|
ic: A,
|
|
6760
|
-
ly:
|
|
6766
|
+
ly: lt,
|
|
6761
6767
|
"'n": nn,
|
|
6762
6768
|
"'t": nn
|
|
6763
6769
|
},
|
|
@@ -6766,7 +6772,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6766
6772
|
oed: W,
|
|
6767
6773
|
ued: W,
|
|
6768
6774
|
xed: W,
|
|
6769
|
-
" so":
|
|
6775
|
+
" so": lt,
|
|
6770
6776
|
"'ll": ri,
|
|
6771
6777
|
"'re": "Copula",
|
|
6772
6778
|
azy: A,
|
|
@@ -6836,7 +6842,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6836
6842
|
wner: w,
|
|
6837
6843
|
//owner
|
|
6838
6844
|
fies: _e,
|
|
6839
|
-
fore:
|
|
6845
|
+
fore: lt,
|
|
6840
6846
|
gate: L,
|
|
6841
6847
|
gone: A,
|
|
6842
6848
|
ices: ne,
|
|
@@ -6867,13 +6873,13 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6867
6873
|
fier: w,
|
|
6868
6874
|
wned: W,
|
|
6869
6875
|
gent: w,
|
|
6870
|
-
tist:
|
|
6871
|
-
pist:
|
|
6872
|
-
rist:
|
|
6873
|
-
mist:
|
|
6874
|
-
yist:
|
|
6875
|
-
vist:
|
|
6876
|
-
ists:
|
|
6876
|
+
tist: G,
|
|
6877
|
+
pist: G,
|
|
6878
|
+
rist: G,
|
|
6879
|
+
mist: G,
|
|
6880
|
+
yist: G,
|
|
6881
|
+
vist: G,
|
|
6882
|
+
ists: G,
|
|
6877
6883
|
lite: w,
|
|
6878
6884
|
site: w,
|
|
6879
6885
|
rite: w,
|
|
@@ -6883,8 +6889,8 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6883
6889
|
date: w,
|
|
6884
6890
|
ndal: w,
|
|
6885
6891
|
vent: w,
|
|
6886
|
-
uist:
|
|
6887
|
-
gist:
|
|
6892
|
+
uist: G,
|
|
6893
|
+
gist: G,
|
|
6888
6894
|
note: w,
|
|
6889
6895
|
cide: w,
|
|
6890
6896
|
//homicide
|
|
@@ -6905,7 +6911,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6905
6911
|
nary: A,
|
|
6906
6912
|
ghty: A,
|
|
6907
6913
|
uent: A,
|
|
6908
|
-
erer:
|
|
6914
|
+
erer: G,
|
|
6909
6915
|
//caterer
|
|
6910
6916
|
bury: C,
|
|
6911
6917
|
dorf: q,
|
|
@@ -6921,7 +6927,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6921
6927
|
},
|
|
6922
6928
|
{
|
|
6923
6929
|
//5-letter
|
|
6924
|
-
elist:
|
|
6930
|
+
elist: G,
|
|
6925
6931
|
holic: w,
|
|
6926
6932
|
phite: w,
|
|
6927
6933
|
tized: W,
|
|
@@ -6930,7 +6936,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6930
6936
|
ances: ne,
|
|
6931
6937
|
bound: A,
|
|
6932
6938
|
ettes: ne,
|
|
6933
|
-
fully:
|
|
6939
|
+
fully: lt,
|
|
6934
6940
|
ishes: _e,
|
|
6935
6941
|
ities: ne,
|
|
6936
6942
|
marek: fe,
|
|
@@ -6943,8 +6949,8 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6943
6949
|
tches: _e,
|
|
6944
6950
|
tieth: "Ordinal",
|
|
6945
6951
|
tures: ne,
|
|
6946
|
-
wards:
|
|
6947
|
-
where:
|
|
6952
|
+
wards: lt,
|
|
6953
|
+
where: lt,
|
|
6948
6954
|
archy: q,
|
|
6949
6955
|
pathy: q,
|
|
6950
6956
|
opoly: q,
|
|
@@ -6952,11 +6958,11 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6952
6958
|
phate: q,
|
|
6953
6959
|
ndent: w,
|
|
6954
6960
|
scent: w,
|
|
6955
|
-
onist:
|
|
6956
|
-
anist:
|
|
6957
|
-
alist:
|
|
6958
|
-
olist:
|
|
6959
|
-
icist:
|
|
6961
|
+
onist: G,
|
|
6962
|
+
anist: G,
|
|
6963
|
+
alist: G,
|
|
6964
|
+
olist: G,
|
|
6965
|
+
icist: G,
|
|
6960
6966
|
ounce: L,
|
|
6961
6967
|
iable: A,
|
|
6962
6968
|
borne: A,
|
|
@@ -6967,7 +6973,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6967
6973
|
// ctory: Adj,
|
|
6968
6974
|
rient: w,
|
|
6969
6975
|
dient: w,
|
|
6970
|
-
maker:
|
|
6976
|
+
maker: G,
|
|
6971
6977
|
burgh: C,
|
|
6972
6978
|
mouth: C,
|
|
6973
6979
|
ceter: C,
|
|
@@ -6989,12 +6995,12 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
6989
6995
|
ionary: w,
|
|
6990
6996
|
cklist: w,
|
|
6991
6997
|
brooke: C,
|
|
6992
|
-
keeper:
|
|
6993
|
-
logist:
|
|
6998
|
+
keeper: G,
|
|
6999
|
+
logist: G,
|
|
6994
7000
|
teenth: "Value",
|
|
6995
|
-
worker:
|
|
6996
|
-
master:
|
|
6997
|
-
writer:
|
|
7001
|
+
worker: G,
|
|
7002
|
+
master: G,
|
|
7003
|
+
writer: G,
|
|
6998
7004
|
brough: C,
|
|
6999
7005
|
cester: C,
|
|
7000
7006
|
ington: C,
|
|
@@ -7004,7 +7010,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
7004
7010
|
{
|
|
7005
7011
|
//7-letter
|
|
7006
7012
|
chester: C,
|
|
7007
|
-
logists:
|
|
7013
|
+
logists: G,
|
|
7008
7014
|
opoulos: fe,
|
|
7009
7015
|
borough: C,
|
|
7010
7016
|
sdottir: fe
|
|
@@ -7276,7 +7282,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
7276
7282
|
["who", T],
|
|
7277
7283
|
["jr", "Person"]
|
|
7278
7284
|
]
|
|
7279
|
-
},
|
|
7285
|
+
}, ot = {
|
|
7280
7286
|
Comparative: {
|
|
7281
7287
|
fwd: "3:ser,ier¦1er:h,t,f,l,n¦1r:e¦2er:ss,or,om",
|
|
7282
7288
|
both: "3er:ver,ear,alm¦3ner:hin¦3ter:lat¦2mer:im¦2er:ng,rm,mb¦2ber:ib¦2ger:ig¦1er:w,p,k,d¦ier:y",
|
|
@@ -7369,9 +7375,9 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
7369
7375
|
}, sn = function(e) {
|
|
7370
7376
|
let t = kg(e);
|
|
7371
7377
|
return Object.keys(t).reduce((n, r) => (n[r] = Ag(r, t[r]), n), {});
|
|
7372
|
-
},
|
|
7378
|
+
}, it = function(e = {}) {
|
|
7373
7379
|
return typeof e == "string" && (e = JSON.parse(e)), e.fwd = sn(e.fwd || ""), e.both = sn(e.both || ""), e.rev = sn(e.rev || ""), e.ex = sn(e.ex || ""), e;
|
|
7374
|
-
}, Qa =
|
|
7380
|
+
}, Qa = it(ot.PastTense), Za = it(ot.PresentTense), Xa = it(ot.Gerund), Ya = it(ot.Participle), xg = xt(Qa), Cg = xt(Za), $g = xt(Xa), Ng = xt(Ya), es = it(ot.Comparative), ts = it(ot.Superlative), jg = xt(es), Tg = xt(ts), Ig = it(ot.AdjToNoun), ns = {
|
|
7375
7381
|
fromPast: Qa,
|
|
7376
7382
|
fromPresent: Za,
|
|
7377
7383
|
fromGerund: Xa,
|
|
@@ -7656,7 +7662,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
7656
7662
|
"university",
|
|
7657
7663
|
"utilities",
|
|
7658
7664
|
"workers"
|
|
7659
|
-
].reduce((e, t) => (e[t] = !0, e), {}),
|
|
7665
|
+
].reduce((e, t) => (e[t] = !0, e), {}), Gg = [
|
|
7660
7666
|
// geology
|
|
7661
7667
|
"atoll",
|
|
7662
7668
|
"basin",
|
|
@@ -7895,10 +7901,10 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
7895
7901
|
[/(ss)$/i, "$1"],
|
|
7896
7902
|
[/(ic)s$/i, "$1"],
|
|
7897
7903
|
[/s$/i, ""]
|
|
7898
|
-
],
|
|
7904
|
+
], Fg = function(e) {
|
|
7899
7905
|
return Object.keys(e).reduce((t, n) => (t[e[n]] = n, t), {});
|
|
7900
7906
|
}, rs = function(e, t) {
|
|
7901
|
-
const { irregularPlurals: n } = t.two, r =
|
|
7907
|
+
const { irregularPlurals: n } = t.two, r = Fg(n);
|
|
7902
7908
|
if (r.hasOwnProperty(e))
|
|
7903
7909
|
return r[e];
|
|
7904
7910
|
for (let o = 0; o < un.length; o++)
|
|
@@ -7911,7 +7917,7 @@ const A = "Adjective", L = "Infinitive", _e = "PresentTense", w = "Singular", W
|
|
|
7911
7917
|
const o = rs(e, t);
|
|
7912
7918
|
return o !== e && n.push(o), n;
|
|
7913
7919
|
}, zg = { toPlural: In, toSingular: rs, all: Sg };
|
|
7914
|
-
let
|
|
7920
|
+
let et = {
|
|
7915
7921
|
Gerund: ["ing"],
|
|
7916
7922
|
Actor: ["erer"],
|
|
7917
7923
|
Infinitive: [
|
|
@@ -7996,13 +8002,13 @@ let Ye = {
|
|
|
7996
8002
|
],
|
|
7997
8003
|
Participle: ["ken", "wn"]
|
|
7998
8004
|
};
|
|
7999
|
-
|
|
8005
|
+
et = Object.keys(et).reduce((e, t) => (et[t].forEach((n) => e[n] = t), e), {});
|
|
8000
8006
|
const os = function(e) {
|
|
8001
8007
|
const t = e.substring(e.length - 3);
|
|
8002
|
-
if (
|
|
8003
|
-
return
|
|
8008
|
+
if (et.hasOwnProperty(t) === !0)
|
|
8009
|
+
return et[t];
|
|
8004
8010
|
const n = e.substring(e.length - 2);
|
|
8005
|
-
return
|
|
8011
|
+
return et.hasOwnProperty(n) === !0 ? et[n] : e.substring(e.length - 1) === "s" ? "PresentTense" : null;
|
|
8006
8012
|
}, Bg = function(e, t) {
|
|
8007
8013
|
let n = "", r = {};
|
|
8008
8014
|
t.one && t.one.prefixes && (r = t.one.prefixes);
|
|
@@ -8550,10 +8556,10 @@ let br = {
|
|
|
8550
8556
|
regexText: Dg,
|
|
8551
8557
|
regexNumbers: Og,
|
|
8552
8558
|
switches: fr,
|
|
8553
|
-
clues:
|
|
8559
|
+
clues: yt,
|
|
8554
8560
|
uncountable: {},
|
|
8555
8561
|
orgWords: Hg,
|
|
8556
|
-
placeWords:
|
|
8562
|
+
placeWords: Gg
|
|
8557
8563
|
}
|
|
8558
8564
|
};
|
|
8559
8565
|
br = lm(br);
|
|
@@ -8584,7 +8590,7 @@ const hm = function(e, t, n, r) {
|
|
|
8584
8590
|
}, pm = (e, t, n = "") => {
|
|
8585
8591
|
const r = (a) => "\x1B[33m\x1B[3m" + a + "\x1B[0m", o = (a) => "\x1B[3m" + a + "\x1B[0m", i = e.text || "[" + e.implicit + "]";
|
|
8586
8592
|
typeof t != "string" && t.length > 2 && (t = t.slice(0, 2).join(", #") + " +"), t = typeof t != "string" ? t.join(", #") : t, console.log(` ${r(i).padEnd(24)} \x1B[32m→\x1B[0m #${t.padEnd(22)} ${o(n)}`);
|
|
8587
|
-
},
|
|
8593
|
+
}, F = function(e, t, n) {
|
|
8588
8594
|
if (!t || t.length === 0 || e.frozen === !0)
|
|
8589
8595
|
return;
|
|
8590
8596
|
const r = typeof process > "u" || !process.env ? self.env || {} : process.env;
|
|
@@ -8600,19 +8606,19 @@ const hm = function(e, t, n, r) {
|
|
|
8600
8606
|
"Honorific",
|
|
8601
8607
|
"Month"
|
|
8602
8608
|
], mm = function(e) {
|
|
8603
|
-
!e.tags.has("Noun") || e.tags.has("Plural") || e.tags.has("Singular") || gm.find((t) => e.tags.has(t)) || (ss(e.normal) ?
|
|
8609
|
+
!e.tags.has("Noun") || e.tags.has("Plural") || e.tags.has("Singular") || gm.find((t) => e.tags.has(t)) || (ss(e.normal) ? F(e, "Plural", "3-plural-guess") : F(e, "Singular", "3-singular-guess"));
|
|
8604
8610
|
}, bm = function(e) {
|
|
8605
8611
|
const t = e.tags;
|
|
8606
8612
|
if (t.has("Verb") && t.size === 1) {
|
|
8607
8613
|
const n = os(e.normal);
|
|
8608
|
-
n &&
|
|
8614
|
+
n && F(e, n, "3-verb-tense-guess");
|
|
8609
8615
|
}
|
|
8610
8616
|
}, _t = function(e, t, n) {
|
|
8611
8617
|
const r = e[t], o = Array.from(r.tags);
|
|
8612
8618
|
for (let i = 0; i < o.length; i += 1)
|
|
8613
8619
|
if (n.one.tagSet[o[i]]) {
|
|
8614
8620
|
const a = n.one.tagSet[o[i]].parents;
|
|
8615
|
-
|
|
8621
|
+
F(r, a, ` -inferred by #${o[i]}`);
|
|
8616
8622
|
}
|
|
8617
8623
|
mm(r), bm(r);
|
|
8618
8624
|
}, ym = /^\p{Lu}[\p{Ll}'’]/u, vm = /[0-9]/, wm = ["Date", "Month", "WeekDay", "Unit", "Expression"], Pm = /[IVX]/, km = /^[IVXLCDM]{2,}$/, Am = /^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/, xm = {
|
|
@@ -8625,7 +8631,7 @@ const hm = function(e, t, n, r) {
|
|
|
8625
8631
|
const r = e[t];
|
|
8626
8632
|
r.index = r.index || [0, 0];
|
|
8627
8633
|
const o = r.index[1], i = r.text || "";
|
|
8628
|
-
return o !== 0 && ym.test(i) === !0 && vm.test(i) === !1 ? wm.find((a) => r.tags.has(a)) || r.pre.match(/["']$/) || r.normal === "the" ? null : (_t(e, t, n), !r.tags.has("Noun") && !r.frozen && r.tags.clear(),
|
|
8634
|
+
return o !== 0 && ym.test(i) === !0 && vm.test(i) === !1 ? wm.find((a) => r.tags.has(a)) || r.pre.match(/["']$/) || r.normal === "the" ? null : (_t(e, t, n), !r.tags.has("Noun") && !r.frozen && r.tags.clear(), F(r, "ProperNoun", "2-titlecase"), !0) : i.length >= 2 && km.test(i) && Pm.test(i) && Am.test(i) && !xm[r.normal] ? (F(r, "RomanNumeral", "2-xvii"), !0) : null;
|
|
8629
8635
|
}, yi = function(e = "", t = []) {
|
|
8630
8636
|
const n = e.length;
|
|
8631
8637
|
let r = 7;
|
|
@@ -8641,9 +8647,9 @@ const hm = function(e, t, n, r) {
|
|
|
8641
8647
|
if (r.tags.size === 0) {
|
|
8642
8648
|
let o = yi(r.normal, n.two.suffixPatterns);
|
|
8643
8649
|
if (o !== null)
|
|
8644
|
-
return
|
|
8650
|
+
return F(r, o, "2-suffix"), r.confidence = 0.7, !0;
|
|
8645
8651
|
if (r.implicit && (o = yi(r.implicit, n.two.suffixPatterns), o !== null))
|
|
8646
|
-
return
|
|
8652
|
+
return F(r, o, "2-implicit-suffix"), r.confidence = 0.7, !0;
|
|
8647
8653
|
}
|
|
8648
8654
|
return null;
|
|
8649
8655
|
}, vi = /['‘’‛‵′`´]/, Kn = function(e, t) {
|
|
@@ -8681,7 +8687,7 @@ const hm = function(e, t, n, r) {
|
|
|
8681
8687
|
if (r.tags.size === 0) {
|
|
8682
8688
|
const o = Tm(r.normal, n.two.prefixPatterns);
|
|
8683
8689
|
if (o !== null)
|
|
8684
|
-
return
|
|
8690
|
+
return F(r, o, "2-prefix"), r.confidence = 0.5, !0;
|
|
8685
8691
|
}
|
|
8686
8692
|
return null;
|
|
8687
8693
|
}, Em = 1400, Dm = 2100, Om = /* @__PURE__ */ new Set([
|
|
@@ -8725,22 +8731,22 @@ const hm = function(e, t, n, r) {
|
|
|
8725
8731
|
if (r && !isNaN(r) && r > Em && r < Dm) {
|
|
8726
8732
|
const o = e[t - 1], i = e[t + 1];
|
|
8727
8733
|
if (wi(o) || wi(i))
|
|
8728
|
-
return
|
|
8734
|
+
return F(n, "Year", "2-tagYear");
|
|
8729
8735
|
if (r >= 1920 && r < 2025) {
|
|
8730
8736
|
if (Pi(o) || Pi(i))
|
|
8731
|
-
return
|
|
8737
|
+
return F(n, "Year", "2-tagYear-close");
|
|
8732
8738
|
if (ki(e[t - 2]) || ki(e[t + 2]))
|
|
8733
|
-
return
|
|
8739
|
+
return F(n, "Year", "2-tagYear-far");
|
|
8734
8740
|
if (o && (o.tags.has("Determiner") || o.tags.has("Possessive")) && i && i.tags.has("Noun") && !i.tags.has("Plural"))
|
|
8735
|
-
return
|
|
8741
|
+
return F(n, "Year", "2-tagYear-noun");
|
|
8736
8742
|
}
|
|
8737
8743
|
}
|
|
8738
8744
|
}
|
|
8739
8745
|
return null;
|
|
8740
|
-
},
|
|
8746
|
+
}, Gm = function(e, t, n, r) {
|
|
8741
8747
|
const o = r.methods.one.setTag, i = e[t], a = ["PastTense", "PresentTense", "Auxiliary", "Modal", "Particle"];
|
|
8742
8748
|
i.tags.has("Verb") && (a.find((u) => i.tags.has(u)) || o([i], "Infinitive", r, null, "2-verb-type''"));
|
|
8743
|
-
}, cs = /^[A-Z]('s|,)?$/, ls = /^[A-Z-]+$/, hs = /^[A-Z]+s$/,
|
|
8749
|
+
}, cs = /^[A-Z]('s|,)?$/, ls = /^[A-Z-]+$/, hs = /^[A-Z]+s$/, Fm = /([A-Z]\.)+[A-Z]?,?$/, Sm = /[A-Z]{2,}('s|,)?$/, zm = /([a-z]\.)+[a-z]\.?$/, ds = {
|
|
8744
8750
|
I: !0,
|
|
8745
8751
|
A: !0
|
|
8746
8752
|
}, Bm = {
|
|
@@ -8756,10 +8762,10 @@ const hm = function(e, t, n, r) {
|
|
|
8756
8762
|
n = n.replace(/s$/, "");
|
|
8757
8763
|
else
|
|
8758
8764
|
return !1;
|
|
8759
|
-
return n.length > 5 || ds.hasOwnProperty(n) || t.one.lexicon.hasOwnProperty(e.normal) ? !1 :
|
|
8765
|
+
return n.length > 5 || ds.hasOwnProperty(n) || t.one.lexicon.hasOwnProperty(e.normal) ? !1 : Fm.test(n) === !0 || zm.test(n) === !0 || cs.test(n) === !0 || Sm.test(n) === !0;
|
|
8760
8766
|
}, Mm = function(e, t, n) {
|
|
8761
8767
|
const r = e[t];
|
|
8762
|
-
return r.tags.has("RomanNumeral") || r.tags.has("Acronym") || r.frozen ? null : Vm(r, n) ? (r.tags.clear(),
|
|
8768
|
+
return r.tags.has("RomanNumeral") || r.tags.has("Acronym") || r.frozen ? null : Vm(r, n) ? (r.tags.clear(), F(r, ["Acronym", "Noun"], "3-no-period-acronym"), Bm[r.normal] === !0 && F(r, "Place", "3-place-acronym"), hs.test(r.text) === !0 && F(r, "Plural", "3-plural-acronym"), !0) : !ds.hasOwnProperty(r.text) && cs.test(r.text) ? (r.tags.clear(), F(r, ["Acronym", "Noun"], "3-one-letter-acronym"), !0) : r.tags.has("Organization") && r.text.length <= 3 ? (F(r, "Acronym", "3-org-acronym"), !0) : r.tags.has("Organization") && ls.test(r.text) && r.text.length <= 6 ? (F(r, "Acronym", "3-titlecase-acronym"), !0) : null;
|
|
8763
8769
|
}, Ai = function(e, t) {
|
|
8764
8770
|
if (!e)
|
|
8765
8771
|
return null;
|
|
@@ -8775,7 +8781,7 @@ const hm = function(e, t, n, r) {
|
|
|
8775
8781
|
if (s.tags.size === 0) {
|
|
8776
8782
|
let u = null;
|
|
8777
8783
|
if (u = u || Ai(e[t - 1], o), u = u || Ai(e[t + 1], i), u = u || xi(e[t - 1], r), u = u || xi(e[t + 1], a), u)
|
|
8778
|
-
return
|
|
8784
|
+
return F(s, u, "3-[neighbour]"), _t(e, t, n), e[t].confidence = 0.2, !0;
|
|
8779
8785
|
}
|
|
8780
8786
|
return null;
|
|
8781
8787
|
}, Wm = (e) => /^\p{Lu}[\p{Ll}'’]/u.test(e), Ci = function(e, t, n) {
|
|
@@ -8845,7 +8851,7 @@ const hm = function(e, t, n, r) {
|
|
|
8845
8851
|
}, qm = function(e, t, n) {
|
|
8846
8852
|
let r = !1;
|
|
8847
8853
|
const o = e[t].tags;
|
|
8848
|
-
(o.size === 0 || o.size === 1 && (o.has("Hyphenated") || o.has("HashTag") || o.has("Prefix") || o.has("SlashedTerm"))) && (r = !0), r && (
|
|
8854
|
+
(o.size === 0 || o.size === 1 && (o.has("Hyphenated") || o.has("HashTag") || o.has("Prefix") || o.has("SlashedTerm"))) && (r = !0), r && (F(e[t], "Noun", "3-[fallback]"), _t(e, t, n), e[t].confidence = 0.1);
|
|
8849
8855
|
}, Qm = /^[A-Z][a-z]/, pe = (e, t) => e[t].tags.has("ProperNoun") && Qm.test(e[t].text) ? "Noun" : null, ji = (e, t, n) => t === 0 && !e[1] ? n : null, Zm = function(e, t) {
|
|
8850
8856
|
return !e[t + 1] && e[t - 1] && e[t - 1].tags.has("Determiner") ? "Noun" : null;
|
|
8851
8857
|
}, Xm = function(e, t, n) {
|
|
@@ -8930,7 +8936,7 @@ const hm = function(e, t, n, r) {
|
|
|
8930
8936
|
_t(e, o, t), i = i || Lm(e, o, t), i = i || qm(e, o, t);
|
|
8931
8937
|
}
|
|
8932
8938
|
for (let o = 0; o < e.length; o += 1)
|
|
8933
|
-
e[o].frozen !== !0 && (Km(e, o, n, r), Rm(e, o, n, r), e0(e, o, n),
|
|
8939
|
+
e[o].frozen !== !0 && (Km(e, o, n, r), Rm(e, o, n, r), e0(e, o, n), Gm(e, o, t, n), dm(e, o, t, n));
|
|
8934
8940
|
n0(e, n);
|
|
8935
8941
|
}, s0 = function(e) {
|
|
8936
8942
|
const { methods: t, model: n, world: r } = e, o = e.docs;
|
|
@@ -9513,7 +9519,7 @@ const hm = function(e, t, n, r) {
|
|
|
9513
9519
|
// 'i'd have' -> i would have..
|
|
9514
9520
|
"be"
|
|
9515
9521
|
//' she'd be'
|
|
9516
|
-
]),
|
|
9522
|
+
]), G0 = (e, t) => {
|
|
9517
9523
|
for (let n = t + 1; n < e.length; n += 1) {
|
|
9518
9524
|
const r = e[n];
|
|
9519
9525
|
if (O0.has(r.normal))
|
|
@@ -9530,9 +9536,9 @@ const hm = function(e, t, n, r) {
|
|
|
9530
9536
|
return "would";
|
|
9531
9537
|
}
|
|
9532
9538
|
return !1;
|
|
9533
|
-
},
|
|
9539
|
+
}, F0 = function(e, t) {
|
|
9534
9540
|
const n = e[t].normal.split(D0)[0];
|
|
9535
|
-
return n === "how" || n === "what" ? [n, "did"] :
|
|
9541
|
+
return n === "how" || n === "what" ? [n, "did"] : G0(e, t) === "had" ? [n, "had"] : [n, "would"];
|
|
9536
9542
|
}, S0 = function(e, t) {
|
|
9537
9543
|
for (let n = t - 1; n >= 0; n -= 1)
|
|
9538
9544
|
if (e[n].tags.has("Noun") || e[n].tags.has("Pronoun") || e[n].tags.has("Plural") || e[n].tags.has("Singular"))
|
|
@@ -9612,7 +9618,7 @@ const hm = function(e, t, n, r) {
|
|
|
9612
9618
|
return o.switch === "Noun|Verb";
|
|
9613
9619
|
}
|
|
9614
9620
|
return !!r.tags.has("Value");
|
|
9615
|
-
},
|
|
9621
|
+
}, Gi = /'/, K0 = function(e) {
|
|
9616
9622
|
e.forEach((t, n) => {
|
|
9617
9623
|
t.index && (t.index[1] = n);
|
|
9618
9624
|
});
|
|
@@ -9621,9 +9627,9 @@ const hm = function(e, t, n, r) {
|
|
|
9621
9627
|
o.document = [e];
|
|
9622
9628
|
let i = n + r;
|
|
9623
9629
|
n > 0 && (n -= 1), e[i] && (i += 1), o.ptrs = [[0, n, i]], o.compute(["freeze", "lexicon", "preTagger", "unfreeze"]), K0(e);
|
|
9624
|
-
},
|
|
9630
|
+
}, Fi = {
|
|
9625
9631
|
// how'd
|
|
9626
|
-
d: (e, t) =>
|
|
9632
|
+
d: (e, t) => F0(e, t),
|
|
9627
9633
|
// we ain't
|
|
9628
9634
|
t: (e, t) => z0(e, t),
|
|
9629
9635
|
// bob's
|
|
@@ -9638,9 +9644,9 @@ const hm = function(e, t, n, r) {
|
|
|
9638
9644
|
if (r[i].implicit)
|
|
9639
9645
|
continue;
|
|
9640
9646
|
let a = null;
|
|
9641
|
-
|
|
9647
|
+
Gi.test(r[i].normal) === !0 && (a = r[i].normal.split(Gi)[1]);
|
|
9642
9648
|
let s = null;
|
|
9643
|
-
if (
|
|
9649
|
+
if (Fi.hasOwnProperty(a) && (s = Fi[a](r, i, t)), s) {
|
|
9644
9650
|
s = J0(s, e), C0(n, [o, i], s), _0(n[o], e, i, s.length);
|
|
9645
9651
|
continue;
|
|
9646
9652
|
}
|
|
@@ -11226,14 +11232,14 @@ const D1 = {
|
|
|
11226
11232
|
e._cache || e.cache();
|
|
11227
11233
|
const r = e._cache;
|
|
11228
11234
|
return e.filter((o, i) => n.some((a) => r[i].has(a)));
|
|
11229
|
-
},
|
|
11235
|
+
}, G1 = function(e, t) {
|
|
11230
11236
|
let n = t;
|
|
11231
11237
|
typeof t == "string" && (n = this.buildNet([{ match: t }]));
|
|
11232
11238
|
const r = this.tokenize(e), o = H1(r, n);
|
|
11233
11239
|
return o.found ? (o.compute(["index", "tagger"]), o.match(t)) : r.none();
|
|
11234
|
-
},
|
|
11240
|
+
}, F1 = {
|
|
11235
11241
|
lib: {
|
|
11236
|
-
lazy:
|
|
11242
|
+
lazy: G1
|
|
11237
11243
|
}
|
|
11238
11244
|
}, S1 = function(e, t) {
|
|
11239
11245
|
const n = e.methods.two.transform.verb.conjugate, r = n(t, e.model);
|
|
@@ -11270,9 +11276,9 @@ const D1 = {
|
|
|
11270
11276
|
v.plugin(v0);
|
|
11271
11277
|
v.plugin(q0);
|
|
11272
11278
|
v.plugin(D1);
|
|
11273
|
-
v.plugin(
|
|
11279
|
+
v.plugin(F1);
|
|
11274
11280
|
v.plugin(K1);
|
|
11275
|
-
const
|
|
11281
|
+
const ht = function(e) {
|
|
11276
11282
|
const { fromComparative: t, fromSuperlative: n } = e.methods.two.transform.adjective, r = e.text("normal");
|
|
11277
11283
|
return e.has("#Comparative") ? t(r, e.model) : e.has("#Superlative") ? n(r, e.model) : r;
|
|
11278
11284
|
}, _1 = function(e) {
|
|
@@ -11283,7 +11289,7 @@ const ct = function(e) {
|
|
|
11283
11289
|
json(r = {}) {
|
|
11284
11290
|
const { toAdverb: o, toNoun: i, toSuperlative: a, toComparative: s } = this.methods.two.transform.adjective;
|
|
11285
11291
|
return r.normal = !0, this.map((u) => {
|
|
11286
|
-
const c = u.toView().json(r)[0] || {}, l =
|
|
11292
|
+
const c = u.toView().json(r)[0] || {}, l = ht(u);
|
|
11287
11293
|
return c.adjective = {
|
|
11288
11294
|
adverb: o(l, this.model),
|
|
11289
11295
|
noun: i(l, this.model),
|
|
@@ -11298,7 +11304,7 @@ const ct = function(e) {
|
|
|
11298
11304
|
conjugate(r) {
|
|
11299
11305
|
const { toComparative: o, toSuperlative: i, toNoun: a, toAdverb: s } = this.methods.two.transform.adjective;
|
|
11300
11306
|
return this.getNth(r).map((u) => {
|
|
11301
|
-
const c =
|
|
11307
|
+
const c = ht(u);
|
|
11302
11308
|
return {
|
|
11303
11309
|
Adjective: c,
|
|
11304
11310
|
Comparative: o(c, this.model),
|
|
@@ -11311,28 +11317,28 @@ const ct = function(e) {
|
|
|
11311
11317
|
toComparative(r) {
|
|
11312
11318
|
const { toComparative: o } = this.methods.two.transform.adjective;
|
|
11313
11319
|
return this.getNth(r).map((i) => {
|
|
11314
|
-
const a =
|
|
11320
|
+
const a = ht(i), s = o(a, this.model);
|
|
11315
11321
|
return i.replaceWith(s);
|
|
11316
11322
|
});
|
|
11317
11323
|
}
|
|
11318
11324
|
toSuperlative(r) {
|
|
11319
11325
|
const { toSuperlative: o } = this.methods.two.transform.adjective;
|
|
11320
11326
|
return this.getNth(r).map((i) => {
|
|
11321
|
-
const a =
|
|
11327
|
+
const a = ht(i), s = o(a, this.model);
|
|
11322
11328
|
return i.replaceWith(s);
|
|
11323
11329
|
});
|
|
11324
11330
|
}
|
|
11325
11331
|
toAdverb(r) {
|
|
11326
11332
|
const { toAdverb: o } = this.methods.two.transform.adjective;
|
|
11327
11333
|
return this.getNth(r).map((i) => {
|
|
11328
|
-
const a =
|
|
11334
|
+
const a = ht(i), s = o(a, this.model);
|
|
11329
11335
|
return i.replaceWith(s);
|
|
11330
11336
|
});
|
|
11331
11337
|
}
|
|
11332
11338
|
toNoun(r) {
|
|
11333
11339
|
const { toNoun: o } = this.methods.two.transform.adjective;
|
|
11334
11340
|
return this.getNth(r).map((i) => {
|
|
11335
|
-
const a =
|
|
11341
|
+
const a = ht(i), s = o(a, this.model);
|
|
11336
11342
|
return i.replaceWith(s);
|
|
11337
11343
|
});
|
|
11338
11344
|
}
|
|
@@ -11958,7 +11964,7 @@ const Ob = {
|
|
|
11958
11964
|
"whom",
|
|
11959
11965
|
"whomever",
|
|
11960
11966
|
"whose"
|
|
11961
|
-
],
|
|
11967
|
+
], Gb = function(e) {
|
|
11962
11968
|
if (e.before("#Preposition$").found)
|
|
11963
11969
|
return !0;
|
|
11964
11970
|
if (!e.before().found)
|
|
@@ -11967,10 +11973,10 @@ const Ob = {
|
|
|
11967
11973
|
if (e.has(Li[n]))
|
|
11968
11974
|
return !0;
|
|
11969
11975
|
return !1;
|
|
11970
|
-
},
|
|
11976
|
+
}, Fb = "(#Pronoun|#Place|#Value|#Person|#Uncountable|#Month|#WeekDay|#Holiday|#Possessive)", Sb = function(e, t) {
|
|
11971
11977
|
if (e.has("#Plural") || e.has("#Noun and #Noun") || e.has("(we|they)"))
|
|
11972
11978
|
return !0;
|
|
11973
|
-
if (t.has(
|
|
11979
|
+
if (t.has(Fb) === !0 || e.has("#Singular"))
|
|
11974
11980
|
return !1;
|
|
11975
11981
|
const n = t.text("normal");
|
|
11976
11982
|
return n.length > 3 && n.endsWith("s") && !n.endsWith("ss");
|
|
@@ -11984,7 +11990,7 @@ const Ob = {
|
|
|
11984
11990
|
adjectives: e.match("#Adjective"),
|
|
11985
11991
|
number: e.values(),
|
|
11986
11992
|
isPlural: Sb(e, t),
|
|
11987
|
-
isSubordinate:
|
|
11993
|
+
isSubordinate: Gb(e),
|
|
11988
11994
|
root: t
|
|
11989
11995
|
};
|
|
11990
11996
|
}, Wi = (e) => e.text(), Bb = (e) => e.json({ terms: !1, normal: !0 }).map((t) => t.normal), Vb = function(e) {
|
|
@@ -12501,18 +12507,18 @@ const Ob = {
|
|
|
12501
12507
|
let r = Rb(this);
|
|
12502
12508
|
return r = r.getNth(n), new t(this.document, r.pointer);
|
|
12503
12509
|
};
|
|
12504
|
-
}, fy = "one|two|three|four|five|six|seven|eight|nine",
|
|
12510
|
+
}, fy = "one|two|three|four|five|six|seven|eight|nine", Ge = "twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety|fourty", py = "eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen", Xn = function(e) {
|
|
12505
12511
|
let t = e.match("#Value+");
|
|
12506
|
-
if (t.has("#NumericValue #NumericValue") && (t.has("#Value @hasComma #Value") ? t.splitAfter("@hasComma") : t.has("#NumericValue #Fraction") ? t.splitAfter("#NumericValue #Fraction") : t = t.splitAfter("#NumericValue")), t.has("#Value #Value #Value") && !t.has("#Multiple") && t.has("(" +
|
|
12507
|
-
t.has("#NumericValue #NumericValue") && (t = t.splitOn("#Year")), t.has("(" +
|
|
12512
|
+
if (t.has("#NumericValue #NumericValue") && (t.has("#Value @hasComma #Value") ? t.splitAfter("@hasComma") : t.has("#NumericValue #Fraction") ? t.splitAfter("#NumericValue #Fraction") : t = t.splitAfter("#NumericValue")), t.has("#Value #Value #Value") && !t.has("#Multiple") && t.has("(" + Ge + ") #Cardinal #Cardinal") && (t = t.splitAfter("(" + Ge + ") #Cardinal")), t.has("#Value #Value")) {
|
|
12513
|
+
t.has("#NumericValue #NumericValue") && (t = t.splitOn("#Year")), t.has("(" + Ge + ") (" + py + ")") && (t = t.splitAfter("(" + Ge + ")"));
|
|
12508
12514
|
const n = t.match("#Cardinal #Cardinal");
|
|
12509
12515
|
if (n.found && !t.has("(point|decimal|#Fraction)") && !n.has("#Cardinal (#Multiple|point|decimal)")) {
|
|
12510
|
-
const r = t.has(`(${fy}) (${
|
|
12516
|
+
const r = t.has(`(${fy}) (${Ge})`), o = n.has("(" + Ge + ") #Cardinal"), i = n.has("#Multiple #Value");
|
|
12511
12517
|
!r && !o && !i && n.terms().forEach((a) => {
|
|
12512
12518
|
t = t.splitOn(a);
|
|
12513
12519
|
});
|
|
12514
12520
|
}
|
|
12515
|
-
t.match("#Ordinal #Ordinal").match("#TextValue").found && !t.has("#Multiple") && (t.has("(" +
|
|
12521
|
+
t.match("#Ordinal #Ordinal").match("#TextValue").found && !t.has("#Multiple") && (t.has("(" + Ge + ") #Ordinal") || (t = t.splitAfter("#Ordinal"))), t = t.splitBefore("#Ordinal [#Cardinal]", 0), t.has("#TextValue #NumericValue") && !t.has("(" + Ge + "|#Multiple)") && (t = t.splitBefore("#TextValue #NumericValue"));
|
|
12516
12522
|
}
|
|
12517
12523
|
return t = t.splitAfter("#NumberRange"), t = t.splitBefore("#Year"), t;
|
|
12518
12524
|
}, gy = function(e, t) {
|
|
@@ -12888,9 +12894,9 @@ const Ob = {
|
|
|
12888
12894
|
});
|
|
12889
12895
|
}
|
|
12890
12896
|
return e;
|
|
12891
|
-
}, Fy = function(e) {
|
|
12892
|
-
return e.verbs().first().toNegative().compute("chunks"), e;
|
|
12893
12897
|
}, Gy = function(e) {
|
|
12898
|
+
return e.verbs().first().toNegative().compute("chunks"), e;
|
|
12899
|
+
}, Fy = function(e) {
|
|
12894
12900
|
return e.verbs().first().toPositive().compute("chunks"), e;
|
|
12895
12901
|
}, Sy = function(e) {
|
|
12896
12902
|
return e.verbs().toInfinitive(), e;
|
|
@@ -12923,10 +12929,10 @@ const Ob = {
|
|
|
12923
12929
|
return this.getNth(o).map((i) => (Ue(i), Sy(i)));
|
|
12924
12930
|
}
|
|
12925
12931
|
toNegative(o) {
|
|
12926
|
-
return this.getNth(o).map((i) => (Ue(i),
|
|
12932
|
+
return this.getNth(o).map((i) => (Ue(i), Gy(i)));
|
|
12927
12933
|
}
|
|
12928
12934
|
toPositive(o) {
|
|
12929
|
-
return this.getNth(o).map((i) => (Ue(i),
|
|
12935
|
+
return this.getNth(o).map((i) => (Ue(i), Fy(i)));
|
|
12930
12936
|
}
|
|
12931
12937
|
isQuestion(o) {
|
|
12932
12938
|
return this.questions(o);
|
|
@@ -13123,7 +13129,7 @@ const Ob = {
|
|
|
13123
13129
|
negative: ev(t),
|
|
13124
13130
|
phrasal: tv(n)
|
|
13125
13131
|
};
|
|
13126
|
-
}, ge = { tense: "PresentTense" }, fn = { conditional: !0 }, $e = { tense: "FutureTense" },
|
|
13132
|
+
}, ge = { tense: "PresentTense" }, fn = { conditional: !0 }, $e = { tense: "FutureTense" }, dt = { progressive: !0 }, K = { tense: "PastTense" }, ft = { complete: !0, progressive: !1 }, Fe = { passive: !0 }, nv = { plural: !0 }, rv = { plural: !1 }, ov = function(e) {
|
|
13127
13133
|
const t = {};
|
|
13128
13134
|
return e.forEach((n) => {
|
|
13129
13135
|
Object.assign(t, n);
|
|
@@ -13170,68 +13176,68 @@ const Ob = {
|
|
|
13170
13176
|
// === Progressive ===
|
|
13171
13177
|
"present-progressive": [
|
|
13172
13178
|
// he is walking
|
|
13173
|
-
["^(is|are|am) #Gerund$", [ge,
|
|
13179
|
+
["^(is|are|am) #Gerund$", [ge, dt]]
|
|
13174
13180
|
],
|
|
13175
13181
|
"past-progressive": [
|
|
13176
13182
|
// he was walking
|
|
13177
|
-
["^(was|were) #Gerund$", [K,
|
|
13183
|
+
["^(was|were) #Gerund$", [K, dt]]
|
|
13178
13184
|
],
|
|
13179
13185
|
"future-progressive": [
|
|
13180
13186
|
// he will be
|
|
13181
|
-
["^will be #Gerund$", [$e,
|
|
13187
|
+
["^will be #Gerund$", [$e, dt]]
|
|
13182
13188
|
],
|
|
13183
13189
|
// === Perfect ===
|
|
13184
13190
|
"present-perfect": [
|
|
13185
13191
|
// he has walked
|
|
13186
|
-
["^(has|have) #PastTense$", [K,
|
|
13192
|
+
["^(has|have) #PastTense$", [K, ft]]
|
|
13187
13193
|
//past?
|
|
13188
13194
|
],
|
|
13189
13195
|
"past-perfect": [
|
|
13190
13196
|
// he had walked
|
|
13191
|
-
["^had #PastTense$", [K,
|
|
13197
|
+
["^had #PastTense$", [K, ft]],
|
|
13192
13198
|
// had been to see
|
|
13193
|
-
["^had #PastTense to #Infinitive", [K,
|
|
13199
|
+
["^had #PastTense to #Infinitive", [K, ft]]
|
|
13194
13200
|
],
|
|
13195
13201
|
"future-perfect": [
|
|
13196
13202
|
// he will have
|
|
13197
|
-
["^will have #PastTense$", [$e,
|
|
13203
|
+
["^will have #PastTense$", [$e, ft]]
|
|
13198
13204
|
],
|
|
13199
13205
|
// === Progressive-perfect ===
|
|
13200
13206
|
"present-perfect-progressive": [
|
|
13201
13207
|
// he has been walking
|
|
13202
|
-
["^(has|have) been #Gerund$", [K,
|
|
13208
|
+
["^(has|have) been #Gerund$", [K, dt]]
|
|
13203
13209
|
//present?
|
|
13204
13210
|
],
|
|
13205
13211
|
"past-perfect-progressive": [
|
|
13206
13212
|
// he had been
|
|
13207
|
-
["^had been #Gerund$", [K,
|
|
13213
|
+
["^had been #Gerund$", [K, dt]]
|
|
13208
13214
|
],
|
|
13209
13215
|
"future-perfect-progressive": [
|
|
13210
13216
|
// will have been
|
|
13211
|
-
["^will have been #Gerund$", [$e,
|
|
13217
|
+
["^will have been #Gerund$", [$e, dt]]
|
|
13212
13218
|
],
|
|
13213
13219
|
// ==== Passive ===
|
|
13214
13220
|
"passive-past": [
|
|
13215
13221
|
// got walked, was walked, were walked
|
|
13216
|
-
["(got|were|was) #Passive", [K,
|
|
13222
|
+
["(got|were|was) #Passive", [K, Fe]],
|
|
13217
13223
|
// was being walked
|
|
13218
|
-
["^(was|were) being #Passive", [K,
|
|
13224
|
+
["^(was|were) being #Passive", [K, Fe]],
|
|
13219
13225
|
// had been walked, have been eaten
|
|
13220
|
-
["^(had|have) been #Passive", [K,
|
|
13226
|
+
["^(had|have) been #Passive", [K, Fe]]
|
|
13221
13227
|
],
|
|
13222
13228
|
"passive-present": [
|
|
13223
13229
|
// is walked, are stolen
|
|
13224
|
-
["^(is|are|am) #Passive", [ge,
|
|
13230
|
+
["^(is|are|am) #Passive", [ge, Fe]],
|
|
13225
13231
|
// is being walked
|
|
13226
|
-
["^(is|are|am) being #Passive", [ge,
|
|
13232
|
+
["^(is|are|am) being #Passive", [ge, Fe]],
|
|
13227
13233
|
// has been cleaned
|
|
13228
|
-
["^has been #Passive", [ge,
|
|
13234
|
+
["^has been #Passive", [ge, Fe]]
|
|
13229
13235
|
],
|
|
13230
13236
|
"passive-future": [
|
|
13231
13237
|
// will have been walked
|
|
13232
|
-
["will have been #Passive", [$e,
|
|
13238
|
+
["will have been #Passive", [$e, Fe, fn]],
|
|
13233
13239
|
// will be cleaned
|
|
13234
|
-
["will be being? #Passive", [$e,
|
|
13240
|
+
["will be being? #Passive", [$e, Fe, fn]]
|
|
13235
13241
|
],
|
|
13236
13242
|
// === Conditional ===
|
|
13237
13243
|
"present-conditional": [
|
|
@@ -13251,11 +13257,11 @@ const Ob = {
|
|
|
13251
13257
|
// he did walk
|
|
13252
13258
|
["^did #Infinitive$", [K, rv]],
|
|
13253
13259
|
// used to walk
|
|
13254
|
-
["^used to #Infinitive$", [K,
|
|
13260
|
+
["^used to #Infinitive$", [K, ft]]
|
|
13255
13261
|
],
|
|
13256
13262
|
"auxiliary-present": [
|
|
13257
13263
|
// we do walk
|
|
13258
|
-
["^(does|do) #Infinitive$", [ge,
|
|
13264
|
+
["^(does|do) #Infinitive$", [ge, ft, nv]]
|
|
13259
13265
|
],
|
|
13260
13266
|
// === modals ===
|
|
13261
13267
|
"modal-past": [
|
|
@@ -13523,7 +13529,7 @@ const iv = function(e, t) {
|
|
|
13523
13529
|
// 'gerund-phrase': noop,
|
|
13524
13530
|
}, mv = function(e, t, n) {
|
|
13525
13531
|
return ia.hasOwnProperty(n) ? (e = ia[n](e, t), e.fullSentence().compute(["tagger", "chunks"]), e) : (e = kr(e, t), e.fullSentence().compute(["tagger", "chunks"]), e);
|
|
13526
|
-
}, Ee = { tags: !0 },
|
|
13532
|
+
}, Ee = { tags: !0 }, pt = (e, t) => {
|
|
13527
13533
|
const { conjugate: n, toInfinitive: r } = e.methods.two.transform.verb, o = t.root;
|
|
13528
13534
|
let i = o.text("normal");
|
|
13529
13535
|
return i = r(i, e.model, ae(o)), Dt(e) === !1 && (i = n(i, e.model).PresentTense), o.has("#Copula") && (i = Ot(e)), i && (e = e.replace(o, i, Ee), e.not("#Particle").tag("PresentTense")), e;
|
|
@@ -13537,7 +13543,7 @@ const iv = function(e, t) {
|
|
|
13537
13543
|
return o = n(o, e.model, ae(r)), o && (e = e.replace(t.root, o, Ee)), e;
|
|
13538
13544
|
}, sa = {
|
|
13539
13545
|
// walk
|
|
13540
|
-
infinitive:
|
|
13546
|
+
infinitive: pt,
|
|
13541
13547
|
// he walks -> he walked
|
|
13542
13548
|
"simple-present": (e, t) => {
|
|
13543
13549
|
const { conjugate: n } = e.methods.two.transform.verb, { root: r } = t;
|
|
@@ -13548,11 +13554,11 @@ const iv = function(e, t) {
|
|
|
13548
13554
|
const a = r.text("normal"), s = n(a, e.model).PresentTense;
|
|
13549
13555
|
a !== s && e.replace(r, s, Ee);
|
|
13550
13556
|
} else
|
|
13551
|
-
return
|
|
13557
|
+
return pt(e, t);
|
|
13552
13558
|
return e;
|
|
13553
13559
|
},
|
|
13554
13560
|
// he walked
|
|
13555
|
-
"simple-past":
|
|
13561
|
+
"simple-past": pt,
|
|
13556
13562
|
// he will walk -> he walked
|
|
13557
13563
|
"simple-future": (e, t) => {
|
|
13558
13564
|
const { root: n, auxiliary: r } = t;
|
|
@@ -13560,7 +13566,7 @@ const iv = function(e, t) {
|
|
|
13560
13566
|
const o = Ot(e);
|
|
13561
13567
|
e.replace(n, o), e = e.remove("will"), e.replace("not " + o, o + " not");
|
|
13562
13568
|
} else
|
|
13563
|
-
|
|
13569
|
+
pt(e, t), e = e.remove("will");
|
|
13564
13570
|
return e;
|
|
13565
13571
|
},
|
|
13566
13572
|
// is walking ->
|
|
@@ -13573,7 +13579,7 @@ const iv = function(e, t) {
|
|
|
13573
13579
|
// will be walking -> is walking
|
|
13574
13580
|
"future-progressive": (e) => (e.match("will").insertBefore("is"), e.remove("be"), e.remove("will")),
|
|
13575
13581
|
// has walked -> (?)
|
|
13576
|
-
"present-perfect": (e, t) => (
|
|
13582
|
+
"present-perfect": (e, t) => (pt(e, t), e = e.remove("(have|had|has)"), e),
|
|
13577
13583
|
// had walked -> has walked
|
|
13578
13584
|
"past-perfect": (e, t) => {
|
|
13579
13585
|
const r = we(e).subject;
|
|
@@ -13620,7 +13626,7 @@ const iv = function(e, t) {
|
|
|
13620
13626
|
// must have walked
|
|
13621
13627
|
"modal-past": (e, t) => (bv(e, t), e.remove("have")),
|
|
13622
13628
|
// started looking
|
|
13623
|
-
"gerund-phrase": (e, t) => (t.root = t.root.not("#Gerund$"),
|
|
13629
|
+
"gerund-phrase": (e, t) => (t.root = t.root.not("#Gerund$"), pt(e, t), e.remove("(will|have)")),
|
|
13624
13630
|
// wanted to walk
|
|
13625
13631
|
"want-infinitive": (e, t) => {
|
|
13626
13632
|
let n = "wants";
|
|
@@ -13971,14 +13977,14 @@ function Hv(e, t, n = 0, r = 0) {
|
|
|
13971
13977
|
if (i.start == null || i.end == null)
|
|
13972
13978
|
continue;
|
|
13973
13979
|
let s = ou(t, i.start, i.end);
|
|
13974
|
-
if (s.length === 0 && i.text && (s =
|
|
13980
|
+
if (s.length === 0 && i.text && (s = Gv(t, i.text)), s.length === 0)
|
|
13975
13981
|
continue;
|
|
13976
|
-
const u =
|
|
13982
|
+
const u = Sv(s);
|
|
13977
13983
|
for (const c of u.values()) {
|
|
13978
|
-
const l =
|
|
13984
|
+
const l = zv(c.map((h) => h.bbox));
|
|
13979
13985
|
o.push({
|
|
13980
13986
|
id: `redact-${Ov++}`,
|
|
13981
|
-
bbox:
|
|
13987
|
+
bbox: Bv(l, 2, n, r),
|
|
13982
13988
|
source: "auto",
|
|
13983
13989
|
entityId: i.id,
|
|
13984
13990
|
enabled: !0,
|
|
@@ -13988,7 +13994,7 @@ function Hv(e, t, n = 0, r = 0) {
|
|
|
13988
13994
|
}
|
|
13989
13995
|
return o;
|
|
13990
13996
|
}
|
|
13991
|
-
function
|
|
13997
|
+
function Gv(e, t) {
|
|
13992
13998
|
const n = t.toLowerCase().trim();
|
|
13993
13999
|
if (!n) return [];
|
|
13994
14000
|
const r = n.split(/\s+/);
|
|
@@ -14007,15 +14013,27 @@ function Fv(e, t) {
|
|
|
14007
14013
|
return a === n || n.includes(a) || a.includes(n);
|
|
14008
14014
|
});
|
|
14009
14015
|
}
|
|
14010
|
-
|
|
14016
|
+
const Fv = 200;
|
|
14017
|
+
function Sv(e) {
|
|
14011
14018
|
const t = /* @__PURE__ */ new Map();
|
|
14012
|
-
for (const
|
|
14013
|
-
const
|
|
14014
|
-
|
|
14019
|
+
for (const o of e) {
|
|
14020
|
+
const i = t.get(o.lineIndex) ?? [];
|
|
14021
|
+
i.push(o), t.set(o.lineIndex, i);
|
|
14015
14022
|
}
|
|
14016
|
-
|
|
14023
|
+
const n = /* @__PURE__ */ new Map();
|
|
14024
|
+
let r = 0;
|
|
14025
|
+
for (const [o, i] of t) {
|
|
14026
|
+
const a = [...i].sort((u, c) => u.bbox.x0 - c.bbox.x0);
|
|
14027
|
+
let s = [a[0]];
|
|
14028
|
+
for (let u = 1; u < a.length; u++) {
|
|
14029
|
+
const c = a[u - 1], l = a[u];
|
|
14030
|
+
l.bbox.x0 - c.bbox.x1 > Fv ? (n.set(o * 1e4 + r++, s), s = [l]) : s.push(l);
|
|
14031
|
+
}
|
|
14032
|
+
n.set(o * 1e4 + r++, s);
|
|
14033
|
+
}
|
|
14034
|
+
return n;
|
|
14017
14035
|
}
|
|
14018
|
-
function
|
|
14036
|
+
function zv(e) {
|
|
14019
14037
|
return {
|
|
14020
14038
|
x0: Math.min(...e.map((t) => t.x0)),
|
|
14021
14039
|
y0: Math.min(...e.map((t) => t.y0)),
|
|
@@ -14023,7 +14041,7 @@ function Sv(e) {
|
|
|
14023
14041
|
y1: Math.max(...e.map((t) => t.y1))
|
|
14024
14042
|
};
|
|
14025
14043
|
}
|
|
14026
|
-
function
|
|
14044
|
+
function Bv(e, t, n = 0, r = 0) {
|
|
14027
14045
|
const o = e.x1 + t, i = e.y1 + t;
|
|
14028
14046
|
return {
|
|
14029
14047
|
x0: Math.max(0, e.x0 - t),
|
|
@@ -14032,7 +14050,7 @@ function zv(e, t, n = 0, r = 0) {
|
|
|
14032
14050
|
y1: r > 0 ? Math.min(r, i) : i
|
|
14033
14051
|
};
|
|
14034
14052
|
}
|
|
14035
|
-
function
|
|
14053
|
+
function Vv(e, t) {
|
|
14036
14054
|
const n = [...e, ...t];
|
|
14037
14055
|
n.sort((o, i) => o.start - i.start || i.end - o.end);
|
|
14038
14056
|
const r = [];
|
|
@@ -14051,8 +14069,8 @@ function Bv(e, t) {
|
|
|
14051
14069
|
}
|
|
14052
14070
|
return r;
|
|
14053
14071
|
}
|
|
14054
|
-
async function
|
|
14055
|
-
const n = e instanceof HTMLImageElement ? e.naturalWidth : e.width, r = e instanceof HTMLImageElement ? e.naturalHeight : e.height, o =
|
|
14072
|
+
async function Mv(e, t) {
|
|
14073
|
+
const n = e instanceof HTMLImageElement ? e.naturalWidth : e.width, r = e instanceof HTMLImageElement ? e.naturalHeight : e.height, o = Lv(n, r), i = Wv(o);
|
|
14056
14074
|
i.drawImage(e, 0, 0, n, r), i.fillStyle = "#000000";
|
|
14057
14075
|
const a = [];
|
|
14058
14076
|
for (const u of t) {
|
|
@@ -14065,13 +14083,13 @@ async function Vv(e, t) {
|
|
|
14065
14083
|
});
|
|
14066
14084
|
}
|
|
14067
14085
|
return {
|
|
14068
|
-
blob: await
|
|
14086
|
+
blob: await Kv(o),
|
|
14069
14087
|
entities: a,
|
|
14070
14088
|
width: n,
|
|
14071
14089
|
height: r
|
|
14072
14090
|
};
|
|
14073
14091
|
}
|
|
14074
|
-
function
|
|
14092
|
+
function Yv(e, t, n = {
|
|
14075
14093
|
fill: "rgba(0, 0, 0, 0.7)",
|
|
14076
14094
|
stroke: "#ff3333",
|
|
14077
14095
|
lineWidth: 2
|
|
@@ -14082,18 +14100,18 @@ function Xv(e, t, n = {
|
|
|
14082
14100
|
e.fillStyle = n.fill, e.fillRect(o, i, u, c), e.strokeStyle = n.stroke, e.lineWidth = n.lineWidth, e.strokeRect(o, i, u, c);
|
|
14083
14101
|
}
|
|
14084
14102
|
}
|
|
14085
|
-
function
|
|
14103
|
+
function Lv(e, t) {
|
|
14086
14104
|
if (typeof OffscreenCanvas < "u")
|
|
14087
14105
|
return new OffscreenCanvas(e, t);
|
|
14088
14106
|
const n = document.createElement("canvas");
|
|
14089
14107
|
return n.width = e, n.height = t, n;
|
|
14090
14108
|
}
|
|
14091
|
-
function
|
|
14109
|
+
function Wv(e) {
|
|
14092
14110
|
const t = e.getContext("2d");
|
|
14093
14111
|
if (!t) throw new Error("Could not get 2D canvas context");
|
|
14094
14112
|
return t;
|
|
14095
14113
|
}
|
|
14096
|
-
async function
|
|
14114
|
+
async function Kv(e) {
|
|
14097
14115
|
return e instanceof OffscreenCanvas ? e.convertToBlob({ type: "image/png" }) : new Promise((t, n) => {
|
|
14098
14116
|
e.toBlob(
|
|
14099
14117
|
(r) => {
|
|
@@ -14103,8 +14121,8 @@ async function Wv(e) {
|
|
|
14103
14121
|
);
|
|
14104
14122
|
});
|
|
14105
14123
|
}
|
|
14106
|
-
async function
|
|
14107
|
-
const r = { ...t }, o =
|
|
14124
|
+
async function _v(e, t, n) {
|
|
14125
|
+
const r = { ...t }, o = Jv(r.memoryMode);
|
|
14108
14126
|
n?.({ phase: "ocr", progress: 0, message: "Starting OCR..." });
|
|
14109
14127
|
const i = await ru(e, r.lang, n);
|
|
14110
14128
|
if (!i.fullText.trim())
|
|
@@ -14116,20 +14134,20 @@ async function Kv(e, t, n) {
|
|
|
14116
14134
|
});
|
|
14117
14135
|
const a = r.useRegex ? hu(i.fullText) : [], s = r.useCompromise ? Dv(i.fullText) : [];
|
|
14118
14136
|
o === "low" && await uu();
|
|
14119
|
-
const u = await su(i.fullText, r.nerModel, r.minConfidence, n), c =
|
|
14137
|
+
const u = await su(i.fullText, r.nerModel, r.minConfidence, n), c = Vv(u, [...a, ...s]), l = Hv(c, i.words, i.imageWidth, i.imageHeight);
|
|
14120
14138
|
return n?.({
|
|
14121
14139
|
phase: "reviewing",
|
|
14122
14140
|
progress: 1,
|
|
14123
14141
|
message: `Found ${l.length} items to redact.`
|
|
14124
14142
|
}), { ocr: i, entities: c, redactions: l };
|
|
14125
14143
|
}
|
|
14126
|
-
function
|
|
14144
|
+
function Jv(e) {
|
|
14127
14145
|
if (e === "low") return "low";
|
|
14128
14146
|
if (e === "normal") return "normal";
|
|
14129
14147
|
const t = navigator.deviceMemory;
|
|
14130
14148
|
return t !== void 0 && t < 4 ? "low" : "normal";
|
|
14131
14149
|
}
|
|
14132
|
-
const
|
|
14150
|
+
const Uv = {
|
|
14133
14151
|
GIVENNAME: "First name",
|
|
14134
14152
|
SURNAME: "Last name",
|
|
14135
14153
|
PERSON: "Person name",
|
|
@@ -14145,7 +14163,7 @@ const Jv = {
|
|
|
14145
14163
|
USERNAME: "Username",
|
|
14146
14164
|
IP_ADDRESS: "IP address",
|
|
14147
14165
|
MANUAL: "Manual redaction"
|
|
14148
|
-
},
|
|
14166
|
+
}, Re = {
|
|
14149
14167
|
lang: "eng",
|
|
14150
14168
|
nerModel: "onnx-community/multilang-pii-ner-ONNX",
|
|
14151
14169
|
maxFileSize: 20 * 1024 * 1024,
|
|
@@ -14155,14 +14173,24 @@ const Jv = {
|
|
|
14155
14173
|
useCompromise: !0,
|
|
14156
14174
|
memoryMode: "auto"
|
|
14157
14175
|
};
|
|
14158
|
-
var
|
|
14159
|
-
for (var o = r > 1 ? void 0 : r ?
|
|
14176
|
+
var Rv = Object.defineProperty, qv = Object.getOwnPropertyDescriptor, E = (e, t, n, r) => {
|
|
14177
|
+
for (var o = r > 1 ? void 0 : r ? qv(t, n) : t, i = e.length - 1, a; i >= 0; i--)
|
|
14160
14178
|
(a = e[i]) && (o = (r ? a(t, n, o) : a(o)) || o);
|
|
14161
|
-
return r && o &&
|
|
14179
|
+
return r && o && Rv(t, n, o), o;
|
|
14162
14180
|
};
|
|
14163
|
-
let
|
|
14181
|
+
let N = class extends Et {
|
|
14164
14182
|
constructor() {
|
|
14165
|
-
super(...arguments), this.lang =
|
|
14183
|
+
super(...arguments), this.lang = Re.lang, this.nerModel = Re.nerModel, this.maxFileSize = Re.maxFileSize, this.minConfidence = Re.minConfidence, this.useRegex = Re.useRegex, this.useCompromise = Re.useCompromise, this.phase = "idle", this.progress = 0, this.progressMessage = "", this.errorMessage = "", this.imageUrl = "", this.imageWidth = 0, this.imageHeight = 0, this.redactions = [], this.entities = [], this.ocrResult = null, this.dragOver = !1, this.isDrawing = !1, this.drawMode = !1, this.drawStart = null, this.drawCurrent = null, this.networkRequestCount = 0, this.redactedBlob = null, this.modelCached = !1, this.imageFile = null, this.imageElement = null, this.undoStack = [], this.perfObserver = null;
|
|
14184
|
+
}
|
|
14185
|
+
// --- Pipeline config (derived from public properties) ---
|
|
14186
|
+
get pipelineConfig() {
|
|
14187
|
+
return {
|
|
14188
|
+
lang: this.lang,
|
|
14189
|
+
nerModel: this.nerModel,
|
|
14190
|
+
minConfidence: this.minConfidence,
|
|
14191
|
+
useRegex: this.useRegex,
|
|
14192
|
+
useCompromise: this.useCompromise
|
|
14193
|
+
};
|
|
14166
14194
|
}
|
|
14167
14195
|
connectedCallback() {
|
|
14168
14196
|
if (super.connectedCallback(), typeof PerformanceObserver < "u") {
|
|
@@ -14210,12 +14238,12 @@ let j = class extends Et {
|
|
|
14210
14238
|
return se`
|
|
14211
14239
|
<div class="container">
|
|
14212
14240
|
${this.renderTrustBanner()}
|
|
14213
|
-
${this.phase === "idle" ? this.renderDropZone() :
|
|
14214
|
-
${this.phase === "loading" || this.phase === "ocr" || this.phase === "detecting" ? this.renderProgress() :
|
|
14215
|
-
${this.phase === "reviewing" ? this.renderEditor() :
|
|
14216
|
-
${this.phase === "exporting" ? this.renderProgress() :
|
|
14217
|
-
${this.phase === "done" ? this.renderDone() :
|
|
14218
|
-
${this.errorMessage ? this.renderError() :
|
|
14241
|
+
${this.phase === "idle" ? this.renderDropZone() : j}
|
|
14242
|
+
${this.phase === "loading" || this.phase === "ocr" || this.phase === "detecting" ? this.renderProgress() : j}
|
|
14243
|
+
${this.phase === "reviewing" ? this.renderEditor() : j}
|
|
14244
|
+
${this.phase === "exporting" ? this.renderProgress() : j}
|
|
14245
|
+
${this.phase === "done" ? this.renderDone() : j}
|
|
14246
|
+
${this.errorMessage ? this.renderError() : j}
|
|
14219
14247
|
</div>
|
|
14220
14248
|
`;
|
|
14221
14249
|
}
|
|
@@ -14345,7 +14373,7 @@ let j = class extends Et {
|
|
|
14345
14373
|
width=${Math.abs(this.drawCurrent.x - this.drawStart.x)}
|
|
14346
14374
|
height=${Math.abs(this.drawCurrent.y - this.drawStart.y)}
|
|
14347
14375
|
/>
|
|
14348
|
-
` :
|
|
14376
|
+
` : j}
|
|
14349
14377
|
</svg>
|
|
14350
14378
|
</div>
|
|
14351
14379
|
</div>
|
|
@@ -14393,7 +14421,7 @@ let j = class extends Et {
|
|
|
14393
14421
|
Network requests to AI model host: 0 — served from local cache.
|
|
14394
14422
|
</p>` : se`<p class="done-network">
|
|
14395
14423
|
Network requests to AI model host: ${this.networkRequestCount}.
|
|
14396
|
-
${this.modelCached ? se`Model is now cached — next time will be 0.` :
|
|
14424
|
+
${this.modelCached ? se`Model is now cached — next time will be 0.` : j}
|
|
14397
14425
|
</p>`;
|
|
14398
14426
|
return se`
|
|
14399
14427
|
<div class="done">
|
|
@@ -14402,7 +14430,7 @@ let j = class extends Et {
|
|
|
14402
14430
|
<button class="primary" @click=${this.handleDownload}>
|
|
14403
14431
|
Download
|
|
14404
14432
|
</button>
|
|
14405
|
-
${e ? se`<button @click=${this.handleShare}>Share</button>` :
|
|
14433
|
+
${e ? se`<button @click=${this.handleShare}>Share</button>` : j}
|
|
14406
14434
|
<button @click=${this.reset}>Redact another</button>
|
|
14407
14435
|
</div>
|
|
14408
14436
|
${t}
|
|
@@ -14429,7 +14457,7 @@ let j = class extends Et {
|
|
|
14429
14457
|
n && this.processFile(n), t.value = "";
|
|
14430
14458
|
}
|
|
14431
14459
|
async processFile(e) {
|
|
14432
|
-
if (!
|
|
14460
|
+
if (!Re.acceptedTypes.includes(e.type)) {
|
|
14433
14461
|
this.errorMessage = `Unsupported file type: ${e.type}. Please use PNG, JPEG, or WebP.`;
|
|
14434
14462
|
return;
|
|
14435
14463
|
}
|
|
@@ -14441,17 +14469,12 @@ let j = class extends Et {
|
|
|
14441
14469
|
try {
|
|
14442
14470
|
const t = await this.loadImage(this.imageUrl);
|
|
14443
14471
|
this.imageElement = t, this.imageWidth = t.naturalWidth, this.imageHeight = t.naturalHeight;
|
|
14444
|
-
const n =
|
|
14445
|
-
lang: this.lang,
|
|
14446
|
-
nerModel: this.nerModel,
|
|
14447
|
-
minConfidence: this.minConfidence,
|
|
14448
|
-
useRegex: this.useRegex
|
|
14449
|
-
}, r = await Kv(
|
|
14472
|
+
const n = await _v(
|
|
14450
14473
|
e,
|
|
14451
|
-
|
|
14452
|
-
(
|
|
14474
|
+
this.pipelineConfig,
|
|
14475
|
+
(r) => this.handleProgress(r)
|
|
14453
14476
|
);
|
|
14454
|
-
this.ocrResult =
|
|
14477
|
+
this.ocrResult = n.ocr, this.entities = n.entities, this.redactions = n.redactions, this.undoStack = [], this.phase = "reviewing", this.checkModelCached();
|
|
14455
14478
|
} catch (t) {
|
|
14456
14479
|
console.error("Pipeline error:", t), this.errorMessage = t instanceof Error ? t.message : "An unexpected error occurred.", this.phase = "idle";
|
|
14457
14480
|
}
|
|
@@ -14549,7 +14572,7 @@ let j = class extends Et {
|
|
|
14549
14572
|
if (this.imageElement) {
|
|
14550
14573
|
this.phase = "exporting", this.progress = 0.5, this.progressMessage = "Rendering redacted image...";
|
|
14551
14574
|
try {
|
|
14552
|
-
const e = await
|
|
14575
|
+
const e = await Mv(
|
|
14553
14576
|
this.imageElement,
|
|
14554
14577
|
this.redactions
|
|
14555
14578
|
);
|
|
@@ -14590,7 +14613,7 @@ let j = class extends Et {
|
|
|
14590
14613
|
// --- Helpers ---
|
|
14591
14614
|
/** Returns a user-friendly label for an entity type. */
|
|
14592
14615
|
getDisplayLabel(e) {
|
|
14593
|
-
return e ?
|
|
14616
|
+
return e ? Uv[e] ?? e : "Manual redaction";
|
|
14594
14617
|
}
|
|
14595
14618
|
getRedactionText(e) {
|
|
14596
14619
|
return e.source === "manual" ? "(manually drawn)" : !e.entityId || !this.ocrResult ? "" : this.entities.find((n) => n.id === e.entityId)?.text ?? "";
|
|
@@ -14600,83 +14623,86 @@ let j = class extends Et {
|
|
|
14600
14623
|
this.imageWidth = t.naturalWidth, this.imageHeight = t.naturalHeight;
|
|
14601
14624
|
}
|
|
14602
14625
|
};
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
],
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
],
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
],
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
],
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
],
|
|
14619
|
-
|
|
14626
|
+
N.styles = Rs;
|
|
14627
|
+
E([
|
|
14628
|
+
rt({ type: String })
|
|
14629
|
+
], N.prototype, "lang", 2);
|
|
14630
|
+
E([
|
|
14631
|
+
rt({ type: String, attribute: "ner-model" })
|
|
14632
|
+
], N.prototype, "nerModel", 2);
|
|
14633
|
+
E([
|
|
14634
|
+
rt({ type: Number, attribute: "max-file-size" })
|
|
14635
|
+
], N.prototype, "maxFileSize", 2);
|
|
14636
|
+
E([
|
|
14637
|
+
rt({ type: Number, attribute: "min-confidence" })
|
|
14638
|
+
], N.prototype, "minConfidence", 2);
|
|
14639
|
+
E([
|
|
14640
|
+
rt({ type: Boolean, attribute: "use-regex" })
|
|
14641
|
+
], N.prototype, "useRegex", 2);
|
|
14642
|
+
E([
|
|
14643
|
+
rt({ type: Boolean, attribute: "use-compromise" })
|
|
14644
|
+
], N.prototype, "useCompromise", 2);
|
|
14645
|
+
E([
|
|
14620
14646
|
J()
|
|
14621
|
-
],
|
|
14622
|
-
|
|
14647
|
+
], N.prototype, "phase", 2);
|
|
14648
|
+
E([
|
|
14623
14649
|
J()
|
|
14624
|
-
],
|
|
14625
|
-
|
|
14650
|
+
], N.prototype, "progress", 2);
|
|
14651
|
+
E([
|
|
14626
14652
|
J()
|
|
14627
|
-
],
|
|
14628
|
-
|
|
14653
|
+
], N.prototype, "progressMessage", 2);
|
|
14654
|
+
E([
|
|
14629
14655
|
J()
|
|
14630
|
-
],
|
|
14631
|
-
|
|
14656
|
+
], N.prototype, "errorMessage", 2);
|
|
14657
|
+
E([
|
|
14632
14658
|
J()
|
|
14633
|
-
],
|
|
14634
|
-
|
|
14659
|
+
], N.prototype, "imageUrl", 2);
|
|
14660
|
+
E([
|
|
14635
14661
|
J()
|
|
14636
|
-
],
|
|
14637
|
-
|
|
14662
|
+
], N.prototype, "imageWidth", 2);
|
|
14663
|
+
E([
|
|
14638
14664
|
J()
|
|
14639
|
-
],
|
|
14640
|
-
|
|
14665
|
+
], N.prototype, "imageHeight", 2);
|
|
14666
|
+
E([
|
|
14641
14667
|
J()
|
|
14642
|
-
],
|
|
14643
|
-
|
|
14668
|
+
], N.prototype, "redactions", 2);
|
|
14669
|
+
E([
|
|
14644
14670
|
J()
|
|
14645
|
-
],
|
|
14646
|
-
|
|
14671
|
+
], N.prototype, "entities", 2);
|
|
14672
|
+
E([
|
|
14647
14673
|
J()
|
|
14648
|
-
],
|
|
14649
|
-
|
|
14674
|
+
], N.prototype, "ocrResult", 2);
|
|
14675
|
+
E([
|
|
14650
14676
|
J()
|
|
14651
|
-
],
|
|
14652
|
-
|
|
14677
|
+
], N.prototype, "dragOver", 2);
|
|
14678
|
+
E([
|
|
14653
14679
|
J()
|
|
14654
|
-
],
|
|
14655
|
-
|
|
14680
|
+
], N.prototype, "isDrawing", 2);
|
|
14681
|
+
E([
|
|
14656
14682
|
J()
|
|
14657
|
-
],
|
|
14658
|
-
|
|
14683
|
+
], N.prototype, "drawMode", 2);
|
|
14684
|
+
E([
|
|
14659
14685
|
J()
|
|
14660
|
-
],
|
|
14661
|
-
|
|
14686
|
+
], N.prototype, "drawStart", 2);
|
|
14687
|
+
E([
|
|
14662
14688
|
J()
|
|
14663
|
-
],
|
|
14664
|
-
|
|
14689
|
+
], N.prototype, "drawCurrent", 2);
|
|
14690
|
+
E([
|
|
14665
14691
|
J()
|
|
14666
|
-
],
|
|
14667
|
-
|
|
14692
|
+
], N.prototype, "networkRequestCount", 2);
|
|
14693
|
+
E([
|
|
14668
14694
|
J()
|
|
14669
|
-
],
|
|
14670
|
-
|
|
14695
|
+
], N.prototype, "redactedBlob", 2);
|
|
14696
|
+
E([
|
|
14671
14697
|
J()
|
|
14672
|
-
],
|
|
14673
|
-
|
|
14698
|
+
], N.prototype, "modelCached", 2);
|
|
14699
|
+
E([
|
|
14674
14700
|
Us(".file-input")
|
|
14675
|
-
],
|
|
14676
|
-
|
|
14701
|
+
], N.prototype, "fileInput", 2);
|
|
14702
|
+
N = E([
|
|
14677
14703
|
Ws("pii-redactor")
|
|
14678
|
-
],
|
|
14679
|
-
async function
|
|
14704
|
+
], N);
|
|
14705
|
+
async function ew(e = {}) {
|
|
14680
14706
|
if (!("serviceWorker" in navigator) || !navigator.serviceWorker)
|
|
14681
14707
|
return null;
|
|
14682
14708
|
const t = e.swPath ?? "/pii-redactor-sw.js", n = {};
|
|
@@ -14687,7 +14713,7 @@ async function Yv(e = {}) {
|
|
|
14687
14713
|
return null;
|
|
14688
14714
|
}
|
|
14689
14715
|
}
|
|
14690
|
-
async function
|
|
14716
|
+
async function tw() {
|
|
14691
14717
|
if (!("serviceWorker" in navigator) || !navigator.serviceWorker)
|
|
14692
14718
|
return !1;
|
|
14693
14719
|
try {
|
|
@@ -14699,22 +14725,22 @@ async function ew() {
|
|
|
14699
14725
|
}
|
|
14700
14726
|
export {
|
|
14701
14727
|
Zs as DARK_THRESHOLD,
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14728
|
+
Re as DEFAULT_CONFIG,
|
|
14729
|
+
N as PiiRedactor,
|
|
14730
|
+
_v as analyzeImage,
|
|
14705
14731
|
eu as computeAverageLuminance,
|
|
14706
14732
|
su as detectPiiNer,
|
|
14707
14733
|
hu as detectPiiRegex,
|
|
14708
|
-
|
|
14734
|
+
Yv as drawRedactionPreview,
|
|
14709
14735
|
Hv as entitiesToRedactions,
|
|
14710
14736
|
tu as isDarkBackground,
|
|
14711
|
-
|
|
14737
|
+
Vv as mergeEntities,
|
|
14712
14738
|
co as preloadNerModel,
|
|
14713
14739
|
nu as preprocessForOcr,
|
|
14714
|
-
|
|
14740
|
+
ew as registerServiceWorker,
|
|
14715
14741
|
uu as releaseNerModel,
|
|
14716
|
-
|
|
14742
|
+
Mv as renderRedactedImage,
|
|
14717
14743
|
ru as runOcr,
|
|
14718
|
-
|
|
14744
|
+
tw as unregisterServiceWorker
|
|
14719
14745
|
};
|
|
14720
14746
|
//# sourceMappingURL=image-pii-redactor.js.map
|