zensols.amrspring package#

Submodules#

zensols.amrspring.app#

Inheritance diagram of zensols.amrspring.app

A client and server that generates AMR graphs from natural language sentences.

Citation:

Bevilacqua et al. (2021) One SPRING to Rule Them Both: Symmetric AMR Semantic Parsing and Generation without a Complex Pipeline. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 12564–12573, Virtual, May.

class zensols.amrspring.app.AmrParseClient(host, port)[source]#

Bases: object

The client endpoint used to communicate to the server that parses the AMR graphs.

Citation:

Bevilacqua et al. (2021) One SPRING to Rule Them Both: Symmetric AMR Semantic Parsing and Generation without a Complex Pipeline. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 12564–12573, Virtual, May.

__init__(host, port)#
host: str#

The prediction server host name.

parse(sents)[source]#

Parse sents and generate AMRs.

Parameters:

sents (Tuple[str]) – the sentence strings to use as input

Return type:

Iterable[AmrPrediction]

Returns:

an iterable of predicted AMR graph results

port: int#

The prediction server host port.

class zensols.amrspring.app.AmrPrediction(sent, graph, error)[source]#

Bases: Dictable

An AMR prediction or error.

__init__(sent, graph, error)#
error: str#

The message of the error or None if the prediction was successful.

graph: str#

The Penman formatted graph string.

property is_error: bool#

Whether this prediction was an error.

sent: str#

The sentence that was used for the prediction.

write(depth=0, writer=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]#

Write this instance as either a Writable or as a Dictable. If class attribute _DICTABLE_WRITABLE_DESCENDANTS is set as True, then use the write() method on children instead of writing the generated dictionary. Otherwise, write this instance by first creating a dict recursively using asdict(), then formatting the output.

If the attribute _DICTABLE_WRITE_EXCLUDES is set, those attributes are removed from what is written in the write() method.

Note that this attribute will need to be set in all descendants in the instance hierarchy since writing the object instance graph is done recursively.

Parameters:
  • depth (int) – the starting indentation depth

  • writer (TextIOBase) – the writer to dump the content of this writable

exception zensols.amrspring.app.AmrServiceError[source]#

Bases: APIError

Client API errors.

__module__ = 'zensols.amrspring.app'#
exception zensols.amrspring.app.AmrServiceRequestError(request, res)[source]#

Bases: AmrServiceError

Errors raised for the protocol transport layer.

__annotations__ = {}#
__init__(request, res)[source]#
__module__ = 'zensols.amrspring.app'#
class zensols.amrspring.app.Application(client)[source]#

Bases: object

A client and server that generates AMR graphs from natural language sentences.

__init__(client)#
client: AmrParseClient#

The client endpoint object.

parse(text_or_file)[source]#

Parse text and write generated AMRs.

Parameters:

text_or_file (str) – if the file exists, use the contents of the file, otherwise, the sentence(s) to parse

zensols.amrspring.cli#

Inheritance diagram of zensols.amrspring.cli

Command line entry point to the application.

class zensols.amrspring.cli.ApplicationFactory(*args, **kwargs)[source]#

Bases: ApplicationFactory

__init__(*args, **kwargs)[source]#
classmethod get_client()[source]#

Return the client to the AMR parse service.

Return type:

AmrParseClient

zensols.amrspring.cli.main(args=['/Users/landes/opt/lib/python/bin/sphinx-build', '-M', 'html', '/Users/landes/view/nlp/amrspring/target/doc/src', '/Users/landes/view/nlp/amrspring/target/doc/build'], **kwargs)[source]#
Return type:

ActionResult

Module contents#