Doc update
Browse files- README.md +5 -20
- pmc_open_access_xml.py +4 -4
README.md
CHANGED
|
@@ -77,7 +77,7 @@ The PMC Open Access Subset is one part of the PMC Article Datasets
|
|
| 77 |
|
| 78 |
This version takes XML version as source, benefiting from the structured text
|
| 79 |
to split the articles in parts, naming the introduction, methods, results,
|
| 80 |
-
discussion and conclusion, and
|
| 81 |
resources (articles, figures, tables, formulas, boxed-text, quotes, code, footnotes, chemicals, graphics, medias).
|
| 82 |
|
| 83 |
The dataset was initially created with relation-extraction tasks in mind, between the references in text and the content of the
|
|
@@ -112,27 +112,11 @@ a corpus of pre-annotated text for other tasks (e.g. figure caption to graphic,
|
|
| 112 |
- "box": List of \<boxed-text\> elements of the article.
|
| 113 |
- "code": List of \<code\> elements of the article.
|
| 114 |
- "quote": List of \<disp-quote\> and \<speech\> elements of the article.
|
| 115 |
-
- "
|
| 116 |
- "supplementary": List of \<supplementary-material\> and \<inline-supplementary-material\> elements of the article.
|
| 117 |
- "footnote": List of \<fn-group\> and \<table-wrap-foot\> elements of the article.
|
| 118 |
- "graphic": List of \<graphic\> and \<inline-graphic\> elements of the article.
|
| 119 |
- "media": List of \<media\> and \<inline-media\> elements of the article.
|
| 120 |
-
|
| 121 |
-
- "references": Lists of references in the order found in the corresponding categories
|
| 122 |
-
- "pmid_ref": PMIDs of other articles. In text, replaced by " ##REF## "
|
| 123 |
-
- "unknown_pub_ref": 0-indexed idx of the article in "unknown_pub". In text, replaced by " ##UREF## "
|
| 124 |
-
- "figure_ref": 0-indexed idx of the figures in "figure" In text, replaced by " ##FIG## "
|
| 125 |
-
- "table_ref": 0-indexed idx of the tables in "table" In text, replaced by " ##TAB## "
|
| 126 |
-
- "formula_ref": 0-indexed idx of the formulas in "formula" In text, replaced by " ##FORMU## "
|
| 127 |
-
- "box_ref": 0-indexed idx of the box in "box" In text, replaced by " ##BOX## "
|
| 128 |
-
- "code_ref": 0-indexed idx of the code in "code" In text, replaced by " ##CODE## "
|
| 129 |
-
- "quote_ref": 0-indexed idx of the quote in "quote" In text, replaced by " ##QUOTE## "
|
| 130 |
-
- "chem_ref": 0-indexed idx of the chemical in "chem" In text, replaced by " ##CHEM## "
|
| 131 |
-
- "supplementary_ref": 0-indexed idx of the figure in "supplementary" In text, replaced by " ##SUPPL## "
|
| 132 |
-
- "footnote_ref": 0-indexed idx of the footnote in "footnote" In text, replaced by " ##FOOTN## "
|
| 133 |
-
- "graphic_ref": 0-indexed idx of the graphics in "graphics" In text, replaced by " ##GRAPH## "
|
| 134 |
-
- "media_ref": 0-indexed idx of the medias in "medias" In text, replaced by " ##MEDIA## "
|
| 135 |
-
- "references_text": For each reference in "references", the corresponding text that the reference keywords replaced.
|
| 136 |
- "glossary": Glossary if found in the XML
|
| 137 |
- "unknown_references": JSON of a dictionnary of each "tag":"text" for the reference that did not indicate a PMID
|
| 138 |
- "n_references": Total number of references and unknown references
|
|
@@ -142,6 +126,7 @@ a corpus of pre-annotated text for other tasks (e.g. figure caption to graphic,
|
|
| 142 |
- "citation": Citation of the article
|
| 143 |
- "package_file": path to the folder containing the graphics and media files of the article (to append to the base URL: ftp.ncbi.nlm.nih.gov/pub/pmc/)
|
| 144 |
|
|
|
|
| 145 |
### Data Splits
|
| 146 |
|
| 147 |
[Needs More Information]
|
|
@@ -204,13 +189,13 @@ future version.
|
|
| 204 |
|
| 205 |
[Needs More Information]
|
| 206 |
|
| 207 |
-
### Preprocessing
|
| 208 |
|
| 209 |
- Filter out empty contents.
|
| 210 |
- Remove unwanted references from the text, and replace either by the "references_text" or by the reference content itself.
|
| 211 |
- Unescape HTML special characters: `import html; html.unescape(my_text)`
|
| 212 |
- Remove superfluous line break in text.
|
| 213 |
-
- Remove XML tags
|
| 214 |
- Join the items of the contents' lists.
|
| 215 |
|
| 216 |
## Additional Information
|
|
|
|
| 77 |
|
| 78 |
This version takes XML version as source, benefiting from the structured text
|
| 79 |
to split the articles in parts, naming the introduction, methods, results,
|
| 80 |
+
discussion and conclusion, and reference with keywords in the text to external or internal
|
| 81 |
resources (articles, figures, tables, formulas, boxed-text, quotes, code, footnotes, chemicals, graphics, medias).
|
| 82 |
|
| 83 |
The dataset was initially created with relation-extraction tasks in mind, between the references in text and the content of the
|
|
|
|
| 112 |
- "box": List of \<boxed-text\> elements of the article.
|
| 113 |
- "code": List of \<code\> elements of the article.
|
| 114 |
- "quote": List of \<disp-quote\> and \<speech\> elements of the article.
|
| 115 |
+
- "chemical": List of \<chem-struct-wrap\> elements of the article.
|
| 116 |
- "supplementary": List of \<supplementary-material\> and \<inline-supplementary-material\> elements of the article.
|
| 117 |
- "footnote": List of \<fn-group\> and \<table-wrap-foot\> elements of the article.
|
| 118 |
- "graphic": List of \<graphic\> and \<inline-graphic\> elements of the article.
|
| 119 |
- "media": List of \<media\> and \<inline-media\> elements of the article.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
- "glossary": Glossary if found in the XML
|
| 121 |
- "unknown_references": JSON of a dictionnary of each "tag":"text" for the reference that did not indicate a PMID
|
| 122 |
- "n_references": Total number of references and unknown references
|
|
|
|
| 126 |
- "citation": Citation of the article
|
| 127 |
- "package_file": path to the folder containing the graphics and media files of the article (to append to the base URL: ftp.ncbi.nlm.nih.gov/pub/pmc/)
|
| 128 |
|
| 129 |
+
In text, the references are in the form ##KEYWORD##IDX_REF##OLD_TEXT##, with keywords (REF, UREF, FIG, TAB, FORMU, BOX, CODE, QUOTE, CHEM, SUPPL, FOOTN, GRAPH, MEDIA) referencing respectively to "pubmed articles" (external), "unknown_references", "figure", "table", "formula", "box", "code", "quote", "chem", "supplementary", "footnote", "graphic" and "media".
|
| 130 |
### Data Splits
|
| 131 |
|
| 132 |
[Needs More Information]
|
|
|
|
| 189 |
|
| 190 |
[Needs More Information]
|
| 191 |
|
| 192 |
+
### Preprocessing recommendations
|
| 193 |
|
| 194 |
- Filter out empty contents.
|
| 195 |
- Remove unwanted references from the text, and replace either by the "references_text" or by the reference content itself.
|
| 196 |
- Unescape HTML special characters: `import html; html.unescape(my_text)`
|
| 197 |
- Remove superfluous line break in text.
|
| 198 |
+
- Remove XML tags (\<italic\>, \<sup\>, \<sub\>, ...), replace by special tokens?
|
| 199 |
- Join the items of the contents' lists.
|
| 200 |
|
| 201 |
## Additional Information
|
pmc_open_access_xml.py
CHANGED
|
@@ -75,7 +75,7 @@ REFS_KEYS = ["pmid_ref", "unknown_pub_ref", "figure_ref", "table_ref", "form
|
|
| 75 |
"quote_ref", "chem_ref", "supplementary_ref", "footnote_ref", "graphic_ref", "media_ref"]
|
| 76 |
CONTENT_KEYS = ["introduction", "methods", "results", "discussion", "conclusion",
|
| 77 |
"front", "body", "back", "figure", "table", "formula", "box",
|
| 78 |
-
"code", "quote", "
|
| 79 |
begin_doc_rgx = re.compile("""<!DOCTYPE.*""")
|
| 80 |
def clean_raw(xml_text):
|
| 81 |
"""
|
|
@@ -434,7 +434,7 @@ class OpenAccessXML(datasets.GeneratorBasedBuilder):
|
|
| 434 |
"box": datasets.features.Sequence(datasets.Value("string")),
|
| 435 |
"code": datasets.features.Sequence(datasets.Value("string")),
|
| 436 |
"quote": datasets.features.Sequence(datasets.Value("string")),
|
| 437 |
-
"
|
| 438 |
"supplementary": datasets.features.Sequence(datasets.Value("string")),
|
| 439 |
"footnote": datasets.features.Sequence(datasets.Value("string")),
|
| 440 |
"graphic": datasets.features.Sequence(datasets.Value("string")),
|
|
@@ -571,7 +571,7 @@ class OpenAccessXML(datasets.GeneratorBasedBuilder):
|
|
| 571 |
"box": content_d["box"],
|
| 572 |
"code": content_d["code"],
|
| 573 |
"quote": content_d["quote"],
|
| 574 |
-
"
|
| 575 |
"supplementary": content_d["supplementary"],
|
| 576 |
"footnote": content_d["footnote"],
|
| 577 |
"graphic": content_d["graphic"],
|
|
@@ -633,7 +633,7 @@ class OpenAccessXML(datasets.GeneratorBasedBuilder):
|
|
| 633 |
"box": content_d["box"],
|
| 634 |
"code": content_d["code"],
|
| 635 |
"quote": content_d["quote"],
|
| 636 |
-
"
|
| 637 |
"supplementary": content_d["supplementary"],
|
| 638 |
"footnote": content_d["footnote"],
|
| 639 |
"graphic": content_d["graphic"],
|
|
|
|
| 75 |
"quote_ref", "chem_ref", "supplementary_ref", "footnote_ref", "graphic_ref", "media_ref"]
|
| 76 |
CONTENT_KEYS = ["introduction", "methods", "results", "discussion", "conclusion",
|
| 77 |
"front", "body", "back", "figure", "table", "formula", "box",
|
| 78 |
+
"code", "quote", "chemical", "supplementary", "footnote"]
|
| 79 |
begin_doc_rgx = re.compile("""<!DOCTYPE.*""")
|
| 80 |
def clean_raw(xml_text):
|
| 81 |
"""
|
|
|
|
| 434 |
"box": datasets.features.Sequence(datasets.Value("string")),
|
| 435 |
"code": datasets.features.Sequence(datasets.Value("string")),
|
| 436 |
"quote": datasets.features.Sequence(datasets.Value("string")),
|
| 437 |
+
"chemical": datasets.features.Sequence(datasets.Value("string")),
|
| 438 |
"supplementary": datasets.features.Sequence(datasets.Value("string")),
|
| 439 |
"footnote": datasets.features.Sequence(datasets.Value("string")),
|
| 440 |
"graphic": datasets.features.Sequence(datasets.Value("string")),
|
|
|
|
| 571 |
"box": content_d["box"],
|
| 572 |
"code": content_d["code"],
|
| 573 |
"quote": content_d["quote"],
|
| 574 |
+
"chemical": content_d["chemical"],
|
| 575 |
"supplementary": content_d["supplementary"],
|
| 576 |
"footnote": content_d["footnote"],
|
| 577 |
"graphic": content_d["graphic"],
|
|
|
|
| 633 |
"box": content_d["box"],
|
| 634 |
"code": content_d["code"],
|
| 635 |
"quote": content_d["quote"],
|
| 636 |
+
"chemical": content_d["chemical"],
|
| 637 |
"supplementary": content_d["supplementary"],
|
| 638 |
"footnote": content_d["footnote"],
|
| 639 |
"graphic": content_d["graphic"],
|