mericope 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.mdown +66 -0
- data/bin/mericope +9 -0
- data/data/book_abbreviations.txt +84 -0
- data/data/chapter_verse_count.txt +1428 -0
- data/lib/cli/base.rb +30 -0
- data/lib/cli/command.rb +23 -0
- data/lib/mericope/cli.rb +124 -0
- data/lib/mericope/version.rb +3 -0
- data/lib/mericope.rb +550 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 570f05fdc93711d844e2cf6a74b80f4012582870
|
4
|
+
data.tar.gz: 296642223ee90fa83818fab295234ef67df8df47
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 342bd01c20d6d69d0bbb56d6f7b924c442a6b26e4dc146237bd343e0ec9679a36faa2c034ee54cd539413c128598ce8cd9010076ff2939833bd9a41be6093fe0
|
7
|
+
data.tar.gz: 7a86fed1dd64ec86469c20cf7259d83a9f4182083cbd20b4d69453ef60893c6e92d223278d14a5925037c85a9ceb5b36c928eabd4fe09a8e0ef8a4084ca802a8
|
data/README.mdown
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Mericope
|
2
|
+
|
3
|
+
Mericope is a gem for parsing Book of Mormon references (i.e. Mormon Pericopes). It's based on Pericope, a gem for parsing Bible references.
|
4
|
+
|
5
|
+
It recognizes common abbreviations and misspellings for names of the books of the Bible and a variety of ways of denoting ranges of chapters and verses. It can parse mericopes singly or out of a block of text. It's useful for comparing two mericopes for intersection and normalizing them into a well-formatted string.
|
6
|
+
|
7
|
+
## Examples
|
8
|
+
|
9
|
+
##### Recognize common abbreviations and misspellings for names of the books of the Bible
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
Mericope.new("ps 118:17").to_s # => Psalm 118:17
|
13
|
+
Mericope.new("jas 3:1-5").to_s # => James 3:1-5
|
14
|
+
Mericope.new("1 ne 12:4").to_s # => 1 Nephi 12:4
|
15
|
+
```
|
16
|
+
|
17
|
+
##### Compare two mericopes to see if they intersect
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
a = Mericope.new("Mark 13:1-6")
|
21
|
+
b = Mericope.new("Mark 13:5")
|
22
|
+
c = Mericope.new("Mark 13:6, 7")
|
23
|
+
|
24
|
+
a.intersects?(b) # => true
|
25
|
+
a.intersects?(c) # => true
|
26
|
+
b.intersects?(c) # => false
|
27
|
+
```
|
28
|
+
|
29
|
+
##### Parse mericopes out of a block of text
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
text = <<-TEXT
|
33
|
+
If then, the Word is so significant, great important attaches to its exact form. It has the form of a promise as in Isaiah 43:1: "Do not fear, for I have redeemed you; I have called you by name, you are mine," or as in Luke 2:10-11, "Do not be afraid..to you is born this day...a Savior." (Bayer, p51)
|
34
|
+
TEXT
|
35
|
+
|
36
|
+
Mericope.parse(text) # => [Isaiah 43:1, Luke 2:10-11]
|
37
|
+
|
38
|
+
Mericope.split(text) # => [" If then, the Word is so significant, great important attaches to its exact form. It has the form of a promise as in ", Isaiah 43:1, ": \"Do not fear, for I have redeemed you; I have called you by name, you are mine,\" or as in ", Luke 2:10-11, ", \"Do not be afraid..to you is born this day...a Savior.\" (Bayer, p51)\n"]
|
39
|
+
```
|
40
|
+
|
41
|
+
##### Converts mericopes into arrays of verses and reconstructs them from arrays of verses
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
array = Mericope.new("gen 1:1-3").to_a # => [1001001, 1001002, 1001003]
|
45
|
+
Mericope.new(array) # => Genesis 1:1-3
|
46
|
+
```
|
47
|
+
|
48
|
+
|
49
|
+
## History
|
50
|
+
|
51
|
+
##### 0.6.1
|
52
|
+
|
53
|
+
- Deprecated the `report` and `extract` methods (they will be removed in 0.7.0)
|
54
|
+
|
55
|
+
##### 0.6.0
|
56
|
+
|
57
|
+
- Removed the `index` attribute
|
58
|
+
- Deprecated the `pattern` argument to the method `Mericope.split(text, pattern=nil)` (it will be removed in 0.7.0)
|
59
|
+
- Improved performance by 2x
|
60
|
+
- Added this README
|
61
|
+
- Fixed a bug with parsing inverted [invalid] ranges (e.g. Mark 3-1)
|
62
|
+
|
63
|
+
|
64
|
+
## License
|
65
|
+
|
66
|
+
Copyright (c) 2012 Bob Lail, released under the MIT license
|
data/bin/mericope
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
1 genesis gen? gn
|
2
|
+
2 exodus exo?d? ex
|
3
|
+
3 leviticus le?v levi le
|
4
|
+
4 numbers? nu?m nu numb
|
5
|
+
5 deuteronomy deut? dt
|
6
|
+
6 joshua jo?sh jos
|
7
|
+
7 judges jd?gs? judg
|
8
|
+
8 ruth? ru rth
|
9
|
+
# isa is technically an abbrev for both Isaiah and 1 Samuel, but it should only be for isaiah
|
10
|
+
23 isaiah isa? ia isa[ih]
|
11
|
+
# there's a space in '1 st', etc, because query normalization puts one in; 2 before 1 because 'samuel' matches 1 samuel
|
12
|
+
10 (?:2|ii|second|2 nd) ?samuels? (?:2|ii|second|2 nd) ?sa?m?
|
13
|
+
9 (?:(?:1|i|first|1 st) ?)?samuels? (?:1|i|first|1 st) ?sa?m?
|
14
|
+
12 (?:2|ii|second|2 nd) ?ki?ng?s? (?:2|ii|second|2 nd) ?ki? (?:2|ii|second|2 nd) ?kgs?
|
15
|
+
11 (?:(?:1|i|first|1 st) ?)?ki?ng?s? (?:1|i) ?ki? (?:1|i|first|1 st) ?kgs?
|
16
|
+
14 (?:2|ii|second|2 nd) ?chronicles? (?:2|ii|second|2 nd) ?chr? (?:2|ii|second|2 nd) ?chro?n?
|
17
|
+
13 (?:(?:1|i|first|1 st) ?)?chronicles? (?:1|i|first|1 st) ?chr? (?:1|i|first|1 st) ?chro?n?
|
18
|
+
15 ezra?
|
19
|
+
16 nehemiah neh
|
20
|
+
17 esther esth? es
|
21
|
+
18 jo?b
|
22
|
+
19 psa?lms? ps[as]?m?
|
23
|
+
20 proverbs? pro?v? prvbs? pv
|
24
|
+
21 ecclesiastes? eccl? eccles ecl?
|
25
|
+
22 (?:the ?)?song ?of ?solomon (?:the ?)?song ?of ?songs sn?gs? songs? so?s sol? son s ?of ? s
|
26
|
+
24 jeremiah? jer? jr jere
|
27
|
+
25 lamentations? lam? lm
|
28
|
+
26 ezekiel ez[ek] ezek
|
29
|
+
27 daniel da?n dl da
|
30
|
+
28 hosea ho?s hos?
|
31
|
+
29 joel? jl
|
32
|
+
30 amo?s?
|
33
|
+
31 obadiah? obad? obd?
|
34
|
+
32 jonah jon
|
35
|
+
33 micah? mic?
|
36
|
+
34 nahum nah? nahu
|
37
|
+
35 habakk?uk habk?
|
38
|
+
36 zephaniah? ze?ph?
|
39
|
+
37 haggai ha?gg?
|
40
|
+
38 zechariah? ze?ch?
|
41
|
+
39 malachi? mal
|
42
|
+
40 matthew ma?tt?
|
43
|
+
41 ma?rk? mk
|
44
|
+
42 luke? lk lu
|
45
|
+
# don't want john to gobble up the "jn" when they really mean 1 jn
|
46
|
+
62 (?:1|i|first|1 st) ?john? (?:1|i|first|1 st) ?jh?n (?:1|i|first|1 st) ?jon? (?:1|i|first|1 st) ?jh
|
47
|
+
63 (?:2|ii|second|2 nd) ?john? (?:2|ii|second|2 nd) ?jh?n (?:2|ii|second|2 nd) ?jon? (?:2|ii|second|2 nd) ?jh
|
48
|
+
64 (?:3|iii|third|3 rd) ?john? (?:3|iii|third|3 rd) ?jh?n (?:3|iii|third|3 rd) ?jon? (?:3|iii|third|3 rd) ?jh
|
49
|
+
43 john? jh?n
|
50
|
+
44 acts act?
|
51
|
+
45 romans? rom? rms? roms
|
52
|
+
47 (?:2|ii|second|2 nd) ?corinthians? (?:2|ii|second|2 nd) ?cor? (?:2|ii) ?corint?h? (?:2|ii) ?corth
|
53
|
+
46 (?:(?:1|i|first|1 st) ?)?corinthians? (?:1|i|first|1 st) ?cor? (?:1|i|first|1 st) ?corint?h? (?:1|i|first|1 st) ?corth
|
54
|
+
48 galatians? gal? galat?
|
55
|
+
49 ephesians? eph? ephe?s?
|
56
|
+
50 philippians? phi?l php phi philipp?
|
57
|
+
51 colossi?ans? col?
|
58
|
+
53 (?:2|ii|second|2 nd) ?thessalonians? (?:2|ii|second|2 nd) ?thes{1,} (?:2|ii|second|2 nd) ?the?s?
|
59
|
+
52 (?:(?:1|i|first|1 st) ?)?thessalonians? (?:(?:1|i|first|1 st) ?)?thes{1,} (?:(?:1|i|first|1 st) ?)?the?s?
|
60
|
+
55 (?:2|ii|second|2 nd) ?timothy? (?:2|ii|second|2 nd) ?tim? (?:2|ii|second|2 nd) ?tm
|
61
|
+
54 (?:(?:1|i|first|1 st) ?)?timothy? (?:1|i|first|1 st) ?tim? (?:1|i|first|1 st) ?tm
|
62
|
+
56 titus tit?
|
63
|
+
57 philemon phl?mn? philem?
|
64
|
+
58 hebrews? heb
|
65
|
+
59 james? ja[ms]? jms?
|
66
|
+
61 (?:2|ii|second|2 nd) ?peter? (?:2|ii|second|2 nd) ?pe?t?r?
|
67
|
+
60 (?:(?:1|i|first|1 st) ?)?peter? (?:1|i|first|1 st) ?pe?t?r?
|
68
|
+
65 jude
|
69
|
+
66 revelations? re?v re revel
|
70
|
+
68 (?:2|ii|second|2 nd) ?nephi (?:2|ii|second|2 nd) ?ne
|
71
|
+
67 (?:1|i|first|1 st) ?nephi (?:1|i|first|1 st) ?ne
|
72
|
+
69 jacob jac
|
73
|
+
70 enos en
|
74
|
+
71 jarom jar
|
75
|
+
72 omni om
|
76
|
+
73 words of mormon wom
|
77
|
+
74 mosiah mosh?
|
78
|
+
75 alma alm?
|
79
|
+
76 helaman hela?
|
80
|
+
77 (?:3|iii|third|3 rd) ?nephi (?:3|iii|third|3 rd) ?ne
|
81
|
+
78 (?:4|iv|fourth|4 th) ?nephi (?:4|iv|fourth|4 th) ?ne
|
82
|
+
79 mormon morm
|
83
|
+
80 ether eth
|
84
|
+
81 moroni moro
|