codexparser 0.0.75 → 0.0.77
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/bcv-single-test.js +1 -1
- package/bcv_test.js +1 -1
- package/package.json +1 -1
- package/src/CodexParser.js +2 -8
- package/sub-verse-scripture-test.js +1 -1
package/bcv-single-test.js
CHANGED
package/bcv_test.js
CHANGED
|
@@ -6,7 +6,7 @@ const jd = "Jd. 5"
|
|
|
6
6
|
const cor = "Hos 1:1-3, 8 Song of Solomon 1:2, Song of Songs 2:2. Ezek 17:3. Ezekiel 17:3 He 10:13 Rev 12:13"
|
|
7
7
|
|
|
8
8
|
const parser = new bcv_parser()
|
|
9
|
-
const textParser = parser.parse("Gen 13:14-16 Clement of Letter to the Romanse, Letter to the Corinthians [51; 77; 111] 10:4-5; Jubilees [14; 43; 46; 118; 175; 179] 13:19-20; Genesis Apocryphon 21:8-10, 13 // Gen 13:15 Gal 3:16; Pseudo-Philo 8:3 Allusions - Jub 19:21-22; QapGn 21:8-10 // Gen 13:15 - Ac 7:5")
|
|
9
|
+
const textParser = parser.parse("Gen 13:14-16 Clement of Letter to the Romanse, Letter to the Corinthians [51; 77; 111] 10:4-5; Jubilees [14; 43; 46; 118; 175; 179] 13:19-20; Genesis Apocryphon 21:8-10, 13 // Gen 13:15 Gal 3:16; Pseudo-Philo 8:3 Allusions - Jub 19:21-22; QapGn 21:8-10 // Gen 13:15 - Ac 7:5 Rev 8:27")
|
|
10
10
|
const passages = textParser.parsed_entities()
|
|
11
11
|
|
|
12
12
|
passages.forEach((passage) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77",
|
|
4
4
|
"description": "This is a Javascript Bible parser and text scanner. It will search through texts and collate all scripture references into an array and parse them into objects, and it will parse passages into objects by book, chapter, verse, and testament. ",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/src/CodexParser.js
CHANGED
|
@@ -42,6 +42,7 @@ class CodexParser {
|
|
|
42
42
|
* @return {array} The found passages from the text.
|
|
43
43
|
*/
|
|
44
44
|
scan(text) {
|
|
45
|
+
text = text.replace(/Rev(?=\s|\.)/gim, "Revelation")
|
|
45
46
|
const regex = /(?:He(?=\s?\d+))/g
|
|
46
47
|
let match
|
|
47
48
|
const matches = []
|
|
@@ -65,7 +66,7 @@ class CodexParser {
|
|
|
65
66
|
text = text.replace(this.EzraAbbrv, "Ezra")
|
|
66
67
|
}
|
|
67
68
|
const passages = this.crawler.parse(text).parsed_entities()
|
|
68
|
-
|
|
69
|
+
|
|
69
70
|
for (let j = 0; j < passages.length; j++) {
|
|
70
71
|
const passage = passages[j]
|
|
71
72
|
for (let i = 0; i < passage.entities.length; i++) {
|
|
@@ -91,12 +92,7 @@ class CodexParser {
|
|
|
91
92
|
this.scan(reference)
|
|
92
93
|
for (let i = 0; i < this.found.length; i++) {
|
|
93
94
|
const result = this.found[i]
|
|
94
|
-
if (!result.entities[0].valid.valid) {
|
|
95
|
-
continue
|
|
96
|
-
}
|
|
97
|
-
|
|
98
95
|
if (result.type === "range" && result.start.b !== result.end.b) {
|
|
99
|
-
console.log("=================")
|
|
100
96
|
const newPassageFound = result.end.b + " " + result.end.c + ":" + result.end.v
|
|
101
97
|
const newPassageToAdd = this.crawler.parse(newPassageFound).parsed_entities()[0].entities
|
|
102
98
|
this.found.splice(i + 1, 0, ...newPassageToAdd)
|
|
@@ -295,7 +291,6 @@ class CodexParser {
|
|
|
295
291
|
|
|
296
292
|
regex(text) {
|
|
297
293
|
this.found = text.match(this.scripturesRegex)
|
|
298
|
-
console.log(this.found)
|
|
299
294
|
return this
|
|
300
295
|
}
|
|
301
296
|
|
|
@@ -304,7 +299,6 @@ class CodexParser {
|
|
|
304
299
|
for (let i = 0; i < this.found.length; i++) {
|
|
305
300
|
let verse, chapter
|
|
306
301
|
const hasChapterRange = this.found[i].match(/(?<=-\s?)\b\d+[.:].+\b/)
|
|
307
|
-
console.log(hasChapterRange)
|
|
308
302
|
const book = this.found[i].match(this.bookRegex)
|
|
309
303
|
if (book === null) continue
|
|
310
304
|
chapter = this.found[i].replace(book[0], "").match(this.chapterRegex)
|
|
@@ -11,5 +11,5 @@ parser.options({
|
|
|
11
11
|
invalid_sequence_strategy: "include",
|
|
12
12
|
single_chapter_1_strategy: "verse",
|
|
13
13
|
})
|
|
14
|
-
const result = parser.parse("
|
|
14
|
+
const result = parser.parse("Genesis 3:17-19 // Genesis 3:17 Genesis 3:18-19 Genesis 3:19")
|
|
15
15
|
dump(result.getPassages())
|