96abhishekarora
commited on
Commit
•
217de99
1
Parent(s):
8036d1a
First version of the AmericanStories dataset.
Browse files- .gitattributes +2 -0
- AmericanStories.py +52 -0
- README.md +3 -0
.gitattributes
CHANGED
@@ -53,3 +53,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
55 |
.tar.gz filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
55 |
.tar.gz filter=lfs diff=lfs merge=lfs -text
|
56 |
+
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
57 |
+
faro_1799.tar.gz filter=lfs diff=lfs merge=lfs -text
|
AmericanStories.py
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import tarfile
|
3 |
+
from datasets import DatasetInfo, DatasetBuilder, DownloadManager
|
4 |
+
|
5 |
+
_CITATION = """\
|
6 |
+
Coming Soon
|
7 |
+
"""
|
8 |
+
|
9 |
+
_DESCRIPTION = """\
|
10 |
+
American Stories offers high-quality structured data from historical newspapers suitable for pre-training large language models to enhance the understanding of historical English and world knowledge. It can also be integrated into external databases of retrieval-augmented language models, enabling broader access to historical information, including interpretations of political events and intricate details about people's ancestors. Additionally, the structured article texts facilitate the application of transformer-based methods for popular tasks like detecting reproduced content, significantly improving accuracy compared to traditional OCR methods. American Stories serves as a substantial and valuable dataset for advancing multimodal layout analysis models and other multimodal applications.
|
11 |
+
"""
|
12 |
+
|
13 |
+
class YourDatasetName(DatasetBuilder):
|
14 |
+
VERSION = "0.0.1"
|
15 |
+
|
16 |
+
BUILDER_CONFIGS = [
|
17 |
+
DatasetBuilderConfig(
|
18 |
+
name="AmericanStories",
|
19 |
+
version=VERSION,
|
20 |
+
description=_DESCRIPTION,
|
21 |
+
),
|
22 |
+
]
|
23 |
+
|
24 |
+
def _info(self) -> DatasetInfo:
|
25 |
+
features = {
|
26 |
+
"feature_name": datasets.Value("string"),
|
27 |
+
# Define the other features of your dataset here
|
28 |
+
}
|
29 |
+
|
30 |
+
return datasets.DatasetInfo(
|
31 |
+
description=_DESCRIPTION,
|
32 |
+
features=datasets.Features(features),
|
33 |
+
citation=_CITATION,
|
34 |
+
)
|
35 |
+
|
36 |
+
def _split_generators(self, dl_manager: DownloadManager) -> List[datasets.SplitGenerator]:
|
37 |
+
# No explicit splits defined
|
38 |
+
return []
|
39 |
+
|
40 |
+
def _generate_examples(self, filepath: str) -> Iterator[datasets.Example]:
|
41 |
+
with tarfile.open(filepath, "r:gz") as tar:
|
42 |
+
for member in tar.getmembers():
|
43 |
+
if member.isfile() and member.name.endswith('.json'):
|
44 |
+
file_name = os.path.basename(member.name)
|
45 |
+
with tar.extractfile(member) as f:
|
46 |
+
data = json.load(f)
|
47 |
+
for idx, example in enumerate(data):
|
48 |
+
# Process and yield each example
|
49 |
+
yield idx, {
|
50 |
+
"feature_name": example["feature_name"],
|
51 |
+
# Assign values to other features of your dataset
|
52 |
+
}
|
README.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc
|
3 |
+
---
|