Package com.oracle.coherence.ai
Class DocumentChunk
java.lang.Object
com.tangosol.io.AbstractEvolvable
com.oracle.coherence.ai.DocumentChunk
- All Implemented Interfaces:
Evolvable,ExternalizableLite,EvolvablePortableObject,PortableObject,Serializable
public final class DocumentChunk
extends AbstractEvolvable
implements EvolvablePortableObject, ExternalizableLite
A chunk of text extracted from a document.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for serialization.DocumentChunk(String text) Create aDocumentChunk.DocumentChunk(String text, Vector<float[]> vector) Create aDocumentChunk.DocumentChunk(String text, Map<String, Object> metadata) Create aDocumentChunk.Create aDocumentChunk. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintDetermine the serialization version supported by the implementing class.inthashCode()static DocumentChunk.IdCreate anDocumentChunk.Id.booleanReturntrueif this chunk has a vector embedding.metadata()Returns the optional metadata associated with this document chunk.voidRestore the contents of a user type instance by reading its state using the specified PofReader object.voidRestore the contents of this object by loading the object's state from the passed DataInput object.setVector(float[] vector) Set the float vector for this chunk.Set the float vector for this chunk.text()Return the text chunk extracted from the document.toString()Vector<float[]> vector()Get the float vector for this chunk.voidwriteExternal(PofWriter out) Save the contents of a POF user type instance by writing its state using the specified PofWriter object.voidwriteExternal(DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object.Methods inherited from class com.tangosol.io.AbstractEvolvable
getDataVersion, getFutureData, setDataVersion, setFutureDataMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.tangosol.io.Evolvable
getDataVersion, getFutureData, setDataVersion, setFutureData
-
Field Details
-
IMPL_VERSION
public static final int IMPL_VERSIONThe POF implementation version.- See Also:
-
-
Constructor Details
-
DocumentChunk
public DocumentChunk()Default constructor for serialization. -
DocumentChunk
Create aDocumentChunk.- Parameters:
text- the chunk of text extracted from a document
-
DocumentChunk
Create aDocumentChunk.- Parameters:
text- the chunk of text extracted from a documentvector- the vector associated with the document chunk
-
DocumentChunk
Create aDocumentChunk.- Parameters:
text- the chunk of text extracted from a documentmetadata- optional document metadata
-
DocumentChunk
Create aDocumentChunk.- Parameters:
text- the chunk of text extracted from a documentmetadata- optional document metadatavector- the vector associated with the document chunk
-
-
Method Details
-
text
Return the text chunk extracted from the document.- Returns:
- the text chunk extracted from the document
-
metadata
Returns the optional metadata associated with this document chunk.- Returns:
- the optional metadata associated with this document chunk
-
isEmbedded
public boolean isEmbedded()Returntrueif this chunk has a vector embedding.- Returns:
trueif this chunk has a vector embedding;falseotherwise
-
vector
Get the float vector for this chunk.- Returns:
- the float vector for this chunk
-
setVector
Set the float vector for this chunk.- Parameters:
vector- the float vector for this chunk
-
setVector
Set the float vector for this chunk.- Parameters:
vector- the float vector for this chunk
-
equals
-
hashCode
public int hashCode() -
toString
-
getImplVersion
public int getImplVersion()Description copied from class:AbstractEvolvableDetermine the serialization version supported by the implementing class.- Specified by:
getImplVersionin interfaceEvolvable- Specified by:
getImplVersionin classAbstractEvolvable- Returns:
- the serialization version supported by this object
-
readExternal
Description copied from interface:PortableObjectRestore the contents of a user type instance by reading its state using the specified PofReader object.- Specified by:
readExternalin interfacePortableObject- Parameters:
in- the PofReader from which to read the object's state- Throws:
IOException- if an I/O error occurs
-
writeExternal
Description copied from interface:PortableObjectSave the contents of a POF user type instance by writing its state using the specified PofWriter object.- Specified by:
writeExternalin interfacePortableObject- Parameters:
out- the PofWriter to which to write the object's state- Throws:
IOException- if an I/O error occurs
-
readExternal
Description copied from interface:ExternalizableLiteRestore the contents of this object by loading the object's state from the passed DataInput object.- Specified by:
readExternalin interfaceExternalizableLite- Parameters:
in- the DataInput stream to read data from in order to restore the state of this object- Throws:
IOException- if an I/O exception occurs
-
writeExternal
Description copied from interface:ExternalizableLiteSave the contents of this object by storing the object's state into the passed DataOutput object.- Specified by:
writeExternalin interfaceExternalizableLite- Parameters:
out- the DataOutput stream to write the state of this object to- Throws:
IOException- if an I/O exception occurs
-
id
Create anDocumentChunk.Id.- Parameters:
sDocId- the document identifiernIndex- the chunk index- Returns:
- an
DocumentChunk.Idwith the specified document identifier and chunk index
-