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.0.tar.gz
(1.3 MB
view details)
Built Distribution
File details
Details for the file py_amr2fred-0.1.0.tar.gz
.
File metadata
- Download URL: py_amr2fred-0.1.0.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 | 08e0d56644c06425f717f02cbf528bdbed78d4ba39be15fac36a29bfea1e8417 |
|
MD5 | a65625c3e9bb72d567319eee342ff20f |
|
BLAKE2b-256 | baace67efdbf72da3c2b98b371e701c5cb3e9ff2e3df5706d3e8bc00f68a3a9d |
File details
Details for the file py_amr2fred-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: py_amr2fred-0.1.0-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 | 45da0c17a714b1061b70f03dc5591e7b5e812f681ea9c695126f1030816745b4 |
|
MD5 | 1f805898aaf1c8f58508340cd5a5ffa1 |
|
BLAKE2b-256 | c67fe083199526bd6a3c5d7729cd4a1fe7eee8282eac6eda55a95838862e79fb |