pydavid


Namepydavid JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/toda-lab/pydavid
SummaryA simple Python interface of Open-David
upload_time2024-03-29 16:49:06
maintainerNone
docs_urlNone
authorTakahisa Toda
requires_python<4.0,>=3.8
licenseMIT
keywords logic inference abduction explanation artificial intelligence
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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 <https://github.com/aurtg/open-david>`__ ,
and then install ``pydavid`` by the following command.

.. code:: shell-session

    $ 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.

.. code:: python

    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 <https://github.com/aurtg/open-david>`__ , but a problem field was
deleted, because ``pydavid`` separately sets knowledge base data and a problem data.

Please see `dhgraph <https://github.com/toda-lab/dhgraph>`__ for usage of
dhgraph.


.. image:: sample.png
    :alt: sample.png

Bugs/Requests/Discussions
=========================

Please report bugs and requests from `GitHub Issues <https://github.com/toda-lab/pydavid/issues>`__ , and 
ask questions from `GitHub Discussions <https://github.com/toda-lab/pydavid/discussions>`__ .

License
=======

Please see `LICENSE <https://github.com/toda-lab/pydavid/blob/main/LICENSE>`__ .


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/toda-lab/pydavid",
    "name": "pydavid",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "logic, inference, abduction, explanation, artificial intelligence",
    "author": "Takahisa Toda",
    "author_email": "toda@disc.lab.uec.ac.jp",
    "download_url": "https://files.pythonhosted.org/packages/fa/6b/98c46ff7603b018ab6e947f3320dc3b90e14f549fa76fa8f05b9e9535bab/pydavid-1.0.1.tar.gz",
    "platform": null,
    "description": "pydavid: A simple Python Interface of Open-David\n==========================================================\n\nIntroduction\n============\n``pydavid`` is a simple Python interface of Open-David (version 1.73), an abductive reasoner written in C++.\n\nInstallation\n============\n``pydavid`` is a frontend of Open-David and does not include Open-David.\nPlease install `Open-David <https://github.com/aurtg/open-david>`__ ,\nand then install ``pydavid`` by the following command.\n\n.. code:: shell-session\n\n    $ pip install pydavid\n\nUsage\n=====\n\nThe following is a sample code.\nBefore run, please set approapriate path to an executable file of Open-David\nin your computer, download ``toy.dav`` in this repository, and\nplace it in your current working directly.\n\n.. code:: python\n\n    from pydavid    import OpenDavid\n    from dhgraph    import DirectedHypergraph\n\n    # PLEASE MODIFY PATH ACCORDING TO YOUR ENVIRONMENT.\n    OpenDavid.set_david_path(\"/usr/local/bin/david\")\n    with open(\"toy.dav\", mode=\"r\") as f:\n        data = f.read()\n        OpenDavid.set_knowledge_base(data)\n\n    observation_list = [\"police(John)\", \"die(E1)\", \"subj(E1, Mary)\",\\\n        \"arrest(E2)\", \"subj(E2, x)\", \"obj(E2, Bob)\"]\n    required_atom_list = [\"(x = John)\"]\n    OpenDavid.set_problem(observation_list, required_atom_list)\n    json_str = OpenDavid.run() # Wait until it terminates if interpreter is used.\n\n    # json is converted to a directed hypergraph.\n    g = OpenDavid.build_proofgraph(json_str) \n    # \"sample.png\" will be generated in your cwd.\n    g.render(filename=\"sample\", format=\"png\")\n\nNOTE: ``toy.dav`` distributed in this repository was obtained from \n`Open-David <https://github.com/aurtg/open-david>`__ , but a problem field was\ndeleted, because ``pydavid`` separately sets knowledge base data and a problem data.\n\nPlease see `dhgraph <https://github.com/toda-lab/dhgraph>`__ for usage of\ndhgraph.\n\n\n.. image:: sample.png\n    :alt: sample.png\n\nBugs/Requests/Discussions\n=========================\n\nPlease report bugs and requests from `GitHub Issues <https://github.com/toda-lab/pydavid/issues>`__ , and \nask questions from `GitHub Discussions <https://github.com/toda-lab/pydavid/discussions>`__ .\n\nLicense\n=======\n\nPlease see `LICENSE <https://github.com/toda-lab/pydavid/blob/main/LICENSE>`__ .\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple Python interface of Open-David",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/toda-lab/pydavid",
        "Repository": "https://github.com/toda-lab/pydavid"
    },
    "split_keywords": [
        "logic",
        " inference",
        " abduction",
        " explanation",
        " artificial intelligence"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08f2a02432758c766dfd15e2e435a205bcc639c3f7545f92d22a710b7fb885cc",
                "md5": "6e45f742b05233d236b6b3d7f01e474f",
                "sha256": "3ba9e116bfb63be1b8f5226716e81715822426b791dcd0a145da2e56ffa7be10"
            },
            "downloads": -1,
            "filename": "pydavid-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6e45f742b05233d236b6b3d7f01e474f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 5512,
            "upload_time": "2024-03-29T16:49:04",
            "upload_time_iso_8601": "2024-03-29T16:49:04.512363Z",
            "url": "https://files.pythonhosted.org/packages/08/f2/a02432758c766dfd15e2e435a205bcc639c3f7545f92d22a710b7fb885cc/pydavid-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa6b98c46ff7603b018ab6e947f3320dc3b90e14f549fa76fa8f05b9e9535bab",
                "md5": "8ca04875b3f81512e2825301abb5540d",
                "sha256": "bc0b8477cbb6896e7981bba55acc6846630199cb7758fbfa0385949f47c60741"
            },
            "downloads": -1,
            "filename": "pydavid-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8ca04875b3f81512e2825301abb5540d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 4849,
            "upload_time": "2024-03-29T16:49:06",
            "upload_time_iso_8601": "2024-03-29T16:49:06.558655Z",
            "url": "https://files.pythonhosted.org/packages/fa/6b/98c46ff7603b018ab6e947f3320dc3b90e14f549fa76fa8f05b9e9535bab/pydavid-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-29 16:49:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "toda-lab",
    "github_project": "pydavid",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "pydavid"
}
        
Elapsed time: 3.30445s