parse_document

function of dascore.utils.documents source

parse_document(
    text: str ,
    file_format: Literal[‘json’, ‘yaml’] ,
    label: str ,
    error: type[<class ’Exception] = <class ‘dascore.exceptions.ParameterError’>,
)-> ‘Any’

Return whatever a document’s text holds, naming its source if it cannot.

Parameters

Parameter Description
text The document’s text.
file_format Either “json” or “yaml”.
label What to call the text in an error: a file’s name, or a phrase for
text which came from somewhere else.
error The exception raised for text which does not parse.