pub struct AnnotatedDocument {
pub document_id: Option<String>,
pub extractions: Option<Vec<Extraction>>,
pub text: Option<String>,
}
Expand description
Annotated document with extractions
Represents the result of processing a document through the annotation pipeline.
Fields§
§document_id: Option<String>
Unique identifier for the document
extractions: Option<Vec<Extraction>>
List of extractions found in the document
text: Option<String>
Original text content
Implementations§
Source§impl AnnotatedDocument
impl AnnotatedDocument
Sourcepub fn with_extractions(extractions: Vec<Extraction>, text: String) -> Self
pub fn with_extractions(extractions: Vec<Extraction>, text: String) -> Self
Create an annotated document with extractions and text
Sourcepub fn get_document_id(&mut self) -> String
pub fn get_document_id(&mut self) -> String
Get or generate a document ID
Sourcepub fn set_document_id(&mut self, id: String)
pub fn set_document_id(&mut self, id: String)
Set the document ID
Sourcepub fn add_extraction(&mut self, extraction: Extraction)
pub fn add_extraction(&mut self, extraction: Extraction)
Add an extraction to this document
Sourcepub fn extraction_count(&self) -> usize
pub fn extraction_count(&self) -> usize
Get the number of extractions
Sourcepub fn extractions_by_class(&self, class_name: &str) -> Vec<&Extraction>
pub fn extractions_by_class(&self, class_name: &str) -> Vec<&Extraction>
Get extractions of a specific class
Trait Implementations§
Source§impl Clone for AnnotatedDocument
impl Clone for AnnotatedDocument
Source§fn clone(&self) -> AnnotatedDocument
fn clone(&self) -> AnnotatedDocument
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AnnotatedDocument
impl Debug for AnnotatedDocument
Source§impl Default for AnnotatedDocument
impl Default for AnnotatedDocument
Source§impl<'de> Deserialize<'de> for AnnotatedDocument
impl<'de> Deserialize<'de> for AnnotatedDocument
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for AnnotatedDocument
impl PartialEq for AnnotatedDocument
Source§impl Serialize for AnnotatedDocument
impl Serialize for AnnotatedDocument
impl StructuralPartialEq for AnnotatedDocument
Auto Trait Implementations§
impl Freeze for AnnotatedDocument
impl RefUnwindSafe for AnnotatedDocument
impl Send for AnnotatedDocument
impl Sync for AnnotatedDocument
impl Unpin for AnnotatedDocument
impl UnwindSafe for AnnotatedDocument
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more