class documentation

Check properties of an ongoing discourse.

Static Method multiply Multiply every thread in discourse by every reading in readings.
Method __init__ Initialize a DiscourseTester.
Method add_background Add a list of background assumptions for reasoning about the discourse.
Method add_sentence Add a sentence to the current discourse.
Method background Show the current background assumptions.
Method expand_threads Given a thread ID, find the list of logic.Expression objects corresponding to the reading IDs in that thread.
Method grammar Print out the grammar in use for parsing input sentences
Method models Call Mace4 to build a model for each current discourse thread.
Method readings Construct and show the readings of the discourse (or of a single sentence).
Method retract_sentence Remove a sentence from the current discourse.
Method sentences Display the list of sentences in the current discourse.
Method _check_consistency Undocumented
Method _construct_readings Use self._sentences to construct a value for self._readings.
Method _construct_threads Use self._readings to construct a value for self._threads and use the model builder to construct a value for self._filtered_threads
Method _get_readings Build a list of semantic readings for a sentence.
Method _show_readings Print out the readings for the discourse (or a single sentence).
Method _show_threads Print out the value of self._threads or self._filtered_hreads
Instance Variable _background Undocumented
Instance Variable _filtered_threads Undocumented
Instance Variable _input Undocumented
Instance Variable _models Undocumented
Instance Variable _reading_command Undocumented
Instance Variable _readings Undocumented
Instance Variable _sentences Undocumented
Instance Variable _threads Undocumented
@staticmethod
def multiply(discourse, readings): (source)

Multiply every thread in discourse by every reading in readings.

Given discourse = [['A'], ['B']], readings = ['a', 'b', 'c'] , returns [['A', 'a'], ['A', 'b'], ['A', 'c'], ['B', 'a'], ['B', 'b'], ['B', 'c']]

Parameters
discourse:list of liststhe current list of readings
readings:list(Expression)an additional list of readings
Returns
A list of listsUndocumented
def __init__(self, input, reading_command=None, background=None): (source)

Initialize a DiscourseTester.

Parameters
input:list of strthe discourse sentences
reading_commandUndocumented
background:list(Expression)Formulas which express background assumptions
def add_background(self, background, verbose=False): (source)

Add a list of background assumptions for reasoning about the discourse.

When called, this method also updates the discourse model's set of readings and threads. :param background: Formulas which contain background information :type background: list(Expression)

def add_sentence(self, sentence, informchk=False, consistchk=False): (source)

Add a sentence to the current discourse.

Updates self._input and self._sentences. :param sentence: An input sentence :type sentence: str :param informchk: if True, check that the result of adding the sentence is thread-informative. Updates self._readings. :param consistchk: if True, check that the result of adding the sentence is thread-consistent. Updates self._readings.

def background(self): (source)

Show the current background assumptions.

def expand_threads(self, thread_id, threads=None): (source)

Given a thread ID, find the list of logic.Expression objects corresponding to the reading IDs in that thread.

Parameters
thread_id:strthread ID
threads:dicta mapping from thread IDs to lists of reading IDs
Returns
list of tupleA list of pairs (rid, reading) where reading is the logic.Expression associated with a reading ID
def grammar(self): (source)

Print out the grammar in use for parsing input sentences

def models(self, thread_id=None, show=True, verbose=False): (source)

Call Mace4 to build a model for each current discourse thread.

Parameters
thread_id:strthread ID
showIf True, display the model that has been found.
verboseUndocumented
def readings(self, sentence=None, threaded=False, verbose=True, filter=False, show_thread_readings=False): (source)

Construct and show the readings of the discourse (or of a single sentence).

Parameters
sentence:strtest just this sentence
threadedif True, print out each thread ID and the corresponding thread.
verboseUndocumented
filterif True, only print out consistent thread IDs and threads.
show_thread_readingsUndocumented
def retract_sentence(self, sentence, verbose=True): (source)

Remove a sentence from the current discourse.

Updates self._input, self._sentences and self._readings. :param sentence: An input sentence :type sentence: str :param verbose: If True, report on the updated list of sentences.

def sentences(self): (source)

Display the list of sentences in the current discourse.

def _check_consistency(self, threads, show=False, verbose=False): (source)

Undocumented

def _construct_readings(self): (source)

Use self._sentences to construct a value for self._readings.

def _construct_threads(self): (source)

Use self._readings to construct a value for self._threads and use the model builder to construct a value for self._filtered_threads

def _get_readings(self, sentence): (source)

Build a list of semantic readings for a sentence.

Returns
list(Expression)Undocumented
def _show_readings(self, sentence=None): (source)

Print out the readings for the discourse (or a single sentence).

def _show_threads(self, filter=False, show_thread_readings=False): (source)

Print out the value of self._threads or self._filtered_hreads

_background = (source)

Undocumented

_filtered_threads: dict = (source)

Undocumented

Undocumented

Undocumented

_reading_command = (source)

Undocumented

_readings: dict = (source)

Undocumented

_sentences = (source)

Undocumented

_threads = (source)

Undocumented