gabrielaltay commited on
Commit
7df1046
1 Parent(s): 5a6db21
bigbiohub.py CHANGED
@@ -1,65 +1,15 @@
1
- import json
2
  from collections import defaultdict
3
- from enum import Enum
4
- from types import SimpleNamespace
5
- from typing import Dict, Optional
6
-
7
  from dataclasses import dataclass
 
8
  import datasets
9
  from datasets.utils.download_manager import DownloadManager
 
10
 
 
 
11
 
12
- BigBioValues = SimpleNamespace(NULL="<BB_NULL_STR>")
13
- DL_MANAGER = DownloadManager()
14
-
15
- LANGUAGES_JSON_PATH = DL_MANAGER.download('https://huggingface.co/datasets/bigscience-biomedical/scitail/raw/main/languages.json')
16
- LICENSES_JSON_PATH = DL_MANAGER.download('https://huggingface.co/datasets/bigscience-biomedical/scitail/raw/main/licenses.json')
17
-
18
- @dataclass
19
- class License:
20
- """
21
- Base class from which all licenses inherit
22
-
23
- Args:
24
- name: License title
25
- text: Accompanying information of the license
26
- link: URL to License
27
- version: Current version of license
28
- provenance: Organization providing authorization, if possible
29
- """
30
-
31
- name: Optional[str] = None
32
- short_name: Optional[str] = None
33
- text: Optional[str] = None
34
- link: Optional[str] = None
35
- version: Optional[str] = None
36
- provenance: Optional[str] = None
37
-
38
- @property
39
- def is_share_alike(self):
40
- """
41
- Is Share-alike?
42
- """
43
- # NOTE: leave here has an example of license properties
44
- raise NotImplementedError()
45
-
46
-
47
- @dataclass
48
- class CustomLicense(License):
49
- """
50
- This class is for custom licenses.
51
- It must contain the text of the license.
52
- Optionally its version and a link to the license webpage.
53
- """
54
-
55
- def __post_init__(self):
56
- if self.name is None:
57
- self.name = "Custom license"
58
 
59
- if self.text is None and self.link is None:
60
- raise ValueError(
61
- "A `CustomLicense` must provide either (a) the license text or (b) the license link!"
62
- )
63
 
64
 
65
  @dataclass
@@ -75,20 +25,10 @@ class BigBioConfig(datasets.BuilderConfig):
75
 
76
  # shamelessly compied from:
77
  # https://github.com/huggingface/datasets/blob/master/src/datasets/utils/metadata.py
78
- langs_json = json.load(open(LANGUAGES_JSON_PATH, "r"))
79
- langs_dict = {k.replace("-", "_").upper(): v for k, v in langs_json.items()}
80
  Lang = Enum("Lang", langs_dict)
81
 
82
 
83
- METADATA: dict = {
84
- "_LOCAL": bool,
85
- "_LANGUAGES": Lang,
86
- "_PUBMED": bool,
87
- "_LICENSE": License,
88
- "_DISPLAYNAME": str,
89
- }
90
-
91
-
92
  class Tasks(Enum):
93
  NAMED_ENTITY_RECOGNITION = "NER"
94
  NAMED_ENTITY_DISAMBIGUATION = "NED"
@@ -256,278 +196,3 @@ SCHEMA_TO_FEATURES = {
256
  "TEXT": text_features,
257
  "PAIRS": pairs_features,
258
  }
259
-
260
-
261
-
262
-
263
-
264
- def _get_variable_name(k: str) -> str:
265
-
266
- return k.replace("-", "_").upper().replace(".", "p").replace("+", "plus")
267
-
268
-
269
- _GENIA_PROJECT_LICENSE_TEXT = """
270
- GENIA Project License for Annotated Corpora
271
-
272
- 1. Copyright of abstracts
273
-
274
- Any abstracts contained in this corpus are from PubMed(R), a database
275
- of the U.S. National Library of Medicine (NLM).
276
-
277
- NLM data are produced by a U.S. Government agency and include works of
278
- the United States Government that are not protected by U.S. copyright
279
- law but may be protected by non-US copyright law, as well as abstracts
280
- originating from publications that may be protected by U.S. copyright
281
- law.
282
-
283
- NLM assumes no responsibility or liability associated with use of
284
- copyrighted material, including transmitting, reproducing,
285
- redistributing, or making commercial use of the data. NLM does not
286
- provide legal advice regarding copyright, fair use, or other aspects
287
- of intellectual property rights. Persons contemplating any type of
288
- transmission or reproduction of copyrighted material such as abstracts
289
- are advised to consult legal counsel.
290
-
291
- 2. Copyright of full texts
292
-
293
- Any full texts contained in this corpus are from the PMC Open Access
294
- Subset of PubMed Central (PMC), the U.S. National Institutes of Health
295
- (NIH) free digital archive of biomedical and life sciences journal
296
- literature.
297
-
298
- Articles in the PMC Open Access Subset are protected by copyright, but
299
- are made available under a Creative Commons or similar license that
300
- generally allows more liberal redistribution and reuse than a
301
- traditional copyrighted work. Please refer to the license of each
302
- article for specific license terms.
303
-
304
- 3. Copyright of annotations
305
-
306
- The copyrights of annotations created in the GENIA Project of Tsujii
307
- Laboratory, University of Tokyo, belong in their entirety to the GENIA
308
- Project.
309
-
310
- 4. Licence terms
311
-
312
- Use and distribution of abstracts drawn from PubMed is subject to the
313
- PubMed(R) license terms as stated in Clause 1.
314
-
315
- Use and distribution of full texts is subject to the license terms
316
- applying to each publication.
317
-
318
- Annotations created by the GENIA Project are licensed under the
319
- Creative Commons Attribution 3.0 Unported License. To view a copy of
320
- this license, visit http://creativecommons.org/licenses/by/3.0/ or
321
- send a letter to Creative Commons, 444 Castro Street, Suite 900,
322
- Mountain View, California, 94041, USA.
323
-
324
- Annotations created by the GENIA Project must be attributed as
325
- detailed in Clause 5.
326
-
327
- 5. Attribution
328
-
329
- The GENIA Project was founded and led by prof. Jun'ichi Tsujii and
330
- the project and its annotation efforts have been coordinated in part
331
- by Nigel Collier, Yuka Tateisi, Sang-Zoo Lee, Tomoko Ohta, Jin-Dong
332
- Kim, and Sampo Pyysalo.
333
-
334
- For a complete list of the GENIA Project members and contributors,
335
- please refer to http://www.geniaproject.org.
336
-
337
- The GENIA Project has been supported by Grant-in-Aid for Scientific
338
- Research on Priority Area "Genome Information Science" (MEXT, Japan),
339
- Grant-in-Aid for Scientific Research on Priority Area "Systems
340
- Genomics" (MEXT, Japan), Core Research for Evolutional Science &
341
- Technology (CREST) "Information Mobility Project" (JST, Japan),
342
- Solution Oriented Research for Science and Technology (SORST) (JST,
343
- Japan), Genome Network Project (MEXT, Japan) and Grant-in-Aid for
344
- Specially Promoted Research (MEXT, Japan).
345
-
346
- Annotations covered by this license must be attributed as follows:
347
-
348
- Corpus annotations (c) GENIA Project
349
-
350
- Distributions including annotations covered by this licence must
351
- include this license text and Attribution section.
352
-
353
- 6. References
354
-
355
- - GENIA Project : http://www.geniaproject.org
356
- - PubMed : http://www.pubmed.gov/
357
- - NLM (United States National Library of Medicine) : http://www.nlm.nih.gov/
358
- - MEXT (Ministry of Education, Culture, Sports, Science and Technology) : http://www.mext.go.jp/
359
- - JST (Japan Science and Technology Agency) : http://www.jst.go.jp
360
- """
361
-
362
- GeniaProjectLicense = CustomLicense(
363
- name="GENIA Project License for Annotated Corpora",
364
- # NOTE: just in case the link will break
365
- text=_GENIA_PROJECT_LICENSE_TEXT,
366
- link="http://www.nactem.ac.uk/meta-knowledge/GENIA_license.txt",
367
- )
368
-
369
-
370
- _NLM_LICENSE_TEXT = """
371
- National Library of Medicine Terms and Conditions
372
-
373
- INTRODUCTION
374
-
375
- Downloading data from the National Library of Medicine FTP servers indicates your acceptance of the following Terms and Conditions: No charges, usage fees or royalties are paid to NLM for this data.
376
-
377
- GENERAL TERMS AND CONDITIONS
378
-
379
- Users of the data agree to:
380
- acknowledge NLM as the source of the data by including the phrase "Courtesy of the U.S. National Library of Medicine" in a clear and conspicuous manner,
381
- properly use registration and/or trademark symbols when referring to NLM products, and
382
- not indicate or imply that NLM has endorsed its products/services/applications.
383
-
384
- Users who republish or redistribute the data (services, products or raw data) agree to:
385
- maintain the most current version of all distributed data, or
386
- make known in a clear and conspicuous manner that the products/services/applications do not reflect the most current/accurate data available from NLM.
387
-
388
- These data are produced with a reasonable standard of care, but NLM makes no warranties express or implied, including no warranty of merchantability or fitness for particular purpose, regarding the accuracy or completeness of the data. Users agree to hold NLM and the U.S. Government harmless from any liability resulting from errors in the data. NLM disclaims any liability for any consequences due to use, misuse, or interpretation of information contained or not contained in the data.
389
-
390
- NLM does not provide legal advice regarding copyright, fair use, or other aspects of intellectual property rights. See the NLM Copyright page.
391
-
392
- NLM reserves the right to change the type and format of its machine-readable data. NLM will take reasonable steps to inform users of any changes to the format of the data before the data are distributed via the announcement section or subscription to email and RSS updates.
393
-
394
- """
395
- NLMLicense = CustomLicense(
396
- name="National Library of Medicine Terms and Conditions",
397
- # NOTE: just in case the link will break
398
- text=_NLM_LICENSE_TEXT,
399
- link="https://www.nlm.nih.gov/databases/download/terms_and_conditions.html",
400
- )
401
-
402
-
403
- _PHYSIONET_LICENSE_1p5_TEXT = """
404
- The PhysioNet Credentialed Health Data License
405
- Version 1.5.0
406
-
407
- Copyright (c) 2022 MIT Laboratory for Computational Physiology
408
-
409
- The MIT Laboratory for Computational Physiology (MIT-LCP) wishes to make data available for research and educational purposes to qualified requestors, but only if the data are used and protected in accordance with the terms and conditions stated in this License.
410
-
411
- It is hereby agreed between the data requestor, hereinafter referred to as the "LICENSEE", and MIT-LCP, that:
412
-
413
- The LICENSEE will not attempt to identify any individual or institution referenced in PhysioNet restricted data.
414
- The LICENSEE will exercise all reasonable and prudent care to avoid disclosure of the identity of any individual or institution referenced in PhysioNet restricted data in any publication or other communication.
415
- The LICENSEE will not share access to PhysioNet restricted data with anyone else.
416
- The LICENSEE will exercise all reasonable and prudent care to maintain the physical and electronic security of PhysioNet restricted data.
417
- If the LICENSEE finds information within PhysioNet restricted data that he or she believes might permit identification of any individual or institution, the LICENSEE will report the location of this information promptly by email to PHI-report@physionet.org, citing the location of the specific information in question.
418
- The LICENSEE will use the data for the sole purpose of lawful use in scientific research and no other.
419
- The LICENSEE will be responsible for ensuring that he or she maintains up to date certification in human research subject protection and HIPAA regulations.
420
- The LICENSEE agrees to contribute code associated with publications arising from this data to a repository that is open to the research community.
421
- This agreement may be terminated by either party at any time, but the LICENSEE's obligations with respect to PhysioNet data shall continue after termination.
422
-
423
- THE DATA ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE USE OR OTHER DEALINGS IN THE DATA.
424
- """
425
- PhysioNetLicense1p5 = CustomLicense(
426
- name="PhysioNet Credentialed Health Data License",
427
- version="1.5",
428
- link="https://physionet.org/content/mimiciv/view-license/0.4/",
429
- # NOTE: just in case the link will break
430
- text=_PHYSIONET_LICENSE_1p5_TEXT,
431
- )
432
-
433
-
434
- UMLSLicense = CustomLicense(
435
- name="UMLS - Metathesaurus License Agreement",
436
- link="https://www.nlm.nih.gov/research/umls/knowledge_sources/metathesaurus/release/license_agreement.html",
437
- )
438
-
439
- _NCBI_LICENSE_TEXT = """
440
- ===========================================================================
441
- *
442
- * PUBLIC DOMAIN NOTICE
443
- * National Center for Biotechnology Information
444
- *
445
- * This software/database is a "United States Government Work" under the
446
- * terms of the United States Copyright Act. It was written as part of
447
- * the author's official duties as a United States Government employee and
448
- * thus cannot be copyrighted. This software/database is freely available
449
- * to the public for use. The National Library of Medicine and the U.S.
450
- * Government have not placed any restriction on its use or reproduction.
451
- *
452
- * Although all reasonable efforts have been taken to ensure the accuracy
453
- * and reliability of the software and data, the NLM and the U.S.
454
- * Government do not and cannot warrant the performance or results that
455
- * may be obtained by using this software or data. The NLM and the U.S.
456
- * Government disclaim all warranties, express or implied, including
457
- * warranties of performance, merchantability or fitness for any particular
458
- * purpose.
459
- *
460
- * Please cite the author in any work or product based on this material.
461
- *
462
- *
463
- ===========================================================================
464
- """
465
- NCBILicense = CustomLicense(
466
- name="National Center fr Biotechnology Information PUBLIC DOMAIN NOTICE",
467
- link="https://github.com/openbiocorpora/genetag/blob/master/LICENSE",
468
- # NOTE: just in case link will break
469
- text=_NCBI_LICENSE_TEXT,
470
- )
471
-
472
- PublicDomainMark_1p0 = CustomLicense(
473
- name="Public Domain Mark 1.0",
474
- text="""This work has been identified as being free of known restrictions under copyright law,
475
- including all related and neighboring rights.
476
- """,
477
- link="https://creativecommons.org/publicdomain/mark/1.0/",
478
- )
479
-
480
-
481
- def load_json_licenses() -> Dict[str, str]:
482
- """
483
- Load all licenses from JSON file.
484
- Amend names to be valid variable names
485
- """
486
-
487
- # shamelessly compied from:
488
- # https://github.com/huggingface/datasets/blob/master/src/datasets/utils/metadata.py
489
- licenses = {
490
- _get_variable_name(k): v
491
- for k, v in json.loads(
492
- open(LICENSES_JSON_PATH, "r").read()
493
- ).items()
494
- }
495
-
496
- licenses["ZERO_BSD"] = licenses.pop("0BSD")
497
-
498
- return licenses
499
-
500
-
501
- def load_licenses() -> Dict[str, License]:
502
- """
503
- Load `_LICENSES` dict:
504
- - key (str) : license name
505
- - value (License) : instance of license class
506
- """
507
-
508
- json_licenses = load_json_licenses()
509
-
510
- json_licenses.update({"DUA": "Data User Agreement"})
511
-
512
- licenses_kwargs = {k: {"name": v} for k, v in json_licenses.items()}
513
-
514
- licenses = {k: License(**kwargs) for k, kwargs in licenses_kwargs.items()}
515
-
516
- custom_licenses = {
517
- "PUBLIC_DOMAIN_MARK_1p0": PublicDomainMark_1p0,
518
- "GENIA_PROJECT_LICENSE": GeniaProjectLicense,
519
- "NLM_LICENSE": NLMLicense,
520
- "NCBI_LICENSE": NCBILicense,
521
- "UMLS_LICENSE": UMLSLicense,
522
- "PHYSIONET_LICENSE_1p5": PhysioNetLicense1p5,
523
- }
524
-
525
- licenses.update(custom_licenses)
526
- for k, v in licenses.items():
527
- v.short_name = k
528
-
529
- return licenses
530
-
531
-
532
- _LICENSES = load_licenses()
533
- Licenses = SimpleNamespace(**_LICENSES)
 
 
1
  from collections import defaultdict
 
 
 
 
2
  from dataclasses import dataclass
3
+ from enum import Enum
4
  import datasets
5
  from datasets.utils.download_manager import DownloadManager
6
+ from types import SimpleNamespace
7
 
8
+ from .languages_data import LANGUAGES_DATA
9
+ from .licenses import Licenses
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ BigBioValues = SimpleNamespace(NULL="<BB_NULL_STR>")
 
 
 
13
 
14
 
15
  @dataclass
 
25
 
26
  # shamelessly compied from:
27
  # https://github.com/huggingface/datasets/blob/master/src/datasets/utils/metadata.py
28
+ langs_dict = {k.replace("-", "_").upper(): v for k, v in LANGUAGES_DATA.items()}
 
29
  Lang = Enum("Lang", langs_dict)
30
 
31
 
 
 
 
 
 
 
 
 
 
32
  class Tasks(Enum):
33
  NAMED_ENTITY_RECOGNITION = "NER"
34
  NAMED_ENTITY_DISAMBIGUATION = "NED"
 
196
  "TEXT": text_features,
197
  "PAIRS": pairs_features,
198
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
biosses.py CHANGED
@@ -28,8 +28,9 @@ import pandas as pd
28
 
29
  from .bigbiohub import pairs_features
30
  from .bigbiohub import BigBioConfig
31
- from .bigbiohub import Lang, Tasks
32
  from .bigbiohub import Licenses
 
33
 
34
 
35
  _DATASETNAME = "biosses"
 
28
 
29
  from .bigbiohub import pairs_features
30
  from .bigbiohub import BigBioConfig
31
+ from .bigbiohub import Lang
32
  from .bigbiohub import Licenses
33
+ from .bigbiohub import Tasks
34
 
35
 
36
  _DATASETNAME = "biosses"
languages.json → languages_data.py RENAMED
@@ -1,4 +1,4 @@
1
- {
2
  "af": "Afrikaans",
3
  "af-NA": "Afrikaans (Namibia)",
4
  "af-ZA": "Afrikaans (South Africa)",
@@ -788,5 +788,5 @@
788
  "zh-Hant-MO": "Chinese (Traditional, Macao SAR China)",
789
  "zh-Hant-TW": "Chinese (Traditional, Taiwan)",
790
  "zu": "Zulu",
791
- "zu-ZA": "Zulu (South Africa)"
792
- }
 
1
+ LANGUAGES_DATA = {
2
  "af": "Afrikaans",
3
  "af-NA": "Afrikaans (Namibia)",
4
  "af-ZA": "Afrikaans (South Africa)",
 
788
  "zh-Hant-MO": "Chinese (Traditional, Macao SAR China)",
789
  "zh-Hant-TW": "Chinese (Traditional, Taiwan)",
790
  "zu": "Zulu",
791
+ "zu-ZA": "Zulu (South Africa)",
792
+ }
licenses.py ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+ from typing import Dict, Optional
3
+ from types import SimpleNamespace
4
+ from .licenses_data import LICENSES_DATA
5
+
6
+
7
+ @dataclass
8
+ class License:
9
+ """
10
+ Base class from which all licenses inherit
11
+
12
+ Args:
13
+ name: License title
14
+ text: Accompanying information of the license
15
+ link: URL to License
16
+ version: Current version of license
17
+ provenance: Organization providing authorization, if possible
18
+ """
19
+
20
+ name: Optional[str] = None
21
+ short_name: Optional[str] = None
22
+ text: Optional[str] = None
23
+ link: Optional[str] = None
24
+ version: Optional[str] = None
25
+ provenance: Optional[str] = None
26
+
27
+ @property
28
+ def is_share_alike(self):
29
+ """
30
+ Is Share-alike?
31
+ """
32
+ # NOTE: leave here has an example of license properties
33
+ raise NotImplementedError()
34
+
35
+
36
+ @dataclass
37
+ class CustomLicense(License):
38
+ """
39
+ This class is for custom licenses.
40
+ It must contain the text of the license.
41
+ Optionally its version and a link to the license webpage.
42
+ """
43
+
44
+ def __post_init__(self):
45
+ if self.name is None:
46
+ self.name = "Custom license"
47
+
48
+ if self.text is None and self.link is None:
49
+ raise ValueError(
50
+ "A `CustomLicense` must provide either (a) the license text or (b) the license link!"
51
+ )
52
+
53
+
54
+ _GENIA_PROJECT_LICENSE_TEXT = """
55
+ GENIA Project License for Annotated Corpora
56
+
57
+ 1. Copyright of abstracts
58
+
59
+ Any abstracts contained in this corpus are from PubMed(R), a database
60
+ of the U.S. National Library of Medicine (NLM).
61
+
62
+ NLM data are produced by a U.S. Government agency and include works of
63
+ the United States Government that are not protected by U.S. copyright
64
+ law but may be protected by non-US copyright law, as well as abstracts
65
+ originating from publications that may be protected by U.S. copyright
66
+ law.
67
+
68
+ NLM assumes no responsibility or liability associated with use of
69
+ copyrighted material, including transmitting, reproducing,
70
+ redistributing, or making commercial use of the data. NLM does not
71
+ provide legal advice regarding copyright, fair use, or other aspects
72
+ of intellectual property rights. Persons contemplating any type of
73
+ transmission or reproduction of copyrighted material such as abstracts
74
+ are advised to consult legal counsel.
75
+
76
+ 2. Copyright of full texts
77
+
78
+ Any full texts contained in this corpus are from the PMC Open Access
79
+ Subset of PubMed Central (PMC), the U.S. National Institutes of Health
80
+ (NIH) free digital archive of biomedical and life sciences journal
81
+ literature.
82
+
83
+ Articles in the PMC Open Access Subset are protected by copyright, but
84
+ are made available under a Creative Commons or similar license that
85
+ generally allows more liberal redistribution and reuse than a
86
+ traditional copyrighted work. Please refer to the license of each
87
+ article for specific license terms.
88
+
89
+ 3. Copyright of annotations
90
+
91
+ The copyrights of annotations created in the GENIA Project of Tsujii
92
+ Laboratory, University of Tokyo, belong in their entirety to the GENIA
93
+ Project.
94
+
95
+ 4. Licence terms
96
+
97
+ Use and distribution of abstracts drawn from PubMed is subject to the
98
+ PubMed(R) license terms as stated in Clause 1.
99
+
100
+ Use and distribution of full texts is subject to the license terms
101
+ applying to each publication.
102
+
103
+ Annotations created by the GENIA Project are licensed under the
104
+ Creative Commons Attribution 3.0 Unported License. To view a copy of
105
+ this license, visit http://creativecommons.org/licenses/by/3.0/ or
106
+ send a letter to Creative Commons, 444 Castro Street, Suite 900,
107
+ Mountain View, California, 94041, USA.
108
+
109
+ Annotations created by the GENIA Project must be attributed as
110
+ detailed in Clause 5.
111
+
112
+ 5. Attribution
113
+
114
+ The GENIA Project was founded and led by prof. Jun'ichi Tsujii and
115
+ the project and its annotation efforts have been coordinated in part
116
+ by Nigel Collier, Yuka Tateisi, Sang-Zoo Lee, Tomoko Ohta, Jin-Dong
117
+ Kim, and Sampo Pyysalo.
118
+
119
+ For a complete list of the GENIA Project members and contributors,
120
+ please refer to http://www.geniaproject.org.
121
+
122
+ The GENIA Project has been supported by Grant-in-Aid for Scientific
123
+ Research on Priority Area "Genome Information Science" (MEXT, Japan),
124
+ Grant-in-Aid for Scientific Research on Priority Area "Systems
125
+ Genomics" (MEXT, Japan), Core Research for Evolutional Science &
126
+ Technology (CREST) "Information Mobility Project" (JST, Japan),
127
+ Solution Oriented Research for Science and Technology (SORST) (JST,
128
+ Japan), Genome Network Project (MEXT, Japan) and Grant-in-Aid for
129
+ Specially Promoted Research (MEXT, Japan).
130
+
131
+ Annotations covered by this license must be attributed as follows:
132
+
133
+ Corpus annotations (c) GENIA Project
134
+
135
+ Distributions including annotations covered by this licence must
136
+ include this license text and Attribution section.
137
+
138
+ 6. References
139
+
140
+ - GENIA Project : http://www.geniaproject.org
141
+ - PubMed : http://www.pubmed.gov/
142
+ - NLM (United States National Library of Medicine) : http://www.nlm.nih.gov/
143
+ - MEXT (Ministry of Education, Culture, Sports, Science and Technology) : http://www.mext.go.jp/
144
+ - JST (Japan Science and Technology Agency) : http://www.jst.go.jp
145
+ """
146
+
147
+ GeniaProjectLicense = CustomLicense(
148
+ name="GENIA Project License for Annotated Corpora",
149
+ # NOTE: just in case the link will break
150
+ text=_GENIA_PROJECT_LICENSE_TEXT,
151
+ link="http://www.nactem.ac.uk/meta-knowledge/GENIA_license.txt",
152
+ )
153
+
154
+
155
+ _NLM_LICENSE_TEXT = """
156
+ National Library of Medicine Terms and Conditions
157
+
158
+ INTRODUCTION
159
+
160
+ Downloading data from the National Library of Medicine FTP servers indicates your acceptance of the following Terms and Conditions: No charges, usage fees or royalties are paid to NLM for this data.
161
+
162
+ GENERAL TERMS AND CONDITIONS
163
+
164
+ Users of the data agree to:
165
+ acknowledge NLM as the source of the data by including the phrase "Courtesy of the U.S. National Library of Medicine" in a clear and conspicuous manner,
166
+ properly use registration and/or trademark symbols when referring to NLM products, and
167
+ not indicate or imply that NLM has endorsed its products/services/applications.
168
+
169
+ Users who republish or redistribute the data (services, products or raw data) agree to:
170
+ maintain the most current version of all distributed data, or
171
+ make known in a clear and conspicuous manner that the products/services/applications do not reflect the most current/accurate data available from NLM.
172
+
173
+ These data are produced with a reasonable standard of care, but NLM makes no warranties express or implied, including no warranty of merchantability or fitness for particular purpose, regarding the accuracy or completeness of the data. Users agree to hold NLM and the U.S. Government harmless from any liability resulting from errors in the data. NLM disclaims any liability for any consequences due to use, misuse, or interpretation of information contained or not contained in the data.
174
+
175
+ NLM does not provide legal advice regarding copyright, fair use, or other aspects of intellectual property rights. See the NLM Copyright page.
176
+
177
+ NLM reserves the right to change the type and format of its machine-readable data. NLM will take reasonable steps to inform users of any changes to the format of the data before the data are distributed via the announcement section or subscription to email and RSS updates.
178
+
179
+ """
180
+ NLMLicense = CustomLicense(
181
+ name="National Library of Medicine Terms and Conditions",
182
+ # NOTE: just in case the link will break
183
+ text=_NLM_LICENSE_TEXT,
184
+ link="https://www.nlm.nih.gov/databases/download/terms_and_conditions.html",
185
+ )
186
+
187
+
188
+ _PHYSIONET_LICENSE_1p5_TEXT = """
189
+ The PhysioNet Credentialed Health Data License
190
+ Version 1.5.0
191
+
192
+ Copyright (c) 2022 MIT Laboratory for Computational Physiology
193
+
194
+ The MIT Laboratory for Computational Physiology (MIT-LCP) wishes to make data available for research and educational purposes to qualified requestors, but only if the data are used and protected in accordance with the terms and conditions stated in this License.
195
+
196
+ It is hereby agreed between the data requestor, hereinafter referred to as the "LICENSEE", and MIT-LCP, that:
197
+
198
+ The LICENSEE will not attempt to identify any individual or institution referenced in PhysioNet restricted data.
199
+ The LICENSEE will exercise all reasonable and prudent care to avoid disclosure of the identity of any individual or institution referenced in PhysioNet restricted data in any publication or other communication.
200
+ The LICENSEE will not share access to PhysioNet restricted data with anyone else.
201
+ The LICENSEE will exercise all reasonable and prudent care to maintain the physical and electronic security of PhysioNet restricted data.
202
+ If the LICENSEE finds information within PhysioNet restricted data that he or she believes might permit identification of any individual or institution, the LICENSEE will report the location of this information promptly by email to PHI-report@physionet.org, citing the location of the specific information in question.
203
+ The LICENSEE will use the data for the sole purpose of lawful use in scientific research and no other.
204
+ The LICENSEE will be responsible for ensuring that he or she maintains up to date certification in human research subject protection and HIPAA regulations.
205
+ The LICENSEE agrees to contribute code associated with publications arising from this data to a repository that is open to the research community.
206
+ This agreement may be terminated by either party at any time, but the LICENSEE's obligations with respect to PhysioNet data shall continue after termination.
207
+
208
+ THE DATA ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE USE OR OTHER DEALINGS IN THE DATA.
209
+ """
210
+ PhysioNetLicense1p5 = CustomLicense(
211
+ name="PhysioNet Credentialed Health Data License",
212
+ version="1.5",
213
+ link="https://physionet.org/content/mimiciv/view-license/0.4/",
214
+ # NOTE: just in case the link will break
215
+ text=_PHYSIONET_LICENSE_1p5_TEXT,
216
+ )
217
+
218
+
219
+ UMLSLicense = CustomLicense(
220
+ name="UMLS - Metathesaurus License Agreement",
221
+ link="https://www.nlm.nih.gov/research/umls/knowledge_sources/metathesaurus/release/license_agreement.html",
222
+ )
223
+
224
+ _NCBI_LICENSE_TEXT = """
225
+ ===========================================================================
226
+ *
227
+ * PUBLIC DOMAIN NOTICE
228
+ * National Center for Biotechnology Information
229
+ *
230
+ * This software/database is a "United States Government Work" under the
231
+ * terms of the United States Copyright Act. It was written as part of
232
+ * the author's official duties as a United States Government employee and
233
+ * thus cannot be copyrighted. This software/database is freely available
234
+ * to the public for use. The National Library of Medicine and the U.S.
235
+ * Government have not placed any restriction on its use or reproduction.
236
+ *
237
+ * Although all reasonable efforts have been taken to ensure the accuracy
238
+ * and reliability of the software and data, the NLM and the U.S.
239
+ * Government do not and cannot warrant the performance or results that
240
+ * may be obtained by using this software or data. The NLM and the U.S.
241
+ * Government disclaim all warranties, express or implied, including
242
+ * warranties of performance, merchantability or fitness for any particular
243
+ * purpose.
244
+ *
245
+ * Please cite the author in any work or product based on this material.
246
+ *
247
+ *
248
+ ===========================================================================
249
+ """
250
+ NCBILicense = CustomLicense(
251
+ name="National Center fr Biotechnology Information PUBLIC DOMAIN NOTICE",
252
+ link="https://github.com/openbiocorpora/genetag/blob/master/LICENSE",
253
+ # NOTE: just in case link will break
254
+ text=_NCBI_LICENSE_TEXT,
255
+ )
256
+
257
+ PublicDomainMark_1p0 = CustomLicense(
258
+ name="Public Domain Mark 1.0",
259
+ text="""This work has been identified as being free of known restrictions under copyright law,
260
+ including all related and neighboring rights.
261
+ """,
262
+ link="https://creativecommons.org/publicdomain/mark/1.0/",
263
+ )
264
+
265
+
266
+ def _get_variable_name(k: str) -> str:
267
+
268
+ return k.replace("-", "_").upper().replace(".", "p").replace("+", "plus")
269
+
270
+
271
+ def load_json_licenses() -> Dict[str, str]:
272
+ """
273
+ Load all licenses from JSON file.
274
+ Amend names to be valid variable names
275
+ """
276
+
277
+ # shamelessly compied from:
278
+ # https://github.com/huggingface/datasets/blob/master/src/datasets/utils/metadata.py
279
+ licenses = {_get_variable_name(k): v for k, v in LICENSES_DATA.items()}
280
+
281
+ licenses["ZERO_BSD"] = licenses.pop("0BSD")
282
+
283
+ return licenses
284
+
285
+
286
+ def load_licenses() -> Dict[str, License]:
287
+ """
288
+ Load `_LICENSES` dict:
289
+ - key (str) : license name
290
+ - value (License) : instance of license class
291
+ """
292
+
293
+ json_licenses = load_json_licenses()
294
+
295
+ json_licenses.update({"DUA": "Data User Agreement"})
296
+
297
+ licenses_kwargs = {k: {"name": v} for k, v in json_licenses.items()}
298
+
299
+ licenses = {k: License(**kwargs) for k, kwargs in licenses_kwargs.items()}
300
+
301
+ custom_licenses = {
302
+ "PUBLIC_DOMAIN_MARK_1p0": PublicDomainMark_1p0,
303
+ "GENIA_PROJECT_LICENSE": GeniaProjectLicense,
304
+ "NLM_LICENSE": NLMLicense,
305
+ "NCBI_LICENSE": NCBILicense,
306
+ "UMLS_LICENSE": UMLSLicense,
307
+ "PHYSIONET_LICENSE_1p5": PhysioNetLicense1p5,
308
+ }
309
+
310
+ licenses.update(custom_licenses)
311
+ for k, v in licenses.items():
312
+ v.short_name = k
313
+
314
+ return licenses
315
+
316
+
317
+ _LICENSES = load_licenses()
318
+ Licenses = SimpleNamespace(**_LICENSES)
licenses.json → licenses_data.py RENAMED
@@ -1,4 +1,4 @@
1
- {
2
  "other": "Other license",
3
  "unknown": "License information unavailable",
4
  "0bsd": "BSD Zero Clause License",
@@ -47,12 +47,12 @@
47
  "blueoak-1.0.0": "Blue Oak Model License 1.0.0",
48
  "borceux": "Borceux license",
49
  "bsd-1-clause": "BSD 1-Clause License",
50
- "bsd-2-clause": "BSD 2-Clause \"Simplified\" License",
51
  "bsd-2-clause-freebsd": "BSD 2-Clause FreeBSD License",
52
  "bsd-2-clause-netbsd": "BSD 2-Clause NetBSD License",
53
  "bsd-2-clause-patent": "BSD-2-Clause Plus Patent License",
54
  "bsd-2-clause-views": "BSD 2-Clause with views sentence",
55
- "bsd-3-clause": "BSD 3-Clause \"New\" or \"Revised\" License",
56
  "bsd-3-clause-attribution": "BSD with attribution",
57
  "bsd-3-clause-clear": "BSD 3-Clause Clear License",
58
  "bsd-3-clause-lbnl": "Lawrence Berkeley National Labs BSD variant license",
@@ -60,7 +60,7 @@
60
  "bsd-3-clause-no-nuclear-license-2014": "BSD 3-Clause No Nuclear License 2014",
61
  "bsd-3-clause-no-nuclear-warranty": "BSD 3-Clause No Nuclear Warranty",
62
  "bsd-3-clause-open-mpi": "BSD 3-Clause Open MPI variant",
63
- "bsd-4-clause": "BSD 4-Clause \"Original\" or \"Old\" License",
64
  "bsd-4-clause-uc": "BSD-4-Clause (University of California-Specific)",
65
  "bsd-protection": "BSD Protection License",
66
  "bsd-source-code": "BSD Source Code Attribution",
@@ -448,5 +448,5 @@
448
  "zlib-acknowledgement": "zlib/libpng License with Acknowledgement",
449
  "zpl-1.1": "Zope Public License 1.1",
450
  "zpl-2.0": "Zope Public License 2.0",
451
- "zpl-2.1": "Zope Public License 2.1"
452
  }
 
1
+ LICENSES_DATA = {
2
  "other": "Other license",
3
  "unknown": "License information unavailable",
4
  "0bsd": "BSD Zero Clause License",
 
47
  "blueoak-1.0.0": "Blue Oak Model License 1.0.0",
48
  "borceux": "Borceux license",
49
  "bsd-1-clause": "BSD 1-Clause License",
50
+ "bsd-2-clause": 'BSD 2-Clause "Simplified" License',
51
  "bsd-2-clause-freebsd": "BSD 2-Clause FreeBSD License",
52
  "bsd-2-clause-netbsd": "BSD 2-Clause NetBSD License",
53
  "bsd-2-clause-patent": "BSD-2-Clause Plus Patent License",
54
  "bsd-2-clause-views": "BSD 2-Clause with views sentence",
55
+ "bsd-3-clause": 'BSD 3-Clause "New" or "Revised" License',
56
  "bsd-3-clause-attribution": "BSD with attribution",
57
  "bsd-3-clause-clear": "BSD 3-Clause Clear License",
58
  "bsd-3-clause-lbnl": "Lawrence Berkeley National Labs BSD variant license",
 
60
  "bsd-3-clause-no-nuclear-license-2014": "BSD 3-Clause No Nuclear License 2014",
61
  "bsd-3-clause-no-nuclear-warranty": "BSD 3-Clause No Nuclear Warranty",
62
  "bsd-3-clause-open-mpi": "BSD 3-Clause Open MPI variant",
63
+ "bsd-4-clause": 'BSD 4-Clause "Original" or "Old" License',
64
  "bsd-4-clause-uc": "BSD-4-Clause (University of California-Specific)",
65
  "bsd-protection": "BSD Protection License",
66
  "bsd-source-code": "BSD Source Code Attribution",
 
448
  "zlib-acknowledgement": "zlib/libpng License with Acknowledgement",
449
  "zpl-1.1": "Zope Public License 1.1",
450
  "zpl-2.0": "Zope Public License 2.0",
451
+ "zpl-2.1": "Zope Public License 2.1",
452
  }