scv-bilara 3.166.3 → 3.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/js/search.js +5 -5
- package/src/bilara-data.js +19 -2
- package/src/ml-doc.js +39 -10
package/package.json
CHANGED
package/scripts/js/search.js
CHANGED
|
@@ -8,10 +8,7 @@ const {
|
|
|
8
8
|
English,
|
|
9
9
|
ExampleV2,
|
|
10
10
|
ExecGitMock,
|
|
11
|
-
FuzzyWordSet,
|
|
12
|
-
Pali,
|
|
13
11
|
Seeker,
|
|
14
|
-
SegDoc,
|
|
15
12
|
SuttaCentralId,
|
|
16
13
|
Verse,
|
|
17
14
|
|
|
@@ -430,7 +427,7 @@ found : segs:${segsMatched} by:${method} mlDocs:${nDocs} docs:${nRefs} ${ref
|
|
|
430
427
|
);
|
|
431
428
|
}
|
|
432
429
|
mlDocs.forEach((mld,im) => {
|
|
433
|
-
let {suid,
|
|
430
|
+
let {suid, docAuthor, docAuthorName, docFooter, lang} = mld;
|
|
434
431
|
mld.segments().forEach((seg,i) => {
|
|
435
432
|
var scid = seg.scid;
|
|
436
433
|
var sep = '---';
|
|
@@ -439,7 +436,7 @@ found : segs:${segsMatched} by:${method} mlDocs:${nDocs} docs:${nRefs} ${ref
|
|
|
439
436
|
let score = mld.score.toFixed(3);
|
|
440
437
|
let title = [
|
|
441
438
|
`doc:${im+1}/${nDocs}`,
|
|
442
|
-
`${
|
|
439
|
+
`${docAuthorName} ${suid}/${lang}/${docAuthor}`,
|
|
443
440
|
`score:${score}`
|
|
444
441
|
].join(' ');
|
|
445
442
|
console.log(`${sep} ${title} ${sep}`);
|
|
@@ -499,6 +496,9 @@ found : segs:${segsMatched} by:${method} mlDocs:${nDocs} docs:${nRefs} ${ref
|
|
|
499
496
|
break;
|
|
500
497
|
}
|
|
501
498
|
});
|
|
499
|
+
let footer = mld.docFooter
|
|
500
|
+
.replaceAll(/<[^>]*>/g, '');
|
|
501
|
+
console.log('\n', footer);
|
|
502
502
|
});
|
|
503
503
|
}
|
|
504
504
|
|
package/src/bilara-data.js
CHANGED
|
@@ -532,14 +532,17 @@
|
|
|
532
532
|
async trilingualDoc(suttaRef, opts={}) {
|
|
533
533
|
const msg = "B8a.trilingualDoc() ";
|
|
534
534
|
const dbg = DBG.TRILINGUALDOC;
|
|
535
|
-
let { bilaraPathMap: bpm, root } = this;
|
|
535
|
+
let { bilaraPathMap: bpm, root } = this;
|
|
536
|
+
suttaRef = SuttaRef.create(suttaRef);
|
|
536
537
|
let {
|
|
537
538
|
rootLang = 'pli',
|
|
538
539
|
rootAuthor = 'ms',
|
|
539
540
|
refLang,
|
|
540
541
|
refAuthor = 'sujato',
|
|
542
|
+
refAuthorName,
|
|
541
543
|
docLang = suttaRef.lang,
|
|
542
544
|
docAuthor = suttaRef.author,
|
|
545
|
+
docAuthorName,
|
|
543
546
|
logLevel,
|
|
544
547
|
} = opts;
|
|
545
548
|
let suid = suttaRef.sutta_uid;
|
|
@@ -548,6 +551,15 @@
|
|
|
548
551
|
let msgData = JSON.stringify({ suidRef, suid });
|
|
549
552
|
throw new Error(`${msg} no suttaInfo(${msgData})`);
|
|
550
553
|
}
|
|
554
|
+
if (docAuthorName == null) {
|
|
555
|
+
let info = AuthorsV2.authorInfo(docAuthor);
|
|
556
|
+
docAuthorName = info?.name?.join(', ');
|
|
557
|
+
}
|
|
558
|
+
if (refAuthorName == null) {
|
|
559
|
+
let info = AuthorsV2.authorInfo(refAuthor);
|
|
560
|
+
refAuthorName = info?.name?.join(', ');
|
|
561
|
+
}
|
|
562
|
+
|
|
551
563
|
let bilaraPaths = bpm.trilingualPaths({
|
|
552
564
|
suid,
|
|
553
565
|
rootLang,
|
|
@@ -567,16 +579,21 @@
|
|
|
567
579
|
bilaraPaths,
|
|
568
580
|
refAuthor,
|
|
569
581
|
refLang,
|
|
582
|
+
refAuthorName,
|
|
570
583
|
docAuthor,
|
|
584
|
+
docAuthorName,
|
|
571
585
|
docLang,
|
|
572
586
|
trilingual:true,
|
|
573
587
|
};
|
|
574
588
|
logLevel && (mldOpts.logLevel = logLevel);
|
|
575
|
-
dbg && console.log(msg, '[1]mldOpts', mldOpts);
|
|
589
|
+
dbg>1 && console.log(msg, '[1]mldOpts', mldOpts);
|
|
576
590
|
let mld = await new MLDoc(mldOpts).load(root);
|
|
577
591
|
if (dbg) {
|
|
578
592
|
let dbgOut = mld && {
|
|
579
593
|
author: mld.author,
|
|
594
|
+
refLang: mld.refLang,
|
|
595
|
+
refAuthor: mld.refAuthor,
|
|
596
|
+
refAuthorName: mld.refAuthorName,
|
|
580
597
|
docLang: mld.docLang,
|
|
581
598
|
docAuthor: mld.docAuthor,
|
|
582
599
|
docAuthorName: mld.docAuthorName,
|
package/src/ml-doc.js
CHANGED
|
@@ -21,7 +21,6 @@ class MLDoc {
|
|
|
21
21
|
author_uid,
|
|
22
22
|
bilaraPaths,
|
|
23
23
|
category = 'sutta',
|
|
24
|
-
docAuthorName,
|
|
25
24
|
footer = MLDoc.SC_FOOTER,
|
|
26
25
|
hyphen = "\u00ad",
|
|
27
26
|
lang,
|
|
@@ -71,11 +70,20 @@ class MLDoc {
|
|
|
71
70
|
this.trilingual = trilingual;
|
|
72
71
|
this.docLang = opts.docLang;
|
|
73
72
|
this.docAuthor = opts.docAuthor;
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
this.docAuthorName = opts.docAuthorName;
|
|
74
|
+
let docInfo = AuthorsV2.authorInfo(this.docAuthor);
|
|
75
|
+
if (docInfo) {
|
|
76
|
+
this.docAuthorName = docInfo.name?.join(', ');
|
|
77
|
+
this.docFooter = MLDoc.SC_FOOTER;
|
|
76
78
|
}
|
|
77
79
|
this.refLang = opts.refLang || 'en';
|
|
78
80
|
this.refAuthor = opts.refAuthor || 'sujato';
|
|
81
|
+
this.refAuthorName = opts.refAuthorName;
|
|
82
|
+
let refInfo = AuthorsV2.authorInfo(this.refAuthor);
|
|
83
|
+
if (refInfo) {
|
|
84
|
+
this.refAuthorName = refInfo.name?.join(', ');
|
|
85
|
+
this.refFooter = MLDoc.SC_FOOTER;
|
|
86
|
+
}
|
|
79
87
|
}
|
|
80
88
|
Object.defineProperty(this, "unicode", {
|
|
81
89
|
value: opts.unicode || new Unicode(),
|
|
@@ -212,15 +220,17 @@ class MLDoc {
|
|
|
212
220
|
bilaraPaths,
|
|
213
221
|
docLang,
|
|
214
222
|
docAuthor,
|
|
223
|
+
docAuthorName,
|
|
215
224
|
refLang,
|
|
216
225
|
refAuthor,
|
|
226
|
+
refAuthorName,
|
|
217
227
|
trilingual,
|
|
218
228
|
} = this;
|
|
219
229
|
this.langSegs = {};
|
|
220
230
|
let langMap = {};
|
|
221
231
|
var p_bp = [];
|
|
222
232
|
dbg && console.log(msg, '[1]',
|
|
223
|
-
{bilaraPaths,
|
|
233
|
+
{bilaraPaths, docLang, docAuthor, refLang, refAuthor});
|
|
224
234
|
|
|
225
235
|
for (var ip = 0; ip < bilaraPaths.length; ip++) {
|
|
226
236
|
var parts = BilaraPath.pathParts(bilaraPaths[ip]);
|
|
@@ -272,15 +282,34 @@ class MLDoc {
|
|
|
272
282
|
header = strings.__header__;
|
|
273
283
|
if (header) {
|
|
274
284
|
delete strings.__header__;
|
|
285
|
+
let { refAuthor, docAuthor } = this;
|
|
275
286
|
this.sutta_uid = header.suid;
|
|
276
|
-
this.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
this.
|
|
287
|
+
this.lang = this.lang || header.lang;
|
|
288
|
+
if (refAuthor === header.author_uid) {
|
|
289
|
+
dbg && console.log(msg, 'ref');
|
|
290
|
+
this.refAuthorName = header.author;
|
|
291
|
+
this.refFooter = header.footer;
|
|
292
|
+
}
|
|
293
|
+
if (docAuthor === header.author_uid) {
|
|
294
|
+
this.docAuthorName = header.author;
|
|
295
|
+
this.docFooter = header.footer;
|
|
281
296
|
}
|
|
282
297
|
|
|
283
|
-
|
|
298
|
+
if (dbg) {
|
|
299
|
+
let show = {
|
|
300
|
+
lang: this.lang,
|
|
301
|
+
docAuthor,
|
|
302
|
+
docAuthorName: this.docAuthorName,
|
|
303
|
+
docFooter: this.docFooter,
|
|
304
|
+
refAuthor,
|
|
305
|
+
refAuthorName: this.refAuthorName,
|
|
306
|
+
refFooter: this.refFooter,
|
|
307
|
+
}
|
|
308
|
+
if (dbg > 1) {
|
|
309
|
+
show.header = header;
|
|
310
|
+
}
|
|
311
|
+
console.log(msg, '[3]__header__', show);
|
|
312
|
+
}
|
|
284
313
|
}
|
|
285
314
|
fh.close();
|
|
286
315
|
let keys = Object.keys(strings);
|