Skip to main content

AMR to RDF translator.

Project description

py_amr2fred

From Abstract Meaning Representation AMR (https://amr.isi.edu/) to RDF, according to the syntax of FRED (http://wit.istc.cnr.it/stlab-tools/fred/)

Python version of amr2fred's core functions

Install:

pip install py_amr2fred

Use:

from py_amr2fred import *
amr2fred = Amr2fred()
mode = Glossary.RdflibMode.N3
amr_text = """
    (c / charge-05 :ARG1 (h / he) :ARG2 (a / and :op1 (i / intoxicate-01 :ARG1 h 
	:location (p / public)) :op2 (r / resist-01 :ARG0 h 
	:ARG1 (a2 / arrest-01 :ARG1 h))))
"""
# translate from AMR
print(amr2fred.translate(amr_text, serialize=True, mode=mode, alt_fred_ns=None))

# translate from natural language
print(amr2fred.translate(text="Four boys making pies", serialize=True, 
      mode=Glossary.RdflibMode.TURTLE, alt_fred_ns="http://fred-01/domain.owl#"))

Parameter [amr]:

amr string in penman format

Parameter [serialize]:

[True] returns a string

[False] returns a rdflib Graph

Parameter [mode]:

  • Glossary.RdflibMode.TURTLE
  • Glossary.RdflibMode.NT
  • Glossary.RdflibMode.XML
  • Glossary.RdflibMode.N3
  • Glossary.RdflibMode.JSON_LD

Parameter [alt_fred_ns]:

Alternate Uri for base Fred NS

Parameter [text]

NL text to translate

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

py_amr2fred-0.1.2.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

py_amr2fred-0.1.2-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file py_amr2fred-0.1.2.tar.gz.

File metadata

  • Download URL: py_amr2fred-0.1.2.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for py_amr2fred-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2b443816ead4d48abbf0ce65c0b417be26d33be7452a0b79272d73307c272174
MD5 3cfca790b63537253ce9d536d642f14f
BLAKE2b-256 ec35bb3a7b28ca051ec5287e2e2eadc6df052a4c048cb7682a8e128b8793e4e9

See more details on using hashes here.

File details

Details for the file py_amr2fred-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: py_amr2fred-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for py_amr2fred-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 56e6f02996324a8acac87d02df6e02f1384a1cba164d67e1eecc7760c3cd86e2
MD5 1c7eb760813a1c2dd0810f1f8fe498b0
BLAKE2b-256 3f996977173321f59f3386a2ffdc93040cf0ebb6e35a917b57e5eb41cb2c018e

See more details on using hashes here.

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