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,
alt_api=False
mode=Glossary.RdflibMode.TURTLE,
alt_fred_ns=None))
print(amr2fred.translate(text="Quattro ragazzi preparano torte",
serialize=True,
mode=Glossary.RdflibMode.TURTLE,
alt_api=False,
multilingual=True,
alt_fred_ns=None))
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
Parameter [alt_api]
[True] the library will use alt. API
[False] the library will use default API
Parameter [multilingual]
[True] the library will use multilingual API
[False] the library will use "English only" API
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.3.tar.gz
(1.3 MB
view details)
Built Distribution
File details
Details for the file py_amr2fred-0.1.3.tar.gz
.
File metadata
- Download URL: py_amr2fred-0.1.3.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 | 13e955e3b0bcb3a659ee4f00436547886a31ce66e7d3c0ded1b354a95f7d1150 |
|
MD5 | 8e608b32b82187c8250eb5505ec37c8a |
|
BLAKE2b-256 | 777c960d2354d424771e6ba336d6de072a974605f848e00e74c1414aaccf8893 |
File details
Details for the file py_amr2fred-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: py_amr2fred-0.1.3-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 | 24803a05a9288cdcf1ac9bbbe6d3f157974a93aa2fbbc6390e8a6fbcc541616a |
|
MD5 | 712e8ff5e5aabb63c8ed83ecf052137b |
|
BLAKE2b-256 | 15d8c706a3edca9ab783f617d3ddcc45b2401308d1444aa311355a79588fdc72 |