pub struct CrossDocCluster {
pub id: u64,
pub canonical_name: String,
pub entity_type: Option<EntityType>,
pub documents: Vec<String>,
pub mentions: Vec<(String, usize)>,
pub kb_id: Option<String>,
pub confidence: f64,
}Expand description
A cross-document entity cluster.
Groups mentions from multiple documents that refer to the same real-world entity.
Fields§
§id: u64Cluster ID
canonical_name: StringCanonical name for the cluster (e.g., “Jensen Huang”)
entity_type: Option<EntityType>Entity type for the cluster
documents: Vec<String>Documents containing mentions of this entity
mentions: Vec<(String, usize)>(doc_id, entity_idx) pairs for all mentions
kb_id: Option<String>External knowledge base ID (if linked)
confidence: f64Confidence in this clustering
Implementations§
Source§impl CrossDocCluster
impl CrossDocCluster
Sourcepub fn mention_count(&self) -> usize
pub fn mention_count(&self) -> usize
Alias for len().
Sourcepub fn add_mention(&mut self, doc_id: &str, entity_idx: usize)
pub fn add_mention(&mut self, doc_id: &str, entity_idx: usize)
Add a mention to the cluster.
Sourcepub fn with_type(self, entity_type: EntityType) -> Self
pub fn with_type(self, entity_type: EntityType) -> Self
Set entity type.
Trait Implementations§
Source§impl Clone for CrossDocCluster
impl Clone for CrossDocCluster
Source§fn clone(&self) -> CrossDocCluster
fn clone(&self) -> CrossDocCluster
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CrossDocCluster
impl Debug for CrossDocCluster
Source§impl Default for CrossDocCluster
impl Default for CrossDocCluster
Source§fn default() -> CrossDocCluster
fn default() -> CrossDocCluster
Source§impl<'de> Deserialize<'de> for CrossDocCluster
impl<'de> Deserialize<'de> for CrossDocCluster
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>,
Source§impl From<&CrossDocCluster> for Identity
Convert a CrossDocCluster to an Identity.
impl From<&CrossDocCluster> for Identity
Convert a CrossDocCluster to an Identity.
This converts from the evaluation/clustering result format to the core representation.
§Note on TrackRefs
CDCR’s CrossDocCluster doesn’t contain track information (only entity indices),
so we cannot create valid TrackRefs. The source is set to None to indicate
this is a conversion from evaluation format. If you need proper TrackRefs,
use Corpus::resolve_inter_doc_coref() instead.
§Note on source: None
The source field is set to None because CrossDocCluster only contains
(doc_id, entity_idx) pairs, not track_ids. Without track IDs, we cannot
create valid TrackRefs that would be needed for IdentitySource::CrossDocCoref.
This is intentional: identities created from evaluation data don’t have the same provenance tracking as identities created through the normal corpus resolution pipeline.
Source§fn from(cluster: &CrossDocCluster) -> Self
fn from(cluster: &CrossDocCluster) -> Self
Auto Trait Implementations§
impl Freeze for CrossDocCluster
impl RefUnwindSafe for CrossDocCluster
impl Send for CrossDocCluster
impl Sync for CrossDocCluster
impl Unpin for CrossDocCluster
impl UnsafeUnpin for CrossDocCluster
impl UnwindSafe for CrossDocCluster
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more