Update inspec.py
Browse files
inspec.py
CHANGED
@@ -25,7 +25,7 @@ _LICENSE = ""
|
|
25 |
|
26 |
_URLS = {
|
27 |
"test": "test.jsonl",
|
28 |
-
|
29 |
"valid": "valid.jsonl"
|
30 |
}
|
31 |
|
@@ -53,7 +53,7 @@ class TestLDKP(datasets.GeneratorBasedBuilder):
|
|
53 |
{
|
54 |
"id": datasets.Value("int64"),
|
55 |
"document": datasets.features.Sequence(datasets.Value("string")),
|
56 |
-
"
|
57 |
|
58 |
}
|
59 |
)
|
@@ -72,13 +72,13 @@ class TestLDKP(datasets.GeneratorBasedBuilder):
|
|
72 |
{
|
73 |
"id": datasets.Value("int64"),
|
74 |
"document": datasets.features.Sequence(datasets.Value("string")),
|
75 |
-
"
|
76 |
"extractive_keyphrases": datasets.features.Sequence(datasets.Value("string")),
|
77 |
"abstractive_keyphrases": datasets.features.Sequence(datasets.Value("string")),
|
78 |
"other_metadata": datasets.features.Sequence(
|
79 |
{
|
80 |
"text": datasets.features.Sequence(datasets.Value("string")),
|
81 |
-
"
|
82 |
}
|
83 |
)
|
84 |
|
@@ -101,14 +101,14 @@ class TestLDKP(datasets.GeneratorBasedBuilder):
|
|
101 |
|
102 |
data_dir = dl_manager.download_and_extract(_URLS)
|
103 |
return [
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
datasets.SplitGenerator(
|
113 |
name=datasets.Split.TEST,
|
114 |
# These kwargs will be passed to _generate_examples
|
@@ -135,20 +135,20 @@ class TestLDKP(datasets.GeneratorBasedBuilder):
|
|
135 |
if self.config.name == "extraction":
|
136 |
# Yields examples as (key, example) tuples
|
137 |
yield key, {
|
138 |
-
"id": data[
|
139 |
"document": data["document"],
|
140 |
-
"
|
141 |
}
|
142 |
elif self.config.name == "ldkp_extraction":
|
143 |
yield key, {
|
144 |
-
"id": data[
|
145 |
-
"document": data["document"]+data["other_metadata"][
|
146 |
-
"
|
147 |
}
|
148 |
elif self.config.name == "ldkp_generation":
|
149 |
yield key, {
|
150 |
"id": data['paper_id'],
|
151 |
-
"document": data["document"]+data["other_metadata"][
|
152 |
"extractive_keyphrases": data["extractive_keyphrases"],
|
153 |
"abstractive_keyphrases": data["abstractive_keyphrases"]
|
154 |
}
|
@@ -163,7 +163,7 @@ class TestLDKP(datasets.GeneratorBasedBuilder):
|
|
163 |
yield key, {
|
164 |
"id": data['paper_id'],
|
165 |
"document": data["document"],
|
166 |
-
"
|
167 |
"extractive_keyphrases": data["extractive_keyphrases"],
|
168 |
"abstractive_keyphrases": data["abstractive_keyphrases"],
|
169 |
"other_metadata": data["other_metadata"]
|
|
|
25 |
|
26 |
_URLS = {
|
27 |
"test": "test.jsonl",
|
28 |
+
"train": "train.jsonl",
|
29 |
"valid": "valid.jsonl"
|
30 |
}
|
31 |
|
|
|
53 |
{
|
54 |
"id": datasets.Value("int64"),
|
55 |
"document": datasets.features.Sequence(datasets.Value("string")),
|
56 |
+
"doc_bio_tags": datasets.features.Sequence(datasets.Value("string"))
|
57 |
|
58 |
}
|
59 |
)
|
|
|
72 |
{
|
73 |
"id": datasets.Value("int64"),
|
74 |
"document": datasets.features.Sequence(datasets.Value("string")),
|
75 |
+
"doc_bio_tags": datasets.features.Sequence(datasets.Value("string")),
|
76 |
"extractive_keyphrases": datasets.features.Sequence(datasets.Value("string")),
|
77 |
"abstractive_keyphrases": datasets.features.Sequence(datasets.Value("string")),
|
78 |
"other_metadata": datasets.features.Sequence(
|
79 |
{
|
80 |
"text": datasets.features.Sequence(datasets.Value("string")),
|
81 |
+
"bio_tags":datasets.features.Sequence(datasets.Value("string"))
|
82 |
}
|
83 |
)
|
84 |
|
|
|
101 |
|
102 |
data_dir = dl_manager.download_and_extract(_URLS)
|
103 |
return [
|
104 |
+
datasets.SplitGenerator(
|
105 |
+
name=datasets.Split.TRAIN,
|
106 |
+
# These kwargs will be passed to _generate_examples
|
107 |
+
gen_kwargs={
|
108 |
+
"filepath": data_dir['train'],
|
109 |
+
"split": "train",
|
110 |
+
},
|
111 |
+
),
|
112 |
datasets.SplitGenerator(
|
113 |
name=datasets.Split.TEST,
|
114 |
# These kwargs will be passed to _generate_examples
|
|
|
135 |
if self.config.name == "extraction":
|
136 |
# Yields examples as (key, example) tuples
|
137 |
yield key, {
|
138 |
+
"id": data['paper_id'],
|
139 |
"document": data["document"],
|
140 |
+
"doc_bio_tags": data["doc_bio_tags"]
|
141 |
}
|
142 |
elif self.config.name == "ldkp_extraction":
|
143 |
yield key, {
|
144 |
+
"id": data['paper_id'],
|
145 |
+
"document": data["document"]+data["other_metadata"]['text'],
|
146 |
+
"doc_bio_tags": data["document_tags"] + data["other_metadata"]['bio_tags']
|
147 |
}
|
148 |
elif self.config.name == "ldkp_generation":
|
149 |
yield key, {
|
150 |
"id": data['paper_id'],
|
151 |
+
"document": data["document"]+data["other_metadata"]['text'],
|
152 |
"extractive_keyphrases": data["extractive_keyphrases"],
|
153 |
"abstractive_keyphrases": data["abstractive_keyphrases"]
|
154 |
}
|
|
|
163 |
yield key, {
|
164 |
"id": data['paper_id'],
|
165 |
"document": data["document"],
|
166 |
+
"doc_bio_tags": data["doc_bio_tags"],
|
167 |
"extractive_keyphrases": data["extractive_keyphrases"],
|
168 |
"abstractive_keyphrases": data["abstractive_keyphrases"],
|
169 |
"other_metadata": data["other_metadata"]
|