Hassan Shavarani
commited on
Commit
•
fe5017b
1
Parent(s):
e3c39dd
Update example_data_reader.py
Browse files- example_data_reader.py +2 -0
example_data_reader.py
CHANGED
@@ -7,6 +7,7 @@ import json
|
|
7 |
import datetime
|
8 |
from zipfile import ZipFile
|
9 |
from tqdm import tqdm
|
|
|
10 |
from collections import namedtuple
|
11 |
|
12 |
ENELabel = namedtuple('ENELabel', ['level_id', 'name'])
|
@@ -102,6 +103,7 @@ class SHINRA5LDS:
|
|
102 |
return self.__next__()
|
103 |
|
104 |
if __name__ == "__main__":
|
|
|
105 |
for article, annotation in tqdm(SHINRA5LDS('SHINRA-5LDS.zip', 'en')):
|
106 |
print('='*80)
|
107 |
print(article.title, annotation.labels.values)
|
|
|
7 |
import datetime
|
8 |
from zipfile import ZipFile
|
9 |
from tqdm import tqdm
|
10 |
+
from torch.hub import download_url_to_file
|
11 |
from collections import namedtuple
|
12 |
|
13 |
ENELabel = namedtuple('ENELabel', ['level_id', 'name'])
|
|
|
103 |
return self.__next__()
|
104 |
|
105 |
if __name__ == "__main__":
|
106 |
+
download_url_to_file("https://huggingface.co/datasets/sshavara/SHINRA-5LDS/resolve/main/SHINRA-5LDS.zip?download=true", "SHINRA-5LDS.zip", progress=True)
|
107 |
for article, annotation in tqdm(SHINRA5LDS('SHINRA-5LDS.zip', 'en')):
|
108 |
print('='*80)
|
109 |
print(article.title, annotation.labels.values)
|