Text Selectors
¶
Describes a textual segment by quoting it, or passages before or after it.
Based on the Web Annotation Data Model
- Parameters
path (Optional[str]) – a path from the root of the document to the XML element where the selected text can be found.
exact (Optional[str]) – a copy of the text which is being selected, after normalization. If None, then the entire text of the element identified by the path parameter is selected. If path is also None, then the whole
Code
is selected.prefix (Optional[str]) – a snippet of text that occurs immediately before the text which is being selected.
suffix (Optional[str]) – the snippet of text that occurs immediately after the text which is being selected.
source (Optional[Union[Regime, Code]]) – the
Code
where the quoted text can be found, or theRegime
that has enacted it. Only needed ifexact
is not specified. If this parameter is given, then theexact
text will be stored even if it’s the entire text of a section orCode
.
Use text found in
source
asexact
parameter forself
.- Return type
Optional[str]
Locate an exact passage from some text.
Serialize the selector.
Based on the JSON serialization format in the Web Annotation Data Model
Get a regex to identify the selected text.