jina.types.sets.chunk¶
-
class
jina.types.sets.chunk.
ChunkSet
(docs_proto, reference_doc)[source]¶ Bases:
jina.types.sets.document.DocumentSet
ChunkSet
inherits fromDocumentSet
. It’s a subset of Documents.- Parameters
docs_proto (
Document
) – Set of sub-documents (i.e chunks) of reference_docreference_doc (
Document
) – ReferenceDocument
for the sub-documents
Set constructor method.
- Parameters
docs_proto – protobuf representation of the chunks
reference_doc (Document) – parent document
-
append
(document, **kwargs)[source]¶ Add a sub-document (i.e chunk) to the current Document.
- Parameters
document (
Document
) – Sub-document to be appendedkwargs – additional keyword arguments
- Returns
the newly added sub-document in
Document
view- Return type
Document
Note
Comparing to
DocumentSet.append()
, this method adds more safeguard to make sure the added chunk is legit.
-
extend
(iterable)[source]¶ Extend the
DocumentSet
by appending all the items from the iterable.- Parameters
iterable (
Iterable
[ForwardRef
]) – the iterable of Documents to extend this set with- Return type
None
-
property
reference_doc
¶ Get the document that
ChunkSet
belongs to.- Return type
- Returns
reference doc
-
property
granularity
¶ Get granularity of all document in this set.
- Return type
int
- Returns
granularity
-
property
adjacency
¶ Get adjacency of all document in this set.
- Return type
int
- Returns
adjacency