From 06392f8588ffac7022654a5f7b2e1e8c3d0d2dd9 Mon Sep 17 00:00:00 2001
From: Raghuram Subramani <raghus2247@gmail.com>
Date: Mon, 07 Apr 2025 11:27:37 +0530
Subject: [PATCH] add heinous offences tool

---
 heinous_offences/.gitignore    |  2 ++
 heinous_offences/import_csv.py | 24 ++++++++++++++++++++++++
 test/.gitignore                |  2 --
 test/transcribe.py             | 14 --------------
 4 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/heinous_offences/.gitignore b/heinous_offences/.gitignore
new file mode 100644
index 0000000..f40e633 100644
--- /dev/null
+++ a/heinous_offences/.gitignore
@@ -1,0 +1,2 @@
+*.json
+*.csv
diff --git a/heinous_offences/import_csv.py b/heinous_offences/import_csv.py
new file mode 100644
index 0000000..bff906f 100644
--- /dev/null
+++ a/heinous_offences/import_csv.py
@@ -1,0 +1,24 @@
+import tinydb
+import csv
+
+db = tinydb.TinyDB('db.json')
+file = open('ipc.csv', 'r')
+
+reader = csv.reader(file)
+
+header_parsed = False
+for row in reader:
+    if not header_parsed:
+        header_parsed = True
+        continue
+
+    record = {
+        'section': row[0],
+        'section_text': row[1],
+        'minimum_punishment': row[2],
+        'severity': row[3],
+        'comment': row[4]
+    }
+    db.insert(record)
+
+file.close()
diff --git a/test/.gitignore b/test/.gitignore
deleted file mode 100644
index 818a333..0000000 100644
--- a/test/.gitignore
+++ /dev/null
@@ -1,2 +1,0 @@
-*.txt
-*.mp3
diff --git a/test/transcribe.py b/test/transcribe.py
deleted file mode 100644
index c64f425..0000000 100644
--- a/test/transcribe.py
+++ /dev/null
@@ -1,14 +1,0 @@
-import os
-import whisper
-
-def transcribe_audio(audio_file_path, model_path):
-    model = whisper.load_model(model_path)
-    result = model.transcribe(audio_file_path)
-    text_file_path = os.path.splitext(audio_file_path)[0] + ".txt"
-    with open(text_file_path, "w") as text_file:
-        text_file.write(result['text'])
-    
-audio_file_path = 'test.mp3'
-
-if audio_file_path is not None:
-    transcribe_audio(audio_file_path, model_path='medium')
--
rgit 0.1.5