gagan3012 commited on
Commit
4b89c8c
1 Parent(s): 6d8389c

Delete legal.py

Browse files
Files changed (1) hide show
  1. legal.py +0 -39
legal.py DELETED
@@ -1,39 +0,0 @@
1
- import datasets
2
- from glob import glob
3
- import pandas as pd
4
-
5
- INSTRCUT_DATA = glob("legal/*.jsonl")
6
- print(INSTRCUT_DATA)
7
-
8
- class Legal(datasets.GeneratorBasedBuilder):
9
- def _info(self):
10
- features = datasets.Features({
11
- "text": datasets.Value("string"),
12
- })
13
-
14
- return datasets.DatasetInfo(features=features)
15
-
16
- def _split_generators(self, dl_manager):
17
- downloaded_files = dl_manager.download(INSTRCUT_DATA)
18
- return [
19
- datasets.SplitGenerator(name=datasets.Split.TRAIN,
20
- gen_kwargs={
21
- "filepaths": downloaded_files})
22
- ]
23
-
24
- def _generate_examples(self, filepaths):
25
- yield from self.generate_examples_arabic(filepaths)
26
-
27
- def generate_examples_arabic(self, filepaths):
28
- key = 0
29
- for filepath in filepaths:
30
- print(filepath)
31
- df = pd.read_json(filepath, lines=True) # Ensure it reads line by line if your JSON is structured that way
32
- filepath_folder = filepath.split("/")[-1].split(".")[0]
33
- print(filepath_folder)
34
- for index, row in df.iterrows():
35
- # Assuming 'row' is a list of conversation turns
36
- yield key, {
37
- "text": row['source_content']
38
- }
39
- key += 1