linkture 2.6.0__tar.gz → 2.6.2__tar.gz
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.
- {linkture-2.6.0 → linkture-2.6.2}/PKG-INFO +16 -10
- {linkture-2.6.0 → linkture-2.6.2}/README.md +14 -9
- {linkture-2.6.0 → linkture-2.6.2}/pyproject.toml +2 -1
- {linkture-2.6.0 → linkture-2.6.2}/src/linkture/__main__.py +7 -7
- {linkture-2.6.0 → linkture-2.6.2}/src/linkture/linkture.py +10 -8
- {linkture-2.6.0 → linkture-2.6.2}/LICENSE +0 -0
- {linkture-2.6.0 → linkture-2.6.2}/src/linkture/__init__.py +0 -0
- {linkture-2.6.0 → linkture-2.6.2}/src/linkture/res/custom.json +0 -0
- {linkture-2.6.0 → linkture-2.6.2}/src/linkture/res/resources.db +0 -0
- {linkture-2.6.0 → linkture-2.6.2}/src/linkture/res/rss-36.png +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: linkture
|
3
|
-
Version: 2.6.
|
3
|
+
Version: 2.6.2
|
4
4
|
Summary: PARSE and PROCESS BIBLE SCRIPTURE REFERENCES: extract, tag, link, rewrite, translate, BCV-encode and decode
|
5
5
|
Keywords: bible,scriptures,scripture-references,scripture-translation,scripture-parser,scripture-linker
|
6
6
|
Author-Email: "Eryk J." <infiniti@inventati.org>
|
@@ -24,11 +24,9 @@ Requires-Dist: argparse>=1.4.0
|
|
24
24
|
Requires-Dist: regex>=2023.8.8
|
25
25
|
Requires-Dist: unidecode>=1.3.8
|
26
26
|
Requires-Dist: pandas==2.2.2
|
27
|
+
Requires-Dist: pathlib>=1.0.1
|
27
28
|
Description-Content-Type: text/markdown
|
28
29
|
|
29
|
-
# linkture
|
30
|
-
|
31
|
-
|
32
30
|
## Purpose
|
33
31
|
|
34
32
|
This module contains functions to parse and process Bible scripture references.
|
@@ -116,15 +114,18 @@ John 17:17; 2 Tim. 3:16, 17
|
|
116
114
|
$ python3 -m linkture -r "Joh 17:17; 2Ti 3:16, 17" --official
|
117
115
|
Joh 17:17; 2Ti 3:16, 17
|
118
116
|
|
117
|
+
|
119
118
|
$ python3 -m linkture -r "Joh 17:17; 2Ti 3:16, 17" -c
|
120
119
|
[('43017017', '43017017'), ('55003016', '55003017')]
|
121
120
|
|
122
121
|
$ python3 -m linkture -r "[('43017017', '43017017'), ('55003016', '55003017')]" -d --translate German
|
123
122
|
['Johannes 17:17', '2. Timotheus 3:16, 17']
|
124
123
|
|
124
|
+
|
125
125
|
$ python3 -m linkture -r "Joh 17:17; 2Ti 3:16, 17" -l '<a href="https://my.website.com/' '/index.html" class="test">'
|
126
126
|
<a href="https://my.website.com/43:17:17/index.html" class="test">John 17:17</a>; <a href="https://my.website.com/55:3:16-55:3:17/index.html" class="test">2 Timothy 3:16, 17</a>
|
127
127
|
|
128
|
+
|
128
129
|
$ python3 -m linkture -r "Joh 17:17; 2Ti 3:16, 17" --translate Chinese
|
129
130
|
约翰福音 17:17; 提摩太后书 3:16, 17
|
130
131
|
|
@@ -137,6 +138,7 @@ Juan 17:17; 2 Tim. 3:16, 17
|
|
137
138
|
$ python3 -m linkture -r "Mat 17:17; Paul 3:16, 17" --full -x
|
138
139
|
['Matthew 17:17']
|
139
140
|
|
141
|
+
|
140
142
|
$ python3 -m linkture -cc 2
|
141
143
|
('01002001', '01002025')
|
142
144
|
|
@@ -149,6 +151,7 @@ $ python3 -m linkture -sv '01001001'
|
|
149
151
|
python3 -m linkture -sc '66022001'
|
150
152
|
1189
|
151
153
|
|
154
|
+
|
152
155
|
python3 -m linkture -r '2Ti 3:16, 17' --full -s '_'
|
153
156
|
2_Timothy_3:16,_17
|
154
157
|
```
|
@@ -162,12 +165,14 @@ Unless you use `-q`, you will see in the terminal any out-of-range errors encoun
|
|
162
165
|
____
|
163
166
|
## Script/import usage
|
164
167
|
|
165
|
-
Assume the text (short string or long document) you want to process is in the variable `txt`.
|
168
|
+
Assume the text (short string or long document) you want to process is in the variable `txt`.
|
169
|
+
|
166
170
|
```
|
167
171
|
from linkture import Scriptures
|
168
172
|
|
169
173
|
s = Scriptures(language="English", translate="Spanish", form="full")
|
170
174
|
|
175
|
+
|
171
176
|
lst = s.list_scriptures(txt)
|
172
177
|
# returns a list of (valid) extracted scriptures in the desired language and format
|
173
178
|
|
@@ -180,19 +185,20 @@ html = s.link_scriptures(txt, prefix='<a href="http://mywebsite.com/', suffix='"
|
|
180
185
|
tagged = s.tag_scriptures(txt)
|
181
186
|
# tagged will contain your document with the translated references enclosed within double braces
|
182
187
|
|
183
|
-
|
188
|
+
new_txt = s.rewrite_scriptures(txt)
|
184
189
|
# the references will simply be rewritten in the desired language and format
|
185
190
|
|
186
|
-
|
191
|
+
|
192
|
+
i = s.serial_chapter_number(ch_bcv)
|
187
193
|
# returns the serial number (1-1189) of the chapter identified by the provided BCV-format string; verse digits irrelevant
|
188
194
|
|
189
|
-
i = s.serial_verse_number(
|
195
|
+
i = s.serial_verse_number(vs_bcv)
|
190
196
|
# returns the serial number (1-31091) of the verse identified by the provided BCV-format string
|
191
197
|
|
192
|
-
|
198
|
+
ch_bcv = s.code_chapter(i)
|
193
199
|
# returns a BCV-format range string for the whole chapter indicated by the provided integer (1-1189)
|
194
200
|
|
195
|
-
|
201
|
+
vs_bcv = s.code_verse(i)
|
196
202
|
# returns a BCV-format range string for the verse indicated by the provided integer (1-31091)
|
197
203
|
```
|
198
204
|
|
@@ -1,6 +1,3 @@
|
|
1
|
-
# linkture
|
2
|
-
|
3
|
-
|
4
1
|
## Purpose
|
5
2
|
|
6
3
|
This module contains functions to parse and process Bible scripture references.
|
@@ -88,15 +85,18 @@ John 17:17; 2 Tim. 3:16, 17
|
|
88
85
|
$ python3 -m linkture -r "Joh 17:17; 2Ti 3:16, 17" --official
|
89
86
|
Joh 17:17; 2Ti 3:16, 17
|
90
87
|
|
88
|
+
|
91
89
|
$ python3 -m linkture -r "Joh 17:17; 2Ti 3:16, 17" -c
|
92
90
|
[('43017017', '43017017'), ('55003016', '55003017')]
|
93
91
|
|
94
92
|
$ python3 -m linkture -r "[('43017017', '43017017'), ('55003016', '55003017')]" -d --translate German
|
95
93
|
['Johannes 17:17', '2. Timotheus 3:16, 17']
|
96
94
|
|
95
|
+
|
97
96
|
$ python3 -m linkture -r "Joh 17:17; 2Ti 3:16, 17" -l '<a href="https://my.website.com/' '/index.html" class="test">'
|
98
97
|
<a href="https://my.website.com/43:17:17/index.html" class="test">John 17:17</a>; <a href="https://my.website.com/55:3:16-55:3:17/index.html" class="test">2 Timothy 3:16, 17</a>
|
99
98
|
|
99
|
+
|
100
100
|
$ python3 -m linkture -r "Joh 17:17; 2Ti 3:16, 17" --translate Chinese
|
101
101
|
约翰福音 17:17; 提摩太后书 3:16, 17
|
102
102
|
|
@@ -109,6 +109,7 @@ Juan 17:17; 2 Tim. 3:16, 17
|
|
109
109
|
$ python3 -m linkture -r "Mat 17:17; Paul 3:16, 17" --full -x
|
110
110
|
['Matthew 17:17']
|
111
111
|
|
112
|
+
|
112
113
|
$ python3 -m linkture -cc 2
|
113
114
|
('01002001', '01002025')
|
114
115
|
|
@@ -121,6 +122,7 @@ $ python3 -m linkture -sv '01001001'
|
|
121
122
|
python3 -m linkture -sc '66022001'
|
122
123
|
1189
|
123
124
|
|
125
|
+
|
124
126
|
python3 -m linkture -r '2Ti 3:16, 17' --full -s '_'
|
125
127
|
2_Timothy_3:16,_17
|
126
128
|
```
|
@@ -134,12 +136,14 @@ Unless you use `-q`, you will see in the terminal any out-of-range errors encoun
|
|
134
136
|
____
|
135
137
|
## Script/import usage
|
136
138
|
|
137
|
-
Assume the text (short string or long document) you want to process is in the variable `txt`.
|
139
|
+
Assume the text (short string or long document) you want to process is in the variable `txt`.
|
140
|
+
|
138
141
|
```
|
139
142
|
from linkture import Scriptures
|
140
143
|
|
141
144
|
s = Scriptures(language="English", translate="Spanish", form="full")
|
142
145
|
|
146
|
+
|
143
147
|
lst = s.list_scriptures(txt)
|
144
148
|
# returns a list of (valid) extracted scriptures in the desired language and format
|
145
149
|
|
@@ -152,19 +156,20 @@ html = s.link_scriptures(txt, prefix='<a href="http://mywebsite.com/', suffix='"
|
|
152
156
|
tagged = s.tag_scriptures(txt)
|
153
157
|
# tagged will contain your document with the translated references enclosed within double braces
|
154
158
|
|
155
|
-
|
159
|
+
new_txt = s.rewrite_scriptures(txt)
|
156
160
|
# the references will simply be rewritten in the desired language and format
|
157
161
|
|
158
|
-
|
162
|
+
|
163
|
+
i = s.serial_chapter_number(ch_bcv)
|
159
164
|
# returns the serial number (1-1189) of the chapter identified by the provided BCV-format string; verse digits irrelevant
|
160
165
|
|
161
|
-
i = s.serial_verse_number(
|
166
|
+
i = s.serial_verse_number(vs_bcv)
|
162
167
|
# returns the serial number (1-31091) of the verse identified by the provided BCV-format string
|
163
168
|
|
164
|
-
|
169
|
+
ch_bcv = s.code_chapter(i)
|
165
170
|
# returns a BCV-format range string for the whole chapter indicated by the provided integer (1-1189)
|
166
171
|
|
167
|
-
|
172
|
+
vs_bcv = s.code_verse(i)
|
168
173
|
# returns a BCV-format range string for the verse indicated by the provided integer (1-31091)
|
169
174
|
```
|
170
175
|
|
@@ -11,6 +11,7 @@ dependencies = [
|
|
11
11
|
"regex>=2023.8.8",
|
12
12
|
"unidecode>=1.3.8",
|
13
13
|
"pandas==2.2.2",
|
14
|
+
"pathlib>=1.0.1",
|
14
15
|
]
|
15
16
|
requires-python = ">=3.9"
|
16
17
|
readme = "README.md"
|
@@ -35,7 +36,7 @@ keywords = [
|
|
35
36
|
"scripture-parser",
|
36
37
|
"scripture-linker",
|
37
38
|
]
|
38
|
-
version = "v2.6.
|
39
|
+
version = "v2.6.2"
|
39
40
|
|
40
41
|
[project.license]
|
41
42
|
text = "MIT"
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"""
|
28
28
|
|
29
29
|
import argparse
|
30
|
-
from .linkture import
|
30
|
+
from .linkture import _available_languages, __app__, __version__, Scriptures
|
31
31
|
from ast import literal_eval
|
32
32
|
|
33
33
|
|
@@ -43,11 +43,11 @@ def main(args):
|
|
43
43
|
elif args['sv']:
|
44
44
|
return s.serial_verse_number(args['sv'])
|
45
45
|
if args['l'] is not None:
|
46
|
-
prefix = '<a href='
|
47
|
-
suffix = '>'
|
48
|
-
if len(args['l']) > 1:
|
46
|
+
prefix = '<a href="'
|
47
|
+
suffix = '">'
|
48
|
+
if len(args['l']) > 1 and args['l'][1] != '':
|
49
49
|
suffix = args['l'][1]
|
50
|
-
if len(args['l']) > 0:
|
50
|
+
if len(args['l']) > 0 and args['l'][0] != '':
|
51
51
|
prefix = args['l'][0]
|
52
52
|
return s.link_scriptures(text, prefix, suffix)
|
53
53
|
elif args['c']:
|
@@ -104,8 +104,8 @@ mode.add_argument('-f', metavar='in-file', help='get input from file (UTF-8)')
|
|
104
104
|
mode.add_argument('-r', metavar='reference', help='process "reference; reference; etc."')
|
105
105
|
parser.add_argument('-o', metavar='out-file', help='output file (terminal output if not provided)')
|
106
106
|
|
107
|
-
parser.add_argument('--language', default='English', choices=
|
108
|
-
parser.add_argument('--translate', choices=
|
107
|
+
parser.add_argument('--language', default='English', choices=_available_languages, help='indicate source language for book names (English if unspecified)')
|
108
|
+
parser.add_argument('--translate', choices=_available_languages, help='indicate output language for book names (same as source if unspecified)')
|
109
109
|
parser.add_argument('-s', metavar='separator', default=' ', help='segment separator (space by default)')
|
110
110
|
parser.add_argument('-u', action='store_true', help='capitalize (upper-case) book names')
|
111
111
|
format_group = parser.add_argument_group('output format (optional)', 'if provided, book names will be rewritten accordingly:')
|
@@ -27,16 +27,17 @@
|
|
27
27
|
"""
|
28
28
|
|
29
29
|
__app__ = 'linkture'
|
30
|
-
__version__ = 'v2.6.
|
30
|
+
__version__ = 'v2.6.2'
|
31
31
|
|
32
32
|
|
33
33
|
import json, regex, sqlite3
|
34
34
|
import pandas as pd
|
35
|
+
from pathlib import Path
|
35
36
|
from unidecode import unidecode
|
36
37
|
|
37
38
|
|
38
|
-
|
39
|
-
|
39
|
+
_available_languages = ('Cebuano', 'Chinese', 'Danish', 'Dutch', 'English', 'French', 'German', 'Greek', 'Hungarian', 'Italian', 'Japanese', 'Korean', 'Norwegian', 'Polish', 'Portuguese', 'Russian', 'Spanish', 'Tagalog', 'Ukrainian')
|
40
|
+
_non_latin = ('Chinese', 'Greek', 'Japanese', 'Korean', 'Russian', 'Ukrainian')
|
40
41
|
|
41
42
|
|
42
43
|
class Scriptures():
|
@@ -44,14 +45,14 @@ class Scriptures():
|
|
44
45
|
def __init__(self, language='English', translate=None, form=None, separator=' ', upper=False, verbose=False):
|
45
46
|
self._verbose = verbose
|
46
47
|
self._separator = separator
|
47
|
-
if language not in
|
48
|
+
if language not in _available_languages:
|
48
49
|
raise ValueError("Indicated source language is not an option!")
|
49
50
|
if translate:
|
50
|
-
if translate not in
|
51
|
+
if translate not in _available_languages:
|
51
52
|
raise ValueError("Indicated translation language is not an option!")
|
52
53
|
else:
|
53
54
|
translate = language
|
54
|
-
if language in
|
55
|
+
if language in _non_latin:
|
55
56
|
self._nl = True
|
56
57
|
else:
|
57
58
|
self._nl = False
|
@@ -66,9 +67,10 @@ class Scriptures():
|
|
66
67
|
else:
|
67
68
|
form = 3
|
68
69
|
self._src_book_names = {}
|
70
|
+
path = Path(__file__).resolve().parent
|
69
71
|
|
70
72
|
self._tr_book_names = ['Bible']
|
71
|
-
con = sqlite3.connect('res/resources.db')
|
73
|
+
con = sqlite3.connect(path / 'res/resources.db')
|
72
74
|
cur = con.cursor()
|
73
75
|
for rec in cur.execute(f"SELECT * FROM Books WHERE Language = '{translate}';").fetchall():
|
74
76
|
if self._upper:
|
@@ -83,7 +85,7 @@ class Scriptures():
|
|
83
85
|
item = unidecode(item)
|
84
86
|
normalized = regex.sub(r'\p{P}|\p{Z}', '', item.upper())
|
85
87
|
self._src_book_names[normalized] = rec[2]
|
86
|
-
with open('res/custom.json', 'r', encoding='UTF-8') as json_file:
|
88
|
+
with open(path / 'res/custom.json', 'r', encoding='UTF-8') as json_file:
|
87
89
|
b = json.load(json_file)
|
88
90
|
if language in b.keys():
|
89
91
|
for row in b[language]:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|