patriziobellan commited on
Commit
1b92190
1 Parent(s): 3f1bc3b

Upload PET.py

Browse files
Files changed (1) hide show
  1. PET.py +90 -25
PET.py CHANGED
@@ -7,23 +7,57 @@ import datasets
7
 
8
  # Find for instance the citation on arxiv or on the dataset repo/website
9
  _CITATION = """\
10
- @article{DBLP:journals/corr/abs-2203-04860,
11
- author = {Patrizio Bellan and
12
- Han van der Aa and
13
- Mauro Dragoni and
14
- Chiara Ghidini and
15
- Simone Paolo Ponzetto},
16
- title = {{PET:} {A} new Dataset for Process Extraction from Natural Language
17
- Text},
18
- journal = {CoRR},
19
- volume = {abs/2203.04860},
20
- year = {2022},
21
- url = {https://doi.org/10.48550/arXiv.2203.04860},
22
- doi = {10.48550/arXiv.2203.04860},
23
- eprinttype = {arXiv},
24
- eprint = {2203.04860},
25
- biburl = {https://dblp.org/rec/journals/corr/abs-2203-04860.bib}
 
 
 
 
 
 
 
 
26
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  """
28
 
29
  # You can copy an official description
@@ -35,9 +69,18 @@ _HOMEPAGE = "https://pdi.fbk.eu/pet-dataset/"
35
 
36
  _LICENSE = "MIT"
37
 
38
- _URL = "https://pdi.fbk.eu/pet/PETHuggingFace/"
39
- _TEST_FILE = "test.json"
40
- _TEST_FILE_RELATIONS = 'PETrelations.json'
 
 
 
 
 
 
 
 
 
41
 
42
  _NER = 'token-classification'
43
  _RELATIONS_EXTRACTION = 'relations-extraction'
@@ -107,6 +150,16 @@ class PET(datasets.GeneratorBasedBuilder):
107
  version=datasets.Version("1.0.1"),
108
  description="The PET Dataset for Relation Extraction"
109
  ),
 
 
 
 
 
 
 
 
 
 
110
  ]
111
 
112
  DEFAULT_CONFIG_NAME = _RELATIONS_EXTRACTION
@@ -136,10 +189,17 @@ class PET(datasets.GeneratorBasedBuilder):
136
  )
137
 
138
  def _split_generators(self, dl_manager):
 
139
  if self.config.name == _NER:
140
- urls_to_download = {
141
- "test": f"{_URL}{_TEST_FILE}",
142
- }
 
 
 
 
 
 
143
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
144
  return [datasets.SplitGenerator(
145
  name=datasets.Split.TEST,
@@ -150,9 +210,14 @@ class PET(datasets.GeneratorBasedBuilder):
150
  },
151
  )]
152
  else:
153
- urls_to_download = {
154
- "test": f"{_URL}{_TEST_FILE_RELATIONS}",
155
- }
 
 
 
 
 
156
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
157
  return [datasets.SplitGenerator(
158
  name=datasets.Split.TEST,
 
7
 
8
  # Find for instance the citation on arxiv or on the dataset repo/website
9
  _CITATION = """\
10
+ @inproceedings{DBLP:conf/bpm/BellanADGP22,
11
+ author = {Patrizio Bellan and
12
+ Han van der Aa and
13
+ Mauro Dragoni and
14
+ Chiara Ghidini and
15
+ Simone Paolo Ponzetto},
16
+ editor = {Cristina Cabanillas and
17
+ Niels Frederik Garmann{-}Johnsen and
18
+ Agnes Koschmider},
19
+ title = {{PET:} An Annotated Dataset for Process Extraction from Natural Language
20
+ Text Tasks},
21
+ booktitle = {Business Process Management Workshops - {BPM} 2022 International Workshops,
22
+ M{\"{u}}nster, Germany, September 11-16, 2022, Revised Selected
23
+ Papers},
24
+ series = {Lecture Notes in Business Information Processing},
25
+ volume = {460},
26
+ pages = {315--321},
27
+ publisher = {Springer},
28
+ year = {2022},
29
+ url = {https://doi.org/10.1007/978-3-031-25383-6\_23},
30
+ doi = {10.1007/978-3-031-25383-6\_23},
31
+ timestamp = {Tue, 14 Feb 2023 09:47:10 +0100},
32
+ biburl = {https://dblp.org/rec/conf/bpm/BellanADGP22.bib},
33
+ bibsource = {dblp computer science bibliography, https://dblp.org}
34
  }
35
+ @inproceedings{DBLP:conf/aiia/BellanGDPA22,
36
+ author = {Patrizio Bellan and
37
+ Chiara Ghidini and
38
+ Mauro Dragoni and
39
+ Simone Paolo Ponzetto and
40
+ Han van der Aa},
41
+ editor = {Debora Nozza and
42
+ Lucia C. Passaro and
43
+ Marco Polignano},
44
+ title = {Process Extraction from Natural Language Text: the {PET} Dataset and
45
+ Annotation Guidelines},
46
+ booktitle = {Proceedings of the Sixth Workshop on Natural Language for Artificial
47
+ Intelligence {(NL4AI} 2022) co-located with 21th International Conference
48
+ of the Italian Association for Artificial Intelligence (AI*IA 2022),
49
+ Udine, November 30th, 2022},
50
+ series = {{CEUR} Workshop Proceedings},
51
+ volume = {3287},
52
+ pages = {177--191},
53
+ publisher = {CEUR-WS.org},
54
+ year = {2022},
55
+ url = {https://ceur-ws.org/Vol-3287/paper18.pdf},
56
+ timestamp = {Fri, 10 Mar 2023 16:23:01 +0100},
57
+ biburl = {https://dblp.org/rec/conf/aiia/BellanGDPA22.bib},
58
+ bibsource = {dblp computer science bibliography, https://dblp.org}
59
+ }
60
+
61
  """
62
 
63
  # You can copy an official description
 
69
 
70
  _LICENSE = "MIT"
71
 
72
+ _URL_11 = "https://raw.githubusercontent.com/patriziobellan86/PETv1.1/master/"
73
+ _URL_10 = "https://pdi.fbk.eu/pet/PETHuggingFace/"
74
+ _TEST_FILE_11 = "PETv1.1-entities.jsonl"
75
+ _TEST_FILE_10 = "test.json"
76
+ _TEST_FILE_RELATIONS_11 = "PETv1.1-relations.json"
77
+ _TEST_FILE_RELATIONS_10 = 'PETrelations.json'
78
+
79
+
80
+
81
+
82
+
83
+
84
 
85
  _NER = 'token-classification'
86
  _RELATIONS_EXTRACTION = 'relations-extraction'
 
150
  version=datasets.Version("1.0.1"),
151
  description="The PET Dataset for Relation Extraction"
152
  ),
153
+ # PETConfig(
154
+ # name=_NER,
155
+ # version=datasets.Version("1.1.0"),
156
+ # description="The PET Dataset for Token Classification"
157
+ # ),
158
+ # PETConfig(
159
+ # name=_RELATIONS_EXTRACTION,
160
+ # version=datasets.Version("1.1.0"),
161
+ # description="The PET Dataset for Relation Extraction"
162
+ # ),
163
  ]
164
 
165
  DEFAULT_CONFIG_NAME = _RELATIONS_EXTRACTION
 
189
  )
190
 
191
  def _split_generators(self, dl_manager):
192
+ print(f"{self.config.version}")
193
  if self.config.name == _NER:
194
+ if self.config.version=='1.0.1':
195
+ urls_to_download = {
196
+ "test": f"{_URL_10}{_TEST_FILE_10}",
197
+ }
198
+ else:
199
+ urls_to_download = {
200
+ "test": f"{_URL_11}{_TEST_FILE_11}",
201
+ }
202
+
203
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
204
  return [datasets.SplitGenerator(
205
  name=datasets.Split.TEST,
 
210
  },
211
  )]
212
  else:
213
+ if self.config.version=='1.0.1':
214
+ urls_to_download = {
215
+ "test": f"{_URL_10}{_TEST_FILE_RELATIONS_10}",
216
+ }
217
+ else:
218
+ urls_to_download = {
219
+ "test": f"{_URL_11}{_TEST_FILE_RELATIONS_11}",
220
+ }
221
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
222
  return [datasets.SplitGenerator(
223
  name=datasets.Split.TEST,