codexparser 0.0.38 → 0.0.40
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/src/CodexParser.js +13 -0
- package/src/regex.js +1 -1
- package/sub-verse-scripture-test.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
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
|
@@ -27,6 +27,19 @@ class CodexParser {
|
|
|
27
27
|
* @return {array} The found passages from the text.
|
|
28
28
|
*/
|
|
29
29
|
scan(text) {
|
|
30
|
+
const abbrs = text.match(/(?:He)(?=.\d+)/gm)
|
|
31
|
+
if (abbrs) {
|
|
32
|
+
const matches = abbrs.map((string) => {
|
|
33
|
+
return {
|
|
34
|
+
abbr: string,
|
|
35
|
+
book: this.bookify(string),
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
for (let i = 0; i < matches.length; i++) {
|
|
39
|
+
const match = matches[i]
|
|
40
|
+
text = text.replace(match.abbr, match.book)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
30
43
|
const passages = this.crawler.parse(text).parsed_entities()
|
|
31
44
|
this.found.push(...passages.flatMap((passage) => passage.entities))
|
|
32
45
|
}
|
package/src/regex.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const bookRegex = /((?:(I+|1st|2nd|3rd|First|Second|Third|[123])\s)?(Gen|
|
|
1
|
+
const bookRegex = /((?:(I+|1st|2nd|3rd|First|Second|Third|[123])\s)?(Gen|Gn|Exo|Ex|Exod|Lev|Lv|Num|Nu|Nm|Nb|Deut|Dt|Josh|Jos|Jsh|Judg|Jdg|Jg|Jdgs|Rth|Ru|Sam|Samuel|Kings|Kgs|Chron|Chronicles|Ezra|Ezr|Ez|Neh|Ne|Esth|Job|Job|Jb|Pslm|Ps|Psalms|Psa|Psm|Pss|Prov|Pr|Prv|Eccles|Ec|Song|So|Canticles|Song of Songs|SOS|Isa|Is|Jer|Je|Jr|Lam|La|Ezek|Eze|Ezk|Dan|Da|Dn|Hos|Ho|Joel|Joe|Jl|Amos|Am|Obad|Ob|Jnh|Jon|Micah|Mic|Nah|Na|Hab|Zeph|Zep|Zp|Haggai|Hag|Hg|Zech|Zec|Zc|Mal|Mal|Ml|Matt|Mrk|Mk|Luk|Lk|John|Jn|Jhn|Acts|Ac|Rom|Ro|Rm|Co|Cor|Corinthians|Gal|Ga|Ephes|Eph|Phil|Php|Col|Col|Thes|Thess|Thessalonians|Ti|Tim|Timothy|Titus|Tit|Philem|Phm|Hebrews|Heb|He|James|Jas|Jm|Pe|Pet|Pt|Peter|Jn|Jo|Joh|Jhn|John|Jude|Jd|Jud|Jud|Rev|The Revelation|Genesis|Exodus|Leviticus|Numbers|Deuteronomy|Joshua|Judges|Ruth|Samuel|Kings|Chronicles|Ezra|Nehemiah|Esther|Job|Psalms|Psalm|Proverbs|Ecclesiastes|Song of Solomon|Isaiah|Jeremiah|Lamentations|Ezekiel|Daniel|Hosea|Joel|Amos|Obadiah|Jonah|Micah|Nahum|Habakkuk|Zephaniah|Haggai|Zechariah|Malachi|Matthew|Mark|Luke|John|Acts|Romans|Corinthians|Galatians|Ephesians|Philippians|Colossians|Thessalonians|Timothy|Titus|Philemon|Hebrews|James|Peter|John|Revelation|Re|Ap))/gmi
|
|
2
2
|
const chapterRegex = /\b(?:\.?\s?\d+[:|\.]?)\b/gm
|
|
3
3
|
const verseRegex = /\b[:.].+\b/gm
|
|
4
4
|
const chapterRange = /.?\s?(?:[-—–])\s?/gm
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const CodexParser = require("./src/CodexParser.js")
|
|
2
2
|
|
|
3
3
|
const parser = new CodexParser()
|
|
4
|
-
const scripture = "He 1:1-3, 8"
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const scripture = "And then he said, turn to He 1:1-3, 8. and He doesn't like it"
|
|
5
|
+
const result = parser.parse(`${scripture}. Please turn in your Bibles.`)
|
|
6
|
+
console.log(result.getPassages())
|