Anchors
Functions for loading TextQuoteSelectors.
-
authorityspoke.io.anchors.
read_selector
(record)
Create new selector from JSON user input.
- Parameters
record (Union
[str
, Dict
[str
, str
]]) – a string or dict representing a text passage
- Return type
TextQuoteSelector
- Returns
a new TextQuoteSelector
-
authorityspoke.io.anchors.
read_selectors
(record)
Create list of TextQuoteSelector
s from JSON user input.
If the input is a str
, tries to break up the string
into prefix
, exact
,
and suffix
, by splitting on the pipe characters.
- Parameters
record (Iterable
[Union
[str
, Dict
[str
, str
]]]) – a string or dict representing a text passage, or list of
strings and dicts.
- Return type
List
[TextQuoteSelector
]
- Returns
a list of TextQuoteSelector
s
-
authorityspoke.io.anchors.
collect_anchors
(obj)
Get list containing any available text anchors.
- Return type
List
[TextQuoteSelector
]
-
authorityspoke.io.anchors.
get_named_anchors
(mentioned)
Move anchors fields to a dict linking object names to lists of anchors.
To be used during loading of Holding
s.
Keys are Factor
s, Enactment
s, or Holding
s,
and values are lists of the Opinion
passages that reference them.
Assumes that the value of the anchors field is a list (not a dict representing a
single text anchor, and not a string in the “shorthand” anchor format).
- Parameters
mentioned (Mentioned
) – a dict representing named Factor
s and Enactment
s
- Return type
Dict
[str
, List
[TextQuoteSelector
]]
- Returns
a dict with keys from the mentioned dict, where each key has as its value
just the “anchors” field from the corresponding dict in “mentioned”
-
authorityspoke.io.anchors.
get_holding_anchors
(record)
Make indexes of text anchors for a list of Holdings.
- Return type
List
[List
[TextQuoteSelector
]]