Upload 8 files
Browse files- Das_Kapital_64b55b6a.json.gz +3 -0
- Divina_Commedia_d5de4a96.json.gz +3 -0
- IPCC_Report_2023_5b129f31.json.gz +3 -0
- King_James_Bible_07a376a9.json.gz +3 -0
- King_James_Bible_f8c80398.json.gz +3 -0
- create_meta_data_csv_md.py +70 -0
- meta_data.csv +6 -0
- meta_data.md +7 -0
Das_Kapital_64b55b6a.json.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9c8b061b6f52bd0013401489fa0955c1ebb20fa41b40e1052272dad0c43a4efc
|
3 |
+
size 5008888
|
Divina_Commedia_d5de4a96.json.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:152eb3eb7f9dec86ad2a762d93e5fbc6c1c2277cc882636ebe351ee2c2b3ebf7
|
3 |
+
size 2707210
|
IPCC_Report_2023_5b129f31.json.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:57eea55c8386c32faf9f0fa6023b21955a49556ef2ddc8d98a89cc5014bb8ebe
|
3 |
+
size 1823088
|
King_James_Bible_07a376a9.json.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bbe117d15b89c15eec02cfbc4d46a71a19cb6cad88e1ec78ffd1973e61a78661
|
3 |
+
size 12003326
|
King_James_Bible_f8c80398.json.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ce1df443c6a73efbce1f9eca3525f4cb4f0cd100a901336ead7d28f1930341e5
|
3 |
+
size 26803964
|
create_meta_data_csv_md.py
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import json
|
3 |
+
import gzip
|
4 |
+
import csv
|
5 |
+
from multiprocessing import Pool, cpu_count
|
6 |
+
import time
|
7 |
+
|
8 |
+
def process_json_file(file_path):
|
9 |
+
with gzip.open(file_path, 'rt', encoding='utf-8') as gz_file:
|
10 |
+
data = json.load(gz_file)
|
11 |
+
return data.get('meta', {})
|
12 |
+
|
13 |
+
def get_file_size_mb(file_path):
|
14 |
+
return round(os.path.getsize(file_path) / (1024 * 1024), 2)
|
15 |
+
|
16 |
+
def write_to_csv_and_md(output_csv, output_md, headers, data):
|
17 |
+
with open(output_csv, 'w', newline='', encoding='utf-8') as csv_file:
|
18 |
+
writer = csv.DictWriter(csv_file, fieldnames=headers)
|
19 |
+
writer.writeheader()
|
20 |
+
writer.writerows(data)
|
21 |
+
|
22 |
+
with open(output_md, 'w', encoding='utf-8') as md_file:
|
23 |
+
md_file.write("| " + " | ".join(headers) + " |\n")
|
24 |
+
md_file.write("|" + "|".join([" --- " for _ in headers]) + "|\n")
|
25 |
+
|
26 |
+
for row in data:
|
27 |
+
md_file.write("| " + " | ".join([str(row[header]) for header in headers]) + " |\n")
|
28 |
+
|
29 |
+
def process_file(file_name, input_directory, base_url):
|
30 |
+
file_path = os.path.join(input_directory, file_name)
|
31 |
+
meta_data = process_json_file(file_path)
|
32 |
+
file_size_mb = get_file_size_mb(file_path)
|
33 |
+
|
34 |
+
row_data = {
|
35 |
+
"filesize": file_size_mb,
|
36 |
+
"filename": file_name,
|
37 |
+
"URL": f"{base_url}{file_name.replace('.json.gz', '')}",
|
38 |
+
**meta_data
|
39 |
+
}
|
40 |
+
|
41 |
+
return row_data
|
42 |
+
|
43 |
+
def main(input_directory, output_csv, output_md, base_url="https://do-me.github.io/SemanticFinder/?hf="):
|
44 |
+
headers = [
|
45 |
+
"filesize", "textTitle", "textAuthor", "textYear", "textLanguage", "URL",
|
46 |
+
"modelName", "quantized", "splitParam", "splitType", "characters", "chunks",
|
47 |
+
"exportDecimals", "lines", "textNotes", "textSourceURL", "filename"
|
48 |
+
]
|
49 |
+
|
50 |
+
all_data = []
|
51 |
+
|
52 |
+
start_time = time.time()
|
53 |
+
|
54 |
+
file_list = [file_name for file_name in os.listdir(input_directory) if file_name.endswith('.json.gz')]
|
55 |
+
|
56 |
+
with Pool(cpu_count()) as pool:
|
57 |
+
all_data = pool.starmap(process_file, [(file_name, input_directory, base_url) for file_name in file_list])
|
58 |
+
|
59 |
+
write_to_csv_and_md(output_csv, output_md, headers, all_data)
|
60 |
+
|
61 |
+
end_time = time.time()
|
62 |
+
processing_time = end_time - start_time
|
63 |
+
print(f"Processing time: {round(processing_time, 2)} seconds")
|
64 |
+
|
65 |
+
if __name__ == "__main__":
|
66 |
+
input_directory = "."
|
67 |
+
output_csv = "meta_data.csv"
|
68 |
+
output_md = "meta_data.md"
|
69 |
+
|
70 |
+
main(input_directory, output_csv, output_md)
|
meta_data.csv
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
filesize,textTitle,textAuthor,textYear,textLanguage,URL,modelName,quantized,splitParam,splitType,characters,chunks,exportDecimals,lines,textNotes,textSourceURL,filename
|
2 |
+
4.78,Das Kapital,Karl Marx,1867,de,https://do-me.github.io/SemanticFinder/?hf=Das_Kapital_64b55b6a,Xenova/multilingual-e5-small,True,80,Words,2003807,3164,5,28673,,https://ia601605.us.archive.org/13/items/KarlMarxDasKapitalpdf/KAPITAL1.pdf,Das_Kapital_64b55b6a.json.gz
|
3 |
+
2.58,Divina Commedia,Dante,1321,it,https://do-me.github.io/SemanticFinder/?hf=Divina_Commedia_d5de4a96,Xenova/multilingual-e5-base,True,50,Words,383782,1179,5,6225,,http://www.letteratura-italiana.com/pdf/divina%20commedia/08%20Inferno%20in%20versione%20italiana.pdf,Divina_Commedia_d5de4a96.json.gz
|
4 |
+
1.74,IPCC Report 2023,IPCC,2023,en,https://do-me.github.io/SemanticFinder/?hf=IPCC_Report_2023_5b129f31,Supabase/bge-small-en,True,200,Chars,307811,1566,5,3230,"state of knowledge of climate change, its widespread impacts and risks, and climate change mitigation and adaptation, based on the peer-reviewed scientific, technical and socio-economic literature",https://report.ipcc.ch/ar6syr/pdf/IPCC_AR6_SYR_LongerReport.pdf,IPCC_Report_2023_5b129f31.json.gz
|
5 |
+
11.45,King James Bible,,,en,https://do-me.github.io/SemanticFinder/?hf=King_James_Bible_07a376a9,TaylorAI/gte-tiny,True,200,Chars,4556163,23056,2,80496,,https://www.holybooks.com/wp-content/uploads/2010/05/The-Holy-Bible-King-James-Version.pdf,King_James_Bible_07a376a9.json.gz
|
6 |
+
25.56,King James Bible,,,en,https://do-me.github.io/SemanticFinder/?hf=King_James_Bible_f8c80398,TaylorAI/gte-tiny,True,200,Chars,4556163,23056,5,80496,,https://www.holybooks.com/wp-content/uploads/2010/05/The-Holy-Bible-King-James-Version.pdf,King_James_Bible_f8c80398.json.gz
|
meta_data.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
| filesize | textTitle | textAuthor | textYear | textLanguage | URL | modelName | quantized | splitParam | splitType | characters | chunks | exportDecimals | lines | textNotes | textSourceURL | filename |
|
2 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
3 |
+
| 4.78 | Das Kapital | Karl Marx | 1867 | de | https://do-me.github.io/SemanticFinder/?hf=Das_Kapital_64b55b6a | Xenova/multilingual-e5-small | True | 80 | Words | 2003807 | 3164 | 5 | 28673 | | https://ia601605.us.archive.org/13/items/KarlMarxDasKapitalpdf/KAPITAL1.pdf | Das_Kapital_64b55b6a.json.gz |
|
4 |
+
| 2.58 | Divina Commedia | Dante | 1321 | it | https://do-me.github.io/SemanticFinder/?hf=Divina_Commedia_d5de4a96 | Xenova/multilingual-e5-base | True | 50 | Words | 383782 | 1179 | 5 | 6225 | | http://www.letteratura-italiana.com/pdf/divina%20commedia/08%20Inferno%20in%20versione%20italiana.pdf | Divina_Commedia_d5de4a96.json.gz |
|
5 |
+
| 1.74 | IPCC Report 2023 | IPCC | 2023 | en | https://do-me.github.io/SemanticFinder/?hf=IPCC_Report_2023_5b129f31 | Supabase/bge-small-en | True | 200 | Chars | 307811 | 1566 | 5 | 3230 | state of knowledge of climate change | https://report.ipcc.ch/ar6syr/pdf/IPCC_AR6_SYR_LongerReport.pdf | IPCC_Report_2023_5b129f31.json.gz |
|
6 |
+
| 11.45 | King James Bible | | None | en | https://do-me.github.io/SemanticFinder/?hf=King_James_Bible_07a376a9 | TaylorAI/gte-tiny | True | 200 | Chars | 4556163 | 23056 | 2 | 80496 | | https://www.holybooks.com/wp-content/uploads/2010/05/The-Holy-Bible-King-James-Version.pdf | King_James_Bible_07a376a9.json.gz |
|
7 |
+
| 25.56 | King James Bible | | None | en | https://do-me.github.io/SemanticFinder/?hf=King_James_Bible_f8c80398 | TaylorAI/gte-tiny | True | 200 | Chars | 4556163 | 23056 | 5 | 80496 | | https://www.holybooks.com/wp-content/uploads/2010/05/The-Holy-Bible-King-James-Version.pdf | King_James_Bible_f8c80398.json.gz |
|