Name | analyzethis JSON |
Version |
0.2.7
JSON |
| download |
home_page | |
Summary | extract structured information from ethics paragraphs |
upload_time | 2023-04-26 19:47:10 |
maintainer | |
docs_url | None |
author | Ayush Garg |
requires_python | |
license | Apache License |
keywords |
research
automation
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
## docanalysis
`docanalysis` is a Command Line Tool that ingests corpora [(CProjects)](https://github.com/petermr/tigr2ess/blob/master/getpapers/TUTORIAL.md#cproject-and-ctrees) and carries out text-analysis of documents, including
- sectioning
- NLP/text-mining
- dictionary generation
Besides the bespoke code, it uses [NLTK](https://www.nltk.org/) and other Python tools for many operations, and [spaCy](https://spacy.io/) or [scispaCy](https://allenai.github.io/scispacy/) for extraction and annotation of entities. Outputs summary data and word-dictionaries.
### Set up `venv`
We recommend you create a virtual environment (`venv`) before installing `docanalysis` and that you activate the `venv` before each time you run `docanalysis`.
#### Windows
Creating a `venv`
```
>> mkdir docanalysis_demo
>> cd docanalysis_demo
>> python -m venv venv
```
Activating `venv`
```
>> venv\Scripts\activate.bat
```
#### MacOS
Creating a `venv`
```
>> mkdir docanalysis_demo
>> cd docanalysis_demo
>> python3 -m venv venv
```
Activating `venv`
```
>> source venv/bin/activate
```
Refer the [official documentation](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/) for more help.
### Install `docanalysis`
You can download `docanalysis` from PYPI.
```
pip install docanalysis
```
If you are on a Mac
```
pip3 install docanalysis
```
Download python from: [https://www.python.org/downloads/](https://www.python.org/downloads/) and select the option `Add Python to Path while installing`. Make sure `pip` is installed along with python. Check out [https://pip.pypa.io/en/stable/installation/](https://pip.pypa.io/en/stable/installation/) if you have difficulties installing pip.
### Run `docanalysis`
`docanalysis --help` should list the flags we support and their use.
```
usage: docanalysis.py [-h] [--run_pygetpapers] [--make_section] [-q QUERY] [-k HITS] [--project_name PROJECT_NAME] [-d DICTIONARY] [-o OUTPUT]
[--make_ami_dict MAKE_AMI_DICT] [--search_section [SEARCH_SECTION [SEARCH_SECTION ...]]] [--entities [ENTITIES [ENTITIES ...]]]
[--spacy_model SPACY_MODEL] [--html HTML] [--synonyms SYNONYMS] [--make_json MAKE_JSON] [--search_html] [--extract_abb EXTRACT_ABB]
[-l LOGLEVEL] [-f LOGFILE]
Welcome to docanalysis version 0.1.3. -h or --help for help
optional arguments:
-h, --help show this help message and exit
--run_pygetpapers [Command] downloads papers from EuropePMC via pygetpapers
--make_section [Command] makes sections; requires a fulltext.xml in CTree directories
-q QUERY, --query QUERY
[pygetpapers] query string
-k HITS, --hits HITS [pygetpapers] number of papers to download
--project_name PROJECT_NAME
CProject directory name
-d DICTIONARY, --dictionary DICTIONARY
[file name/url] existing ami dictionary to annotate sentences or support supervised entity extraction
-o OUTPUT, --output OUTPUT
outputs csv with sentences/terms
--make_ami_dict MAKE_AMI_DICT
[Command] title for ami-dict. Makes ami-dict of all extracted entities; works only with spacy
--search_section [SEARCH_SECTION [SEARCH_SECTION ...]]
[NER/dictionary search] section(s) to annotate. Choose from: ALL, ACK, AFF, AUT, CON, DIS, ETH, FIG, INT, KEY, MET, RES, TAB, TIL. Defaults to
ALL
--entities [ENTITIES [ENTITIES ...]]
[NER] entities to extract. Default (ALL). Common entities SpaCy: GPE, LANGUAGE, ORG, PERSON (for additional ones check: ); SciSpaCy: CHEMICAL,
DISEASE
--spacy_model SPACY_MODEL
[NER] optional. Choose between spacy or scispacy models. Defaults to spacy
--html HTML outputs html with sentences/terms
--synonyms SYNONYMS annotate the corpus/sections with synonyms from ami-dict
--make_json MAKE_JSON
outputs json with sentences/terms
--search_html searches html documents (mainly IPCC)
--extract_abb EXTRACT_ABB
[Command] title for abb-ami-dict. Extracts abbreviations and expansions; makes ami-dict of all extracted entities
-l LOGLEVEL, --loglevel LOGLEVEL
provide logging level. Example --log warning <<info,warning,debug,error,critical>>, default='info'
-f LOGFILE, --logfile LOGFILE
saves log to specified file in output directory as well as printing to terminal
```
#### Download papers from [EPMC](https://europepmc.org/) via `pygetpapers`
COMMAND
```
docanalysis --run_pygetpapers -q "terpene" -k 10 --project_name terpene_10
```
LOGS
```
INFO: making project/searching terpene for 10 hits into C:\Users\shweata\docanalysis\terpene_10
INFO: Total Hits are 13935
1it [00:00, 936.44it/s]
INFO: Saving XML files to C:\Users\shweata\docanalysis\terpene_10\*\fulltext.xml
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:30<00:00, 3.10s/it]
```
CPROJ
```
C:\USERS\SHWEATA\DOCANALYSIS\TERPENE_10
│ eupmc_results.json
│
├───PMC8625850
│ eupmc_result.json
│ fulltext.xml
│
├───PMC8727598
│ eupmc_result.json
│ fulltext.xml
│
├───PMC8747377
│ eupmc_result.json
│ fulltext.xml
│
├───PMC8771452
│ eupmc_result.json
│ fulltext.xml
│
├───PMC8775117
│ eupmc_result.json
│ fulltext.xml
│
├───PMC8801761
│ eupmc_result.json
│ fulltext.xml
│
├───PMC8831285
│ eupmc_result.json
│ fulltext.xml
│
├───PMC8839294
│ eupmc_result.json
│ fulltext.xml
│
├───PMC8840323
│ eupmc_result.json
│ fulltext.xml
│
└───PMC8879232
eupmc_result.json
fulltext.xml
```
#### Section the papers
COMMAND
```
docanalysis --project_name terpene_10 --make_section
```
LOGS
```
WARNING: Making sections in /content/terpene_10/PMC9095633/fulltext.xml
INFO: dict_keys: dict_keys(['abstract', 'acknowledge', 'affiliation', 'author', 'conclusion', 'discussion', 'ethics', 'fig_caption', 'front', 'introduction', 'jrnl_title', 'keyword', 'method', 'octree', 'pdfimage', 'pub_date', 'publisher', 'reference', 'results_discuss', 'search_results', 'sections', 'svg', 'table', 'title'])
WARNING: loading templates.json
INFO: wrote XML sections for /content/terpene_10/PMC9095633/fulltext.xml /content/terpene_10/PMC9095633/sections
WARNING: Making sections in /content/terpene_10/PMC9120863/fulltext.xml
INFO: wrote XML sections for /content/terpene_10/PMC9120863/fulltext.xml /content/terpene_10/PMC9120863/sections
WARNING: Making sections in /content/terpene_10/PMC8982386/fulltext.xml
INFO: wrote XML sections for /content/terpene_10/PMC8982386/fulltext.xml /content/terpene_10/PMC8982386/sections
WARNING: Making sections in /content/terpene_10/PMC9069239/fulltext.xml
INFO: wrote XML sections for /content/terpene_10/PMC9069239/fulltext.xml /content/terpene_10/PMC9069239/sections
WARNING: Making sections in /content/terpene_10/PMC9165828/fulltext.xml
INFO: wrote XML sections for /content/terpene_10/PMC9165828/fulltext.xml /content/terpene_10/PMC9165828/sections
WARNING: Making sections in /content/terpene_10/PMC9119530/fulltext.xml
INFO: wrote XML sections for /content/terpene_10/PMC9119530/fulltext.xml /content/terpene_10/PMC9119530/sections
WARNING: Making sections in /content/terpene_10/PMC8982077/fulltext.xml
INFO: wrote XML sections for /content/terpene_10/PMC8982077/fulltext.xml /content/terpene_10/PMC8982077/sections
WARNING: Making sections in /content/terpene_10/PMC9067962/fulltext.xml
INFO: wrote XML sections for /content/terpene_10/PMC9067962/fulltext.xml /content/terpene_10/PMC9067962/sections
WARNING: Making sections in /content/terpene_10/PMC9154778/fulltext.xml
INFO: wrote XML sections for /content/terpene_10/PMC9154778/fulltext.xml /content/terpene_10/PMC9154778/sections
WARNING: Making sections in /content/terpene_10/PMC9164016/fulltext.xml
INFO: wrote XML sections for /content/terpene_10/PMC9164016/fulltext.xml /content/terpene_10/PMC9164016/sections
47% 1056/2258 [00:01<00:01, 1003.31it/s]ERROR: cannot parse /content/terpene_10/PMC9165828/sections/1_front/1_article-meta/26_custom-meta-group/0_custom-meta/1_meta-value/0_xref.xml
67% 1516/2258 [00:01<00:00, 1047.68it/s]ERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/7_xref.xml
ERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/14_email.xml
ERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/3_xref.xml
ERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/6_xref.xml
ERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/9_email.xml
ERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/10_email.xml
ERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/4_xref.xml
...
100% 2258/2258 [00:02<00:00, 949.43it/s]
```
CTREE
```
├───PMC8625850
│ └───sections
│ ├───0_processing-meta
│ ├───1_front
│ │ ├───0_journal-meta
│ │ └───1_article-meta
│ ├───2_body
│ │ ├───0_1._introduction
│ │ ├───1_2._materials_and_methods
│ │ │ ├───1_2.1._materials
│ │ │ ├───2_2.2._bacterial_strains
│ │ │ ├───3_2.3._preparation_and_character
│ │ │ ├───4_2.4._evaluation_of_the_effect_
│ │ │ ├───5_2.5._time-kill_studies
│ │ │ ├───6_2.6._propidium_iodide_uptake-e
│ │ │ └───7_2.7._hemolysis_test_from_human
│ │ ├───2_3._results
│ │ │ ├───1_3.1._encapsulation_of_terpene_
│ │ │ ├───2_3.2._both_terpene_alcohol-load
│ │ │ ├───3_3.3._farnesol_and_geraniol-loa
│ │ │ └───4_3.4._farnesol_and_geraniol-loa
│ │ ├───3_4._discussion
│ │ ├───4_5._conclusions
│ │ └───5_6._patents
│ ├───3_back
│ │ ├───0_ack
│ │ ├───1_fn-group
│ │ │ └───0_fn
│ │ ├───2_app-group
│ │ │ └───0_app
│ │ │ └───2_supplementary-material
│ │ │ └───0_media
│ │ └───9_ref-list
│ └───4_floats-group
│ ├───4_table-wrap
│ ├───5_table-wrap
│ ├───6_table-wrap
│ │ └───4_table-wrap-foot
│ │ └───0_fn
│ ├───7_table-wrap
│ └───8_table-wrap
...
```
##### Search sections using dictionary
COMMAND
```
docanalysis --project_name terpene_10 --output entities.csv --make_ami_dict entities.xml
```
LOGS
```
INFO: Found 7134 sentences in the section(s).
INFO: getting terms from /content/activity.xml
100% 7134/7134 [00:02<00:00, 3172.14it/s]
/usr/local/lib/python3.7/dist-packages/docanalysis/entity_extraction.py:352: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.
"[", "").str.replace("]", "")
INFO: wrote output to /content/terpene_10/activity.csv
```
#### Extract entities
We use `spacy` to extract Named Entites. Here's the list of Entities it supports:CARDINAL, DATE, EVENT, FAC, GPE, LANGUAGE, LAW,LOC, MONEY, NORP, ORDINAL, ORG, PERCENT, PERSON, PRODUCT, QUANTITY, TIME, WORK_OF_ART
INPUT
```
docanalysis --project_name terpene_10 --make_section --spacy_model spacy --entities ORG --output org.csv
```
LOGS
```
INFO: Found 7134 sentences in the section(s).
INFO: Loading spacy
100% 7134/7134 [01:08<00:00, 104.16it/s]
/usr/local/lib/python3.7/dist-packages/docanalysis/entity_extraction.py:352: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.
"[", "").str.replace("]", "")
INFO: wrote output to /content/terpene_10/org.csv
```
##### Extract information from specific section(s)
You can choose to extract entities from specific sections
COMMAND
```
docanalysis --project_name terpene_10 --make_section --spacy_model spacy --search_section AUT, AFF --entities ORG --output org_aut_aff.csv
```
LOG
```
INFO: Found 28 sentences in the section(s).
INFO: Loading spacy
100% 28/28 [00:00<00:00, 106.66it/s]
/usr/local/lib/python3.7/dist-packages/docanalysis/entity_extraction.py:352: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.
"[", "").str.replace("]", "")
INFO: wrote output to /content/terpene_10/org_aut_aff.csv
```
#### Create dictionary of extracted entities
COMMAND
```
docanalysis --project_name terpene_10 --make_section --spacy_model spacy --search_section AUT, AFF --entities ORG --output org_aut_aff.csvv --make_ami_dict org
```
LOG
```
INFO: Found 28 sentences in the section(s).
INFO: Loading spacy
100% 28/28 [00:00<00:00, 96.56it/s]
/usr/local/lib/python3.7/dist-packages/docanalysis/entity_extraction.py:352: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.
"[", "").str.replace("]", "")
INFO: wrote output to /content/terpene_10/org_aut_aff.csvv
INFO: Wrote all the entities extracted to ami dict
```
Snippet of the dictionary
```
<?xml version="1.0"?>
- dictionary title="/content/terpene_10/org.xml">
<entry count="2" term="Department of Biochemistry"/>
<entry count="2" term="Chinese Academy of Agricultural Sciences"/>
<entry count="2" term="Tianjin University"/>
<entry count="2" term="Desert Research Center"/>
<entry count="2" term="Chinese Academy of Sciences"/>
<entry count="2" term="University of Colorado Boulder"/>
<entry count="2" term="Department of Neurology"/>
<entry count="1" term="Max Planck Institute for Chemical Ecology"/>
<entry count="1" term="College of Forest Resources and Environmental Science"/>
<entry count="1" term="Michigan Technological University"/>
```
### Extract Abbreviations
```
docanalysis --project_name corpus\ethics_10 --output dict_search_5.csv --make_json dict_search_5.json --make_ami_dict entities --extract_abb ethics_abb
```
`--extract_abb` extracts all abbreviations and make an ami-dictionary of abbreviations and its expansion.
EXAMPLE DICTIONARY:
```
<dictionary title="ethics_abb">
<entry name="ASD" term="Atrial septal defect"/>
<entry name="SPSS" term="Statistical Package for Social Sciences"/>
<entry name="ACGME" term="Accreditation Council of Graduate Medical Education"/>
<entry name="ABP" term="American Board of Paediatrics"/>
<entry name="TBL" term="Team Based Learning"/>
<entry name="TBL" term="Team-Based Learning"/>
<entry name="UNTH" term="University of Nigeria Teaching Hospital"/>
<entry name="PAH" term="pulmonary hypertension"/>
<entry name="HREC" term="Human Sciences Research Council, Research Ethics Committee"/>
<entry name="HREC" term="Human Sciences Research Council, Research Ethics Committee"/>
<entry name="CDC" term="Center for Disease Control and Prevention"/>
<entry name="ASD" term="Atrial septal defect"/>
<entry name="PAH" term="pulmonary arterial hypertension"/>
<entry name="CVDs" term="cardiovascular diseases"/>
<entry name="BNs" term="Bayesian networks"/>
<entry name="GI" term="gastrointestinal cancer"/>
<entry name="ART" term="antiretroviral therapy"/>
<entry name="HIV" term="human immunodeficiency virus"/>
<entry name="GATE" term="Global Cooperation on Assistive Technology"/>
</dictionary>
```
### Search HTML
If you working with HTML files (IPCC Reports, for example) and not XMLs in CProjects, you can use `--search_html` flag.
```
docanalysis --project_name corpus\ipcc_sectioned --extract_abb ethics_abb --search_html
```
Make sure that your `html` sections is in `sections` folder. Here's an example structure:
```
C:.
| dict_search_2.csv
| dict_search_2.json
|
\---chap4
| chapter_4
|
\---sections
4.1.html
4.2.1.html
4.2.2.html
4.2.3.html
4.2.4.html
4.2.5.html
4.2.7.html
4.2.html
4.3.1.html
4.3.2.html
4.3.html
4.4.1.html
4.4.2.html
4.4.html
4.5.html
executive_summary.html
frequently_asked_questions.html
table_of_contents.html
```
If you haven't sectioned your `html`, please use `py4ami` to section it.
#### What is a dictionary
Dictionary, in `ami`'s terminology, a set of terms/phrases in XML format.
Dictionaries related to ethics and acknowledgments are available in [Ethics Dictionary](https://github.com/petermr/docanalysis/tree/main/ethics_dictionary) folder
If you'd like to create a custom dictionary, you can find the steps, [here](https://github.com/petermr/tigr2ess/blob/master/dictionaries/TUTORIAL.md)
```
### Python tools used
- [`pygetpapers`](https://github.com/petermr/pygetpapers) - scrape open repositories to download papers of interest
- [nltk](https://www.nltk.org/) - splits sentences
- [spaCy](https://spacy.io/) and [SciSpaCy](https://allenai.github.io/scispacy/)
- recognize Named-Entities and label them
- Here's the list of NER labels [SpaCy's English model](https://spacy.io/models/en) provides:
`CARDINAL, DATE, EVENT, FAC, GPE, LANGUAGE, LAW, LOC, MONEY, NORP, ORDINAL, ORG, PERCENT, PERSON, PRODUCT, QUANTITY, TIME, WORK_OF_ART`
### Credits:
- [Ayush Garg](https://github.com/ayush4921)
- [Shweata N. Hegde](https://github.com/ShweataNHegde/)
- [Daniel Mietchen](https://github.com/Daniel-Mietchen)
- [Peter Murray-Rust](https://github.com/petermr)
Raw data
{
"_id": null,
"home_page": "",
"name": "analyzethis",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "research automation",
"author": "Ayush Garg",
"author_email": "",
"download_url": "",
"platform": null,
"description": "## docanalysis \n`docanalysis` is a Command Line Tool that ingests corpora [(CProjects)](https://github.com/petermr/tigr2ess/blob/master/getpapers/TUTORIAL.md#cproject-and-ctrees) and carries out text-analysis of documents, including\n- sectioning\n- NLP/text-mining\n- dictionary generation \n\nBesides the bespoke code, it uses [NLTK](https://www.nltk.org/) and other Python tools for many operations, and [spaCy](https://spacy.io/) or [scispaCy](https://allenai.github.io/scispacy/) for extraction and annotation of entities. Outputs summary data and word-dictionaries. \n\n### Set up `venv`\nWe recommend you create a virtual environment (`venv`) before installing `docanalysis` and that you activate the `venv` before each time you run `docanalysis`.\n\n#### Windows\nCreating a `venv`\n```\n>> mkdir docanalysis_demo\n>> cd docanalysis_demo\n>> python -m venv venv\n```\n\nActivating `venv`\n```\n>> venv\\Scripts\\activate.bat\n```\n\n#### MacOS\nCreating a `venv`\n```\n>> mkdir docanalysis_demo\n>> cd docanalysis_demo\n>> python3 -m venv venv\n```\n\nActivating `venv`\n```\n>> source venv/bin/activate\n```\n\nRefer the [official documentation](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/) for more help. \n\n### Install `docanalysis`\nYou can download `docanalysis` from PYPI. \n```\n pip install docanalysis\n```\nIf you are on a Mac\n```\npip3 install docanalysis\n```\n\nDownload python from: [https://www.python.org/downloads/](https://www.python.org/downloads/) and select the option `Add Python to Path while installing`. Make sure `pip` is installed along with python. Check out [https://pip.pypa.io/en/stable/installation/](https://pip.pypa.io/en/stable/installation/) if you have difficulties installing pip.\n\n### Run `docanalysis`\n`docanalysis --help` should list the flags we support and their use.\n\n```\nusage: docanalysis.py [-h] [--run_pygetpapers] [--make_section] [-q QUERY] [-k HITS] [--project_name PROJECT_NAME] [-d DICTIONARY] [-o OUTPUT]\n [--make_ami_dict MAKE_AMI_DICT] [--search_section [SEARCH_SECTION [SEARCH_SECTION ...]]] [--entities [ENTITIES [ENTITIES ...]]]\n [--spacy_model SPACY_MODEL] [--html HTML] [--synonyms SYNONYMS] [--make_json MAKE_JSON] [--search_html] [--extract_abb EXTRACT_ABB]\n [-l LOGLEVEL] [-f LOGFILE]\n\nWelcome to docanalysis version 0.1.3. -h or --help for help\n\noptional arguments:\n -h, --help show this help message and exit\n --run_pygetpapers [Command] downloads papers from EuropePMC via pygetpapers\n --make_section [Command] makes sections; requires a fulltext.xml in CTree directories\n -q QUERY, --query QUERY\n [pygetpapers] query string\n -k HITS, --hits HITS [pygetpapers] number of papers to download\n --project_name PROJECT_NAME\n CProject directory name\n -d DICTIONARY, --dictionary DICTIONARY\n [file name/url] existing ami dictionary to annotate sentences or support supervised entity extraction\n -o OUTPUT, --output OUTPUT\n outputs csv with sentences/terms\n --make_ami_dict MAKE_AMI_DICT\n [Command] title for ami-dict. Makes ami-dict of all extracted entities; works only with spacy\n --search_section [SEARCH_SECTION [SEARCH_SECTION ...]]\n [NER/dictionary search] section(s) to annotate. Choose from: ALL, ACK, AFF, AUT, CON, DIS, ETH, FIG, INT, KEY, MET, RES, TAB, TIL. Defaults to\n ALL\n --entities [ENTITIES [ENTITIES ...]]\n [NER] entities to extract. Default (ALL). Common entities SpaCy: GPE, LANGUAGE, ORG, PERSON (for additional ones check: ); SciSpaCy: CHEMICAL,\n DISEASE\n --spacy_model SPACY_MODEL\n [NER] optional. Choose between spacy or scispacy models. Defaults to spacy\n --html HTML outputs html with sentences/terms\n --synonyms SYNONYMS annotate the corpus/sections with synonyms from ami-dict\n --make_json MAKE_JSON\n outputs json with sentences/terms\n --search_html searches html documents (mainly IPCC)\n --extract_abb EXTRACT_ABB\n [Command] title for abb-ami-dict. Extracts abbreviations and expansions; makes ami-dict of all extracted entities\n -l LOGLEVEL, --loglevel LOGLEVEL\n provide logging level. Example --log warning <<info,warning,debug,error,critical>>, default='info'\n -f LOGFILE, --logfile LOGFILE\n saves log to specified file in output directory as well as printing to terminal\n```\n\n#### Download papers from [EPMC](https://europepmc.org/) via `pygetpapers`\nCOMMAND\n```\ndocanalysis --run_pygetpapers -q \"terpene\" -k 10 --project_name terpene_10\n```\nLOGS\n```\nINFO: making project/searching terpene for 10 hits into C:\\Users\\shweata\\docanalysis\\terpene_10\nINFO: Total Hits are 13935\n1it [00:00, 936.44it/s]\nINFO: Saving XML files to C:\\Users\\shweata\\docanalysis\\terpene_10\\*\\fulltext.xml\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 10/10 [00:30<00:00, 3.10s/it]\n```\n\nCPROJ\n```\nC:\\USERS\\SHWEATA\\DOCANALYSIS\\TERPENE_10\n\u2502 eupmc_results.json\n\u2502\n\u251c\u2500\u2500\u2500PMC8625850\n\u2502 eupmc_result.json\n\u2502 fulltext.xml\n\u2502\n\u251c\u2500\u2500\u2500PMC8727598\n\u2502 eupmc_result.json\n\u2502 fulltext.xml\n\u2502\n\u251c\u2500\u2500\u2500PMC8747377\n\u2502 eupmc_result.json\n\u2502 fulltext.xml\n\u2502\n\u251c\u2500\u2500\u2500PMC8771452\n\u2502 eupmc_result.json\n\u2502 fulltext.xml\n\u2502\n\u251c\u2500\u2500\u2500PMC8775117\n\u2502 eupmc_result.json\n\u2502 fulltext.xml\n\u2502\n\u251c\u2500\u2500\u2500PMC8801761\n\u2502 eupmc_result.json\n\u2502 fulltext.xml\n\u2502\n\u251c\u2500\u2500\u2500PMC8831285\n\u2502 eupmc_result.json\n\u2502 fulltext.xml\n\u2502\n\u251c\u2500\u2500\u2500PMC8839294\n\u2502 eupmc_result.json\n\u2502 fulltext.xml\n\u2502\n\u251c\u2500\u2500\u2500PMC8840323\n\u2502 eupmc_result.json\n\u2502 fulltext.xml\n\u2502\n\u2514\u2500\u2500\u2500PMC8879232\n eupmc_result.json\n fulltext.xml\n```\n\n#### Section the papers\nCOMMAND\n```\ndocanalysis --project_name terpene_10 --make_section\n```\nLOGS\n```\nWARNING: Making sections in /content/terpene_10/PMC9095633/fulltext.xml\nINFO: dict_keys: dict_keys(['abstract', 'acknowledge', 'affiliation', 'author', 'conclusion', 'discussion', 'ethics', 'fig_caption', 'front', 'introduction', 'jrnl_title', 'keyword', 'method', 'octree', 'pdfimage', 'pub_date', 'publisher', 'reference', 'results_discuss', 'search_results', 'sections', 'svg', 'table', 'title'])\nWARNING: loading templates.json\nINFO: wrote XML sections for /content/terpene_10/PMC9095633/fulltext.xml /content/terpene_10/PMC9095633/sections\nWARNING: Making sections in /content/terpene_10/PMC9120863/fulltext.xml\nINFO: wrote XML sections for /content/terpene_10/PMC9120863/fulltext.xml /content/terpene_10/PMC9120863/sections\nWARNING: Making sections in /content/terpene_10/PMC8982386/fulltext.xml\nINFO: wrote XML sections for /content/terpene_10/PMC8982386/fulltext.xml /content/terpene_10/PMC8982386/sections\nWARNING: Making sections in /content/terpene_10/PMC9069239/fulltext.xml\nINFO: wrote XML sections for /content/terpene_10/PMC9069239/fulltext.xml /content/terpene_10/PMC9069239/sections\nWARNING: Making sections in /content/terpene_10/PMC9165828/fulltext.xml\nINFO: wrote XML sections for /content/terpene_10/PMC9165828/fulltext.xml /content/terpene_10/PMC9165828/sections\nWARNING: Making sections in /content/terpene_10/PMC9119530/fulltext.xml\nINFO: wrote XML sections for /content/terpene_10/PMC9119530/fulltext.xml /content/terpene_10/PMC9119530/sections\nWARNING: Making sections in /content/terpene_10/PMC8982077/fulltext.xml\nINFO: wrote XML sections for /content/terpene_10/PMC8982077/fulltext.xml /content/terpene_10/PMC8982077/sections\nWARNING: Making sections in /content/terpene_10/PMC9067962/fulltext.xml\nINFO: wrote XML sections for /content/terpene_10/PMC9067962/fulltext.xml /content/terpene_10/PMC9067962/sections\nWARNING: Making sections in /content/terpene_10/PMC9154778/fulltext.xml\nINFO: wrote XML sections for /content/terpene_10/PMC9154778/fulltext.xml /content/terpene_10/PMC9154778/sections\nWARNING: Making sections in /content/terpene_10/PMC9164016/fulltext.xml\nINFO: wrote XML sections for /content/terpene_10/PMC9164016/fulltext.xml /content/terpene_10/PMC9164016/sections\n 47% 1056/2258 [00:01<00:01, 1003.31it/s]ERROR: cannot parse /content/terpene_10/PMC9165828/sections/1_front/1_article-meta/26_custom-meta-group/0_custom-meta/1_meta-value/0_xref.xml\n 67% 1516/2258 [00:01<00:00, 1047.68it/s]ERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/7_xref.xml\nERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/14_email.xml\nERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/3_xref.xml\nERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/6_xref.xml\nERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/9_email.xml\nERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/10_email.xml\nERROR: cannot parse /content/terpene_10/PMC9119530/sections/1_front/1_article-meta/24_custom-meta-group/0_custom-meta/1_meta-value/4_xref.xml\n...\n100% 2258/2258 [00:02<00:00, 949.43it/s] \n```\n\nCTREE\n```\n\u251c\u2500\u2500\u2500PMC8625850\n\u2502 \u2514\u2500\u2500\u2500sections\n\u2502 \u251c\u2500\u2500\u25000_processing-meta\n\u2502 \u251c\u2500\u2500\u25001_front\n\u2502 \u2502 \u251c\u2500\u2500\u25000_journal-meta\n\u2502 \u2502 \u2514\u2500\u2500\u25001_article-meta\n\u2502 \u251c\u2500\u2500\u25002_body\n\u2502 \u2502 \u251c\u2500\u2500\u25000_1._introduction\n\u2502 \u2502 \u251c\u2500\u2500\u25001_2._materials_and_methods\n\u2502 \u2502 \u2502 \u251c\u2500\u2500\u25001_2.1._materials\n\u2502 \u2502 \u2502 \u251c\u2500\u2500\u25002_2.2._bacterial_strains\n\u2502 \u2502 \u2502 \u251c\u2500\u2500\u25003_2.3._preparation_and_character\n\u2502 \u2502 \u2502 \u251c\u2500\u2500\u25004_2.4._evaluation_of_the_effect_\n\u2502 \u2502 \u2502 \u251c\u2500\u2500\u25005_2.5._time-kill_studies\n\u2502 \u2502 \u2502 \u251c\u2500\u2500\u25006_2.6._propidium_iodide_uptake-e\n\u2502 \u2502 \u2502 \u2514\u2500\u2500\u25007_2.7._hemolysis_test_from_human\n\u2502 \u2502 \u251c\u2500\u2500\u25002_3._results\n\u2502 \u2502 \u2502 \u251c\u2500\u2500\u25001_3.1._encapsulation_of_terpene_\n\u2502 \u2502 \u2502 \u251c\u2500\u2500\u25002_3.2._both_terpene_alcohol-load\n\u2502 \u2502 \u2502 \u251c\u2500\u2500\u25003_3.3._farnesol_and_geraniol-loa\n\u2502 \u2502 \u2502 \u2514\u2500\u2500\u25004_3.4._farnesol_and_geraniol-loa\n\u2502 \u2502 \u251c\u2500\u2500\u25003_4._discussion\n\u2502 \u2502 \u251c\u2500\u2500\u25004_5._conclusions\n\u2502 \u2502 \u2514\u2500\u2500\u25005_6._patents\n\u2502 \u251c\u2500\u2500\u25003_back\n\u2502 \u2502 \u251c\u2500\u2500\u25000_ack\n\u2502 \u2502 \u251c\u2500\u2500\u25001_fn-group\n\u2502 \u2502 \u2502 \u2514\u2500\u2500\u25000_fn\n\u2502 \u2502 \u251c\u2500\u2500\u25002_app-group\n\u2502 \u2502 \u2502 \u2514\u2500\u2500\u25000_app\n\u2502 \u2502 \u2502 \u2514\u2500\u2500\u25002_supplementary-material\n\u2502 \u2502 \u2502 \u2514\u2500\u2500\u25000_media\n\u2502 \u2502 \u2514\u2500\u2500\u25009_ref-list\n\u2502 \u2514\u2500\u2500\u25004_floats-group\n\u2502 \u251c\u2500\u2500\u25004_table-wrap\n\u2502 \u251c\u2500\u2500\u25005_table-wrap\n\u2502 \u251c\u2500\u2500\u25006_table-wrap\n\u2502 \u2502 \u2514\u2500\u2500\u25004_table-wrap-foot\n\u2502 \u2502 \u2514\u2500\u2500\u25000_fn\n\u2502 \u251c\u2500\u2500\u25007_table-wrap\n\u2502 \u2514\u2500\u2500\u25008_table-wrap\n...\n```\n##### Search sections using dictionary\nCOMMAND\n```\ndocanalysis --project_name terpene_10 --output entities.csv --make_ami_dict entities.xml\n```\nLOGS\n```\nINFO: Found 7134 sentences in the section(s).\nINFO: getting terms from /content/activity.xml\n100% 7134/7134 [00:02<00:00, 3172.14it/s]\n/usr/local/lib/python3.7/dist-packages/docanalysis/entity_extraction.py:352: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.\n \"[\", \"\").str.replace(\"]\", \"\")\nINFO: wrote output to /content/terpene_10/activity.csv\n```\n\n#### Extract entities\nWe use `spacy` to extract Named Entites. Here's the list of Entities it supports:CARDINAL, DATE, EVENT, FAC, GPE, LANGUAGE, LAW,LOC, MONEY, NORP, ORDINAL, ORG, PERCENT, PERSON, PRODUCT, QUANTITY, TIME, WORK_OF_ART \nINPUT\n```\ndocanalysis --project_name terpene_10 --make_section --spacy_model spacy --entities ORG --output org.csv\n```\nLOGS\n```\nINFO: Found 7134 sentences in the section(s).\nINFO: Loading spacy\n100% 7134/7134 [01:08<00:00, 104.16it/s]\n/usr/local/lib/python3.7/dist-packages/docanalysis/entity_extraction.py:352: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.\n \"[\", \"\").str.replace(\"]\", \"\")\nINFO: wrote output to /content/terpene_10/org.csv\n```\n##### Extract information from specific section(s)\nYou can choose to extract entities from specific sections\n\nCOMMAND\n```\ndocanalysis --project_name terpene_10 --make_section --spacy_model spacy --search_section AUT, AFF --entities ORG --output org_aut_aff.csv\n```\nLOG\n```\nINFO: Found 28 sentences in the section(s).\nINFO: Loading spacy\n100% 28/28 [00:00<00:00, 106.66it/s]\n/usr/local/lib/python3.7/dist-packages/docanalysis/entity_extraction.py:352: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.\n \"[\", \"\").str.replace(\"]\", \"\")\nINFO: wrote output to /content/terpene_10/org_aut_aff.csv\n```\n#### Create dictionary of extracted entities\nCOMMAND\n```\ndocanalysis --project_name terpene_10 --make_section --spacy_model spacy --search_section AUT, AFF --entities ORG --output org_aut_aff.csvv --make_ami_dict org\n```\nLOG\n```\nINFO: Found 28 sentences in the section(s).\nINFO: Loading spacy\n100% 28/28 [00:00<00:00, 96.56it/s] \n/usr/local/lib/python3.7/dist-packages/docanalysis/entity_extraction.py:352: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will *not* be treated as literal strings when regex=True.\n \"[\", \"\").str.replace(\"]\", \"\")\nINFO: wrote output to /content/terpene_10/org_aut_aff.csvv\nINFO: Wrote all the entities extracted to ami dict\n```\n\nSnippet of the dictionary\n```\n<?xml version=\"1.0\"?>\n- dictionary title=\"/content/terpene_10/org.xml\">\n<entry count=\"2\" term=\"Department of Biochemistry\"/>\n<entry count=\"2\" term=\"Chinese Academy of Agricultural Sciences\"/>\n<entry count=\"2\" term=\"Tianjin University\"/>\n<entry count=\"2\" term=\"Desert Research Center\"/>\n<entry count=\"2\" term=\"Chinese Academy of Sciences\"/>\n<entry count=\"2\" term=\"University of Colorado Boulder\"/>\n<entry count=\"2\" term=\"Department of Neurology\"/>\n<entry count=\"1\" term=\"Max Planck Institute for Chemical Ecology\"/>\n<entry count=\"1\" term=\"College of Forest Resources and Environmental Science\"/>\n<entry count=\"1\" term=\"Michigan Technological University\"/>\n```\n\n### Extract Abbreviations\n\n```\ndocanalysis --project_name corpus\\ethics_10 --output dict_search_5.csv --make_json dict_search_5.json --make_ami_dict entities --extract_abb ethics_abb\n```\n\n`--extract_abb` extracts all abbreviations and make an ami-dictionary of abbreviations and its expansion. \n\nEXAMPLE DICTIONARY: \n```\n<dictionary title=\"ethics_abb\">\n <entry name=\"ASD\" term=\"Atrial septal defect\"/>\n <entry name=\"SPSS\" term=\"Statistical Package for Social Sciences\"/>\n <entry name=\"ACGME\" term=\"Accreditation Council of Graduate Medical Education\"/>\n <entry name=\"ABP\" term=\"American Board of Paediatrics\"/>\n <entry name=\"TBL\" term=\"Team Based Learning\"/>\n <entry name=\"TBL\" term=\"Team-Based Learning\"/>\n <entry name=\"UNTH\" term=\"University of Nigeria Teaching Hospital\"/>\n <entry name=\"PAH\" term=\"pulmonary hypertension\"/>\n <entry name=\"HREC\" term=\"Human Sciences Research Council, Research Ethics Committee\"/>\n <entry name=\"HREC\" term=\"Human Sciences Research Council, Research Ethics Committee\"/>\n <entry name=\"CDC\" term=\"Center for Disease Control and Prevention\"/>\n <entry name=\"ASD\" term=\"Atrial septal defect\"/>\n <entry name=\"PAH\" term=\"pulmonary arterial hypertension\"/>\n <entry name=\"CVDs\" term=\"cardiovascular diseases\"/>\n <entry name=\"BNs\" term=\"Bayesian networks\"/>\n <entry name=\"GI\" term=\"gastrointestinal cancer\"/>\n <entry name=\"ART\" term=\"antiretroviral therapy\"/>\n <entry name=\"HIV\" term=\"human immunodeficiency virus\"/>\n <entry name=\"GATE\" term=\"Global Cooperation on Assistive Technology\"/>\n</dictionary>\n```\n\n### Search HTML\nIf you working with HTML files (IPCC Reports, for example) and not XMLs in CProjects, you can use `--search_html` flag.\n\n```\ndocanalysis --project_name corpus\\ipcc_sectioned --extract_abb ethics_abb --search_html\n```\n\n Make sure that your `html` sections is in `sections` folder. Here's an example structure: \n\n```\nC:.\n| dict_search_2.csv\n| dict_search_2.json\n|\n\\---chap4\n | chapter_4\n |\n \\---sections\n 4.1.html\n 4.2.1.html\n 4.2.2.html\n 4.2.3.html\n 4.2.4.html\n 4.2.5.html\n 4.2.7.html\n 4.2.html\n 4.3.1.html\n 4.3.2.html\n 4.3.html\n 4.4.1.html\n 4.4.2.html\n 4.4.html\n 4.5.html\n executive_summary.html\n frequently_asked_questions.html\n table_of_contents.html\n```\nIf you haven't sectioned your `html`, please use `py4ami` to section it. \n#### What is a dictionary\nDictionary, in `ami`'s terminology, a set of terms/phrases in XML format. \nDictionaries related to ethics and acknowledgments are available in [Ethics Dictionary](https://github.com/petermr/docanalysis/tree/main/ethics_dictionary) folder\n\nIf you'd like to create a custom dictionary, you can find the steps, [here](https://github.com/petermr/tigr2ess/blob/master/dictionaries/TUTORIAL.md)\n\n```\n### Python tools used\n- [`pygetpapers`](https://github.com/petermr/pygetpapers) - scrape open repositories to download papers of interest\n- [nltk](https://www.nltk.org/) - splits sentences\n- [spaCy](https://spacy.io/) and [SciSpaCy](https://allenai.github.io/scispacy/)\n - recognize Named-Entities and label them\n - Here's the list of NER labels [SpaCy's English model](https://spacy.io/models/en) provides: \n `CARDINAL, DATE, EVENT, FAC, GPE, LANGUAGE, LAW, LOC, MONEY, NORP, ORDINAL, ORG, PERCENT, PERSON, PRODUCT, QUANTITY, TIME, WORK_OF_ART`\n\n\n### Credits: \n- [Ayush Garg](https://github.com/ayush4921)\n- [Shweata N. Hegde](https://github.com/ShweataNHegde/)\n- [Daniel Mietchen](https://github.com/Daniel-Mietchen)\n- [Peter Murray-Rust](https://github.com/petermr)\n\n\n",
"bugtrack_url": null,
"license": "Apache License",
"summary": "extract structured information from ethics paragraphs",
"version": "0.2.7",
"split_keywords": [
"research",
"automation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2784cb2304fc897bc17ad02f60b6251adc4d7b4e8b29db7fa7b6b6d6e97475d9",
"md5": "2ab7bf6e143f9dcbf33c6fc7f6d23ec8",
"sha256": "f5b16f75049fd5d67aa81ea37562aa31f516cd983ba511529e4cc57ee9e0c8b2"
},
"downloads": -1,
"filename": "analyzethis-0.2.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2ab7bf6e143f9dcbf33c6fc7f6d23ec8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 40483,
"upload_time": "2023-04-26T19:47:10",
"upload_time_iso_8601": "2023-04-26T19:47:10.748202Z",
"url": "https://files.pythonhosted.org/packages/27/84/cb2304fc897bc17ad02f60b6251adc4d7b4e8b29db7fa7b6b6d6e97475d9/analyzethis-0.2.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-26 19:47:10",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "analyzethis"
}