doc_id_scheme_of#

scikitplot.corpus.doc_id_scheme_of(doc_id)[source]#

Return the scheme that produced doc_id, judged by its exact form.

Parameters:
doc_idobject

A document identifier.

Returns:
DocIdScheme or None

DocIdScheme.SHA256 for exactly 64 lowercase hex characters, DocIdScheme.UUID7 for the 36-character lowercase canonical form of a version-7 RFC 9562 UUID, None for anything else: a caller’s own id, or a 16-hex id from a build before identities were widened.

Parameters:

doc_id (object)

Return type:

DocIdScheme | None

Notes

The two forms cannot be confused: one has 64 characters and no hyphen, the other 36 with four. The test is purely syntactic; it cannot tell whether a 64-hex string was produced by CorpusDocument.make_doc_id.

Examples

>>> doc_id_scheme_of("0" * 16) is None  # pre-widening width
True