In standard usage, each Twaddle sentence is processed in isolation. Lookup labels and synchronizers affect only the sentence in which they are defined.
In some cases, it may be desired to use labels or synchronizers across multiple sentences. This can be enabled by instantiating the Twaddle runner in persistent mode:
runner = TwaddleRunner(<path_to_dictionaries>, persistent=True)
In this case, all defined Lookup labels and synchronizers are retained and may be re-used in subsequent sentences.
The labels and synchronizers may be cleared in Python code by calling the
TwaddleRunner’s clear()
method. They may also be cleared in an interactive
session with the clear
function.
In some cases it may be desirable to retain labels for use across multiple
sentences but not synchronizers, or vice versa. Label-only and synchronizer-only
persistent modes are also available with the persistent_labels
and
persistent_synchronizers
options on the TwaddleRunner. Setting the generic
persistent
option to True
forces persistence for both labels and synchronizers
regardless of these parameters.
runner = TwaddleRunner(<path_to_dictionaries>, persistent_labels=True)
runner = TwaddleRunner(<path_to_dictionaries>, persistent_synchronizers=True)