Internal Interfaces

poetic.exceptions Module

Module for custom exceptions.

The exceptions module includes custom classes for specific errors in the poetic package. This is not part of the public interface.

exception poetic.exceptions.InputLengthError(message: Optional[str] = None)

Bases: Exception

Raises Input Length Error.

This exception is used in the Predictor class for the input length of 0.

Parameters

message (str) – The error message to display.

exception poetic.exceptions.UnsupportedConfigError(message: Optional[str] = None)

Bases: Exception

Raises Unsupported Configuration Error.

This exception is used in the _Arguments class for checking unsupported commandline flags.

Parameters

message (str) – The error message to display.

poetic.gui Module

Module for Poetry Predictor GUI.

This module includes the class and methods for poetic’s desktop Tkinter GUI. As an internal interface, this is not intended or recommended for being used as an import. To run the GUI, follow the given examples or refer to the documentation.

Examples

Simply run the GUI:

python -m poetic

Make prediction and launch GUI by adding the -g or --GUI flag:

python -m poetic -s "This is poetic." -o "<PATH>" -g
class poetic.gui.GUI(predictor: Optional[poetic.Predictor.predictor] = None, *, _test: Optional[bool] = False)

Bases: object

Launches the GUI, which is equivalent to launching it through the command line.

predictor

A Predictor object created through the predictor module. If not supplying a Predictor object, the GUI will have no predicting functionality.

Type

Predictor, optional

poetic.util._Arguments Class

class poetic.util._Arguments

Bases: object

parse(args: Optional[List[str]] = None) → Dict[str, Optional[str]]
version() → str

poetic.predictor.Predictions Class

class poetic.predictor.Predictions(results: List[List[float]], sentences: Optional[List[str]])

Bases: poetic.results.Diagnostics

Class for prediction results from Predictor class.

This class inherets from Diagnostics class of the results module, and it is intended for being internally called by the Predictor class. To directly access the Diagnostics class’s functionality, use it instead.

Parameters
  • results (list(list(float))) – The prediction results predicted with Keras models.

  • sentences (list(str), optional) – A list of strings to represent tokenized sentences predicted by the Predictor class.

predictions

Predictions of poetic scores.

Type

list

sentences

Sentences associated with the predictions.

Type

list

diagnostics

A dictionary of diagnostics statistics, including sentence count, five number summary, and the predictions themselves.

Type

dict