pub struct Extraction {
pub extraction_class: String,
pub extraction_text: String,
pub char_interval: Option<CharInterval>,
pub alignment_status: Option<AlignmentStatus>,
pub extraction_index: Option<usize>,
pub group_index: Option<usize>,
pub description: Option<String>,
pub attributes: Option<HashMap<String, Value>>,
pub token_interval: Option<TokenInterval>,
}
Expand description
Represents an extraction extracted from text
This struct encapsulates an extraction’s characteristics and its position within the source text. It can represent diverse information for NLP information extraction tasks.
Fields§
§extraction_class: String
The class or type of the extraction
extraction_text: String
The extracted text content
char_interval: Option<CharInterval>
Character position in the original text
alignment_status: Option<AlignmentStatus>
How well this extraction aligns with the source
extraction_index: Option<usize>
Index of this extraction in the list
group_index: Option<usize>
Group index for related extractions
description: Option<String>
Human-readable description
attributes: Option<HashMap<String, Value>>
Additional attributes as key-value pairs
token_interval: Option<TokenInterval>
Token position information
Implementations§
Source§impl Extraction
impl Extraction
Source§impl Extraction
impl Extraction
Sourcepub fn with_char_interval(
extraction_class: String,
extraction_text: String,
char_interval: CharInterval,
) -> Self
pub fn with_char_interval( extraction_class: String, extraction_text: String, char_interval: CharInterval, ) -> Self
Create a new extraction with character interval
Sourcepub fn set_char_interval(&mut self, interval: CharInterval)
pub fn set_char_interval(&mut self, interval: CharInterval)
Set the character interval for this extraction
Sourcepub fn set_attribute(&mut self, key: String, value: Value)
pub fn set_attribute(&mut self, key: String, value: Value)
Set an attribute value
Sourcepub fn get_attribute(&self, key: &str) -> Option<&Value>
pub fn get_attribute(&self, key: &str) -> Option<&Value>
Get an attribute value
Sourcepub fn overlaps_with(&self, other: &Extraction) -> bool
pub fn overlaps_with(&self, other: &Extraction) -> bool
Check if this extraction overlaps with another based on character intervals
Trait Implementations§
Source§impl Clone for Extraction
impl Clone for Extraction
Source§fn clone(&self) -> Extraction
fn clone(&self) -> Extraction
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 Extraction
impl Debug for Extraction
Source§impl Default for Extraction
impl Default for Extraction
Source§impl<'de> Deserialize<'de> for Extraction
impl<'de> Deserialize<'de> for Extraction
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 Extraction
impl PartialEq for Extraction
Source§impl Serialize for Extraction
impl Serialize for Extraction
impl StructuralPartialEq for Extraction
Auto Trait Implementations§
impl Freeze for Extraction
impl RefUnwindSafe for Extraction
impl Send for Extraction
impl Sync for Extraction
impl Unpin for Extraction
impl UnwindSafe for Extraction
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