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
Release history Release notifications | RSS feed
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.1.tar.gz
(1.3 MB
view details)
Built Distribution
File details
Details for the file py_amr2fred-0.1.1.tar.gz
.
File metadata
- Download URL: py_amr2fred-0.1.1.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | afb23b7da17c59f403df758c26574cb7dcb1ecbf5f3e640313a2fead7bbb13af |
|
MD5 | 70297e6197ac89f14599a12728026309 |
|
BLAKE2b-256 | 1ada5827f108bef2c7bc8ce895a1e078da00adfa91e59fa05bec7b9e6bea2557 |
File details
Details for the file py_amr2fred-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: py_amr2fred-0.1.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38e0239acee8ad5eb0432c8cb99f15f6852713e29b7aa7d53e4bb5a6d8b4b69c |
|
MD5 | d50468a381db4ff34ea3ece06e00fd52 |
|
BLAKE2b-256 | fa300decd2460b06927766a13798be3fb8bbdcd4a63b17901eb02b844299b511 |