def sentences(obj: BioCCollection or BioCDocument or BioCPassage) \
        -> Generator[BioCSentence, None, None]:
    """
    Get all sentences in document id.

    Args:
        obj: BioCCollection, BioCDocument, or BioCPassage

    Yields:
        one sentence
    """
    if isinstance(obj, BioCCollection):
        for document in obj.documents:
            yield from sentences(document)
    elif isinstance(obj, BioCDocument):
        for passage in obj.passages:
            yield from sentences(passage)
    elif isinstance(obj, BioCPassage):
        yield from obj.sentences
    else:
        raise TypeError(f'Object of type {obj.__class__.__name__} must be BioCCollection, '
                        f'BioCDocument, BioCPassage, or BioCSentence')
def sentences ( obj : BioCCollection or BioCDocument or BioCPassage ) -> Generator [ BioCSentence , None , None ] : if isinstance ( obj , BioCCollection ) : for document in obj . documents : yield from sentences ( document ) elif isinstance ( obj , BioCDocument ) : for passage in obj . passages : yield from sentences ( passage ) elif isinstance ( obj , BioCPassage ) : yield from obj . sentences else : raise TypeError ( f'Object of type {obj.__class__.__name__} must be BioCCollection, ' f'BioCDocument, BioCPassage, or BioCSentence' )
Get all sentences in document id.

    Args:
        obj: BioCCollection, BioCDocument, or BioCPassage

    Yields:
        one sentence