Skip to main content

AnCast++ metric for evaluating UMR semantic graphs

Project description

Ancast

AnCast metric for evaluating UMR semantic graphs.

Install

ancast is currently available as a local, editable install only

$ pip install -e .

Usage

Consider sample AMR/UMR files in samples dir

CLI command

Currently, output file path is required and will contain analysis csv file.

$ ancast --help
usage: ancast++ Argparser [-h] -p PRED [PRED ...] [-pe PRED_EXT [PRED_EXT ...]] -g GOLD [GOLD ...] [-ge GOLD_EXT [GOLD_EXT ...]] [-o OUTPUT] [-s {snt,doc}] [-df {amr,umr}] [-c CNEIGHBOR] [-sc SENSE_COEFFICIENT] [--separate-1-and-2 [SEPARATE_1_AND_2]]
                          [--allow-reify [ALLOW_REIFY]] [--use-alignment [USE_ALIGNMENT]] [--use-smatch-top [USE_SMATCH_TOP]] [--weighted {snts,toks}] [--seed SEED] [--debug]

options:
  -h, --help            show this help message and exit
  -p PRED [PRED ...], --pred PRED [PRED ...]
                        (required) path to prediction file or dir (if dir, same filenames must exist in `gold`)
  -pe PRED_EXT [PRED_EXT ...], --pred-ext PRED_EXT [PRED_EXT ...]
                        if `args.pred` flag is a dir, which file extensions to consider
  -g GOLD [GOLD ...], --gold GOLD [GOLD ...]
                        (required) path to gold file or dir (if dir, same filenames must exist in `pred`)
  -ge GOLD_EXT [GOLD_EXT ...], --gold-ext GOLD_EXT [GOLD_EXT ...]
                        if `args.gold` flag is a dir, which file extensions to consider
  -o OUTPUT, --output OUTPUT
                        (optional) path to output analysis files(if new dir, should not contain comma in the base dirname)
  -s {snt,doc}, --scope {snt,doc}
                        whether to run ancast over AMR/UMR sentence-level graphs (`snt`) or to run ancast++ over UMR document-level graphs (`doc`)
  -df {amr,umr}, --data-format {amr,umr}
                        whether the input data are AMR(s) or UMR(s) (automatically set to `umr` if `--scope` is `doc`)
  -c CNEIGHBOR, --cneighbor CNEIGHBOR
                        coefficient for the importance of neighborhood information when broadcasting
  -sc SENSE_COEFFICIENT, --sense-coefficient SENSE_COEFFICIENT
                        importance of sense ID when comparing two concepts
  --separate-1-and-2 [SEPARATE_1_AND_2]
                        whether to combine one-hop and two-hop neighbors together
  --allow-reify [ALLOW_REIFY]
                        whether to apply reification before comparing graphs
  --use-alignment [USE_ALIGNMENT]
                        whether to use alignment information when establishing anchors
  --use-smatch-top [USE_SMATCH_TOP]
                        whether to add (TOP :root `ROOT_NODE`) edge
  --weighted {snts,toks}
                        whether to apply weighted average for ancast++ doc-level evaluation by (1) number of sentences or (2) number of tokens
  --seed SEED           random seed for reproducibility
  --debug               debug logging mode

Python API

evaluate accepts the same set of arguments described above.

from ancast import evaluate

pred_fpath = "./samples/umr_test.txt"
gold_fpath = "./samples/umr_gold.txt"
out_fpath = "./samples/outputs"

out = evaluate(
    pred_fpath,
    gold_fpath, 
    out_fpath, 
    scope="doc"
)

Cite

Please cite this paper for now:

@inproceedings{sun2024ancast,
    title = "Anchor and Broadcast: An Efficient Concept Alignment Approach for Evaluation of Semantic Graphs",
    author = "Sun, Haibo and Nianwen Xue ",
    booktitle = "Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation",
    month = may,
    year = "2024",
}

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

ancast-0.1.0.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ancast-0.1.0-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file ancast-0.1.0.tar.gz.

File metadata

  • Download URL: ancast-0.1.0.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ancast-0.1.0.tar.gz
Algorithm Hash digest
SHA256 674966d25e28e2e2ad17c500f0204d3ea7298a76c218d3f6062ae7e1418f0f59
MD5 8b324c61567254ce3e6a106fb510dcdb
BLAKE2b-256 46f2c3ec35b75df5c2edc46d22c8629ee8c18d3c8469cf17b8abebfc0c4a0a78

See more details on using hashes here.

Provenance

The following attestation bundles were made for ancast-0.1.0.tar.gz:

Publisher: python-publish.yml on umr4nlp/ancast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ancast-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ancast-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ancast-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 105c8ec2d05cc481f72950489353060135e589d05cbd1e0e18e0770e01d238cc
MD5 52d58d495519dd2ca6e82b26dadfbbc7
BLAKE2b-256 9ea46b442895d9dfd22a7a82aa2ba6ab68e4d346d83462046cfc060cae73d6e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ancast-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on umr4nlp/ancast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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