pydavid: A simple Python Interface of Open-David
Introduction
pydavid is a simple Python interface of Open-David (version 1.73), an abductive reasoner written in C++.
Installation
pydavid is a frontend of Open-David and does not include Open-David. Please install Open-David , and then install pydavid by the following command.
$ pip install pydavid
Usage
The following is a sample code. Before run, please set approapriate path to an executable file of Open-David in your computer, download toy.dav in this repository, and place it in your current working directly.
from pydavid import OpenDavid
from dhgraph import DirectedHypergraph
# PLEASE MODIFY PATH ACCORDING TO YOUR ENVIRONMENT.
OpenDavid.set_david_path("/usr/local/bin/david")
with open("toy.dav", mode="r") as f:
data = f.read()
OpenDavid.set_knowledge_base(data)
observation_list = ["police(John)", "die(E1)", "subj(E1, Mary)",\
"arrest(E2)", "subj(E2, x)", "obj(E2, Bob)"]
required_atom_list = ["(x = John)"]
OpenDavid.set_problem(observation_list, required_atom_list)
json_str = OpenDavid.run() # Wait until it terminates if interpreter is used.
# json is converted to a directed hypergraph.
g = OpenDavid.build_proofgraph(json_str)
# "sample.png" will be generated in your cwd.
g.render(filename="sample", format="png")
NOTE: toy.dav distributed in this repository was obtained from Open-David , but a problem field was deleted, because pydavid separately sets knowledge base data and a problem data.
Please see dhgraph for usage of dhgraph.
Bugs/Requests/Discussions
Please report bugs and requests from GitHub Issues , and ask questions from GitHub Discussions .
License
Please see LICENSE .
Metadata
Release files for pydavid 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydavid-1.0.1.tar.gz | 4.8 kB | Without provenance | Details for pydavid-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydavid-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pydavid-1.0.1-py3-none-any.whl |
Total release size: 10.4 kB
Release files / pydavid-1.0.1.tar.gz
| Download URL | pydavid-1.0.1.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc0b8477cbb6896e7981bba55acc6846630199cb7758fbfa0385949f47c60741
|
|
BLAKE2b-256 checksum How to use checksums |
fa6b98c46ff7603b018ab6e947f3320dc3b90e14f549fa76fa8f05b9e9535bab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Release files / pydavid-1.0.1-py3-none-any.whl
| Download URL | pydavid-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ba9e116bfb63be1b8f5226716e81715822426b791dcd0a145da2e56ffa7be10
|
|
BLAKE2b-256 checksum How to use checksums |
08f2a02432758c766dfd15e2e435a205bcc639c3f7545f92d22a710b7fb885cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Security for pydavid 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.