generous_book_names = {
	"genesis": "Genesis",
	"gen": "Genesis",
	"exodus": "Exodus",
	"exod": "Exodus",
	"ex": "Exodus",
	"leviticus": "Leviticus",
	"lev": "Leviticus",
	"numbers": "Numbers",
	"num": "Numbers",
	"numeri": "Numbers",
	"deuteronomy": "Deuteronomy",
	"deut": "Deuteronomy",
	"deuteronomium": "Deuteronomy",
	"joshua": "Joshua",
	"josh": "Joshua",
	"josua": "Joshua",
	"judges": "Judges",
	"judg": "Judges",
	"judices": "Judges",
	"1 samuel": "1_Samuel",
	"1_samuel": "1_Samuel",
	"1sam": "1_Samuel",
	"1 sam": "1_Samuel",
	"samuel_i": "1_Samuel",
	"2 samuel": "2_Samuel",
	"2_samuel": "2_Samuel",
	"2sam": "2_Samuel",
	"2 sam": "2_Samuel",
	"samuel_ii": "2_Samuel",
	"1 kings": "1_Kings",
	"1_kings": "1_Kings",
	"1kgs": "1_Kings",
	"1 kgs": "1_Kings",
	"reges_i": "1_Kings",
	"2 kings": "2_Kings",
	"2_kings": "2_Kings",
	"2kgs": "2_Kings",
	"2 kgs": "2_Kings",
	"reges_ii": "2_Kings",
	"isaiah": "Isaiah",
	"isa": "Isaiah",
	"jesaia": "Isaiah",
	"jeremiah": "Jeremiah",
	"jer": "Jeremiah",
	"jeremia": "Jeremiah",
	"ezekiel": "Ezekiel",
	"ezek": "Ezekiel",
	"ezechiel": "Ezekiel",
	"hosea": "Hosea",
	"hos": "Hosea",
	"joel": "Joel",
	"amos": "Amos",
	"obadiah": "Obadiah",
	"obad": "Obadiah",
	"ob": "Obadiah",
	"obadia": "Obadiah",
	"jonah": "Jonah",
	"jon": "Jonah",
	"jona": "Jonah",
	"micah": "Micah",
	"mic": "Micah",
	"micha": "Micah",
	"nahum": "Nahum",
	"nah": "Nahum",
	"habakkuk": "Habakkuk",
	"hab": "Habakkuk",
	"habakuk": "Habakkuk",
	"zephaniah": "Zephaniah",
	"zeph": "Zephaniah",
	"zephania": "Zephaniah",
	"haggai": "Haggai",
	"hag": "Haggai",
	"zechariah": "Zechariah",
	"zech": "Zechariah",
	"sacharia": "Zechariah",
	"malachi": "Malachi",
	"mal": "Malachi",
	"maleachi": "Malachi",
	"psalms": "Psalms",
	"ps": "Psalms",
	"pss": "Psalms",
	"psalmi": "Psalms",
	"iob": "Job",
	"job": "Job",
	"proverbs": "Proverbs",
	"prov": "Proverbs",
	"proverbia": "Proverbs",
	"ruth": "Ruth",
	"song of solomon": "Song_of_songs",
	"songofsolomon": "Song_of_songs",
	"song_of_solomon": "Song_of_songs",
	"song of songs": "Song_of_songs",
	"songofsongs": "Song_of_songs",
	"song_of_songs": "Song_of_songs",
	"song_of_songs": "Song_of_songs",
	"songs": "Song_of_songs",
	"song": "Song_of_songs",
	"cant": "Song_of_songs",
	"canticum": "Song_of_songs",
	"ecclesiastes": "Ecclesiastes",
	"eccl": "Ecclesiastes",
	"lamentations": "Lamentations",
	"lam": "Lamentations",
	"threni": "Lamentations",
	"esther": "Esther",
	"esth": "Esther",
	"daniel": "Daniel",
	"dan": "Daniel",
	"esra": "Ezra",
	"nehemiah": "Nehemiah",
	"neh": "Nehemiah",
	"nehemia": "Nehemiah",
	"1chr": "1_Chronicles",
	"1 chr": "1_Chronicles",
	"1chron": "1_Chronicles",
	"1 chronicles": "1_Chronicles",
	"1_chronicles": "1_Chronicles",
	"chronica_i": "1_Chronicles",
	"2chr": "2_Chronicles",
	"2 chr": "2_Chronicles",
	"2chron": "2_Chronicles",
	"2 chronicles": "2_Chronicles",
	"2_chronicles": "2_Chronicles",
	"chronica_ii": "2_Chronicles",
}
book_to_index = {
	"Genesis": 1,
	"Exodus": 2,
	"Leviticus": 3,
	"Numbers": 4,
	"Deuteronomy": 5,
	"Joshua": 6,
	"Judges": 7,
	"Ruth": 8,
	"1_Samuel": 9,
	"2_Samuel": 10,
	"1_Kings": 11,
	"2_Kings": 12,
	"1_Chronicles": 13,
	"2_Chronicles": 14,
	"Ezra": 15,
	"Nehemiah": 16,
	"Esther": 17,
	"Job": 18,
	"Psalms": 19,
	"Proverbs": 20,
	"Ecclesiastes": 21,
	"Song_of_songs": 22,
	"Isaiah": 23,
	"Jeremiah": 24,
	"Lamentations": 25,
	"Ezekiel": 26,
	"Daniel": 27,
	"Hosea": 28,
	"Joel": 29,
	"Amos": 30,
	"Obadiah": 31,
	"Jonah": 32,
	"Micah": 33,
	"Nahum": 34,
	"Habakkuk": 35,
	"Zephaniah": 36,
	"Haggai": 37,
	"Zechariah": 38,
	"Malachi": 39,
}
# SBL Abbreviations
abbreviated_book_names = {
	"Genesis": "Gen",
	"Exodus": "Exod",
	"Leviticus": "Lev",
	"Numbers": "Num",
	"Deuteronomy": "Deut",
	"Joshua": "Josh",
	"Judges": "Judg",
	"1_Samuel": "1 Sam",
	"2_Samuel": "2 Sam",
	"1_Kings": "1 Kgs",
	"2_Kings": "2 Kgs",
	"Isaiah": "Isa",
	"Jeremiah": "Jer",
	"Ezekiel": "Ezek",
	"Hosea": "Hos",
	"Joel": "Joel",
	"Amos": "Amos",
	"Obadiah": "Obad",
	"Jonah": "Jonah",
	"Micah": "Mic",
	"Nahum": "Nah",
	"Habakkuk": "Hab",
	"Zephaniah": "Zeph",
	"Haggai": "Hag",
	"Zechariah": "Zech",
	"Malachi": "Mal",
	"Psalms": "Ps",
	"Job": "Job",
	"Proverbs": "Prov",
	"Ruth": "Ruth",
	"Song_of_songs": "Song",
	"Ecclesiastes": "Eccl",
	"Lamentations": "Lam",
	"Esther": "Esth",
	"Daniel": "Dan",
	"Ezra": "Ezra",
	"Nehemiah": "Neh",
	"1_Chronicles": "1 Chr",
	"2_Chronicles": "2 Chr",
}

def generous_name(book_name):
	normalised_book_name = book_name.replace("+", " ").lower()
	return generous_book_names[normalised_book_name] if normalised_book_name in generous_book_names else book_name

def book_index(book_name):
	return int(book_to_index[generous_name(book_name)])
	# return int(book_to_index[book_name])

def book_abbreviation(book_name):
	return abbreviated_book_names[generous_name(book_name)]
