harsh13333
commited on
Commit
•
27e6c9e
1
Parent(s):
c2908e2
adding validation data
Browse files- shipping_label_ner.py +21 -16
shipping_label_ner.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
|
2 |
import datasets
|
3 |
-
|
|
|
|
|
|
|
4 |
|
5 |
logger = datasets.logging.get_logger(__name__)
|
6 |
|
@@ -8,28 +11,33 @@ logger = datasets.logging.get_logger(__name__)
|
|
8 |
_CITATION = """
|
9 |
"""
|
10 |
|
11 |
-
_DESCRIPTION = """
|
|
|
|
|
12 |
|
13 |
-
_URL = "https://raw.githubusercontent.com/SanghaviHarshPankajkumar/shipping_label_project/main/"
|
14 |
_TRAINING_FILE = "train.txt"
|
|
|
15 |
_TEST_FILE = "test.txt"
|
16 |
|
17 |
|
18 |
-
class
|
19 |
-
"""
|
20 |
|
21 |
def __init__(self, **kwargs):
|
|
|
|
|
|
|
22 |
"""
|
23 |
-
|
24 |
-
super(WNUT_17Config, self).__init__(**kwargs)
|
25 |
|
26 |
|
27 |
-
class
|
28 |
-
"""
|
29 |
|
30 |
BUILDER_CONFIGS = [
|
31 |
-
|
32 |
-
name="
|
33 |
),
|
34 |
]
|
35 |
|
@@ -54,10 +62,6 @@ class WNUT_17(datasets.GeneratorBasedBuilder):
|
|
54 |
"I-ORG",
|
55 |
"B-LOCATION",
|
56 |
"I-LOCATION",
|
57 |
-
"B-PINCODE",
|
58 |
-
"I-PINCODE",
|
59 |
-
"B-COUNTRY",
|
60 |
-
"I-COUNTRY",
|
61 |
"B-NAME",
|
62 |
"I-NAME",
|
63 |
"B-BARCODE",
|
@@ -68,7 +72,6 @@ class WNUT_17(datasets.GeneratorBasedBuilder):
|
|
68 |
}
|
69 |
),
|
70 |
supervised_keys=None,
|
71 |
-
# homepage="http://noisy-text.github.io/2017/emerging-rare-entities.html",
|
72 |
citation=_CITATION,
|
73 |
)
|
74 |
|
@@ -77,12 +80,14 @@ class WNUT_17(datasets.GeneratorBasedBuilder):
|
|
77 |
urls_to_download = {
|
78 |
"train": f"{_URL}{_TRAINING_FILE}",
|
79 |
"test": f"{_URL}{_TEST_FILE}",
|
|
|
80 |
}
|
81 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
82 |
|
83 |
return [
|
84 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
85 |
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
|
|
86 |
]
|
87 |
|
88 |
def _generate_examples(self, filepath):
|
|
|
1 |
|
2 |
import datasets
|
3 |
+
# coding=utf-8
|
4 |
+
# Copyright 2024 HuggingFace Datasets Authors.
|
5 |
+
# Lint as: python3
|
6 |
+
"""The Shipping label Dataset."""
|
7 |
|
8 |
logger = datasets.logging.get_logger(__name__)
|
9 |
|
|
|
11 |
_CITATION = """
|
12 |
"""
|
13 |
|
14 |
+
_DESCRIPTION = """
|
15 |
+
|
16 |
+
The goal of this task is to provide a dataset for name entity recognition."""
|
17 |
|
18 |
+
_URL = "https://raw.githubusercontent.com/SanghaviHarshPankajkumar/shipping_label_project/main/NER/data/"
|
19 |
_TRAINING_FILE = "train.txt"
|
20 |
+
_VAL_FILE = "val.txt"
|
21 |
_TEST_FILE = "test.txt"
|
22 |
|
23 |
|
24 |
+
class shipping_labels_Config(datasets.BuilderConfig):
|
25 |
+
"""Shipping Label Dataset for ner"""
|
26 |
|
27 |
def __init__(self, **kwargs):
|
28 |
+
"""BuilderConfig for Shipping Label data.
|
29 |
+
Args:
|
30 |
+
**kwargs: keyword arguments forwarded to super.
|
31 |
"""
|
32 |
+
super(shipping_labels_Config, self).__init__(**kwargs)
|
|
|
33 |
|
34 |
|
35 |
+
class shiping_label_ner(datasets.GeneratorBasedBuilder):
|
36 |
+
"""Shipping Label Dataset for ner"""
|
37 |
|
38 |
BUILDER_CONFIGS = [
|
39 |
+
shipping_label_Config(
|
40 |
+
name="shipping_label_ner", version=datasets.Version("1.0.0"), description="Shipping Label Dataset for ner"
|
41 |
),
|
42 |
]
|
43 |
|
|
|
62 |
"I-ORG",
|
63 |
"B-LOCATION",
|
64 |
"I-LOCATION",
|
|
|
|
|
|
|
|
|
65 |
"B-NAME",
|
66 |
"I-NAME",
|
67 |
"B-BARCODE",
|
|
|
72 |
}
|
73 |
),
|
74 |
supervised_keys=None,
|
|
|
75 |
citation=_CITATION,
|
76 |
)
|
77 |
|
|
|
80 |
urls_to_download = {
|
81 |
"train": f"{_URL}{_TRAINING_FILE}",
|
82 |
"test": f"{_URL}{_TEST_FILE}",
|
83 |
+
"val": f"{_URL}{_VAL_FILE}",
|
84 |
}
|
85 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
86 |
|
87 |
return [
|
88 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
89 |
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
90 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["val"]}),
|
91 |
]
|
92 |
|
93 |
def _generate_examples(self, filepath):
|