-
Notifications
You must be signed in to change notification settings - Fork 1
/
psalms.py
30 lines (27 loc) · 828 Bytes
/
psalms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Taken from http://en.wikipedia.org/wiki/Psalms#Numbering
PSALMS_TABLE = [
((1, 8), (1, 8)),
((9, 10), (9, 9)),
((11, 113), (10, 112)),
((114, 115), (113, 113)),
((116, 116), (114, 115)),
((117, 146), (116, 145)),
((147, 147), (146, 147)),
((148, 150), (148, 150)),
]
def masoretic_to_septuagint(num):
for (a, b), (c, d) in PSALMS_TABLE:
if a <= num and num <= b:
if a == b or c == d:
return c, d
else:
return c + (num - a), c + (num - a)
def septuagint_to_masoretic(num):
for (c, d), (a, b) in PSALMS_TABLE:
if a <= num and num <= b:
if a == b or c == d:
return c, d
else:
return c + (num - a), c + (num - a)