Name Indexing¶
Functions for indexing named objects in JSON to be imported.
Index of cross-referenced objects, keyed to phrases that reference them.
Add record to dict, using value of record’s “name” field as the dict key.
- Return type
Convert retrieved record so name is a field rather than the key for the whole record.
Retrieve a record from the index, if it exists.
Sort dict items from longest to shortest.
Used to ensure that keys nearer the start can’t be substrings of later keys.
- Return type
Use the content to assign a name to any Fact that lacks one.
This can fail if the parser replaces placeholder text with another placeholder
Return an appropriate name for Evidence.
Return an appropriate name for a Pleading.
Create unique name for unloaded Enactment data, for indexing.
- Return type
Create unique name for unloaded Enactment data, for indexing.
- Return type
Determine what kind of RawFactor the input is and return an appropriate name.
Add a name to a RawFactor if it doesn’t already have one.
Update name index from a list of
RawFactor
s or strings referencing them.- Parameters
terms (
List
[Dict
[str
,Union
[Dict
[str
,Union
[str
,bool
]],Sequence
[Any
],str
,bool
]]]) – a list ofRawFactor
s or strings referencing them. BothRawFactor
s and strings may exist in the list.mentioned (
Mentioned
) –RawFactor
s indexed by name for retrieval when loading objects using a Marshmallow schema.
- Returns
an updated “mentioned” name index
Find string template placeholders in content, and use them to create dicts to be loaded as Entities.
- Return type
Update index of mentioned Factors from Factors mentioned in Fact’s content, and vice versa.
Update index of mentioned Factors with ‘obj’, if obj is named.
If there is already an entry in the mentioned index with the same name as obj, the old entry won’t be replaced. But if any additional text anchors are present in the new obj, the anchors will be added.
If obj has a name, it will be collapsed to a name reference.
Make a dict of all nested objects labeled by name, creating names if needed.
To be used during loading to expand name references to full objects.
Make a dict of all nested objects labeled by name, creating names if needed.
To be used during loading to expand name references to full objects.
Call all functions to prepare “mentioned” index.
The names are sorted by length so that if one mentioned Factor’s name is a substring of another, the longest available name is expanded.
- Return type
- Returns
a modified version of the dict to load, plus a dict of names and the objects to expand them with.
Nesting fields to prepare to load a dict with a Marshmallow schema.
Make sure specified fields are nested under “nest” key.
Traverse tree of dicts and lists, and modify each node.