Factors

class authorityspoke.factors.Factor(*, name=None, generic=False, absent=False)

Things relevant to a Court’s application of a Rule.

The same Factor that is in the outputs for the Procedure of one legal Rule might be in the inputs of the Procedure for another.

__init__(*, name=None, generic=False, absent=False)

Initialize self. See help(type(self)) for accurate signature.

property context_factor_names

Get names of attributes to compare in means() or __ge__().

This method and interchangeable_factors() should be the only parts of the context-matching process that need to be unique for each subclass of Factor.

Return type

Tuple[str, …]

Returns

attribute names identifying which attributes of self and other must match, for a Analogy to hold between this Factor and another.

property interchangeable_factors

List ways to reorder context_factors but preserve self’s meaning.

The empty list is the default return value for subclasses that don’t have any interchangeable context_factors.

Return type

List[ContextRegister]

Returns

the ways context_factors can be reordered without changing the meaning of self, or whether it would be true in a particular context.

property generic_factors

Factors that can be replaced without changing selfs meaning.

Return type

Tuple[Factor, …]

Returns

a list made from a dict with self’s generic Factors as keys and None as values, so that the keys can be matched to another object’s generic_factors to perform an equality test.

property context_factors

Get Factors used in comparisons with other Factors.

Return type

Sequence[Optional[Factor]]

Returns

a tuple of attributes that are designated as the context_factors for whichever subclass of Factor calls this method. These can be used for comparing objects using consistent_with()

property recursive_factors

Collect self’s context_factors, and their context_factors, recursively.

Return type

Dict[Factor, None]

Returns

a dict (instead of a set, to preserve order) of Factors.

consistent_with(other, context)

Check if self and other can be non-contradictory.

Return type

Iterator[ContextRegister]

Returns

a bool indicating whether there’s at least one way to match the context_factors of self and other, such that they fit the relationship comparison.

contradicts(other, context=None)

Test whether self implies the absence of other.

Return type

bool

Returns

True if self and other can’t both be true at the same time. Otherwise returns False.

explain_contradiction(other, context=None)

Test whether self implies() the absence of other.

This should only be called after confirming that other is not None.

Return type

Iterator[ContextRegister]

Returns

True if self and other can’t both be true at the same time. Otherwise returns False.

evolve(changes)

Make new object with attributes from self.__dict__, replacing attributes as specified.

Parameters

changes (Union[str, Tuple[str, …], Dict[str, Any]]) – a dict where the keys are names of attributes of self, and the values are new values for those attributes, or else an attribute name or list of names that need to have their values replaced with their boolean opposite.

Return type

Factor

Returns

a new object initialized with attributes from self.__dict__, except that any attributes named as keys in the changes parameter are replaced by the corresponding value.

means(other, context=None)

Test whether self and other have identical meanings.

Return type

bool

Returns

whether other is another Factor with the same meaning as self. Not the same as an equality comparison with the == symbol, which simply converts self’s and other’s fields to tuples and compares them.

explain_same_meaning(other, context=None)

Generate ways to match contexts of self and other so they mean the same.

Return type

Iterator[ContextRegister]

get_factor_by_name(name)

Search of self and self’s attributes for Factor with specified name.

Return type

Optional[Factor]

Returns

a Factor with the specified name attribute if it exists, otherwise None.

explain_implication(other, context=None)

Generate ContextRegisters that cause self to imply other.

If self is absent, then generate a ContextRegister from other’s point of view and then swap the keys and values.

Return type

Iterator[ContextRegister]

implies(other, context=None)

Test whether self implies other.

Return type

bool

__gt__(other)

Test whether self implies other and self != other.

Return type

bool

__ge__(other)

Call implies() as an alias.

Return type

bool

Returns

bool indicating whether self implies other

compare_context_factors(other, relation)

Test if relation holds for corresponding context factors of self and other.

This doesn’t track a persistent ContextRegister as it goes down the sequence of Factor pairs. Perhaps(?) this simpler process can weed out Factors that clearly don’t satisfy a comparison before moving on to the more costly Analogy process. Or maybe it’s useful for testing.

Return type

bool

make_generic()

Get a copy of self except ensure generic is True.

Note

The new object created with this method will have all the attributes of self except generic=False. Therefore the method isn’t equivalent to creating a new instance of the class with only the generic attribute specified. To do that, you would use Fact(generic=True).

Return type

Factor

Returns

a new object changing generic to True.

new_context(changes)

Create new Factor, replacing keys of changes with values.

Parameters

changes (ContextRegister) – has Factors to replace as keys, and has their replacements as the corresponding values.

Return type

Factor

Returns

a new Factor object with the replacements made.

own_attributes()

Return attributes of self that aren’t inherited from another class.

Used for getting parameters to pass to __init__() when generating a new object.

Return type

Dict[str, Any]

__str__()

Return str(self).

property short_string

Use the regular string method unless otherwise specified.

update_context_register(other, register, comparison)

Find ways to update self_mapping to allow relationship comparison.

Parameters
  • other (Optional[Factor]) – another Factor being compared to self

  • register (ContextRegister) – keys representing Factors from self’s context and values representing Factors in other’s context.

  • comparison (Callable) – a function defining the comparison that must be True between self and other. Could be Factor.means() or Factor.__ge__().

Yields

every way that self_mapping can be updated to be consistent with self and other having the relationship comparison.

Return type

Iterator[ContextRegister]

__weakref__

list of weak references to the object (if defined)

Entities

Inheritance diagram of authorityspoke.entities.Entity
class authorityspoke.entities.Entity(name=None, generic=True, plural=False)

Things that exist in the outside world, like people, places, or events.

Not concepts that derive their meaning from litigation, such as a legal Fact, an Allegation, a Pleading, etc.

Best used to specify things to be mentioned in multiple Factors in a Rule, often in the Predicate of a Fact object.

An Entity is often, but not always, generic with respect to the meaning of the Rule in which it is mentioned, which means that the Rule is understood to apply generally even if some other Entity was substituted.

Parameters
  • name (Optional[str]) – An identifier. An Entity with the same name is considered to refer to the same specific object, but if they have different names but are generic and are otherwise the same, then they’re considered to have the same meaning and they evaluate equal to one another.

  • generic (bool) – Determines whether a change in the name of the Entity would change the meaning of the Factor in which the Entity is embedded.

  • plural (bool) – Specifies whether the Entity object refers to more than one thing. In other words, whether it would be represented by a plural noun.

means(other)

Test whether other has the same meaning as self.

Generic Entity objects are considered equivalent in meaning as long as they’re the same class. If not generic, they’re considered equivalent if all their attributes are the same.

__ge__(other)

Call implies() as an alias.

Returns

bool indicating whether self implies other

__str__()

Return str(self).

contradicts(other)

Test whether self contradicts the other Factor.

Return type

bool

Returns

False, because an Entity contradicts no other Factor.

new_context(changes)

Create new Factor, replacing keys of changes with values.

Assumes no changes are possible because the new_context_helper() decorator would have replaced self if any replacement was available.

Return type

Entity

Facts

Inheritance diagram of authorityspoke.facts.Fact
class authorityspoke.facts.Fact(predicate, context_factors=(), name=None, standard_of_proof=None, absent=False, generic=False)

An assertion accepted as factual by a court.

Often based on factfinding by a judge or jury.

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

  • context_factors (Sequence[Factor]) – a series of Factor objects that fill in the blank spaces in the predicate statement.

  • name (Optional[str]) – 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.

  • standard_of_proof (Optional[str]) – a descriptor for the degree of certainty associated with the assertion in the predicate.

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

  • generic (bool) – whether this object could be replaced by another generic object of the same class without changing the truth of the Rule in which it is mentioned.

Attr standards_of_proof

a tuple with every allowable name for a standard of proof, in order from weakest to strongest.

Exhibits

Inheritance diagram of authorityspoke.evidence.Exhibit
class authorityspoke.evidence.Exhibit(form=None, statement=None, stated_by=None, name=None, absent=False, generic=False)

A source of information for use in litigation.

TODO: Allowed inputs for form will need to be limited.

Evidence

Inheritance diagram of authorityspoke.evidence.Evidence
class authorityspoke.evidence.Evidence(exhibit=None, to_effect=None, name=None, absent=False, generic=False)

An Exhibit admitted by a court to aid a factual determination.

Pleadings

Inheritance diagram of authorityspoke.pleadings.Pleading
class authorityspoke.pleadings.Pleading(filer=None, name=None, absent=False, generic=False)

A document filed by a party to make Allegations.

Allegations

Inheritance diagram of authorityspoke.pleadings.Allegation
class authorityspoke.pleadings.Allegation(to_effect=None, pleading=None, name=None, absent=False, generic=False)

A formal assertion of a Fact.

May be included by a party in a Pleading to establish a cause of action.