Skip to main content

No project description provided

Project description

xdwarf

Mining XML to tabular data, FAAAAAAST

PyPI version Python version License PyPI Downloads

Install

pip install xdwarf

The library is an wrapping on rust_dwarf, a rust based mining tool.

Mining

# finding in glob pattern, project name, use all - 2 CPUs
dwarf = Dwarf.from_glob("../test/data/*.xml", "PMC",-2)

Define the mining detail as xpath query pattern, chaining multistage mining is well supported.

dwarf.find_one('article-meta > article-id[pub-id-type=pmid]' , "pmid")
dwarf.find_one("abstract", "abstract").find_many("p", "paragraph")

# mining stage can be chained to longer detials
reference = dwarf.find_one("ref-list", "ref_list").find_many("ref","reference")
reference.find_one("pub-id[pub-id-type=pmid]", "ref_id")
reference.find_one("pub-id[pub-id-type=doi]", "doi")
ref_name = reference.find_many("name", "ref_name")
ref_name.find_one("surname", "ref_surname")
dwarf.set_necessary("pmid")
dwarf.create_children()

Mining start

result = dwarf()

See result

result.child_df().head(2)

See child result

result['ref_list'].child_df().head()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xdwarf-0.1.0.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

xdwarf-0.1.0-py3-none-any.whl (16.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page