ancestors#

scikitplot.corpus.ancestors(documents, doc_id, *, max_depth=64)[source]#

Return the chain from doc_id’s parent up to the root.

Parameters:
documentsIterable[Any]

iterable of CorpusDocument

doc_idstr

The root’s identifier.

max_depthint, optional

Maximum levels to descend.

Returns:
list

Nearest ancestor first. Stops safely on a cycle or a dangling parent.

Parameters:
Return type:

list[Any]