xaif-eval


Namexaif-eval JSON
Version 0.1.4 PyPI version JSON
download
home_pageNone
Summaryxaif package
upload_time2024-08-22 15:14:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # xaif_eval

[![PyPI version](https://badge.fury.io/py/xaif_eval.svg)](https://badge.fury.io/py/xaif_eval)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python version](https://img.shields.io/badge/python-%3E=3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)

## Overview

`xaif_eval` is a Python library designed for handling and manipulating AIF (Argument Interchange Format) structures. It provides utilities to validate, traverse, and manipulate AIF JSON structures, facilitating the development and evaluation of argumentation frameworks.

## Features

- Validate AIF JSON structures
- Generate unique node and edge IDs
- Add and manage argument components
- Generate tabular data in CSV format


## Installation

You can install the `xaif_eval` package via pip:

```sh
pip install xaif_eval
```

## Usage

### Importing the Library

```python
from xaif_eval import AIF
```

### Example

```python
from xaif_eval import AIF

# Sample xAIF JSON 
aif= {
  "AIF": {
    "descriptorfulfillments": null,
    "edges": [
      {
        "edgeID": 0,
        "fromID": 0,
        "toID": 4
      },
      {
        "edgeID": 1,
        "fromID": 4,
        "toID": 3
      },
      {
        "edgeID": 2,
        "fromID": 1,
        "toID": 6
      },
      {
        "edgeID": 3,
        "fromID": 6,
        "toID": 5
      },
      {
        "edgeID": 4,
        "fromID": 2,
        "toID": 8
      },
      {
        "edgeID": 5,
        "fromID": 8,
        "toID": 7
      },
      {
        "edgeID": 6,
        "fromID": 3,
        "toID": 9
      },
      {
        "edgeID": 7,
        "fromID": 9,
        "toID": 7
      }
    ],
    "locutions": [
      {
        "nodeID": 0,
        "personID": 0
      },
      {
        "nodeID": 1,
        "personID": 1
      },
      {
        "nodeID": 2,
        "personID": 2
      }
    ],
    "nodes": [
      {
        "nodeID": 0,
        "text": "disagreements between party members are entirely to be expected.",
        "type": "L"
      },
      {
        "nodeID": 1,
        "text": "the SNP has disagreements.",
        "type": "L"
      },
      {
        "nodeID": 2,
        "text": "it's not uncommon for there to be disagreements between party members.",
        "type": "L"
      },
      {
        "nodeID": 3,
        "text": "disagreements between party members are entirely to be expected.",
        "type": "I"
      },
      {
        "nodeID": 4,
        "text": "Default Illocuting",
        "type": "YA"
      },
      {
        "nodeID": 5,
        "text": "the SNP has disagreements.",
        "type": "I"
      },
      {
        "nodeID": 6,
        "text": "Default Illocuting",
        "type": "YA"
      },
      {
        "nodeID": 7,
        "text": "it's not uncommon for there to be disagreements between party members.",
        "type": "I"
      },
      {
        "nodeID": 8,
        "text": "Default Illocuting",
        "type": "YA"
      },
      {
        "nodeID": 9,
        "text": "Default Inference",
        "type": "RA"
      }
    ],
    "participants": [
      {
        "firstname": "Speaker",
        "participantID": 0,
        "surname": "1"
      },
      {
        "firstname": "Speaker",
        "participantID": 1,
        "surname": "2"
      }
    ],
    "schemefulfillments": null
  },
  "dialog": true,
  "ova": [],
  "text": {
    "txt": " Speaker 1 <span class=\"highlighted\" id=\"0\">disagreements between party members are entirely to be expected.</span>.<br><br> Speaker 2 <span class=\"highlighted\" id=\"1\">the SNP has disagreements.</span>.<br><br> Speaker 1 <span class=\"highlighted\" id=\"2\">it's not uncommon for there to be disagreements between party members. </span>.<br><br>"
  }
}

# Initialize the AIF object
aif = AIF(xaif)

# Check if the AIF JSON is valid
is_valid = aif.is_valid_json_aif()
print(f"Is valid AIF JSON: {is_valid}")

# Check if the AIF JSON is a dialog
is_dialog = aif.is_json_aif_dialog()
print(f"Is dialog: {is_dialog}")

# Get the next max node ID
next_node_id = aif.get_next_max_id('nodes', 'nodeID')
print(f"Next node ID: {next_node_id}")

# Get the speaker of a node
speaker = aif.get_speaker(1)
print(f"Speaker: {speaker}")

# Add argument relation
aif.add_component("argument_relation", Relation_type, I_nodeID-1, I_nodeID-2)

# Get propsotion pairs along with the argument relations in csv format

df = aif.get_csv("argument-relation") 
```

## Documentation

The full documentation is available at [xaif_eval Documentation](https://github.com/debelatesfaye/xaif).

## Contributing

Contributions are welcome! Please visit the [Contributing Guidelines](https://github.com/debelatesfaye/xaif/blob/main/CONTRIBUTING.md) for more information.

## Issues

If you encounter any problems, please file an issue at the [Issue Tracker](https://github.com/debelatesfaye/xaif/issues).

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/debelatesfaye/xaif/blob/main/LICENSE) file for details.

## Authors

- DEBELA - [d.t.z.gemechu@dundee.ac.uk](mailto:d.t.z.gemechu@dundee.ac.uk)

## Acknowledgments

- Thanks to all contributors and users for their feedback and support.
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "xaif-eval",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "DEBELA <dabookoo@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/4a/fc/5a37d88b49c9a270322fe368f414c9fa69cd16fb2d073109d859caf710a8/xaif_eval-0.1.4.tar.gz",
    "platform": null,
    "description": "# xaif_eval\n\n[![PyPI version](https://badge.fury.io/py/xaif_eval.svg)](https://badge.fury.io/py/xaif_eval)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python version](https://img.shields.io/badge/python-%3E=3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)\n\n## Overview\n\n`xaif_eval` is a Python library designed for handling and manipulating AIF (Argument Interchange Format) structures. It provides utilities to validate, traverse, and manipulate AIF JSON structures, facilitating the development and evaluation of argumentation frameworks.\n\n## Features\n\n- Validate AIF JSON structures\n- Generate unique node and edge IDs\n- Add and manage argument components\n- Generate tabular data in CSV format\n\n\n## Installation\n\nYou can install the `xaif_eval` package via pip:\n\n```sh\npip install xaif_eval\n```\n\n## Usage\n\n### Importing the Library\n\n```python\nfrom xaif_eval import AIF\n```\n\n### Example\n\n```python\nfrom xaif_eval import AIF\n\n# Sample xAIF JSON \naif= {\n  \"AIF\": {\n    \"descriptorfulfillments\": null,\n    \"edges\": [\n      {\n        \"edgeID\": 0,\n        \"fromID\": 0,\n        \"toID\": 4\n      },\n      {\n        \"edgeID\": 1,\n        \"fromID\": 4,\n        \"toID\": 3\n      },\n      {\n        \"edgeID\": 2,\n        \"fromID\": 1,\n        \"toID\": 6\n      },\n      {\n        \"edgeID\": 3,\n        \"fromID\": 6,\n        \"toID\": 5\n      },\n      {\n        \"edgeID\": 4,\n        \"fromID\": 2,\n        \"toID\": 8\n      },\n      {\n        \"edgeID\": 5,\n        \"fromID\": 8,\n        \"toID\": 7\n      },\n      {\n        \"edgeID\": 6,\n        \"fromID\": 3,\n        \"toID\": 9\n      },\n      {\n        \"edgeID\": 7,\n        \"fromID\": 9,\n        \"toID\": 7\n      }\n    ],\n    \"locutions\": [\n      {\n        \"nodeID\": 0,\n        \"personID\": 0\n      },\n      {\n        \"nodeID\": 1,\n        \"personID\": 1\n      },\n      {\n        \"nodeID\": 2,\n        \"personID\": 2\n      }\n    ],\n    \"nodes\": [\n      {\n        \"nodeID\": 0,\n        \"text\": \"disagreements between party members are entirely to be expected.\",\n        \"type\": \"L\"\n      },\n      {\n        \"nodeID\": 1,\n        \"text\": \"the SNP has disagreements.\",\n        \"type\": \"L\"\n      },\n      {\n        \"nodeID\": 2,\n        \"text\": \"it's not uncommon for there to be disagreements between party members.\",\n        \"type\": \"L\"\n      },\n      {\n        \"nodeID\": 3,\n        \"text\": \"disagreements between party members are entirely to be expected.\",\n        \"type\": \"I\"\n      },\n      {\n        \"nodeID\": 4,\n        \"text\": \"Default Illocuting\",\n        \"type\": \"YA\"\n      },\n      {\n        \"nodeID\": 5,\n        \"text\": \"the SNP has disagreements.\",\n        \"type\": \"I\"\n      },\n      {\n        \"nodeID\": 6,\n        \"text\": \"Default Illocuting\",\n        \"type\": \"YA\"\n      },\n      {\n        \"nodeID\": 7,\n        \"text\": \"it's not uncommon for there to be disagreements between party members.\",\n        \"type\": \"I\"\n      },\n      {\n        \"nodeID\": 8,\n        \"text\": \"Default Illocuting\",\n        \"type\": \"YA\"\n      },\n      {\n        \"nodeID\": 9,\n        \"text\": \"Default Inference\",\n        \"type\": \"RA\"\n      }\n    ],\n    \"participants\": [\n      {\n        \"firstname\": \"Speaker\",\n        \"participantID\": 0,\n        \"surname\": \"1\"\n      },\n      {\n        \"firstname\": \"Speaker\",\n        \"participantID\": 1,\n        \"surname\": \"2\"\n      }\n    ],\n    \"schemefulfillments\": null\n  },\n  \"dialog\": true,\n  \"ova\": [],\n  \"text\": {\n    \"txt\": \" Speaker 1 <span class=\\\"highlighted\\\" id=\\\"0\\\">disagreements between party members are entirely to be expected.</span>.<br><br> Speaker 2 <span class=\\\"highlighted\\\" id=\\\"1\\\">the SNP has disagreements.</span>.<br><br> Speaker 1 <span class=\\\"highlighted\\\" id=\\\"2\\\">it's not uncommon for there to be disagreements between party members. </span>.<br><br>\"\n  }\n}\n\n# Initialize the AIF object\naif = AIF(xaif)\n\n# Check if the AIF JSON is valid\nis_valid = aif.is_valid_json_aif()\nprint(f\"Is valid AIF JSON: {is_valid}\")\n\n# Check if the AIF JSON is a dialog\nis_dialog = aif.is_json_aif_dialog()\nprint(f\"Is dialog: {is_dialog}\")\n\n# Get the next max node ID\nnext_node_id = aif.get_next_max_id('nodes', 'nodeID')\nprint(f\"Next node ID: {next_node_id}\")\n\n# Get the speaker of a node\nspeaker = aif.get_speaker(1)\nprint(f\"Speaker: {speaker}\")\n\n# Add argument relation\naif.add_component(\"argument_relation\", Relation_type, I_nodeID-1, I_nodeID-2)\n\n# Get propsotion pairs along with the argument relations in csv format\n\ndf = aif.get_csv(\"argument-relation\") \n```\n\n## Documentation\n\nThe full documentation is available at [xaif_eval Documentation](https://github.com/debelatesfaye/xaif).\n\n## Contributing\n\nContributions are welcome! Please visit the [Contributing Guidelines](https://github.com/debelatesfaye/xaif/blob/main/CONTRIBUTING.md) for more information.\n\n## Issues\n\nIf you encounter any problems, please file an issue at the [Issue Tracker](https://github.com/debelatesfaye/xaif/issues).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/debelatesfaye/xaif/blob/main/LICENSE) file for details.\n\n## Authors\n\n- DEBELA - [d.t.z.gemechu@dundee.ac.uk](mailto:d.t.z.gemechu@dundee.ac.uk)\n\n## Acknowledgments\n\n- Thanks to all contributors and users for their feedback and support.\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "xaif package",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/debelatesfaye/xaif",
        "Issues": "https://github.com/debelatesfaye/xaif/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "654fc17d4b0b3469249e8e3f965790df42664414ae6187e17a2e8849d83b92e5",
                "md5": "7575606472fe0494cf390479c585c54a",
                "sha256": "11d17b60ef1f8f39c7cfbfacfb17eb383144b2c1f5dd18c6776ae44e23e1c54c"
            },
            "downloads": -1,
            "filename": "xaif_eval-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7575606472fe0494cf390479c585c54a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6264,
            "upload_time": "2024-08-22T15:14:12",
            "upload_time_iso_8601": "2024-08-22T15:14:12.785528Z",
            "url": "https://files.pythonhosted.org/packages/65/4f/c17d4b0b3469249e8e3f965790df42664414ae6187e17a2e8849d83b92e5/xaif_eval-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4afc5a37d88b49c9a270322fe368f414c9fa69cd16fb2d073109d859caf710a8",
                "md5": "f6fe847941964837dedd8f44c5703a04",
                "sha256": "7072a52cf74527e3505764bcf8bb25a648fd582f3a2f99c61d969fe7576438ff"
            },
            "downloads": -1,
            "filename": "xaif_eval-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "f6fe847941964837dedd8f44c5703a04",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 5652,
            "upload_time": "2024-08-22T15:14:14",
            "upload_time_iso_8601": "2024-08-22T15:14:14.244004Z",
            "url": "https://files.pythonhosted.org/packages/4a/fc/5a37d88b49c9a270322fe368f414c9fa69cd16fb2d073109d859caf710a8/xaif_eval-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 15:14:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "debelatesfaye",
    "github_project": "xaif",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "xaif-eval"
}
        
Elapsed time: 0.48221s