Statements

class nettlesome.statements.Statement(**data)

An assertion that can be accepted as factual and compared to other Statements.

Parameters
  • predicate – a natural-language clause with zero or more slots to insert terms that are typically the subject and objects of the clause.

  • terms – a series of Factor objects that fill in the blank spaces in the predicate statement.

  • name – an identifier for this object, often used if the object needs to be referred to multiple times in the process of composing other Factor objects.

  • absent – whether the absence, rather than the presence, of the legal fact described above is being asserted.

  • generic – whether this object could be replaced by another generic object of the same class without changing the truth of a :class:`~nettlesome.predicates.Predicate` in which it is mentioned.

  • truth – a new “truth” attribute for the “predicate”, if needed.

__hash__ = None
__str__()

Create one-line string representation for inclusion in other Facts.

__weakref__

list of weak references to the object (if defined)

new_context(changes)

Create new Factor, replacing keys of changes with values.

Return type

Comparable

Returns

a version of self with the new context.

property short_string: str

Represent object without line breaks.

Return type

str

property slug: str

Get a representation of self without whitespace.

Intended for use as a sympy Symbol

Return type

str

property str_with_concrete_context: str

Identify this Statement more verbosely, specifying which text is a concrete context factor.

Return type

str

Returns

the same as the __str__ method, but with an added “SPECIFIC CONTEXT” section

term_permutations()

Generate permutations of context factors that preserve same meaning.

Return type

Iterator[TermSequence]

property term_sequence: nettlesome.terms.TermSequence

Return a TermSequence of the terms in this Statement.

Return type

TermSequence

property terms_without_nulls: Sequence[nettlesome.terms.Term]

Get Terms that are not None.

No Terms should be None for the Statement class, so this method is like an assertion for type checking.

Return type

Sequence[Term]

property truth: Optional[bool]

Access truth attribute.

Return type

Optional[bool]

property wrapped_string

Wrap text in string representation of self.