Added mybible

This commit is contained in:
Jonathan Herrewijnen 2024-09-29 22:37:18 +02:00
parent ede1783a3a
commit 42cf64e579
5 changed files with 32 additions and 5 deletions

15
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}

View File

@ -16,7 +16,7 @@ def extract_text_from_pdf(pdf_path):
return lines return lines
# Replace 'your_pdf_file.pdf' with the actual path to your PDF file # Replace 'your_pdf_file.pdf' with the actual path to your PDF file
pdf_path = '/mnt/c/Projects/telosvertaling/telos_nt.pdf' pdf_path = 'telos_nt.pdf'
extracted_text = extract_text_from_pdf(pdf_path)#.replace('\n', '') extracted_text = extract_text_from_pdf(pdf_path)#.replace('\n', '')
def merge_entries(verse_list): def merge_entries(verse_list):
@ -110,10 +110,23 @@ df['Chapter'] = df['Chapter'].fillna(method='bfill')
for book in df['Bookname'].unique(): for book in df['Bookname'].unique():
df.loc[df['Bookname'] == book, 'Book'] = list(df['Bookname'].unique()).index(book) + 40 df.loc[df['Bookname'] == book, 'Book'] = list(df['Bookname'].unique()).index(book) + 40
df.to_csv('/mnt/c/Projects/telosvertaling/telos.csv', index=False) df.to_csv('telos.csv', index=False)
# write to sql database df_details = pd.DataFrame(columns=['Description', 'Abbreviation', 'Comments', 'Version', 'VersionDate', 'PublishDate', 'RightToLeft', 'OT', 'NT', 'Strong'])
df.to_sql('telos', 'sqlite:///telos.db', if_exists='replace', index=False) df_details.loc[0] = ['Telos vertaling', 'TELOS', 'Telos from PDF. H. Medema Vaassen, revised from the original Voorhoeve translation from 1877.', '1', '2024-09-29', '1982-01-01', 0, 0, 1, 0]
df['Verse'] = df['Verse'].astype(int)
df['Chapter'] = df['Chapter'].astype(int)
df['Book'] = df['Book'].astype(int)
df['Bookname'] = df['Bookname'].astype(str)
df['Scripture'] = df['Scripture'].astype(str)
# Write both dataframes to a single db file
import sqlite3
conn = sqlite3.connect('telos.mybible')
df[['Book', 'Chapter', 'Verse', 'Scripture']].to_sql('Scripture', conn, if_exists='replace', index=False)
df_details.to_sql('Details', conn, if_exists='replace', index=False)
conn.close()
# with open('/mnt/c/Projects/telosvertaling/merged_entries.txt', 'w', encoding='utf-8') as f: # with open('/mnt/c/Projects/telosvertaling/merged_entries.txt', 'w', encoding='utf-8') as f:
# f.write(str([text for text in merged_entries])) # f.write(str([text for text in merged_entries]))

View File

@ -1 +0,0 @@
[]

BIN
telos.db Normal file

Binary file not shown.

BIN
telos.mybible Normal file

Binary file not shown.