Skip to content

Format converter from PoetryLab JSON to POSTDATA semantic formats

License

Unknown, Apache-2.0 licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE.old
Notifications You must be signed in to change notification settings

linhd-postdata/horace

Repository files navigation

Horace

Documentation Status Updates

Format converter from PoetryLab JSON to POSTDATA semantic formats

Features

  • get_scansion_graph() receives a scansion dictionary from Rantanplan and outputs an RDFLib Graph object. With it, serialization options become available.
from rantanplan import get_scansion
from horace import get_scansion_graph

poem = """Me gustas cuando callas porque estás como ausente,
y me oyes desde lejos, y mi voz no te toca.
Parece que los ojos se te hubieran volado
y parece que un beso te cerrara la boca.

Como todas las cosas están llenas de mi alma
emerges de las cosas, llena del alma mía.
Mariposa de sueño, te pareces a mi alma,
y te pareces a la palabra melancolía."""

scansion = get_scansion(poem)
graph = get_scansion_graph(scansion)
graph.serialize(format="xml")

Graphs can be joined together, which is useful when combining graphs generated from scansion, enjambment analysus, or extraction of named entities.

graphs = []
graphs.append(get_scansion_graph(scansion1))
graphs.append(get_scansion_graph(scansion2))

graph = reduce(lambda x, y: x + y, graphs)  # union on graphs
graph.serialize(format="xml")

By default, xml is used to serialize to RDF/XML. Other formats are supported as well, such as json-ld, n3, turtle, and nt.

Credits

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

About

Format converter from PoetryLab JSON to POSTDATA semantic formats

Resources

License

Unknown, Apache-2.0 licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE.old

Stars

Watchers

Forks

Packages

No packages published