Predicates

class authorityspoke.predicates.Predicate(content, truth=True, reciprocal=False, comparison='', quantity=None)

A statement about real events or about a legal conclusion.

Predicates may be “alleged” by a pleading, “supported” by evidence, or “found” to be factual by a jury verdict or a judge’s finding of fact.

Parameters
  • content (str) – a clause containing an assertion, with blanks represented by curly brackets showing where references to specific entities from the case can be inserted to make the clause specific.

  • truth (Optional[bool]) – indicates whether the clause in content is asserted to be true or false. None indicates an assertion as to “whether” the clause is true or false, without specifying which.

  • reciprocal (bool) – if True, then the order of the first two entities is considered interchangeable. There’s no way to make any entities interchangeable other than the first two.

  • comparison (str) – A string representing an equality or inequality sign like ==, >, or <=. Used to indicate that the clause ends with a comparison to some quantity. Should be defined if and only if a quantity is defined. Even though “=” is the default, it’s the least useful, because courts almost always state rules that are intended to apply to quantities above or below some threshold.

  • quantity (Optional[Union[int, float, ureg.Quantity]]) – a Python number object or ureg.Quantity from the pint library. Comparisons to quantities can be used to determine whether Predicates imply or contradict each other. A single Predicate may contain no more than one comparison and one quantity.

__post_init__()

Clean up and test validity of attributes.

If the content sentence is phrased to have a plural context factor, normalizes it by changing “were” to “was”.

property context_slots

Count bracket pairs in self.content, minus 1 if self.quantity==True.

Return type

int

Returns

the number of context Factors that must be specified to fill in the blanks in self.content.

content_with_entities(context)

Make a sentence by filling in self.content with generic Factors.

Parameters

context (Union[Factor, Sequence[Factor]]) – generic Factors to be mentioned in the context of this Predicate. They do not need to be type Entity.

Return type

str

Returns

a sentence created by substituting string representations of generic factors from a particular case into the return value of the __str__() method.

consistent_dimensionality(other)

Test if other has a quantity parameter consistent with self.

Return type

bool

contradicts(other)

Test whether other and self have contradictory meanings.

This first tries to find a contradiction based on the relationship between the quantities in the Predicates. If there are no quantities, it returns False only if the content is exactly the same and self.truth is different.

Return type

bool

same_content_meaning(other)

Test if content strings of self and other have same meaning.

This once was used to disregard differences between “was” and “were”, but that now happens in Predicate.__post_init__().

Parameters

other (Predicate) – another Predicate being compared to self

Return type

bool

Returns

whether self and other have content strings similar enough to be considered to have the same meaning.

means(other)

Test whether self and other have identical meanings.

To return True, other can be neither broader nor narrower.

Return type

bool

__gt__(other)

Test whether self implies other.

Return type

bool

Returns

whether self implies other, which is True if their statements about quantity imply it.

implies(other)

Test whether self implies other.

Return type

bool

Returns

whether self implies other, which is True if their statements about quantity imply it.

__ge__(other)

Return self>=value.

Return type

bool

excludes_other_quantity(other)

Test if quantity ranges in self and other are non-overlapping.

Return type

bool

includes_other_quantity(other)

Test if the range of quantities mentioned in self is a subset of other’s.

Return type

bool

__len__()

Also called the linguistic valency, arity, or adicity.

Returns

the number of entities that can fit in the pairs of brackets in the predicate. self.quantity doesn’t count as one of these entities, even though the place where self.quantity goes in represented by brackets in the self.content string.

quantity_comparison()

Convert text to a comparison with a quantity.

Return type

str

Returns

string representation of a comparison with a quantity, which can include units due to the pint library.

negated()

Copy self, with the opposite truth value.

Return type

Predicate

__str__()

Return str(self).

static make_context_plural(sentence, index=0)

Replace “was” with “were” after a context slot in a sentence.

Parameters
  • sentence (str) – a sentence with pairs of curly braces representing slots for context factors

  • index (int) – the index of the context factor that is plural, counting from the start of the sentence

Return type

str

Returns

a form of the sentence with one instance of “was” replaced with “were”

__weakref__

list of weak references to the object (if defined)